ensure string consistency

This commit is contained in:
Eyck Jentzsch 2017-09-19 21:50:42 +02:00
parent dc6577b2b9
commit d050a47357
5 changed files with 10 additions and 6 deletions

View File

@ -13,7 +13,7 @@ class RdlPreferencePage extends FieldEditorPreferencePage implements IWorkbenchP
new() {
super(GRID)
val store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "com.minres.rdl.rdl");
val store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.SCOPE_NAME);
setPreferenceStore(store);
setDescription("Code generator configuration options");
}

View File

@ -14,7 +14,7 @@ import org.eclipse.ui.preferences.ScopedPreferenceStore;
public class RdlPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
public RdlPreferencePage() {
super(FieldEditorPreferencePage.GRID);
final ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "com.minres.rdl.rdl");
final ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.SCOPE_NAME);
this.setPreferenceStore(store);
this.setDescription("Code generator configuration options");
}

View File

@ -5,8 +5,12 @@ package com.minres.rdl.preferences;
*/
public class PreferenceConstants {
public static final String SCOPE_NAME = "com.minres.rdl.rdl";
public static final String P_GENERATE_CSV = "booleanCsvPreference";
public static final String P_ADDRESSUNIT = "choiceAddrunitPreference";
public static final String ADDRESSUNIT_PROP = "com.minres.rdl.addrunit";
}

View File

@ -18,7 +18,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
public void initializeDefaultPreferences() {
IEclipsePreferences store = getPreferenceStore();
store.putBoolean(PreferenceConstants.P_GENERATE_CSV, true);
String value = System.getProperty("com.minres.rdl.rdl.addrunit");
String value = System.getProperty(PreferenceConstants.ADDRESSUNIT_PROP);
if(value!=null){
if("byte".equals(value)){
store.put(PreferenceConstants.P_ADDRESSUNIT, "byte");
@ -35,7 +35,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
}
public static IEclipsePreferences getPreferenceStore() {
return DefaultScope.INSTANCE.getNode("com.minres.rdl.rdl");
return DefaultScope.INSTANCE.getNode(PreferenceConstants.SCOPE_NAME);
}
}

View File

@ -10,10 +10,10 @@ public class RdlPreferences {
}
public static String getAddrUnit() {
return getPreferenceStore().get(PreferenceConstants.P_ADDRESSUNIT, System.getProperty("com.minres.rdl.rdl.addrunit"));
return getPreferenceStore().get(PreferenceConstants.P_ADDRESSUNIT, System.getProperty(PreferenceConstants.ADDRESSUNIT_PROP));
}
public static IEclipsePreferences getPreferenceStore() {
return InstanceScope.INSTANCE.getNode("com.minres.rdl.rdl");
return InstanceScope.INSTANCE.getNode(PreferenceConstants.SCOPE_NAME);
}
}