Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2003-04-02 16:30:23 -0500
committerDoug Schaefer2003-04-02 16:30:23 -0500
commite31f920f10e68aac60b67dd963f77f191871437a (patch)
treed99c4b94ee52777b03173f66d889629d2aa24715
parentf4e1d9d593b2fe1e7d6d1e168945e8051f17b4f2 (diff)
downloadorg.eclipse.cdt-e31f920f10e68aac60b67dd963f77f191871437a.tar.gz
org.eclipse.cdt-e31f920f10e68aac60b67dd963f77f191871437a.tar.xz
org.eclipse.cdt-e31f920f10e68aac60b67dd963f77f191871437a.zip
Patch for myself for a change:
- This patch changes the default for the CModel to use the new parser. - Also, I change the preference to be stored in the CCorePlugin preferences instead of the silly kludge I had before.
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java12
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CPluginPreferencePage.java8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java4
3 files changed, 11 insertions, 13 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 24c89f122a..61fbc04f42 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
@@ -46,6 +46,7 @@ public class CCorePlugin extends Plugin {
public final static String PREF_BINARY_PARSER = "binaryparser";
public final static String DEFAULT_BINARY_PARSER_SIMPLE_ID = "ELF";
public final static String DEFAULT_BINARY_PARSER_UNIQ_ID = PLUGIN_ID + "." + DEFAULT_BINARY_PARSER_SIMPLE_ID;
+ public final static String PREF_USE_NEW_PARSER = "useNewParser";
private static CCorePlugin fgCPlugin;
private static ResourceBundle fgResourceBundle;
@@ -127,6 +128,9 @@ public class CCorePlugin extends Plugin {
getIndexModel();
fDescriptorManager = new CDescriptorManager();
fDescriptorManager.startup();
+
+ // Set the default for using the new parser
+ getPluginPreferences().setDefault(PREF_USE_NEW_PARSER, true);
}
public IConsole getConsole(String id) {
@@ -404,15 +408,13 @@ public class CCorePlugin extends Plugin {
}
// Preference to turn on/off the new parser
-
- private boolean useNewParser = false;
-
public void setUseNewParser(boolean useNewParser) {
- this.useNewParser = useNewParser;
+ getPluginPreferences().setValue(PREF_USE_NEW_PARSER, useNewParser);
+ savePluginPreferences();
}
public boolean useNewParser() {
- return useNewParser;
+ return getPluginPreferences().getBoolean(PREF_USE_NEW_PARSER);
}
/**
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 6c52e83cc7..48beb89884 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
@@ -23,7 +23,6 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
private static final String PREF_LINK_TO_EDITOR= "linkToEditor"; //$NON-NLS-1$
public static final String PREF_SHOW_CU_CHILDREN= "CUChildren"; //$NON-NLS-1$
- private static final String PREF_USE_NEW_PARSER= "useNewParser"; //$NON-NLS-1$
private static final String LINK_TO_EDITOR_LABEL= "CBasePreferencePage.linkToEditor.label";
private static final String SHOW_CU_CHILDREN_LABEL= "CBasePreferencePage.CUChildren.label";
@@ -54,7 +53,7 @@ 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);
+ BooleanFieldEditor useNewParserEditor= new BooleanFieldEditor(CCorePlugin.PREF_USE_NEW_PARSER, CUIPlugin.getResourceString(USE_NEW_PARSER_LABEL), parent);
addField(useNewParserEditor);
}
@@ -68,13 +67,14 @@ public class CPluginPreferencePage extends FieldEditorPreferencePage implements
}
public static boolean useNewParser() {
- return CUIPlugin.getDefault().getPreferenceStore().getBoolean(PREF_USE_NEW_PARSER);
+ return CUIPlugin.getDefault().getPreferenceStore().getBoolean(CCorePlugin.PREF_USE_NEW_PARSER);
}
/**
* @see IWorkbenchPreferencePage#init
*/
public void init(IWorkbench workbench) {
+ CUIPlugin.getDefault().getPreferenceStore().setValue(CCorePlugin.PREF_USE_NEW_PARSER, CCorePlugin.getDefault().useNewParser());
}
/**
@@ -83,7 +83,7 @@ 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, false);
+ prefs.setDefault(CCorePlugin.PREF_USE_NEW_PARSER, CCorePlugin.getDefault().useNewParser());
}
/* (non-Javadoc)
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
index 3f8531d3cf..851b89ee69 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
@@ -239,10 +239,6 @@ public class CUIPlugin extends AbstractUIPlugin {
CPluginImages.initialize();
}
});
-
- // TODO - temporary kludge (maybe) to make sure the core preferences
- // are kept in sync with the stored preferences
- CCorePlugin.getDefault().setUseNewParser(CPluginPreferencePage.useNewParser());
}
/**

Back to the top