Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java13
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginResources.properties1
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java23
3 files changed, 37 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
index d847070e82..f1a1ab4f53 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java
@@ -397,4 +397,17 @@ public class CCorePlugin extends Plugin {
}
return null;
}
+
+ // Preference to turn on/off the new parser
+
+ private boolean useNewParser = false;
+
+ public void setUseNewParser(boolean useNewParser) {
+ this.useNewParser = useNewParser;
+ }
+
+ public boolean useNewParser() {
+ return useNewParser;
+ }
+
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginResources.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginResources.properties
index 47639c3c49..7d6acf1a78 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginResources.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginResources.properties
@@ -16,6 +16,7 @@ CBasePreferencePage.autoOpenConsole.label=Open C-Build view when building
CBasePreferencePage.consoleOnTop.label=Bring C-Build view to top when building (if present)
CBasePreferencePage.linkToEditor.label=Link view selection to active editor
CBasePreferencePage.CUChildren.label=Show file members in Project View
+CBasePreferencePage.useNewParser.label=Use New Parser for Code Model
CBasePreferencePage.editorFont.label=C Editor font:
CBasePreferencePage.consoleFont.label=C-Build view font:
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java
index f92edb71d9..678c76d5f4 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java
@@ -5,6 +5,7 @@ package org.eclipse.cdt.internal.ui.preferences;
* All Rights Reserved.
*/
+import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.jface.preference.BooleanFieldEditor;
@@ -22,9 +23,11 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
private static final String PREF_LINK_TO_EDITOR= "linkToEditor";
public static final String PREF_SHOW_CU_CHILDREN= "CUChildren"; //$NON-NLS-1$
+ private static final String PREF_USE_NEW_PARSER= "useNewParser";
private static final String LINK_TO_EDITOR_LABEL= "CBasePreferencePage.linkToEditor.label";
private static final String SHOW_CU_CHILDREN_LABEL= "CBasePreferencePage.CUChildren.label";
+ private static final String USE_NEW_PARSER_LABEL= "CBasePreferencePage.useNewParser.label";
public CPluginPreferencePage() {
super(GRID);
@@ -51,6 +54,8 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
BooleanFieldEditor showCUChildrenEditor= new BooleanFieldEditor(PREF_SHOW_CU_CHILDREN, CUIPlugin.getResourceString(SHOW_CU_CHILDREN_LABEL), parent);
addField(showCUChildrenEditor);
+ BooleanFieldEditor useNewParserEditor= new BooleanFieldEditor(PREF_USE_NEW_PARSER, CUIPlugin.getResourceString(USE_NEW_PARSER_LABEL), parent);
+ addField(useNewParserEditor);
}
@@ -62,10 +67,16 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_SHOW_CU_CHILDREN);
}
+ public static boolean useNewParser() {
+ return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_USE_NEW_PARSER);
+ }
+
/**
* @see IWorkbenchPreferencePage#init
*/
public void init(IWorkbench workbench) {
+ CUIPlugin.getDefault().getPreferenceStore().setValue(PREF_USE_NEW_PARSER,
+ CCorePlugin.getDefault().useNewParser());
}
/**
@@ -74,6 +85,18 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
public static void initDefaults(IPreferenceStore prefs) {
prefs.setDefault(PREF_LINK_TO_EDITOR, true);
prefs.setDefault(PREF_SHOW_CU_CHILDREN, true);
+ prefs.setDefault(PREF_USE_NEW_PARSER, CCorePlugin.getDefault().useNewParser());
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ if (!super.performOk())
+ return false;
+
+ CCorePlugin.getDefault().setUseNewParser(useNewParser());
+ return true;
+ }
+
}

Back to the top