Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2010-04-27 22:59:40 -0400
committerAlena Laskavaia2010-04-27 22:59:40 -0400
commit7fa181c4b6506a41ac8b81d17c40b0319264ad5a (patch)
tree83a836b824735fb97f33e93be063fd49e5a07cdc /codan/org.eclipse.cdt.codan.ui.cxx
parent25406f96bc0422856723fda83d3aab87629f9675 (diff)
downloadorg.eclipse.cdt-7fa181c4b6506a41ac8b81d17c40b0319264ad5a.tar.gz
org.eclipse.cdt-7fa181c4b6506a41ac8b81d17c40b0319264ad5a.tar.xz
org.eclipse.cdt-7fa181c4b6506a41ac8b81d17c40b0319264ad5a.zip
- added preference to disable check as you type
Diffstat (limited to 'codan/org.eclipse.cdt.codan.ui.cxx')
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/internal/ui/cxx/CodanCReconciler.java34
1 files changed, 30 insertions, 4 deletions
diff --git a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/internal/ui/cxx/CodanCReconciler.java b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/internal/ui/cxx/CodanCReconciler.java
index a94143c273..ac9cd9ff1c 100644
--- a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/internal/ui/cxx/CodanCReconciler.java
+++ b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/internal/ui/cxx/CodanCReconciler.java
@@ -10,11 +10,22 @@
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.cxx;
-import org.eclipse.cdt.codan.core.cxx.internal.model.CxxCodanRenciler;
+import java.io.File;
+import java.net.URI;
+
+import org.eclipse.cdt.codan.core.PreferenceConstants;
+import org.eclipse.cdt.codan.core.cxx.internal.model.CxxCodanReconciler;
+import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.internal.ui.editor.CEditor;
import org.eclipse.cdt.internal.ui.text.ICReconcilingListener;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.texteditor.ITextEditor;
/**
@@ -22,7 +33,7 @@ import org.eclipse.ui.texteditor.ITextEditor;
*
*/
public class CodanCReconciler implements ICReconcilingListener {
- private CxxCodanRenciler reconsiler = new CxxCodanRenciler();
+ private CxxCodanReconciler reconsiler = new CxxCodanReconciler();
void install(ITextEditor editor) {
if (editor instanceof CEditor) {
@@ -66,7 +77,22 @@ public class CodanCReconciler implements ICReconcilingListener {
*/
public void reconciled(IASTTranslationUnit ast, boolean force,
IProgressMonitor progressMonitor) {
- reconsiler.reconciledAst(ast, progressMonitor);
- // System.err.println("ast reconsiled");
+ if (ast == null)
+ return;
+ String filePath = ast.getFilePath();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ IFile[] resources;
+ URI uri = new File(filePath).toURI();
+ resources = root.findFilesForLocationURI(uri);
+ if (resources != null && resources.length > 0) {
+ IFile resource = resources[0];
+ IProject project = resource.getProject();
+ IPreferenceStore store = CodanUIActivator.getDefault()
+ .getPreferenceStore(project);
+ if (store.getBoolean(PreferenceConstants.P_RUN_IN_EDITOR)) {
+ reconsiler.reconciledAst(ast, resource, progressMonitor);
+ }
+ }
}
}

Back to the top