</children>
<children xsi:type="menu:MenuSeparator" xmi:id="_BmuOUB63EeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.menuseparator.3"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_jE5VoB60EeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.handledmenuitem.import" label="%command.label.3" command="_dlo3oB60EeePLJ5to5QrXQ">
- <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_0UicAB61EeePLJ5to5QrXQ" coreExpressionId="isCdmStoreConnected"/>
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_0UicAB61EeePLJ5to5QrXQ" coreExpressionId="isCdmStoreConnectedAndShowIOMenuEnabled"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_xT7KsB61EeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.handledmenuitem.export" label="%command.label.4" command="_CYHrgB62EeePLJ5to5QrXQ">
- <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_21J-oB61EeePLJ5to5QrXQ" coreExpressionId="isCdmStoreConnected"/>
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_21J-oB61EeePLJ5to5QrXQ" coreExpressionId="isCdmStoreConnectedAndShowIOMenuEnabled"/>
</children>
<children xsi:type="menu:MenuSeparator" xmi:id="_XE1yMB62EeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.menuseparator.1"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_YM8CsB62EeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.handledmenuitem.save" label="%command.label.1" command="_PkWcQB62EeePLJ5to5QrXQ">
</children>
<children xsi:type="menu:MenuSeparator" xmi:id="_liWNsKLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.7"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_ob4moKLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.specimen" label="%handledmenuitem.label.8" tooltip="%handledmenuitem.label.8" command="_Kc-ToCAzEeeepOgM49meig">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_sEquQMu6EeiGO4eKaXkw0w"/>
<parameters xmi:id="_ob4moaLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.parameter.input.occurrence" name="taxeditor-bulkeditor.commandParameter.inputType" value="bulkeditor.input.occurrence"/>
</children>
</elements>
<children xsi:type="menu:HandledMenuItem" xmi:id="_o1PAsJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.movefactualdata" label="%command.label.moveFactualData" command="_3PRy8JIxEeeJAdt8ZUxyaw"/>
<children xsi:type="menu:MenuSeparator" xmi:id="_rBdnsJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.2"/>
<children xsi:type="menu:Menu" xmi:id="_T8ey0KkeEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.navigation.menu.import" label="Import">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_7ZtcEMuuEeiGO4eKaXkw0w" coreExpressionId="isShowIOMenuEnabled"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_YMugAKkeEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importSpecimens" label="Import Specimens" command="_yBC78KnJEeeTAPHmaMLwQQ"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_2NC0kKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importAbcd" label="%wizard.name.3" command="_AOq4QKnKEeeTAPHmaMLwQQ"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_3rMNkKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importExceldistribution" label="%wizard.name.23" command="_Anfn8KnKEeeTAPHmaMLwQQ">
<children xsi:type="menu:HandledMenuItem" xmi:id="_7w_lUKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importTcs" label="%wizard.name" command="_LCsbgKnKEeeTAPHmaMLwQQ"/>
</children>
<children xsi:type="menu:Menu" xmi:id="_rbInwKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.menu.export" label="Export">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_3qJaEMuuEeiGO4eKaXkw0w" coreExpressionId="isShowIOMenuEnabled"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_tPAZIKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportJaxb" label="%wizard.name.6" command="_fQX7EKqhEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_xwZgsKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportSdd" label="%wizard.name.8" command="_iaZnEKqhEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_zDuJwKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportDwca" label="%wizard.name.9" command="_juMxQKqhEeeXcJGhyhlrKA"/>
definitionId="isCdmStoreConnected">
</reference>
</and>
+ </definition>
+ <definition
+ id="isCdmStoreConnectedAndShowIOMenuEnabled">
+ <and>
+ <reference
+ definitionId="isShowIOMenuEnabled">
+ </reference>
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </and>
</definition>
<definition
id="isClassification">
command.name.OPEN_REFERENCING_OBJECTS_VIEW = Open Referencing Objects View\r
extension.name.1 = Store Workbench Model\r
page.name.21 = Distribution Editor Configuration\r
+page.name.21 = Distribution Data Configuration\r
page.name.40 = ABCD Import Configuration\r
page.name.41 = ABCD Import Provider\r
page.name.42 = Database Preferences\r
extension-point.name.0 = Preference Page\r
extension-point.name.1 = Admin Preference Page\r
page.name.45 = Specimen\r
-page.name.46 = Publish Flag
\ No newline at end of file
+page.name.46 = Publish Flag\r
+page.name.47 = Vocabulary Selection\r
+command.name.111 = Open Admin Distributionstatus-Wizard\r
+command.name.112 = Open Admin CommonNameArea-Wizard
\ No newline at end of file
partdescriptor.label.featureTreeEditor = Merkmalsbaum-Editor
command.name.OPEN_REFERENCING_OBJECTS_VIEW = Öffne Referenzierende Objekte
page.name.21 = Verbreitungs-Editor
+page.name.100 = Verbreitungs-Daten
page.name.40 = ABCD Import
page.name.41 = Biocase Provider
page.name.42 = Datenbank Präferenzen
extension-point.name.0 = Präferenzen
extension-point.name.1 = Admin Präferenzen
page.name.45 = Specimen
-page.name.46 = Publish Flag
\ No newline at end of file
+page.name.46 = Publish Flag
+page.name.47 = Vokabular Auswahl
+command.name.111 = \u00d6ffne Admin Verbreitungsstatus-Wizard
+command.name.112 = \u00d6ffne Admin Common Name Areal-Wizard
\ No newline at end of file
<elements xsi:type="commands:Command" xmi:id="_AJtnsCHXEeiP8eNo0PEm1g" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.createFeatureTree" commandName="Create feature tree"/>
<elements xsi:type="commands:Command" xmi:id="_FTpC0MVSEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler" commandName="%command.name.11"/>
<elements xsi:type="commands:Command" xmi:id="_Vs75kMVfEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler" commandName="%command.name.110"/>
+ <elements xsi:type="commands:Command" xmi:id="_tPtdwMiIEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardAdminHandler" commandName="%command.name.111"/>
+ <elements xsi:type="commands:Command" xmi:id="_tRsg8MrcEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.store.open.OpenCommonNameAreaWizardAdminHandler" commandName="%command.name.112"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="xpath:/">
<elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
<elements xsi:type="commands:Handler" xmi:id="_H98S8K2tEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.handler.e4.SwitchUserHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.SwitchUserHandlerE4" command="_S868QK2dEeeykrJkROy5EA"/>
<elements xsi:type="commands:Handler" xmi:id="_zdDe8BWNEeiazYUJirF0Pw" elementId="eu.etaxonomy.taxeditor.handler.update.UpdateHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.update.UpdateHandler" command="_jSJrsBWPEeiazYUJirF0Pw"/>
<elements xsi:type="commands:Handler" xmi:id="_4owEkMVREeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionEditorWizardHandlerAdminE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionEditorWizardHandlerAdminE4" command="_Vs75kMVfEeiKErB3UVzQug"/>
+ <elements xsi:type="commands:Handler" xmi:id="_VBYX4MiQEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStausWizardAdminHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStatusWizardAdminHandler" command="_tPtdwMiIEeiKErB3UVzQug"/>
+ <elements xsi:type="commands:Handler" xmi:id="_jnQb8MrcEeiKErB3UVzQug" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler" command="_tRsg8MrcEeiKErB3UVzQug"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="before:eu.etaxonomy.taxeditor.application.windowMenu.last">
<elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="Term Editor">
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_ITE10KkVEeejedk4mZQIGw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.file" positionInList="before:eu.etaxonomy.taxeditor.application.filemenu.io">
<elements xsi:type="menu:Menu" xmi:id="_z6EugKqXEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.menu.export" label="Export">
- <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_3eyLYKqXEeeXcJGhyhlrKA" coreExpressionId="isCdmStoreConnected"/>
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_3eyLYKqXEeeXcJGhyhlrKA" coreExpressionId="isShowIOMenuEnabled"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_b9E38KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportJaxb" label="%wizard.name.6" command="_L0xNEKqYEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_lXe84KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportSdd" label="%wizard.name.8" command="_ybovsKqZEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_nf4z0KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportDwca" label="%wizard.name.9" command="_y69I8KqZEeeXcJGhyhlrKA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_uruvcKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCdmLight" label="%wizard.name.22" command="_zLKvMKqZEeeXcJGhyhlrKA"/>
</elements>
<elements xsi:type="menu:Menu" xmi:id="_QC5O8KkaEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.store.menu.import" label="Import">
- <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_UL4dkKkaEeejedk4mZQIGw" coreExpressionId="isCdmStoreConnected"/>
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_UL4dkKkaEeejedk4mZQIGw" coreExpressionId="isShowIOMenuEnabled"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_RUOtQKkVEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.workbench.handledmenuitem.importspecimens" label="%wizard.name.14" command="_TwGSwKkVEeejedk4mZQIGw"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_NO718KmQEeeDJPU_cUTI2g" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importAbcd" label="%wizard.name.3" command="_QbHeEKmQEeeDJPU_cUTI2g"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_-h0G8KmfEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importExceldistribution" label="%wizard.name.23" command="_tpPnUKmfEeeTAPHmaMLwQQ">
class="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
id="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
namespace="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
- properties="isShowExperimentalFeatures, isChecklistEditorEnabled"
+ properties="isShowExperimentalFeatures, isChecklistEditorEnabled, isShowIOMenuEnabled"
type="java.lang.Object">
</propertyTester>
<propertyTester
property="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester.isShowExperimentalFeatures">
</test>
</definition>
+ <definition
+ id="isShowIOMenuEnabled">
+ <test
+ property="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester.isShowIOMenuEnabled">
+ </test>
+ </definition>
<definition
id="isModifiable">
<with
</reference>
</and>
</definition>
+
<definition
id="isChecklistEditorEnabled">
<test
</page> -->
<page
category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.DistributionAdminPreferences"
+ id="eu.etaxonomy.taxeditor.store.distribution"
+ name="%page.name.100">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.store.distribution"
class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.ChecklistEditorGeneralPreference"
id="eu.etaxonomy.taxeditor.store.checklist"
name="%page.name.21">
class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.AbcdImportProvider"
id="eu.etaxonomy.taxeditor.store.abcdImportProvider"
name="%page.name.41">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.VokabularyAdminPreferences"
+ id="eu.etaxonomy.taxeditor.store.vocabularyAdminPreference"
+ name="%page.name.47">
</page>
<page
category="eu.etaxonomy.taxeditor.preferences.general"
import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.api.service.IPreferenceService;
-import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.taxeditor.l10n.Messages;
*/
public class AbcdImportProvider extends CdmPreferencePage implements IE4AdminPreferencePage{
- private Abcd206ImportConfigurator configurator;
-
ListComponent biocaseProviderList;
/**
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridLayout;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
/**
* @author a.oppermann
- final CLabel label = new CLabel(child, SWT.NULL);
- label.setText(Messages.ChecklistEditorGeneralPreference_open_wizard);
+//
-
- final CommandHandlerButton button_openWizard = new CommandHandlerButton(child, SWT.PUSH,
- "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler");
-
- button_openWizard.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
+//
+// final CommandHandlerButton button_openWizard = new CommandHandlerButton(child, SWT.PUSH,
+// "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler");
+//
+// button_openWizard.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
// Table table = new Table
--- /dev/null
+/**
+* Copyright (C) 2018 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.databaseAdmin.preferencePage;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
+import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
+
+/**
+ * @author k.luther
+ * @since 08.10.2018
+ *
+ */
+public class DistributionAdminPreferences extends CdmPreferencePage implements IE4AdminPreferencePage {
+
+ boolean allowOverride;
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+
+
+ CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies);
+ if (pref != null){
+ allowOverride = pref.isAllowOverride();
+ }
+
+
+
+ final CLabel label = new CLabel(composite, SWT.NULL);
+ label.setText(Messages.ChecklistEditorGeneralPreference_open_wizard);
+
+ final CommandHandlerButton button_openWizard = new CommandHandlerButton(composite, SWT.PUSH,
+ "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler");
+
+ button_openWizard.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
+ final Button allowOverrideCheckButton = new Button(composite, SWT.CHECK);
+ allowOverrideCheckButton.setText(Messages.ChecklistEditorGeneralPreference_allowOverride);
+ allowOverrideCheckButton.setSelection(allowOverride);
+ allowOverrideCheckButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ allowOverride = allowOverrideCheckButton.getSelection();
+
+ }
+ });
+
+
+ pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionStatus);
+
+ if (pref != null){
+ allowOverride = pref.isAllowOverride();
+ }
+
+ final CLabel labelStatus = new CLabel(composite, SWT.NULL);
+ labelStatus.setText("Select the status which should be available for distribution data.");
+
+ final CommandHandlerButton button_openStatusWizard = new CommandHandlerButton(composite, SWT.PUSH,
+ "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardAdminHandler");
+
+ button_openStatusWizard.setText(Messages.Distribution_status_selection);
+ final Button allowOverrideStatusCheckButton = new Button(composite, SWT.CHECK);
+ allowOverrideStatusCheckButton.setText(Messages.ChecklistEditorGeneralPreference_allowOverride);
+ allowOverrideStatusCheckButton.setSelection(allowOverride);
+ allowOverrideStatusCheckButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ allowOverride = allowOverrideStatusCheckButton.getSelection();
+
+ }
+ });
+
+ return composite;
+ }
+
+
+}
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import eu.etaxonomy.cdm.api.application.ICdmRepository;
+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.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @author k.luther
*/
public class GeneralAdminPreferencePage extends CdmPreferencePage implements IE4AdminPreferencePage {
+
+ boolean isShowIOMenu = true;
/**
* {@inheritDoc}
*/
GridLayout gridLayout = new GridLayout();
composite.setLayout(gridLayout);
+ ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
+ if (controller != null){
+ IPreferenceService service = controller.getPreferenceService();
+ PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowImportExportMenu);
+ CdmPreference isShowSpecimenPref = service.find(key);
+ if (isShowSpecimenPref != null){
+ this.isShowIOMenu = Boolean.valueOf(isShowSpecimenPref.getValue());
+ }
+ }
+ final Button showIOMenuButton = new Button(composite, SWT.CHECK);
+
+ showIOMenuButton.setText(Messages.DatabasePreferncesPage_Show_IOMenu);
+
+ showIOMenuButton.setSelection(isShowIOMenu);
+ showIOMenuButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ isShowIOMenu = showIOMenuButton.getSelection();
+
+ }
+ });
return composite;
}
getControl().setVisible(false);
}
+ @Override
+ public boolean performOk() {
+ ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
+ if (controller != null){
+ IPreferenceService service = controller.getPreferenceService();
+
+ CdmPreference pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowImportExportMenu, Boolean.toString(this.isShowIOMenu));
+ pref.setAllowOverride(false);
+ service.set(pref);
+ PreferencesUtil.updateDBPreferences();
+
+
+ }
+ return true;
+ }
+
}
isSimpleDetailsViewActivated = nameDetailsConfig.isSimpleDetailsViewActivated();
activateCheckButton.setSelection(isSimpleDetailsViewActivated);
activateCheckButton.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- isSimpleDetailsViewActivated = activateCheckButton.getSelection();
- //
- if(isSimpleDetailsViewActivated){
- dbSettings.setVisible(true);
- dbSettings.setEnabled(true);
- }else{
- dbSettings.setVisible(false);
- dbSettings.setEnabled(false);
- }
- }
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ isSimpleDetailsViewActivated = activateCheckButton.getSelection();
+ //
+ if(isSimpleDetailsViewActivated){
+ dbSettings.setVisible(true);
+ dbSettings.setEnabled(true);
+ }else{
+ dbSettings.setVisible(false);
+ dbSettings.setEnabled(false);
+ }
+ }
});
final Button allowLocalPreference = new Button(dbSettings, SWT.CHECK);
// boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
- allowLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
- isAllowOverride = nameDetailsConfig.isAllowOverride();
- allowLocalPreference.setSelection(isAllowOverride);
- allowLocalPreference.addSelectionListener(new SelectionAdapter(){
+ allowLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
+ isAllowOverride = nameDetailsConfig.isAllowOverride();
+ allowLocalPreference.setSelection(isAllowOverride);
+ allowLocalPreference.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isAllowOverride = allowLocalPreference.getSelection();
}
- });
+ });
Label separator= new Label(dbSettings, SWT.HORIZONTAL | SWT.SEPARATOR);
separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Button showTaxon = new Button(dbSettings, SWT.CHECK);
@Override
public void widgetSelected(SelectionEvent e) {
isShowNameApprobiation = showNameApprobiation.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION, isShowNameApprobiation);
+ //PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION, isShowNameApprobiation);
}
});
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.api.service.IPreferenceService;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
import eu.etaxonomy.taxeditor.store.CdmStore;
*
*/
public class SpecimenAdminPreferences extends CdmPreferencePage implements IE4AdminPreferencePage {
+ public SpecimenAdminPreferences() {
+ }
-
+ boolean isShowSpecimenRelatedIssues;
boolean isShowCollectingAreaInGeneralSection;
boolean isDeterminationOnlyForFieldUnits;
boolean isShowTaxonAssociation;
boolean isShowLifeForm;
boolean isUseLocalPreference;
-
+ Composite composite;
@Override
protected Control createContents(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
+
getValues();
+
+
+ final Button showSpecimenButton = new Button(parent, SWT.CHECK);
+
+ showSpecimenButton.setText(Messages.DatabasePreferncesPage_Show_Specimen);
+
+ showSpecimenButton.setSelection(isShowSpecimenRelatedIssues);
+ showSpecimenButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ isShowSpecimenRelatedIssues = showSpecimenButton.getSelection();
+ if(isShowSpecimenRelatedIssues){
+ composite.setVisible(true);
+ composite.setEnabled(true);
+ }else{
+ composite.setVisible(false);
+ composite.setEnabled(false);
+ }
+ }
+ });
+ composite = new Composite(parent, SWT.NULL);
GridLayout gridLayout = new GridLayout();
composite.setLayout(gridLayout);
+ composite.setEnabled(isShowSpecimenRelatedIssues);
+ Label separator= new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section);
@Override
public void widgetSelected(SelectionEvent e) {
isDeterminationOnlyForFieldUnits = determinationOnlyForFieldUnitsButton.getSelection();
- }
+ }
});
final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK);
ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
if (controller != null){
IPreferenceService service = controller.getPreferenceService();
- PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection);
+ PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowSpecimen);
+ CdmPreference isShowSpecimenPref = service.find(key);
+ if (isShowSpecimenPref != null){
+ this.isShowSpecimenRelatedIssues = Boolean.valueOf(isShowSpecimenPref.getValue());
+ }
+
+
+ key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection);
CdmPreference isShowCollectingAreaInGeneralSectionPref = service.find(key);
if (isShowCollectingAreaInGeneralSectionPref != null){
this.isShowCollectingAreaInGeneralSection = Boolean.valueOf(isShowCollectingAreaInGeneralSectionPref.getValue());
pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(this.isShowLifeForm));
pref.setAllowOverride(isUseLocalPreference);
service.set(pref);
+ PreferencesUtil.updateDBPreferences();
}
--- /dev/null
+/**
+* Copyright (C) 2018 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.databaseAdmin.preferencePage;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
+import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
+
+/**
+ * @author k.luther
+ * @since 05.10.2018
+ *
+ */
+public class VokabularyAdminPreferences extends CdmPreferencePage implements IE4AdminPreferencePage {
+
+ boolean allowOverride;
+
+
+
+ @Override
+ protected Control createContents(Composite parent) {
+
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+
+ CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
+
+ if (pref != null){
+ allowOverride = pref.isAllowOverride();
+ }
+
+ final CLabel commonNameAreaLabel = new CLabel(composite, SWT.NULL);
+ commonNameAreaLabel.setText("Select the area vocabularies which should be available for common names.");
+
+ final CommandHandlerButton button_opencommonNameAreaWizard = new CommandHandlerButton(composite, SWT.PUSH,
+ "eu.etaxonomy.taxeditor.store.open.OpenCommonNameAreaWizardAdminHandler");
+
+ button_opencommonNameAreaWizard.setText(Messages.GeneralPreference_open_common_name_area_selection);
+ final Button allowOverrideCommonNameAreaCheckButton = new Button(composite, SWT.CHECK);
+ allowOverrideCommonNameAreaCheckButton.setText(Messages.ChecklistEditorGeneralPreference_allowOverride);
+ allowOverrideCommonNameAreaCheckButton.setSelection(allowOverride);
+ allowOverrideCommonNameAreaCheckButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ allowOverride = allowOverrideCommonNameAreaCheckButton.getSelection();
+
+ }
+ });
+
+ return composite;
+ }
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2018 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.handler.e4;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.preference.wizard.AvailableVocabularyWizard;
+
+/**
+ * @author k.luther
+ * @since 08.10.2018
+ *
+ */
+public class OpenCommonNameAreaWizardAdminHandler {
+ String commandID = "eu.etaxonomy.taxeditor.handler.e4.OpenCommonNameAreaWizardAdminHandler";
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+ CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
+ if (pref == null){
+ pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.CommonNameAreaVocabularies, null);
+ }
+ AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(false, pref, "Common Names");
+
+ WizardDialog dialog = new WizardDialog(shell,
+ wizard);
+
+ dialog.open();
+ }
+}
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.wizard.AvailableVocabularyWizard;
/**
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
-
- AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(false);
+ CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies);
+ if (pref == null){
+ pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, null);
+ }
+ AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(false, pref, "Distribution");
WizardDialog dialog = new WizardDialog(shell,
wizard);
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
- AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(true);
+ AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(true, null, "Distribution");
WizardDialog dialog = new WizardDialog(shell,
wizard);
--- /dev/null
+/**
+* Copyright (C) 2018 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.handler.e4;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.preference.wizard.AvailableDistributionStatusWizard;
+
+/**
+ * @author k.luther
+ * @since 05.10.2018
+ *
+ */
+public class OpenDistributionStatusWizardAdminHandler {
+ String commandID = "eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStatusWizardAdminHandler";
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+ AvailableDistributionStatusWizard wizard = new AvailableDistributionStatusWizard();
+
+ WizardDialog dialog = new WizardDialog(shell,
+ wizard);
+
+ dialog.open();
+ }
+}
public static String DateDetail_parseText_tooltip;
+
+ public static String GeneralPreference_open_common_name_area_selection;
+
+
+ public static String DatabasePreferncesPage_Show_Specimen;
+
+
+ public static String SpecimenConfiguration_description;
+
+
+ public static String DatabasePreferncesPage_Show_IOMenu;
+
+
+ public static String Distribution_status_selection;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
DateDetail_parseText_tooltip=This field is for quick data entry. The content is parsed and the atomised fields will be filled, the content of this field will not be saved.
+GeneralPreference_open_common_name_area_selection=Selection of vocabularies for common name distributions
+
+DatabasePreferncesPage_Show_Specimen=Show specimen related views and menu entries
+SpecimenConfiguration_description=Select whether you want to edit specimen related data and how they should be displayed.
+DatabasePreferncesPage_Show_IOMenu=Show Import/Export menu entries
+Distribution_status_selection=Status Selection
DateDetail_parseText_tooltip=Dieses Feld ist für die schnelle Dateneingabe. Der Inhalt des Feldes wird geparsed und in die atomisierten Felder geschrieben. Der Inhalt des Feldes selber wird nicht gespeichert.
+GeneralPreference_open_common_name_area_selection=Auswahl der Vokabulare für die Verbreitung der Common Names
+
+DatabasePreferncesPage_Show_Specimen=Zeige Specimenbezogene Views und Menüeintrgäge
+SpecimenConfiguration_description=Wählen Sie aus, ob sie specimenbezogene Daten editieren wollen und wie diese angezeigt werden sollen.
+DatabasePreferncesPage_Show_IOMenu=Zeige Import/Export Menü Einträge an
+Distribution_status_selection=Status Auswahl
IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES,
"Show experimental features", getFieldEditorParent()));
+
}
}
boolean isShowSymbol;
boolean isShowIdInVocabulary;
Composite child ;
+ boolean isAllowOverride;
@Override
protected Control createContents(Composite parent) {
composite.setLayout(new GridLayout());
CdmPreference distributionEditorPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DistributionEditorActivated);
- boolean isAllowOverride = false;
+ isAllowOverride = false;
if (distributionEditorPref != null){
isAllowOverride = distributionEditorPref.isAllowOverride();
}
@Override
public boolean performOk() {
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, isEditorActivated);
- PreferencesUtil.setSortNamedAreasByOrderInVocabulary(isSortByVocabularyOrder);
- PreferencesUtil.setShowRankInChecklistEditor(isShowRank);
- PreferencesUtil.setShowSymbolInChecklistEditor(isShowSymbol);
- PreferencesUtil.setShowIdInVocabularyInChecklistEditor(isShowIdInVocabulary);
+ if (isAllowOverride){
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, isEditorActivated);
+ PreferencesUtil.setSortNamedAreasByOrderInVocabulary(isSortByVocabularyOrder);
+ PreferencesUtil.setShowRankInChecklistEditor(isShowRank);
+ PreferencesUtil.setShowSymbolInChecklistEditor(isShowSymbol);
+ PreferencesUtil.setShowIdInVocabularyInChecklistEditor(isShowIdInVocabulary);
+ }
return true;
}
public static final String SHOW_LIFE_FORM = "eu.etaxonomy.taxeditor.specimen.showLifeForm";
public static final String SHOW_LIFE_FORM_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showLifeForm.override";
public static final String SHOW_LIFE_FORM_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showLifeForm.allowOverride";
-
- public static final String ALLOW_OVERRIDE_SPECIMEN_PREF = "eu.etaxonomy.taxeditor.specimen.allowOverride";
- public static final String OVERRIDE_SPECIMEN_PREF = "eu.etaxonomy.taxeditor.specimen.override";
+ public static final String SHOW_SPECIMEN = "eu.etaxonomy.taxeditor.specimen.showSpecimen";
+ public static final String SHOW_SPECIMEN_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showSpecimen.allowOverride";
+ public static final String SHOW_SPECIMEN_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showSpecimen.override";
//Distribution Editor preferences
public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActive";
public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE_OVERRIDE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActiveOverride";
public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActiveAllowOverride";
+ public static final String DISTRIBUTION_STATUS_OVERRIDE = "eu.etaxonomy.taxeditor.distribution.status";
+
+ public static final String COMMON_NAME_AREA_VOCABULARIES = "eu.etaxonomy.taxeditor.commonNames.areaVocabularies";
+ public static final String COMMON_NAME_AREA_VOCABULARIES_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.commonNames.areaVocabularies.allowOverride";
+ public static final String COMMON_NAME_AREA_VOCABULARIES_OVERRIDE = "eu.etaxonomy.taxeditor.commonNames.areaVocabularies.override";
//Name details view
public static final String SHOW_SIMPLE_NAME_DETAILS_SECTION = "eu.etaxonomy.taxeditor.name.showSimpleName";
public static final String SHOW_SIMPLE_NAME_DETAILS_TAXON = "eu.etaxonomy.taxeditor.name.showNameTaxon";
public static final String PUBLISH = "PUBLISH";
public static final String FILTER_COMMON_NAME_REFERENCES = "eu.etaxonomy.taxeditor.references.selection.filterCommonNameReferences";
+ public static final String SHOW_IO_MENU = "eu.etaxonomy.taxeditor.menu.showIO";
private static final String SHOW_CHECKLIST_EDITOR = "isChecklistEditorEnabled";
+ private static final String SHOW_IO_MENU = "isShowIOMenuEnabled";
+
@Override
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
if(SHOW_CHECKLIST_EDITOR.equals(property)){
return isChecklistEditorEnabled();
}
+ if(SHOW_IO_MENU.equals(property)){
+ return isShowIOMenuEnabled();
+ }
return false;
}
private boolean isChecklistEditorEnabled() {
return PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE);
}
+ private boolean isShowIOMenuEnabled() {
+ return PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_IO_MENU);
+ }
}
import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.IDefinedTerm;
import eu.etaxonomy.cdm.model.common.ISimpleTerm;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.common.TermBase;
+import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.description.FeatureTree;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.TermStore;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
import eu.etaxonomy.taxeditor.ui.dialog.DefaultLanguageDialog;
}
public static boolean isShowTaxonAssociations(){
- if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
+ if (getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS_OVERRIDE) && getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS_ALLOW_OVERRIDE)) {
return getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS);
} else{
CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
}
public static boolean isShowLifeForm(){
- if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
+ if (getPreferenceStore().getBoolean(SHOW_LIFE_FORM_OVERRIDE) && getPreferenceStore().getBoolean(SHOW_LIFE_FORM_ALLOW_OVERRIDE)) {
return getPreferenceStore().getBoolean(SHOW_LIFE_FORM);
} else{
CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowLifeForm);
}
public static boolean isDeterminationOnlyForFieldUnits(){
- if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
+ if (getPreferenceStore().getBoolean(DETERMINATION_ONLY_FOR_FIELD_UNITS_OVERRIDE) && getPreferenceStore().getBoolean(DETERMINATIONS_ONLY_FOR_FIELDUNITS_ALLOW_OVERRIDE)) {
return getPreferenceStore().getBoolean(DETERMINATION_ONLY_FOR_FIELD_UNITS);
} else{
CdmPreference pref = getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
}
public static boolean isCollectingAreaInGeneralSection(){
- if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
+ if (getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION_OVERRIDE) && getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION_ALLOW_OVERRIDE)) {
return getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION);
} else{
CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection);
getPreferenceStore().setDefault(SORT_TAXA_BY_RANK_AND_NAME, true);
//override db preferences
getPreferenceStore().setDefault(ABCD_IMPORT_OVERRIDE, false);
- getPreferenceStore().setDefault(OVERRIDE_SPECIMEN_PREF, false);
+ getPreferenceStore().setDefault(SHOW_SPECIMEN_OVERRIDE, false);
getPreferenceStore().setDefault(OVERRIDE_NAME_DETAILS, false);
getPreferenceStore().setDefault(DISTRIBUTION_AREA_PREFRENCES_ACTIVE_OVERRIDE, false);
getPreferenceStore().setDefault(FILTER_COMMON_NAME_REFERENCES, false);
updateAbcdImportConfigurationPreference();
+ preference = getPreferenceFromDB(PreferencePredicate.ShowImportExportMenu);
+ if (preference != null){
+ if(!prefStore.getBoolean(SHOW_IO_MENU) || !preference.isAllowOverride()){
+ prefStore.setValue(SHOW_IO_MENU, preference.getValue());
+ }
+ }
//Specimen Details
+ preference = getPreferenceFromDB(PreferencePredicate.ShowSpecimen);
+ if (preference != null){
+ if(!prefStore.getBoolean(SHOW_SPECIMEN) || !preference.isAllowOverride()){
+ prefStore.setValue(SHOW_SPECIMEN, preference.getValue());
+ }
+ }
+
preference = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
if (preference != null){
if(!prefStore.getBoolean(SHOW_TAXON_ASSOCIATIONS_OVERRIDE) || !preference.isAllowOverride()){
}
}
+ preference = getPreferenceFromDB(PreferencePredicate.AvailableDistributionStatus);
+ if (preference != null){
+ if (!prefStore.getBoolean(DISTRIBUTION_STATUS_OVERRIDE) || !preference.isAllowOverride()){
+ //get terms for the uuids... and add them to the termManager as preferred terms
+ ITermService termService = CdmStore.getService(ITermService.class);
+ String[] uuidArray = preference.getValue().split(";");
+ List<UUID> uuidList = new ArrayList();
+ for (String uuidString:uuidArray){
+ uuidList.add(UUID.fromString(uuidString));
+ }
+
+ List<DefinedTermBase> definedTermBases = termService.load(uuidList, null);
+ CdmStore.getTermManager().setPreferredTerms(definedTermBases, TermStore.getTerms(TermType.PresenceAbsenceTerm, null));
+ }
+ }
+
+ preference = getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
+ if (preference != null){
+ if (!prefStore.getBoolean(COMMON_NAME_AREA_VOCABULARIES_OVERRIDE) || !preference.isAllowOverride()){
+ prefStore.setValue(COMMON_NAME_AREA_VOCABULARIES, preference.getValue());
+ }
+ }
+
}
@Override
protected void createFieldEditors() {
- if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF)) {
+ if (getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SPECIMEN_ALLOW_OVERRIDE)) {
addField(new BooleanFieldEditor(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS,
"Taxon determination only on FieldUnit level",
getFieldEditorParent()));
label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
addField(new BooleanFieldEditor(
- IPreferenceKeys.OVERRIDE_SPECIMEN_PREF,
+ IPreferenceKeys.SHOW_SPECIMEN_OVERRIDE,
"Use local specimen preferences",
getFieldEditorParent()));
* @since 04.06.2018
*
*/
-public abstract class AbstractAreaSelectionWizard extends WizardPage {
+public abstract class AbstractTermSelectionWizardPage extends WizardPage {
private ColumnViewer viewer;
private List<TermVocabulary<DefinedTermBase>> vocabularies = new ArrayList<>();
boolean localPref;
- List<TermBase> listCheckedTerms;
- List<TermBase> listGrayedTerms;
+ List<TermBase> listCheckedTerms = new ArrayList<>();
+ List<TermBase> listGrayedTerms = new ArrayList<>();
+
+ TermType type;
/**
* @param pageName
*/
- protected AbstractAreaSelectionWizard(String pageName) {
+ protected AbstractTermSelectionWizardPage(String pageName, TermType type) {
super(pageName);
// TODO check if configuration exists
CdmStore.getCurrentSessionManager().bindNullSession();
+ this.type = type;
}
/**
listGrayedTerms = new ArrayList();
}
getTermsFromStringValues(listGrayed, this.listGrayedTerms);
- NamedAreaWrapper wrapper;
-// for(TermBase element : listGrayedTerms){
-// if(element != null){
-// if (element instanceof DefinedTermBase){
-// wrapper = new NamedAreaWrapper((DefinedTermBase)element, true, null);
-// if (getViewer() instanceof CheckboxTreeViewer) {
-// ((CheckboxTreeViewer)getViewer()).setGrayChecked(wrapper, true);
-// }
-// }else{
-// if (getViewer() instanceof CheckboxTreeViewer) {
-// ((CheckboxTreeViewer)getViewer()).setGrayChecked(element, true);
-// }
-// }
-// }
-//
-// }
+
}
if (checkedValues != null && checkedValues != "") {
String[] listChecked = checkedValues.split(";");
}
getTermsFromStringValues(checked, listCheckedTerms);
-// Object[] elements = ((CheckboxTreeViewer)getViewer()).getExpandedElements();
-// for (Object element: elements){
-// if (element instanceof NamedAreaWrapper){
-// if (listCheckedTerms.contains(((NamedAreaWrapper)element).getNamedArea())){
-// ((CheckboxTreeViewer)getViewer()).setChecked(element, true);
-// }
-// if (listGrayedTerms.contains(((NamedAreaWrapper)element).getNamedArea())){
-// ((CheckboxTreeViewer)getViewer()).setGrayChecked(element, true);
-// }
-// }
-// }
- NamedAreaWrapper wrapper;
-// for(Object element : listCheckedTerms){
-// if(element != null){
-// if (element instanceof DefinedTermBase){
-// wrapper = new NamedAreaWrapper((DefinedTermBase)element, true, null);
-// if (getViewer() instanceof CheckboxTreeViewer) {
-// ((CheckboxTreeViewer)getViewer()).setChecked(wrapper, true);
-// }
-// }else{
-// if (getViewer() instanceof CheckboxTreeViewer) {
-// ((CheckboxTreeViewer)getViewer()).setChecked(element, true);
-// }
-// }
-// }
-// }
}
}
}else{
vocs = CdmStore.getService(IVocabularyService.class).findByTermType(
- TermType.NamedArea, null);
+ type, null);
}
setVocabularies(vocs);
}
import java.util.List;
import java.util.Map;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.swt.widgets.Display;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.taxeditor.editor.definedterm.VocabularyContentProvider;
import eu.etaxonomy.taxeditor.editor.definedterm.VocabularyLabelProvider;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
* @since 04.06.2018
*
*/
-public class AvailableAreaVocabulariesPage extends AbstractAreaSelectionWizard implements ICdmEntitySessionEnabled{
-
+public class AvailableAreaVocabulariesPage extends AbstractTermSelectionWizardPage implements ICdmEntitySessionEnabled{
+ CdmPreference pref;
+ String featureTitle;
/**
* @param pageName
*/
- public AvailableAreaVocabulariesPage(String pageName, boolean localPref) {
- super(pageName);
+ public AvailableAreaVocabulariesPage(String pageName, boolean localPref, CdmPreference pref, String featureTitle) {
+ super(pageName, TermType.NamedArea);
this.localPref = localPref;
+ this.pref = pref;
+ this.featureTitle = featureTitle;
}
*/
@Override
public void createControl(Composite parent) {
- IPreferenceStore preferenceStore = PreferencesUtil.getPreferenceStore();
- // String checkedValues = preferenceStore.getString(PreferencesUtil.DISTRIBUTION_VOCABULARIES);
-
- String vocString = PreferencesUtil.getPreferredVocabulariesForDistributionEditor(localPref);
- // String grayedValues = preferenceStore.getString(PreferencesUtil.DISTRIBUTION_AREA_OCCURENCE_STATUS_GRAYED);
- setTitle("Select vocabularies for Distribution Editor");
- setDescription("In order to be able to modify and see the distribution status of taxa,\n"
- + "you have to select the areas which you like to see.");
+ String vocString = null;
+ if (localPref){
+ vocString = PreferencesUtil.getPreferredVocabulariesForDistributionEditor(localPref);
+ }else if (pref != null){
+ vocString = pref.getValue();
+ }
+ setTitle("Select Vocabularies for "+ featureTitle);
+ setDescription("In order to be able to modify and see the "+ featureTitle +" of taxa,\n"
+ + "you have to select the vocabularies to select the areas from.");
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
setViewer(CheckboxTableViewer.newCheckList(composite, SWT.NULL));
((CheckboxTableViewer)getViewer()).getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-// viewer.setContentProvider(new TermContentProvider());
+
Styler styler = new Styler() {
@Override
public void applyStyles(TextStyle textStyle) {
}
});
rememberCheckedValues(vocString, null);
+ ((CheckboxTableViewer)getViewer()).setCheckedElements(listCheckedTerms.toArray());
setControl(composite);
}
*/
@Override
public ICdmEntitySession getCdmEntitySession() {
- // TODO Auto-generated method stub
return null;
}
*/
@Override
public <T extends CdmBase> Collection<T> getRootEntities() {
- // TODO Auto-generated method stub
return null;
}
*/
@Override
public Map<Object, List<String>> getPropertyPathsMap() {
- // TODO Auto-generated method stub
return null;
}
import org.eclipse.swt.widgets.Display;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
* @date 21.07.2014
*
*/
-public class AvailableDistributionPage extends AbstractAreaSelectionWizard implements ICdmEntitySessionEnabled {
+public class AvailableDistributionPage extends AbstractTermSelectionWizardPage implements ICdmEntitySessionEnabled {
/**
* @param pageName
*/
protected AvailableDistributionPage(String pageName) {
- super(pageName);
+ super(pageName, TermType.NamedArea);
this.localPref = true;
}
// TODO: write listener or toggle button to select all named areas
rememberCheckedValues(checkedValues, grayedValues);
- ((CheckboxTreeViewer)getViewer()).expandToLevel(2);
+ // ((CheckboxTreeViewer)getViewer()).expandToLevel(2);
setControl(composite);
}
}
-// /**
-// *
-// * @param path
-// */
-// private void checkParents(final TreePath path) {
-// if (path == null) {
-// return;
-// }
-// TermContentProvider tcp = new TermContentProvider();
-// Object treeElement = path.getLastSegment();
-//
-// if (treeElement != null) {
-// boolean allChecked = true;
-// boolean allUnchecked = true;
-// for (final Object fieldElement : tcp.getChildren(treeElement)) {
-// allChecked = allChecked && ((CheckboxTreeViewer)getViewer()).getChecked(fieldElement);
-// allUnchecked = allUnchecked && !((CheckboxTreeViewer)getViewer()).getChecked(fieldElement);
-// }
-// if (allUnchecked) {
-// ((CheckboxTreeViewer)getViewer()).setChecked(treeElement, false);
-// ((CheckboxTreeViewer)getViewer()).setGrayed(treeElement, false);
-// } else if (allChecked) {
-// ((CheckboxTreeViewer)getViewer()).setChecked(treeElement, true);
-// ((CheckboxTreeViewer)getViewer()).setGrayed(treeElement, false);
-// } else if (!allUnchecked && !allChecked) {
-// ((CheckboxTreeViewer)getViewer()).setChecked(treeElement, true);
-// ((CheckboxTreeViewer)getViewer()).setGrayed(treeElement, true);
-// }
-// }
-// checkParents(path.getParentPath());
-// }
-
-
/**
*
* @param path
--- /dev/null
+/**
+* Copyright (C) 2018 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.wizard;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.StyledString.Styler;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.TextStyle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.common.TermVocabulary;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermContentProvider;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermLabelProvider;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+
+/**
+ * @author k.luther
+ * @since 05.10.2018
+ *
+ */
+public class AvailableDistributionStatusPage extends AbstractTermSelectionWizardPage implements ICdmEntitySessionEnabled{
+
+ private ColumnViewer viewer;
+ private List<TermVocabulary<DefinedTermBase>> vocabularies = new ArrayList<>();
+ private CdmPreference pref;
+
+
+ public AvailableDistributionStatusPage(String pageName, CdmPreference pref) {
+ super(pageName, TermType.PresenceAbsenceTerm);
+ this.pref = pref;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void createControl(Composite parent) {
+
+ // String checkedValues = preferenceStore.getString(PreferencesUtil.DISTRIBUTION_VOCABULARIES);
+
+
+ // String grayedValues = preferenceStore.getString(PreferencesUtil.DISTRIBUTION_AREA_OCCURENCE_STATUS_GRAYED);
+ setTitle("Select Distribution Status");
+ setDescription("In order to be able to modify and see the distribution status of taxa,\n"
+ + "you have to select the status the user should be allowed to use.");
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayout(new GridLayout());
+ setViewer(new CheckboxTreeViewer(composite, SWT.NULL));
+ ((CheckboxTreeViewer)getViewer()).getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+// viewer.setContentProvider(new TermContentProvider());
+ Styler styler = new Styler() {
+ @Override
+ public void applyStyles(TextStyle textStyle) {
+ textStyle.foreground = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
+ }
+ };
+ getViewer().setContentProvider(new TermContentProvider());
+ getViewer().setLabelProvider(new TermLabelProvider(styler));
+ getViewer().setComparator(new ViewerComparator());
+ ((CheckboxTreeViewer)getViewer()).addCheckStateListener(new ICheckStateListener() {
+
+ private boolean ignoreCheckEvent = false;
+
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+
+
+ if (ignoreCheckEvent ) {
+ return;
+ }
+
+ ignoreCheckEvent = true;
+
+ try {
+
+
+ }
+ finally {
+ ignoreCheckEvent = false;
+ }
+
+ }
+ });
+ String checkedValues = null;
+ if (pref != null){
+ checkedValues = pref.getValue();
+ }
+ rememberCheckedValues(checkedValues, null);
+ ((CheckboxTreeViewer)getViewer()).setCheckedElements(listCheckedTerms.toArray());
+ ((CheckboxTreeViewer)getViewer()).expandToLevel(2);
+ setControl(composite);
+
+ }
+
+
+ @Override
+ public ColumnViewer getViewer() {
+ return viewer;
+ }
+
+ @Override
+ public void setViewer(ColumnViewer viewer) {
+ this.viewer = viewer;
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public <T extends CdmBase> Collection<T> getRootEntities() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2018 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.wizard;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @since 05.10.2018
+ *
+ */
+public class AvailableDistributionStatusWizard extends Wizard implements IConversationEnabled{
+ private ConversationHolder conversation;
+ private final AvailableDistributionStatusPage aPage;
+ CdmPreference pref;
+
+
+ public AvailableDistributionStatusWizard() {
+ setWindowTitle("Distribution Status Selection Wizard");
+ // TODO if preferenceStore has elements checked load elements in wizard
+ pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionStatus);
+ aPage = new AvailableDistributionStatusPage("AvailableDistributionStatusPage", pref);
+ }
+
+ @Override
+ public void addPages() {
+ addPage(aPage);
+ }
+
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IWizardPage getPage(String pageName) {
+
+ return aPage;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getPageCount() {
+ return 1;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IWizardPage[] getPages() {
+ IWizardPage[] pages = new IWizardPage[1];
+ pages [0] = aPage;
+ return pages;
+ }
+
+
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getWindowTitle() {
+
+ return "Distribution Status Selection Wizard";
+ }
+
+
+
+
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean performCancel() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean performFinish() {
+ Object[] checkedElements = ((CheckboxTreeViewer)aPage.getViewer()).getCheckedElements();
+
+ List<UUID> listUIIDChecked = new ArrayList<>();
+ List<DefinedTermBase> preferredTerms = new ArrayList<>();
+ for (Object o : checkedElements) {
+ if(o instanceof DefinedTermBase){
+ DefinedTermBase otb = (DefinedTermBase) o;
+ listUIIDChecked.add(otb.getUuid());
+ preferredTerms.add(otb);
+ }
+ }
+ String saveCheckedElements = StringUtils.join(listUIIDChecked, ";");
+ pref = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.AvailableDistributionStatus, saveCheckedElements);
+
+ PreferencesUtil.setPreferenceToDB(pref);
+ CdmStore.getTermManager().setPreferredTerms(preferredTerms, aPage.getVocabularies().get(0).getTerms());
+ return true;
+ }
+
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ if (conversation == null) {
+ conversation = CdmStore.createConversation();
+ }
+ return conversation;
+ }
+
+}
String saveGrayedElements = StringUtils.join(listUIIDGrayed, ";");
IPreferenceStore preferenceStore = PreferencesUtil.getPreferenceStore();
//ToDo, if whole vocabulary is selected, save the vocabulary not all areas
+
PreferencesUtil.setPreferredNamedAreasForDistributionEditor(saveCheckedElements, saveGrayedElements, false);
preferenceStore.setValue(PreferencesUtil.DISTRIBUTION_AREA_OCCURENCE_STATUS, saveCheckedElements);
preferenceStore.setValue(PreferencesUtil.DISTRIBUTION_AREA_OCCURENCE_STATUS_GRAYED, saveGrayedElements);
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.common.TermVocabulary;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
private ConversationHolder conversation;
private final AvailableAreaVocabulariesPage aPage;
private boolean localPref = true;
+ private CdmPreference pref;
- public AvailableVocabularyWizard(boolean localPref) {
+ public AvailableVocabularyWizard(boolean localPref, CdmPreference pref, String featureTitle) {
setWindowTitle("Vocabulary Selection Wizard");
// TODO if preferenceStore has elements checked load elements in wizard
this.localPref = localPref;
- aPage = new AvailableAreaVocabulariesPage("AvailableDistributionPage", localPref);
+ this.pref = pref;
+ aPage = new AvailableAreaVocabulariesPage("AvailableDistributionPage", localPref, pref, featureTitle);
}
@Override
}
}
String saveCheckedElements = StringUtils.join(listUIIDChecked, ";");
- // IPreferenceStore preferenceStore = PreferencesUtil.getPreferenceStore();
- PreferencesUtil.setPreferredVocabulariesForDistributionEditor(saveCheckedElements, localPref);
- // preferenceStore.setValue(PreferencesUtil.DISTRIBUTION_VOCABULARIES, saveCheckedElements);
+ //
+ CdmPreference savePref = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.getByKey(pref.getPredicate()), saveCheckedElements);
+ PreferencesUtil.setPreferenceToDB(savePref);
+
+ PreferencesUtil.updateDBPreferences();
return true;
}
--- /dev/null
+/**
+* Copyright (C) 2018 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.ui.dialog.selection;
+
+import java.util.UUID;
+
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ * @author k.luther
+ * @since 09.10.2018
+ *
+ */
+public class CommonNameNamedAreaSelectionDialog extends NamedAreaSelectionDialog {
+
+ /**
+ * @param shell
+ * @param title
+ * @param multi
+ * @param namedArea
+ * @param preferenceId
+ * @param preselectedVocabularyUuids
+ */
+ protected CommonNameNamedAreaSelectionDialog(Shell shell, String title, boolean multi, NamedArea namedArea,
+ Object preferenceId) {
+ super(shell, title, multi, namedArea, preferenceId, createVocabularyUuidList());
+
+
+ }
+
+ private static UUID[] createVocabularyUuidList() {
+ String preselectedVocString = PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.COMMON_NAME_AREA_VOCABULARIES);
+ String[] preselectedVocArray = preselectedVocString.split(";");
+ UUID[] uuidList = new UUID[preselectedVocArray.length];
+ int i = 0;
+ for (String uuidString: preselectedVocArray){
+ uuidList[i]= UUID.fromString(uuidString);
+ i++;
+ }
+ return uuidList;
+ }
+
+ /**
+ * Creates a filtered selection dialog to select a named area.
+ *
+ * @param shell
+ * The shell for displaying this widget
+ * @param namedArea
+ * A namedArea that should be selected when the dialog opens
+ * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ * @param preferenceId a class which is used for generating the preference key so that every
+ * dialogs can be grouped to have their own preferences depending on this id
+ * @param preselectedVocabularyUuids the {@link UUID}s of the pre-selected vocabularies
+ * @return a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
+ */
+ public static NamedArea select(Shell shell, //ConversationHolder conversation,
+ NamedArea namedArea, String preferenceId) {
+ CommonNameNamedAreaSelectionDialog dialog = new CommonNameNamedAreaSelectionDialog(shell, //conversation,
+ "Choose an area", false, namedArea, preferenceId);
+ return getSelectionFromDialog(dialog);
+ }
+}
// search;//re-init to consider pre-selected vocabularies
}
- private List<TermVocabulary> createSelectedVocabularies() {
+ protected List<TermVocabulary> createSelectedVocabularies() {
List<TermVocabulary> tempSelectedVocabularies = new ArrayList<TermVocabulary>();
for(TermVocabulary vocabulary:selectedVocabularies){
if(preselectedVocabularies.contains(vocabulary)
import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberElement;
import eu.etaxonomy.taxeditor.ui.section.description.CommonNameSourceElement;
+import eu.etaxonomy.taxeditor.ui.section.description.detail.CommonNameDetailElement;
import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement;
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
return (T) NamedAreaSelectionDialog.select(shell, //conversation,
(NamedArea) currentSelection, DerivedUnit.class.getCanonicalName(), Country.uuidCountryVocabulary);
}
+ else if(parentElement instanceof CommonNameDetailElement ){
+ return (T) CommonNameNamedAreaSelectionDialog.select(shell, //conversation,
+ (NamedArea) currentSelection, DerivedUnit.class.getCanonicalName());
+ }
else{
return (T) NamedAreaSelectionDialog.select(shell, //conversation,
(NamedArea) currentSelection, parentElement.getClass().getCanonicalName());