diff options
author | Doug Schaefer | 2003-02-27 22:17:39 +0000 |
---|---|---|
committer | Doug Schaefer | 2003-02-27 22:17:39 +0000 |
commit | 4bfaf9664ccab31e1eec7212527bf92cbc980b12 (patch) | |
tree | 6ca2716bcc93a012445b5082fed8af8fb78b654a /core | |
parent | 8d34573e773eb229c4716fe06ef2c0d6658de506 (diff) | |
download | org.eclipse.cdt-4bfaf9664ccab31e1eec7212527bf92cbc980b12.tar.gz org.eclipse.cdt-4bfaf9664ccab31e1eec7212527bf92cbc980b12.tar.xz org.eclipse.cdt-4bfaf9664ccab31e1eec7212527bf92cbc980b12.zip |
Patch for Doug Schaefer:
- Created preference to turn on/off the new parser which would replace
the 1.0 parser.
Diffstat (limited to 'core')
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 d847070e828..f1a1ab4f535 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 47639c3c49b..7d6acf1a78d 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 f92edb71d9c..678c76d5f42 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; + } + } |