mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
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.
This commit is contained in:
parent
f4e1d9d593
commit
e31f920f10
3 changed files with 11 additions and 13 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue