Community
Participate
Working Groups
Build Identifier: 20110204-0611 org.eclipse.cdt.codan.internal.ui.cxx.CodanCReconciler uses org.eclipse.core.resources.IWorkspaceRoot to find an IResource from a java.net.URI. It works for normal file systems, but not for the customized file system we use. The problem is that Codan does not run checkers in "run in editor" mode in our projects. The solution is to use org.eclipse.cdt.internal.core.resources.ResourceLookup#findFilesForLocationURI(URI) instead. I have tested it with regular projects and our own and it works. Reproducible: Always Steps to Reproduce: It is not possible to reproduce this bug outside my workplace, because of the customizations of our development environment.
Created attachment 189970 [details] Proposed patch Patch with the proposed solution.
> String filePath = ast.getFilePath(); > URI uri = new File(filePath).toURI(); > IFile[] resources = ResourceLookup.findFilesForLocationURI(uri); That still looks weird. How does this cope with non-file URI paths? Does this stuff support generic EFS resources at all?
Probably Alena is the best to answer this question :) AFAIK, codan only works with files (at least that is the default behavior in IChecker#enabledInContext(IResource) (In reply to comment #2) > > String filePath = ast.getFilePath(); > > URI uri = new File(filePath).toURI(); > > IFile[] resources = ResourceLookup.findFilesForLocationURI(uri); > > That still looks weird. How does this cope with non-file URI paths? Does this > stuff support generic EFS resources at all?
Fixed in HEAD > 20110325.
*** cdt cvs genie on behalf of sprigogin *** Bug 338349. Added IASTTranslationUnit.getOriginatingTranslationUnit method. [*] ASTTranslationUnit.java 1.19 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java?root=Tools_Project&r1=1.18&r2=1.19 [*] IASTTranslationUnit.java 1.61 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTranslationUnit.java?root=Tools_Project&r1=1.60&r2=1.61 [*] TranslationUnit.java 1.117 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java?root=Tools_Project&r1=1.116&r2=1.117 [*] CodanCReconciler.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/internal/ui/cxx/CodanCReconciler.java?root=Tools_Project&r1=1.4&r2=1.5