Project

General

Profile

Revision bf0c676a

IDbf0c676afc77d47aa9b4bd4e42c6620256ceb9e9
Parent fb3b51ea
Child 53894154

Added by Patrick Plitzner about 3 years ago

ref #7849 code refactoring

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
107 107
		return TaxeditorStorePlugin.getDefault().getPreferenceStore();
108 108
	}
109 109

  
110
	private static String prefKey(String name) {
111
	    return name + "_"+  ((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString();
112
	}
113

  
110 114
	/**
111 115
     * <p>
112 116
     * setStringValue
......
115 119
     *
116 120
     **/
117 121
    public static void setStringValue(String name, String value) {
118
        getPreferenceStore().setValue(name + "_"+  ((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString(), value);
122
        getPreferenceStore().setValue(prefKey(name), value);
119 123
    }
120 124

  
121 125
    /**
......
126 130
     *
127 131
     **/
128 132
    public static void setIntValue(String name, int value) {
129
        getPreferenceStore().setValue(name + "_"+  ((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString(), value);
133
        getPreferenceStore().setValue(prefKey(name), value);
130 134
    }
131 135

  
132 136
    /**
......
137 141
     *
138 142
     **/
139 143
    public static void setBooleanValue(String name, boolean value) {
140
        getPreferenceStore().setValue(name + "_"+  ((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString(), value);
144
        getPreferenceStore().setValue(prefKey(name), value);
141 145
    }
142 146

  
143 147
    /**
......
148 152
     *
149 153
     **/
150 154
    public static void setDoubleValue(String name, double value) {
151
        getPreferenceStore().setValue(name + "_"+  ((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString(), value);
155
        getPreferenceStore().setValue(prefKey(name), value);
152 156
    }
153 157

  
154 158
    /**
......
170 174
     *
171 175
     **/
172 176
    public static void setLongValue(String name, long value) {
173
        getPreferenceStore().setValue(name + "_"+  ((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString(), value);
177
        getPreferenceStore().setValue(prefKey(name), value);
174 178
    }
175 179

  
176 180
    /**
......
182 186
     **/
183 187
    public static String getStringValue(String name) {
184 188

  
185
        String dbSpecific = name + "_"+((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString();
189
        String dbSpecific = prefKey(name);
186 190
        if (getPreferenceStore().contains(dbSpecific)){
187 191
            return getPreferenceStore().getString(dbSpecific);
188 192
        }else{
......
200 204
     *
201 205
     **/
202 206
    public static int getIntValue(String name) {
203
        String dbSpecific = name + "_"+((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString();
207
        String dbSpecific = prefKey(name);
204 208
        if (getPreferenceStore().contains(dbSpecific)){
205 209
            return getPreferenceStore().getInt(dbSpecific);
206 210
        }else{
......
219 223
     **/
220 224
    public static boolean getBooleanValue(String name) {
221 225
        if (CdmStore.isActive()){
222
            String dbSpecific = name + "_"+((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString();
226
            String dbSpecific = prefKey(name);
223 227
            if (getPreferenceStore().contains(dbSpecific)){
224 228
                return getPreferenceStore().getBoolean(dbSpecific);
225 229
            }else{
......
242 246
     *
243 247
     **/
244 248
    public static double getDoubleValue(String name) {
245
        String dbSpecific = name + "_"+((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString();
249
        String dbSpecific = prefKey(name);
246 250
        if (getPreferenceStore().contains(dbSpecific)){
247 251
            return getPreferenceStore().getDouble(dbSpecific);
248 252
        }else{
......
260 264
     *
261 265
     **/
262 266
    public static float getFloatValue(String name) {
263
        String dbSpecific = name + "_"+((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString();
267
        String dbSpecific = prefKey(name);
264 268
        if (getPreferenceStore().contains(dbSpecific)){
265 269
            return getPreferenceStore().getFloat(dbSpecific);
266 270
        }else{
......
278 282
     *
279 283
     **/
280 284
    public static long getLongValue(String name) {
281
        String dbSpecific = name + "_"+((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString();
285
        String dbSpecific = prefKey(name);
282 286
        if (getPreferenceStore().contains(dbSpecific)){
283 287
            return getPreferenceStore().getLong(dbSpecific);
284 288
        }else{
......
738 742
	}
739 743

  
740 744
	public static String createPreferenceString(String property){
741
	   return property +"_"+((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString();
745
	   return prefKey(property);
742 746

  
743 747
	}
744 748

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)