id="eu.etaxonomy.taxeditor.preferences.languages"
name="%page.name.10">
</page>
+ <page
+ category="eu.etaxonomy.taxeditor.preference.EmptyLanguagePage"
+ class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.CommonNameLanguageAdminPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.commonnameAdminlanguages"
+ name="%page.name.58">
+ </page>
<page
category="eu.etaxonomy.taxeditor.preferences.description"
class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.NameFeatureAdminMenuPreference"
<page
category="eu.etaxonomy.taxeditor.preferences.description"
class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.CommonNameVocabularyAdminPreferencePage"
- id="eu.etaxonomy.taxeditor.store.vocabularyAdminPreference"
+ id="eu.etaxonomy.taxeditor.store.commonNameAdminPreference"
name="%page.name.47">
</page>
- <page
+ <page
category="eu.etaxonomy.taxeditor.preferences.general"
class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.SpecimenAdminPreferences"
id="eu.etaxonomy.taxeditor.store.specimenAdminPreferences"
--- /dev/null
+/**
+* Copyright (C) 2021 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 java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.lang3.StringUtils;
+
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.taxeditor.preference.LocalOrDefaultEnum;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.preference.menu.CommonNameLanguagePreferences;
+
+/**
+ * @author k.luther
+ * @since Aug 27, 2021
+ */
+public class CommonNameLanguageAdminPreferences extends CommonNameLanguagePreferences {
+
+ public CommonNameLanguageAdminPreferences(){
+ super();
+ isAdminPreference = true;
+ }
+
+ @Override
+ public boolean performOk() {
+ if (!isApply()){
+ return true;
+ }
+
+ Object[] checkedElements = treeComposite.getViewer().getCheckedElements();
+
+ List<UUID> listUIIDChecked = new ArrayList<>();
+
+ for (Object o : checkedElements) {
+ if(o instanceof TermDto){
+ TermDto termDto = (TermDto) o;
+ listUIIDChecked.add(termDto.getUuid());
+
+ }
+ }
+ String saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
+ if (pref == null){
+ saveCheckedElements = null;
+ }
+ CdmPreference savePref = CdmPreference.NewTaxEditorInstance(predicate, saveCheckedElements);
+ String text = this.useLocalOrAdmin.getText();
+ if (text.equals(LocalOrDefaultEnum.Database.getLabel()) ){
+ savePref.setAllowOverride(false);
+ }else if (text.equals(LocalOrDefaultEnum.AllowOverride.getLabel())){
+ savePref.setAllowOverride(true);
+ }
+
+ PreferencesUtil.setPreferenceToDB(savePref);
+ PreferencesUtil.updateDBPreferences();
+ PreferencesUtil.firePreferencesChanged(this.getClass());
+ return true;
+
+ }
+
+}