Revision 62306db3
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/CommonNameNamedAreaSelectionDialog.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.ui.dialog.selection; |
10 | 10 |
|
11 |
import java.util.ArrayList; |
|
12 |
import java.util.List; |
|
11 | 13 |
import java.util.UUID; |
12 | 14 |
|
15 |
import org.apache.commons.lang.StringUtils; |
|
13 | 16 |
import org.eclipse.swt.widgets.Shell; |
14 | 17 |
|
18 |
import eu.etaxonomy.cdm.api.service.IVocabularyService; |
|
19 |
import eu.etaxonomy.cdm.model.common.TermType; |
|
20 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
|
15 | 21 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
16 | 22 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
17 | 23 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
24 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
18 | 25 |
|
19 | 26 |
/** |
20 | 27 |
* @author k.luther |
... | ... | |
40 | 47 |
|
41 | 48 |
private static UUID[] createVocabularyUuidList() { |
42 | 49 |
String preselectedVocString = PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.COMMON_NAME_AREA_VOCABULARIES); |
50 |
if (StringUtils.isBlank(preselectedVocString)){ |
|
51 |
return null; |
|
52 |
} |
|
43 | 53 |
String[] preselectedVocArray = preselectedVocString.split(";"); |
44 | 54 |
UUID[] uuidList = new UUID[preselectedVocArray.length]; |
45 | 55 |
int i = 0; |
... | ... | |
49 | 59 |
} |
50 | 60 |
return uuidList; |
51 | 61 |
} |
62 |
@Override |
|
63 |
protected void init() { |
|
64 |
vocabularies = getAvailableVocabularies(); |
|
65 |
} |
|
66 |
|
|
67 |
|
|
68 |
protected List<TermVocabulary> getAvailableVocabularies(){ |
|
69 |
List<TermVocabulary> vocabularies = new ArrayList(); |
|
70 |
|
|
71 |
if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.COMMON_NAME_AREA_VOCABULARIES_ALLOW_OVERRIDE)){ |
|
72 |
UUID[] preselectedVocabularyUuids = createVocabularyUuidList(); |
|
73 |
|
|
74 |
for(int i=0;i<preselectedVocabularyUuids.length;i++){ |
|
75 |
TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]); |
|
76 |
vocabularies.add(preselectedVocabulary); |
|
77 |
} |
|
78 |
}else{ |
|
79 |
vocabularies = CdmStore.getService(IVocabularyService.class).listByTermType(TermType.NamedArea, true, null, null, null, null); |
|
80 |
} |
|
81 |
return vocabularies; |
|
82 |
} |
|
52 | 83 |
|
53 | 84 |
/** |
54 | 85 |
* Creates a filtered selection dialog to select a named area. |
Also available in: Unified diff
ref #7793: fix named area and commonNameArea selection filter