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
|
setLocalPref(true);
|
38
|
setPredicate(PreferencePredicate.NameFeatures);
|
39
|
type = TermType.Feature;
|
40
|
}
|
41
|
|
42
|
@Override
|
43
|
protected List<TermVocabularyDto> getVocabulariesFromPreference() {
|
44
|
// TODO Auto-generated method stub
|
45
|
return null;
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
public boolean performOk(){
|
50
|
boolean result = super.performOk();
|
51
|
if (result){
|
52
|
PreferencesUtil.createPreferredFeatureTreeForNameDescription();
|
53
|
}
|
54
|
return true;
|
55
|
|
56
|
}
|
57
|
|
58
|
@Override
|
59
|
protected void initialiseVocabularies() {
|
60
|
|
61
|
if (getVocabularies() != null) {
|
62
|
getVocabularies().clear();
|
63
|
}
|
64
|
List<TermVocabularyDto> vocs = new ArrayList<>();
|
65
|
vocs.add(CdmStore.getService(IVocabularyService.class).findVocabularyDtoByVocabularyUuid(VocabularyEnum.NameFeature.getUuid()));
|
66
|
|
67
|
setVocabularies(vocs);
|
68
|
}
|
69
|
|
70
|
|
71
|
|
72
|
}
|