Revision e9773ade
Added by Katja Luther over 7 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java | ||
---|---|---|
16 | 16 |
import org.eclipse.ui.IWorkbench; |
17 | 17 |
import org.eclipse.ui.IWorkbenchPreferencePage; |
18 | 18 |
|
19 |
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; |
|
20 |
import eu.etaxonomy.cdm.api.service.IPreferenceService; |
|
21 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference; |
|
22 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey; |
|
23 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
|
24 |
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject; |
|
19 | 25 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
20 | 26 |
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper; |
27 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
21 | 28 |
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; |
22 | 29 |
|
23 | 30 |
/** |
... | ... | |
41 | 48 |
*/ |
42 | 49 |
@Override |
43 | 50 |
protected void createFieldEditors() { |
51 |
PreferencesUtil.setPreferredNomenclaturalCode(null, false); |
|
44 | 52 |
if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY)) { |
45 | 53 |
addField(new ComboFieldEditor( |
46 | 54 |
IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY, |
... | ... | |
84 | 92 |
setPreferenceStore(TaxeditorStorePlugin.getDefault() |
85 | 93 |
.getPreferenceStore()); |
86 | 94 |
|
95 |
ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration(); |
|
96 |
if (controller != null){ |
|
97 |
IPreferenceService service = controller.getPreferenceService(); |
|
98 |
PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode); |
|
99 |
CdmPreference pref = service.find(key); |
|
100 |
getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY, pref.isAllowOverride()); |
|
101 |
} |
|
102 |
|
|
87 | 103 |
if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY)) { |
88 | 104 |
setDescription("Choose which nomenclatural code you would like to use in your local application for scientific names unless otherwise specified."); |
89 | 105 |
}else{ |
90 | 106 |
setDescription("The CDM settings don't allow to set the nomenclatural code locally. If you need to make local settings, please ask an administrator."); |
91 | 107 |
|
92 |
//PreferencesUtil.setPreferredNomenclaturalCode(null, true); |
|
93 | 108 |
} |
94 | 109 |
} |
95 | 110 |
|
Also available in: Unified diff
ref #5971: new main menu admin with cdm preference nomenclatural code and insert polytomous key node