Confusing IPrefrenceStore and PreferenceService [message #503864] |
Wed, 16 December 2009 02:23 |
Eclipse User |
|
|
|
Hi all,
i've used IPreferenceStore sometimes in the past, to store the values of
my field editor's values. Now, i was confronted with PrefereneService,
which seems to be the same concept, but it doesn't work with the old
preference store, i guess.
Currently, i'm storing the values of the field editors in this way:
###############
public MBTStructuralCoverageCriteriaPreferencePage() {
super(GRID);
setPreferenceStore(Activator.getDefault().getPreferenceStore ());
setDescription("A demonstration of a preference page implementation");
}
....
addField(new RadioGroupFieldEditor(PreferenceConstants.COVERAGE_CRITERIA,
"&Coverage:", 1,
new String[][] {
{"&state coverage", MBTToolConstants.CONDITION_STATE_COVERAGE+""},
{"rea&ched state", MBTToolConstants.CONDITION_REACHED_STATE+"" },
{"&edge coverage", MBTToolConstants.CONDITION_EDGE_COVERAGE+"" },
{"re&ached edge", MBTToolConstants.CONDITION_REACHED_REQUIREMENT+"" },
{"test &length", MBTToolConstants.CONDITION_TEST_LENGTH+"" },
/*{"&requirements coverage",
MBTToolConstants.CONDITION_REQUIREMENT_COVERAGE+"" },*/
/*{"r&eached requirement",
MBTToolConstants.CONDITION_REACHED_REQUIREMENT+"" },*/
{"&no particular condition", MBTToolConstants.CONDITION_NEVER+"" }
}, getFieldEditorParent()));
....
################
May i have to save the store manually by overwriting performOK() or will
the store be saved automatically for persistence?
In my application code, i try to access the preferences like this:
###########
final IPreferencesService service = Platform.getPreferencesService();
final String alternativeConditionDetail = service.getString(toolQN,
PreferenceConstants.DEFAULT_TEST_LENGTH_VALUE, 15+"", null);
###########
But this doesn't work... i'm really confused, because i think, i've
misunderstood how these things corelate with each other. Can anyone help
me, please?
Thanks Timothy
|
|
|
Powered by
FUDForum. Page generated in 0.02819 seconds