Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2011-02-09 02:03:13 +0000
committerAlena Laskavaia2011-02-09 02:03:13 +0000
commit746c7f5b5c2834d3df45ddf407eb04ae0066f507 (patch)
tree927f7d8767f58b312c3030024741dec7c7011e20 /codan/org.eclipse.cdt.codan.core.cxx/src
parent3c1dd64023a43825ac067fa6e15f933686919aa9 (diff)
downloadorg.eclipse.cdt-746c7f5b5c2834d3df45ddf407eb04ae0066f507.tar.gz
org.eclipse.cdt-746c7f5b5c2834d3df45ddf407eb04ae0066f507.tar.xz
org.eclipse.cdt-746c7f5b5c2834d3df45ddf407eb04ae0066f507.zip
Bug 336554 - Codan shouldn't bother if the file is not under C/C++ project
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core.cxx/src')
-rw-r--r--codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/CxxCodanReconciler.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/CxxCodanReconciler.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/CxxCodanReconciler.java
index 5e7aa110294..f823169c573 100644
--- a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/CxxCodanReconciler.java
+++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/internal/model/CxxCodanReconciler.java
@@ -12,8 +12,12 @@ package org.eclipse.cdt.codan.core.cxx.internal.model;
import org.eclipse.cdt.codan.core.CodanRuntime;
import org.eclipse.cdt.codan.internal.core.CodanBuilder;
+import org.eclipse.cdt.core.CCProjectNature;
+import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
/**
@@ -21,12 +25,23 @@ import org.eclipse.core.runtime.IProgressMonitor;
*
*/
public class CxxCodanReconciler {
- private CodanBuilder builder = (CodanBuilder) CodanRuntime.getInstance().getBuilder();
+ private CodanBuilder builder = (CodanBuilder) CodanRuntime.getInstance()
+ .getBuilder();
public void reconciledAst(IASTTranslationUnit ast, IResource resource,
IProgressMonitor monitor) {
if (ast == null)
return;
- builder.runInEditor(ast, resource, monitor);
+ IProject project = resource.getProject();
+ if (project==null) return;
+ try {
+ if (project.hasNature(CProjectNature.C_NATURE_ID)
+ || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ builder.runInEditor(ast, resource, monitor);
+ }
+ } catch (CoreException e) {
+ // ignore
+ }
+
}
}

Back to the top