import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- * <p>FilteredNamedAreaSelectionDialog class.</p>
- *
* @author n.hoffmann
* @created May 11, 2010
* @version 1.0
}
private Collection<TermVocabulary<NamedArea>> selectedVocabularies;
- private final ArrayList<TermVocabulary> preselectedVocabularies;
+ private ArrayList<TermVocabulary> preselectedVocabularies;
/**
return getSelectionFromDialog(dialog);
}
- /**
- * <p>Constructor for FilteredNamedAreaSelectionDialog.</p>
- *
- * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
- * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- * @param title a {@link java.lang.String} object.
- * @param multi a boolean.
- * @param namedArea a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
- * @param preselectedVocabularyUuids the {@link UUID}s of the pre-selected Vocabularies
- */
protected NamedAreaSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, NamedArea namedArea, UUID... preselectedVocabularyUuids) {
super(shell, conversation, title, multi, NamedAreaSelectionDialog.class.getCanonicalName(), namedArea);
- preselectedVocabularies = new ArrayList<TermVocabulary>();
- for(int i=0;i<preselectedVocabularyUuids.length;i++){
- TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
- preselectedVocabularies.add(preselectedVocabulary);
+ if(preselectedVocabularyUuids.length>0){
+ preselectedVocabularies = new ArrayList<TermVocabulary>();
+ for(int i=0;i<preselectedVocabularyUuids.length;i++){
+ TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
+ preselectedVocabularies.add(preselectedVocabulary);
+ }
+ selectedVocabularies.retainAll(preselectedVocabularies);
+ initModel();//re-init to consider pre-selected vocabularies
}
- selectedVocabularies.retainAll(preselectedVocabularies);
- initModel();//re-init to consider pre-selected vocabularies
}
/** {@inheritDoc} */
for(TermVocabulary<NamedArea> vocabulary : getAvailableVocabularies()){
IncludeNamedAreaVocabulary action = new IncludeNamedAreaVocabulary(vocabulary);
menuManager.add(action);
- if(preselectedVocabularies.isEmpty() || preselectedVocabularies.contains(vocabulary)) {
+ if(preselectedVocabularies==null || preselectedVocabularies.isEmpty() || preselectedVocabularies.contains(vocabulary)) {
action.setChecked(true);
}
}