ref #5971: don't allow to edit local nomenclatural code if allowOverride is false
authorKatja Luther <k.luther@bgbm.org>
Tue, 1 Nov 2016 12:03:05 +0000 (13:03 +0100)
committerKatja Luther <k.luther@bgbm.org>
Tue, 1 Nov 2016 12:03:05 +0000 (13:03 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AdminNomenclaturalCode.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java

index 4c8b0d1f210326a8055099d57d6b7cf1f38abbd6..40ec6fbfad4dad54b68f68721900be1c459ed3b6 100755 (executable)
@@ -86,7 +86,7 @@ public class AdminNomenclaturalCode extends FieldEditorPreferencePage implements
            String value = getPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
            String allowOverride =  getPreferenceStore().getString(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
            CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value);
            String value = getPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
            String allowOverride =  getPreferenceStore().getString(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
            CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value);
-           pref.setAllowOverride(Boolean.getBoolean(allowOverride));
+           pref.setAllowOverride(Boolean.parseBoolean(allowOverride));
            ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration();
            if (controller == null){
                return false;
            ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration();
            if (controller == null){
                return false;
index 657a40dc4e59602a2898793f00f918a80f1d016b..521a6a304faf6bbc57f54f744330ab90e8030e97 100644 (file)
@@ -41,7 +41,7 @@ public class NomenclaturalCodePreferences extends FieldEditorPreferencePage
         */
        @Override
        protected void createFieldEditors() {
         */
        @Override
        protected void createFieldEditors() {
-           if (getPreferenceStore().getBoolean(IPreferenceKeys.OVERRIDE_NOMENCLATURAL_CODE_KEY)) {
+           if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY)) {
                addField(new ComboFieldEditor(
                                IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY,
                                "Available Codes", getLabelAndValues(),
                addField(new ComboFieldEditor(
                                IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY,
                                "Available Codes", getLabelAndValues(),
@@ -80,10 +80,17 @@ public class NomenclaturalCodePreferences extends FieldEditorPreferencePage
         */
        @Override
     public void init(IWorkbench workbench) {
         */
        @Override
     public void init(IWorkbench workbench) {
-               setPreferenceStore(TaxeditorStorePlugin.getDefault()
+
+               setPreferenceStore(TaxeditorStorePlugin.getDefault()
                                .getPreferenceStore());
                                .getPreferenceStore());
-               setDescription("Choose which nomenclatural code you would like to use in your local application for scientific names unless otherwise specified.");
-               //PreferencesUtil.setPreferredNomenclaturalCode(null, true);
+
+           if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY)) {
+               setDescription("Choose which nomenclatural code you would like to use in your local application for scientific names unless otherwise specified.");
+           }else{
+               setDescription("The CDM settings don't allow to set the nomenclatural code locally. If you need to make local settings, please ask an administrator.");
+
+               //PreferencesUtil.setPreferredNomenclaturalCode(null, true);
+           }
        }
 
        @Override
        }
 
        @Override