mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-20 15:35:24 +02:00
Bug 336554 - Codan shouldn't bother if the file is not under C/C++ project
This commit is contained in:
parent
3c1dd64023
commit
746c7f5b5c
1 changed files with 17 additions and 2 deletions
|
@ -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;
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue