commit be140ab305a6b7e7ba3e06cc810c1e10d232ae5a
Author: Katja Luther <k.luther@bgbm.org>
Date:   Tue Nov 1 12:16:51 2016 +0100

    ref #5971: add an admin page to the prefs and add cdm pref nomenclatural code

diff --git a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties
index bec383a23..3d5878ca8 100644
--- a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties
+++ b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties
@@ -26,6 +26,10 @@ page.name.22 = Default Feature Trees
 page.name.23 = Representation
 page.name.24 = Mobot Open Url
 page.name.25 = Type Designations
+page.name.36 = Name Details View
+page.name.37 = Cdm Preferences
+page.name.38 = General Preferences
+page.name.39 = Nomenclatural Code
 view.name = Datasource
 view.name.0 = Progress
 view.name.1 = Message
diff --git a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
index 13c9fe572..4a7869277 100644
--- a/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
+++ b/eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
@@ -26,6 +26,10 @@ page.name.22 = Standard Merkmalsbaum
 page.name.23 = Repr\u00e4sentation
 page.name.24 = Mobot Open Url
 page.name.25 = Typus
+page.name.36 = Namensdetails
+page.name.37 = CDM Präferenzen
+page.name.38 = allgemeine CDM Präferenzen
+page.name.39 = Nomenklatorischer Code
 view.name = Datenquelle
 view.name.0 = Fortschritt
 view.name.1 = Nachrichten
diff --git a/eu.etaxonomy.taxeditor.store/plugin.xml b/eu.etaxonomy.taxeditor.store/plugin.xml
index 9b1bca568..32beeab33 100755
--- a/eu.etaxonomy.taxeditor.store/plugin.xml
+++ b/eu.etaxonomy.taxeditor.store/plugin.xml
@@ -8,6 +8,30 @@
             class="eu.etaxonomy.taxeditor.preference.TaxonomicEditorGeneralPreferences"
             id="eu.etaxonomy.taxeditor.preferences.general"
             name="%page.name">
+      </page>
+       <page
+            category="eu.etaxonomy.taxeditor.preferences.general"
+            class="eu.etaxonomy.taxeditor.preference.AdminPreferencesPage"
+            id="eu.etaxonomy.taxeditor.preferences.admin"
+            name="%page.name.37">
+      </page>
+      <!-- <page
+            category="eu.etaxonomy.taxeditor.preferences.admin"
+            class="eu.etaxonomy.taxeditor.preference.AdminGeneralPreferences"
+            id="eu.etaxonomy.taxeditor.preferences.adminGeneral"
+            name="%page.name.38">
+      </page>-->
+       <page
+            category="eu.etaxonomy.taxeditor.preferences.admin"
+            class="eu.etaxonomy.taxeditor.preference.AdminNomenclaturalCode"
+            id="eu.etaxonomy.taxeditor.preferences.adminNomenclaturalCode"
+            name="%page.name.39">
+      </page>
+      <page
+       		category="eu.etaxonomy.taxeditor.preferences.general"
+            class="eu.etaxonomy.taxeditor.preference.NameDetailsViewConfiguration"
+            id="eu.etaxonomy.taxeditor.preferences.nameDetails"
+            name="%page.name.36">
       </page>
       <page
             category="eu.etaxonomy.taxeditor.preferences.general"
@@ -213,7 +237,7 @@
             id="eu.etaxonomy.taxeditor.preference.TaxonNavigator"
             name="%page.name.32">
       </page>
-       <page
+      <page
             category="eu.etaxonomy.taxeditor.preferences.general"
             class="eu.etaxonomy.taxeditor.preference.DebugPreferences"
             id="eu.etaxonomy.taxeditor.preferences.debug"
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java
index ccdd5e285..53f077581 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java
@@ -30,7 +30,6 @@ import eu.etaxonomy.cdm.database.CdmPersistentDataSource;
 import eu.etaxonomy.cdm.database.DataSourceNotFoundException;
 import eu.etaxonomy.cdm.database.ICdmDataSource;
 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
-
 import eu.etaxonomy.taxeditor.model.MementoHelper;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
@@ -191,7 +190,7 @@ public class CdmDataSourceRepository{
 		NomenclaturalCode applicationNomenclaturalCode = PreferencesUtil.getPreferredNomenclaturalCode(true);
 
 		if( dataSourceNomenclaturalCode != null && ! dataSourceNomenclaturalCode.equals(applicationNomenclaturalCode)){
-			PreferencesUtil.setPreferredNomenclaturalCode(dataSourceNomenclaturalCode);
+			PreferencesUtil.setPreferredNomenclaturalCode(dataSourceNomenclaturalCode, true);
 			MessagingUtils.informationDialog("Nomenclatural Code Change", "The Datasource that was just " +
 					"loaded has a different nomenclatural code than the one stored in Preferences. " +
 					"The nomenclatural code was changed in the application.");
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AdminGeneralPreferences.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AdminGeneralPreferences.java
new file mode 100755
index 000000000..c1abee458
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AdminGeneralPreferences.java
@@ -0,0 +1,51 @@
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.preference;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * @author k.luther
+ * @date 01.11.2016
+ *
+ */
+public class AdminGeneralPreferences extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+     */
+    @Override
+    public void init(IWorkbench workbench) {
+        setPreferenceStore(PreferencesUtil.getPreferenceStore());
+
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+     */
+    @Override
+    protected void createFieldEditors() {
+        addField(new BooleanFieldEditor(IPreferenceKeys.IS_SHOW_UP_WIDGET_IS_DISPOSED,
+                "Show up widget is disposed error messages.",
+                getFieldEditorParent()));
+        addField(new BooleanFieldEditor(IPreferenceKeys.DISABLE_SERVICES_API_TIMESTAMP_CHECK,
+                "Disable services api timestamp check",
+                getFieldEditorParent()));
+        addField(new BooleanFieldEditor(
+                IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES,
+                "Show experimental features", getFieldEditorParent()));
+
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AdminNomenclaturalCode.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AdminNomenclaturalCode.java
new file mode 100755
index 000000000..d87a9d84b
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AdminNomenclaturalCode.java
@@ -0,0 +1,99 @@
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.preference;
+
+import java.util.List;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.ComboFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
+import eu.etaxonomy.cdm.api.service.IPreferenceService;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
+
+/**
+ * @author k.luther
+ * @date 01.11.2016
+ *
+ */
+public class AdminNomenclaturalCode extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+     */
+    @Override
+    public void init(IWorkbench workbench) {
+        setPreferenceStore(TaxeditorStorePlugin.getDefault()
+                .getPreferenceStore());
+        setDescription("Choose which nomenclatural code you would like to use for scientific names unless otherwise specified. \nATTENTION, this preference is stored in DB!");
+        PreferencesUtil.setPreferredNomenclaturalCode(null, false);
+
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+     */
+    @Override
+    protected void createFieldEditors() {
+        addField(new ComboFieldEditor(
+                IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY,
+                "Available Codes", getLabelAndValues(),
+                getFieldEditorParent()));
+        addField(new BooleanFieldEditor(
+                IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY,
+                "allow to use local preference",
+                getFieldEditorParent()));
+
+
+    }
+
+    /**
+     * @return
+     */
+    private String[][] getLabelAndValues() {
+        List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
+                .getSupportedCodes();
+        String[][] labelAndValues = new String[supportedCodes.size()][2];
+        for (int i = 0; i < supportedCodes.size(); i++) {
+            labelAndValues[i][0] = NomenclaturalCodeHelper
+                    .getDescription(supportedCodes.get(i));
+            labelAndValues[i][1] = PreferencesUtil
+                    .getPreferenceKey(supportedCodes.get(i));
+        }
+        return labelAndValues;
+    }
+    @Override
+    public boolean performOk() {
+
+       boolean result = super.performOk();
+       if (result){
+           String value = getPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
+           CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value);
+           ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration();
+           if (controller == null){
+               return false;
+           }
+           IPreferenceService service = controller.getPreferenceService();
+           service.set(pref);
+       }
+       return result;
+   }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AdminPreferencesPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AdminPreferencesPage.java
new file mode 100755
index 000000000..dcc7287e0
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AdminPreferencesPage.java
@@ -0,0 +1,40 @@
+// $Id$
+/**
+* Copyright (C) 2016 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.preference;
+
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * @author k.luther
+ * @date 01.11.2016
+ *
+ */
+public class AdminPreferencesPage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+     */
+    @Override
+    public void init(IWorkbench workbench) {
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+     */
+    @Override
+    protected void createFieldEditors() {
+
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
index ccbc6b96e..1f92bf6c3 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
@@ -24,7 +24,9 @@ public interface IPreferenceKeys {
 	 *
 	 */
 	public static final String PREFERRED_NOMENCLATURAL_CODE_KEY = "eu.etaxonomy.taxeditor.nomenclaturalCode";
-
+    public static final String OVERRIDE_NOMENCLATURAL_CODE_KEY = "eu.etaxonomy.taxeditor.nomenclaturalCode.override";
+    public static final String ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY = "eu.etaxonomy.taxeditor.nomenclaturalCode.allow_override";
+    public static final String CDM_NOMENCLATURAL_CODE_KEY = "eu.etaxonomy.taxeditor.cdm.nomenclaturalCode";
 	/**
 	 *
 	 */
@@ -171,7 +173,7 @@ public interface IPreferenceKeys {
     public static final String SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP = "eu.etaxonomy.taxeditor.name.showNameNameRelationship";
 	public static final String SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE = "eu.etaxonomy.taxeditor.name.showNameAppendedPhrase";
 	public static final String SHOW_NAME_DETAILS_SECTION_CACHE = "eu.etaxonomy.taxeditor.name.showNameCache";
-	
+
     public static final String PROMPT_FOR_OPEN_SPECIMEN_IN_EDITOR = "eu.etaxonomy.taxeditor.specimen.promptForOpenSpecimenInEditor";
 
     // TODO RL
@@ -186,7 +188,10 @@ public interface IPreferenceKeys {
      */
     public static final String P2_REPOSITORY_LIST = "eu.etaxonomy.taxeditor.p2.repositories";
 
-	
+
+
+
+
 
 
 
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/InitNomenclaturalCodePrefDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/InitNomenclaturalCodePrefDialog.java
index 291c80ffd..ae0335605 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/InitNomenclaturalCodePrefDialog.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/InitNomenclaturalCodePrefDialog.java
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -33,7 +33,7 @@ import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
  * @version 1.0
  */
 public class InitNomenclaturalCodePrefDialog extends Dialog {
-	
+
 	/**
 	 * If the user makes no change, or cancels, preferred nom. code will be set to the default
 	 */
@@ -47,7 +47,7 @@ public class InitNomenclaturalCodePrefDialog extends Dialog {
 	public InitNomenclaturalCodePrefDialog(Shell parentShell) {
 		super(parentShell);
 	}
-	
+
 	/**
 	 * {@inheritDoc}
 	 *
@@ -71,23 +71,24 @@ public class InitNomenclaturalCodePrefDialog extends Dialog {
 		buttonsComposite.setLayout(new GridLayout());
 
 		NomenclaturalCode defaultCode = NomenclaturalCodeHelper.getDefaultCode();
-		
+
 		for (final NomenclaturalCode code : NomenclaturalCodeHelper.getSupportedCodes()) {
 			Button button = new Button(buttonsComposite, SWT.RADIO);
 			button.setText(NomenclaturalCodeHelper.getDescription(code));
 			button.setSelection(defaultCode.equals(code));
 			button.addSelectionListener(new SelectionAdapter() {
-				public void widgetSelected(SelectionEvent e) {
+				@Override
+                public void widgetSelected(SelectionEvent e) {
 					setPreferredCode(code);
 				}
 			});
 		}
-			
+
 		// More dialog text
 		String defaultCodeDescription = NomenclaturalCodeHelper.getDescription(defaultCode);
 		final Label chooseANomenclaturalLabel_1 = new Label(container, SWT.WRAP);
 		chooseANomenclaturalLabel_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-		chooseANomenclaturalLabel_1.setText("If you hit \"Cancel\", " + defaultCodeDescription + 
+		chooseANomenclaturalLabel_1.setText("If you hit \"Cancel\", " + defaultCodeDescription +
 												" will be set as your default nomenclatural code.\n\nYou can change the nomenclatural code at any time in the \"Preferences\" menu.");
 		//
 		return container;
@@ -111,25 +112,27 @@ public class InitNomenclaturalCodePrefDialog extends Dialog {
 	protected Point getInitialSize() {
 		return new Point(500, 375);
 	}
-	
+
 	/** {@inheritDoc} */
-	protected void configureShell(Shell newShell) {
+	@Override
+    protected void configureShell(Shell newShell) {
 		super.configureShell(newShell);
 		newShell.setText("Choose a nomenclatural code");
 	}
-		
+
 	/**
 	 * <p>close</p>
 	 *
 	 * @return a boolean.
 	 */
-	public boolean close() {
-		
+	@Override
+    public boolean close() {
+
 		// Save preferred nomenclatural code before closing
-		PreferencesUtil.setPreferredNomenclaturalCode(preferredCode);
-		
+		PreferencesUtil.setPreferredNomenclaturalCode(preferredCode, true);
+
 		return super.close();
 	}
-	
-	
+
+
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java
index 16b326ca8..126909a5b 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NomenclaturalCodePreferences.java
@@ -1,39 +1,30 @@
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
 package eu.etaxonomy.taxeditor.preference;
 
-import java.util.Iterator;
 import java.util.List;
 
-import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.ComboFieldEditor;
 import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.RadioGroupFieldEditor;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
-import eu.etaxonomy.cdm.api.service.IClassificationService;
-import eu.etaxonomy.cdm.api.service.IPreferenceService;
-import eu.etaxonomy.cdm.model.metadata.CdmPreference;
-import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
-import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
-import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
 import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
-import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 
 /**
  * <p>
  * NomenclaturalCodePreferences class.
  * </p>
- * 
+ *
  * @author p.ciardelli
  * @created 16.09.2008
  * @version 1.0
@@ -43,7 +34,7 @@ public class NomenclaturalCodePreferences extends FieldEditorPreferencePage
 
 	/*
 	 * (non-Javadoc)
-	 * 
+	 *
 	 * @see
 	 * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
 	 * ()
@@ -51,10 +42,14 @@ public class NomenclaturalCodePreferences extends FieldEditorPreferencePage
 	@Override
 	protected void createFieldEditors() {
 
-		addField(new RadioGroupFieldEditor(
+		addField(new ComboFieldEditor(
 				IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY,
-				"Available Codes", 1, getLabelAndValues(),
-				getFieldEditorParent(), true));
+				"Available Codes", getLabelAndValues(),
+				getFieldEditorParent()));
+		addField(new BooleanFieldEditor(
+                IPreferenceKeys.OVERRIDE_NOMENCLATURAL_CODE_KEY,
+                "Use local nomenclatural code",
+                getFieldEditorParent()));
 
 	}
 
@@ -76,33 +71,34 @@ public class NomenclaturalCodePreferences extends FieldEditorPreferencePage
 
 	/**
 	 * {@inheritDoc}
-	 * 
+	 *
 	 * Initialize the preference page
 	 */
-	public void init(IWorkbench workbench) {
+	@Override
+    public void init(IWorkbench workbench) {
 		setPreferenceStore(TaxeditorStorePlugin.getDefault()
 				.getPreferenceStore());
-		setDescription("Choose which nomenclatural code you would like to use for scientific names unless otherwise specified. \nATTENTION, this preference is stored in DB!");
-		PreferencesUtil.setPreferredNomenclaturalCode(null);
+		setDescription("Choose which nomenclatural code you would like to use in your local application for scientific names unless otherwise specified.");
+		//PreferencesUtil.setPreferredNomenclaturalCode(null, true);
 	}
-	
+
 	@Override
 	 public boolean performOk() {
-		
+
 		boolean result = super.performOk();
-		if (result){
-			String value = getPreferenceStore().getString(IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY);
-			CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value);
-			ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration();
-			if (controller == null){
-				return false;
-			}
-			IPreferenceService service = controller.getPreferenceService();
-			service.set(pref);
-		}
+//		if (result){
+//			String value = getPreferenceStore().getString(IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY);
+//			CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value);
+//			ICdmApplicationConfiguration controller = CdmStore.getCurrentApplicationConfiguration();
+//			if (controller == null){
+//				return false;
+//			}
+//			IPreferenceService service = controller.getPreferenceService();
+//			service.set(pref);
+//		}
         return result;
     }
-	
-	
+
+
 
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
index 0dd68af2e..f4f32c9b2 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
@@ -37,7 +37,6 @@ import org.eclipse.ui.PlatformUI;
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeConfigurator;
 import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
-import eu.etaxonomy.cdm.api.service.IPreferenceService;
 import eu.etaxonomy.cdm.api.service.ITermService;
 import eu.etaxonomy.cdm.api.service.config.FindTaxaAndNamesConfiguratorImpl;
 import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
@@ -108,38 +107,50 @@ public class PreferencesUtil implements IPreferenceKeys {
 	 *            a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode}
 	 *            object.
 	 */
-	public static void setPreferredNomenclaturalCode(
-			NomenclaturalCode preferredCode) {
-		ICdmApplicationConfiguration controller;
-		controller = CdmStore.getCurrentApplicationConfiguration();
-		PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode);
-		CdmPreference preference = null;
-		if (controller == null){
-			return;
-		}
-		if (preferredCode == null){
-			preference = controller.getPreferenceService().find(key);
-			if (preference == null){
-				return;
-			} else{
-				int index = StringUtils.lastIndexOf(preference.getValue(), ".");
-				UUID uuid = UUID.fromString(preference.getValue().substring(index +1, preference.getValue().length()));
-				preferredCode = NomenclaturalCode.getByUuid(uuid);
-			}
-		} else{
-			preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode, preferredCode.getKey());
-			controller.getPreferenceService().set(preference);
-		}
-		 
-	    
-		getPreferenceStore().setValue(PREFERRED_NOMENCLATURAL_CODE_KEY,
-	    			getPreferenceKey(preferredCode));
+	public static NomenclaturalCode setPreferredNomenclaturalCode(
+			NomenclaturalCode preferredCode, boolean local) {
+	    if (local){
+	        getPreferenceStore().setValue(PREFERRED_NOMENCLATURAL_CODE_KEY,
+                    getPreferenceKey(preferredCode));
+	    }
+	    else{
+    		ICdmApplicationConfiguration controller;
+    		controller = CdmStore.getCurrentApplicationConfiguration();
+    		PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode);
+    		CdmPreference preference = null;
+    		if (controller == null){
+    			return null;
+    		}
+    		if (preferredCode == null){
+    			preference = controller.getPreferenceService().find(key);
+    			if (preference == null){
+    				return null;
+    			} else{
+    				int index = StringUtils.lastIndexOf(preference.getValue(), ".");
+    				UUID uuid = UUID.fromString(preference.getValue().substring(index +1, preference.getValue().length()));
+    				preferredCode = NomenclaturalCode.getByUuid(uuid);
+    				return preferredCode;
+    			}
+    		} else{
+    			preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode, preferredCode.getKey());
+    			controller.getPreferenceService().set(preference);
+
+    		}
+	    }
+        return preferredCode;
+
+
+
 	}
 
 	public static NomenclaturalCode getPreferredNomenclaturalCode(){
-		return getPreferredNomenclaturalCode(false);
+	    if (getPreferenceStore().getBoolean(OVERRIDE_NOMENCLATURAL_CODE_KEY)) {
+            return getPreferredNomenclaturalCode(true);
+        } else{
+            return getPreferredNomenclaturalCode(false);
+        }
 	}
-	
+
 	/**
 	 * <p>
 	 * getPreferredNomenclaturalCode
@@ -147,10 +158,10 @@ public class PreferencesUtil implements IPreferenceKeys {
 	 *
 	 * @return a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
 	 */
-	public static NomenclaturalCode getPreferredNomenclaturalCode(boolean preConnected) {
+	public static NomenclaturalCode getPreferredNomenclaturalCode(boolean useLocal) {
 		ICdmApplicationConfiguration controller;
 		CdmPreference pref = null;
-		if (!preConnected){
+		if (!useLocal){
 			try{
 				controller = CdmStore.getCurrentApplicationConfiguration();
 				PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.NomenclaturalCode);
@@ -159,7 +170,7 @@ public class PreferencesUtil implements IPreferenceKeys {
 				e.printStackTrace();
 			}
 		}
-		
+
 	    String preferredCode;
 	    if(pref == null){
 	    	preferredCode = getPreferenceStore().getString(
@@ -167,10 +178,8 @@ public class PreferencesUtil implements IPreferenceKeys {
 	    }else{
 	    	preferredCode = pref.getValue();
 	    }
-	    
+
 		for (NomenclaturalCode code : NomenclaturalCodeHelper.getAllCodes()) {
-//			String preferredCode = getPreferenceStore().getString(
-//					PREFERRED_NOMENCLATURAL_CODE_KEY);
 			if (getPreferenceKey(code).equals(preferredCode)) {
 				return code;
 			}
@@ -475,7 +484,7 @@ public class PreferencesUtil implements IPreferenceKeys {
 
 
 		if (PreferencesUtil.getPreferredNomenclaturalCode(true) == null) {
-			PreferencesUtil.setPreferredNomenclaturalCode(NomenclaturalCode.ICNAFP);
+			PreferencesUtil.setPreferredNomenclaturalCode(NomenclaturalCode.ICNAFP, true);
 			/*
 
 			StoreUtil.info("No nomencatural code set.");
