Revision b9801dc0
Added by Katja Luther over 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.preference; |
10 | 10 |
|
11 |
import java.util.Iterator; |
|
11 | 12 |
import java.util.List; |
12 | 13 |
|
14 |
import org.eclipse.jface.preference.FieldEditor; |
|
13 | 15 |
import org.eclipse.jface.preference.FieldEditorPreferencePage; |
14 | 16 |
import org.eclipse.jface.preference.RadioGroupFieldEditor; |
15 | 17 |
import org.eclipse.ui.IWorkbench; |
16 | 18 |
import org.eclipse.ui.IWorkbenchPreferencePage; |
17 | 19 |
|
20 |
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; |
|
21 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
|
22 |
import eu.etaxonomy.cdm.api.service.IPreferenceService; |
|
23 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference; |
|
24 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey; |
|
25 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
|
26 |
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject; |
|
18 | 27 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
19 | 28 |
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper; |
29 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
20 | 30 |
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; |
21 | 31 |
|
22 | 32 |
/** |
... | ... | |
73 | 83 |
setPreferenceStore(TaxeditorStorePlugin.getDefault() |
74 | 84 |
.getPreferenceStore()); |
75 | 85 |
setDescription("Choose which nomenclatural code you would like to use for scientific names unless otherwise specified."); |
86 |
PreferencesUtil.setPreferredNomenclaturalCode(null); |
|
76 | 87 |
} |
88 |
|
|
89 |
@Override |
|
90 |
public boolean performOk() { |
|
91 |
|
|
92 |
boolean result = super.performOk(); |
|
93 |
if (result){ |
|
94 |
String value = getPreferenceStore().getString(IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY); |
|
95 |
CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value); |
|
96 |
ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration(); |
|
97 |
IPreferenceService service = controller.getPreferenceService(); |
|
98 |
service.set(pref); |
|
99 |
} |
|
100 |
return result; |
|
101 |
} |
|
102 |
|
|
103 |
|
|
77 | 104 |
|
78 | 105 |
} |
Also available in: Unified diff
ref #5969: get the preference NC from db when initialize preference store and save the changes in db