ref #8489: code cleaning
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / preference / menu / NameFeatureMenuPreference.java
1 /**
2 * Copyright (C) 2019 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9 package eu.etaxonomy.taxeditor.preference.menu;
10
11 import java.util.ArrayList;
12 import java.util.List;
13
14 import eu.etaxonomy.cdm.api.service.IVocabularyService;
15 import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
16 import eu.etaxonomy.cdm.model.term.TermType;
17 import eu.etaxonomy.cdm.model.term.VocabularyEnum;
18 import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
19 import eu.etaxonomy.taxeditor.preference.GeneralTermPreference;
20 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
21 import eu.etaxonomy.taxeditor.store.CdmStore;
22
23 /**
24 * @author k.luther
25 * @since 14.05.2019
26 *
27 */
28 public class NameFeatureMenuPreference extends GeneralTermPreference {
29 /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.feat"{trunked}</code> */
30 public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.preferences.nameFeature"; //$NON-NLS-1$
31
32 /**
33 * <p>Constructor for NameFeatureMenuPreference.</p>
34 */
35 public NameFeatureMenuPreference() {
36 super();
37 setPredicate(PreferencePredicate.NameFeatures);
38 type = TermType.Feature;
39 }
40
41
42
43 @Override
44 public boolean performOk(){
45 if (isApply()){
46 boolean result = super.performOk();
47 if (result){
48 PreferencesUtil.createPreferredFeatureTreeForNameDescription();
49 }
50 }
51 return true;
52
53 }
54
55 @Override
56 protected void initialiseVocabularies() {
57
58 if (getVocabularies() != null) {
59 getVocabularies().clear();
60 }
61 List<TermVocabularyDto> vocs = new ArrayList<>();
62 vocs.add(CdmStore.getService(IVocabularyService.class).findVocabularyDtoByVocabularyUuid(VocabularyEnum.NameFeature.getUuid()));
63
64 setVocabularies(vocs);
65 }
66
67
68
69 }