page.name.23 = Representation\r
page.name.24 = Mobot Open Url\r
page.name.25 = Type Designations\r
+page.name.36 = Name Details View\r
+page.name.37 = Cdm Preferences\r
+page.name.38 = General Preferences\r
+page.name.39 = Nomenclatural Code\r
view.name = Datasource\r
view.name.0 = Progress\r
view.name.1 = Message\r
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
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"
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"
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;
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.");
--- /dev/null
+// $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()));
+
+ }
+
+}
--- /dev/null
+// $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;
+ }
+
+
+}
--- /dev/null
+// $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() {
+
+ }
+
+
+}
*
*/
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";
/**
*
*/
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
*/
public static final String P2_REPOSITORY_LIST = "eu.etaxonomy.taxeditor.p2.repositories";
-
+
+
+
+
/**
* 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.
*/
* @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
*/
public InitNomenclaturalCodePrefDialog(Shell parentShell) {
super(parentShell);
}
-
+
/**
* {@inheritDoc}
*
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;
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();
}
-
-
+
+
}
/**
* 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
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
* ()
@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()));
}
/**
* {@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;
}
-
-
+
+
}
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;
* 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
*
* @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);
e.printStackTrace();
}
}
-
+
String preferredCode;
if(pref == null){
preferredCode = getPreferenceStore().getString(
}else{
preferredCode = pref.getValue();
}
-
+
for (NomenclaturalCode code : NomenclaturalCodeHelper.getAllCodes()) {
-// String preferredCode = getPreferenceStore().getString(
-// PREFERRED_NOMENCLATURAL_CODE_KEY);
if (getPreferenceKey(code).equals(preferredCode)) {
return code;
}
if (PreferencesUtil.getPreferredNomenclaturalCode(true) == null) {
- PreferencesUtil.setPreferredNomenclaturalCode(NomenclaturalCode.ICNAFP);
+ PreferencesUtil.setPreferredNomenclaturalCode(NomenclaturalCode.ICNAFP, true);
/*
StoreUtil.info("No nomencatural code set.");