/**\r
* @author n.hoffmann\r
* @date Jan 25, 2012\r
- *\r
*/\r
public class SelectionDialogFactory {\r
\r
- public static <T extends ICdmBase> T getSelectionFromDialog(Class<T> clazz, Shell shell, //ConversationHolder conversation,\r
+ public static <T extends ICdmBase> T getSelectionFromDialog(Class<T> clazz, Shell shell,\r
T currentSelection){\r
return getSelectionFromDialog(clazz, shell, //conversation,\r
currentSelection, null);\r
}\r
\r
- public static <T extends ICdmBase> T getSelectionFromDialog(Class<T> clazz, Shell shell, //ConversationHolder conversation,\r
+ public static <T extends ICdmBase> T getSelectionFromDialog(Class<T> clazz, Shell shell,\r
T currentSelection, ICdmFormElement parentElement){\r
\r
if(clazz.equals(Taxon.class)){\r
- return (T) TaxonSelectionDialog.selectTaxon(shell, //conversation,\r
+ return (T) TaxonSelectionDialog.selectTaxon(shell,\r
(Taxon) currentSelection);\r
}\r
if(clazz.equals(Synonym.class)){\r
- return (T) TaxonBaseSelectionDialog.selectSynonym(shell );//,conversation);\r
+ return (T) TaxonBaseSelectionDialog.selectSynonym(shell );\r
}\r
if(clazz.equals(TaxonBase.class)){\r
- return (T) TaxonBaseSelectionDialog.selectTaxonBase(shell);//, conversation);\r
+ return (T) TaxonBaseSelectionDialog.selectTaxonBase(shell);\r
}\r
if(clazz.equals(Classification.class)){\r
- return (T) ClassificationSelectionDialog.select(shell, //conversation,\r
+ return (T) ClassificationSelectionDialog.select(shell,\r
(Classification) currentSelection);\r
}\r
if(clazz.equals(TaxonNode.class)){\r
- return (T) TaxonNodeSelectionDialog.select(shell, //conversation,\r
+ return (T) TaxonNodeSelectionDialog.select(shell,\r
null, null, (TaxonNode) currentSelection, ((TaxonNode) currentSelection).getClassification().getUuid());\r
}\r
if(clazz.equals(Reference.class) && parentElement != null && parentElement.getParentElement() instanceof NomenclaturalReferenceDetailElement){\r
- return (T) NomenclaturalReferenceSelectionDialog.select(shell, //conversation,\r
+ return (T) NomenclaturalReferenceSelectionDialog.select(shell,\r
(Reference) currentSelection, ((NomenclaturalReferenceDetailElement)parentElement.getParentElement()).getEntity().getCombinationAuthorship());\r
}\r
if(clazz.equals(Reference.class) && parentElement instanceof CommonNameSourceElement && PreferencesUtil.getFilterCommonNameReferences()){\r
- return (T) CommonNameReferenceSelectionDialog.select(shell, //conversation,\r
+ return (T) CommonNameReferenceSelectionDialog.select(shell,\r
(Reference) currentSelection);\r
}\r
if(clazz.equals(Reference.class)){\r
if (parentElement instanceof ReferenceDetailElement){\r
- return (T) ReferenceSelectionDialog.select(shell, //conversation,\r
+ return (T) ReferenceSelectionDialog.select(shell,\r
((ReferenceDetailElement) parentElement).getEntity(), true);\r
}\r
- return (T) ReferenceSelectionDialog.select(shell, //conversation,\r
+ return (T) ReferenceSelectionDialog.select(shell,\r
(Reference) currentSelection);\r
}\r
\r
if(clazz.equals(TaxonName.class)){\r
- return (T) NameSelectionDialog.select(shell, //conversation,\r
+ return (T) NameSelectionDialog.select(shell,\r
(TaxonName) currentSelection);\r
}\r
if(clazz.equals(Team.class)){\r
- return (T) TeamSelectionDialog.select(shell, //conversation,\r
+ return (T) TeamSelectionDialog.select(shell,\r
(Team) currentSelection);\r
}\r
if(clazz.equals(TeamOrPersonBase.class) && parentElement instanceof AuthorshipDetailElement){\r
- return (T) NomenclaturalAuthorSelectionDialog.select(shell, //conversation,\r
+ return (T) NomenclaturalAuthorSelectionDialog.select(shell,\r
(TeamOrPersonBase) currentSelection, false);\r
}else if(clazz.equals(AgentBase.class) && parentElement instanceof FieldUnitFacadeGeneralDetailElement){\r
- return (T) CollectorSelectionDialog.select(shell, //conversation,\r
+ return (T) CollectorSelectionDialog.select(shell,\r
(TeamOrPersonBase) currentSelection, false);\r
}else if(clazz.equals(TeamOrPersonBase.class)){\r
//TODO: add TeamOrPersonBaseSelectionDialog (see ticket #4545)\r
- return (T) TeamOrPersonBaseSelectionDialog.select(shell, //conversation,\r
+ return (T) TeamOrPersonBaseSelectionDialog.select(shell,\r
(TeamOrPersonBase) currentSelection, false);\r
}\r
if(clazz.equals(Person.class) && parentElement instanceof TeamMemberElement){\r
- return (T) NomenclaturalPersonAuthorSelectionDialog.select(shell, //conversation,\r
+ return (T) NomenclaturalPersonAuthorSelectionDialog.select(shell,\r
(TeamOrPersonBase) currentSelection, true);\r
}\r
if(clazz.equals(AgentBase.class)){\r
- return (T) AgentSelectionDialog.select(shell, //conversation,\r
+ return (T) AgentSelectionDialog.select(shell,\r
(AgentBase) currentSelection, false);\r
}\r
if(clazz.equals(Feature.class)){\r
- return (T) FeatureSelectionDialog.select(shell, //conversation,\r
+ return (T) FeatureSelectionDialog.select(shell,\r
(Feature) currentSelection);\r
}\r
if(clazz.equals(TermTree.class)){\r
- return (T) FeatureTreeSelectionDialog.select(shell, //conversation,\r
+ return (T) FeatureTreeSelectionDialog.select(shell,\r
(TermTree) currentSelection);\r
}\r
if(clazz.equals(PolytomousKey.class)){\r
- return (T) PolytomousKeySelectionDialog.select(shell, //conversation,\r
+ return (T) PolytomousKeySelectionDialog.select(shell,\r
(PolytomousKey) currentSelection);\r
}\r
if(clazz.equals(PolytomousKeyNode.class)){\r
return null;\r
}\r
if(clazz.equals(DerivedUnit.class)){\r
- return (T) DerivedUnitSelectionDialog.select(shell, //conversation,\r
+ return (T) DerivedUnitSelectionDialog.select(shell,\r
(DerivedUnit) currentSelection);\r
}\r
if(clazz.equals(FieldUnit.class)){\r
- return (T) FieldUnitSelectionDialog.select(shell, //conversation,\r
+ return (T) FieldUnitSelectionDialog.select(shell,\r
(FieldUnit) currentSelection);\r
}\r
if(clazz.equals(SpecimenOrObservationBase.class)){\r
- return (T) SpecimenOrObservationBaseSelectionDialog.select(shell, //conversation,\r
+ return (T) SpecimenOrObservationBaseSelectionDialog.select(shell,\r
(SpecimenOrObservationBase) currentSelection);\r
}\r
if(clazz.equals(NamedArea.class)){\r
if(parentElement instanceof IEntityElement && ((IEntityElement) parentElement).getEntity() instanceof DerivedUnitFacade){\r
- return (T) NamedAreaSelectionDialog.select(shell, //conversation,\r
+ return (T) NamedAreaSelectionDialog.select(shell,\r
(NamedArea) currentSelection, DerivedUnit.class.getCanonicalName(), Country.uuidCountryVocabulary);\r
}\r
else if(parentElement instanceof CommonNameDetailElement ){\r
- return (T) CommonNameNamedAreaSelectionDialog.select(shell, //conversation,\r
+ return (T) CommonNameNamedAreaSelectionDialog.select(shell,\r
(NamedArea) currentSelection, parentElement.getClass().getCanonicalName());\r
}\r
else{\r
+ List<UUID> uuidList = PreferencesUtil.createUUIDListFromStringPref(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey(), false);\r
+ UUID[] uuidArray = null;\r
+ if (uuidList != null){\r
+ uuidArray = new UUID[uuidList.size()];\r
+ uuidList.toArray(uuidArray);\r
\r
- List<UUID> uuidList = PreferencesUtil.createUUIDListFromStringPref(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey(), false);\r
- UUID[] uuidArray = null;\r
- if (uuidList != null){\r
- uuidArray = new UUID[uuidList.size()];\r
- uuidList.toArray(uuidArray);\r
-\r
- }\r
- return (T)NamedAreaSelectionDialog.select(shell, (NamedArea) currentSelection, null, uuidArray);\r
-\r
+ }\r
+ return (T)NamedAreaSelectionDialog.select(shell, (NamedArea) currentSelection, null, uuidArray);\r
}\r
}\r
if(clazz.equals(Collection.class)){\r
- return (T) CollectionSelectionDialog.select(shell, //conversation,\r
+ return (T) CollectionSelectionDialog.select(shell,\r
(Collection) currentSelection);\r
}\r
if(clazz.equals(User.class) && parentElement instanceof MemberDetailElement){\r
MemberDetailSection section = (MemberDetailSection)((MemberDetailElement)parentElement).getParentElement();\r
- return (T) UserSelectionDialog.select(shell, //conversation,\r
+ return (T) UserSelectionDialog.select(shell,\r
(User) currentSelection, section.getEntity());\r
}\r
if(clazz.equals(GrantedAuthorityImpl.class)){\r
- return (T) GrantedAuthoritySelectionDialog.select(shell, //conversation,\r
+ return (T) GrantedAuthoritySelectionDialog.select(shell,\r
(GrantedAuthorityImpl) currentSelection);\r
}\r
if (clazz.equals(Person.class)){\r
- return (T) PersonSelectionDialog.select(shell, //conversation,\r
+ return (T) PersonSelectionDialog.select(shell,\r
(Person) currentSelection);\r
}\r
if(clazz.equals(Group.class) && parentElement instanceof GroupsByUserDetailElement){\r
GroupsByUserDetailSection section =(GroupsByUserDetailSection)((GroupsByUserDetailElement)parentElement).getParentElement();\r
- return (T) GroupSelectionDialog.select(shell, //conversation,\r
+ return (T) GroupSelectionDialog.select(shell,\r
(Group) currentSelection, section.getEntity());\r
}\r
if(clazz.equals(Institution.class)){\r
- return (T) InstitutionSelectionDialog.select(shell, //conversation,\r
+ return (T) InstitutionSelectionDialog.select(shell,\r
(Institution) currentSelection);\r
}\r
if(clazz.equals(Primer.class)){\r
- return (T) PrimerSelectionDialog.select(shell, //conversation,\r
+ return (T) PrimerSelectionDialog.select(shell,\r
(Primer) currentSelection);\r
}\r
if(clazz.equals(Amplification.class)){\r
- return (T) AmplificationSelectionDialog.select(shell, //conversation,\r
+ return (T) AmplificationSelectionDialog.select(shell,\r
(Amplification) currentSelection);\r
}\r
if(clazz.equals(Media.class)){\r
- return (T) MediaSelectionDialog.select(shell, //conversation,\r
+ return (T) MediaSelectionDialog.select(shell,\r
(Media) currentSelection);\r
}\r
if(clazz.equals(Rights.class)){\r
- return (T) RightsSelectionDialog.select(shell, //conversation,\r
+ return (T) RightsSelectionDialog.select(shell,\r
(Rights) currentSelection);\r
}\r
\r
return null;\r
}\r
\r
- public static <T extends ICdmBase> T getSelectionFromExtDialog(Class<T> clazz, Shell shell, //ConversationHolder conversation,\r
+ public static <T extends ICdmBase> T getSelectionFromExtDialog(Class<T> clazz, Shell shell,\r
ICdmFormElement parentElement){\r
- return (T) ExtReferenceSelectionDialog.select(shell, //conversation,\r
+ return (T) ExtReferenceSelectionDialog.select(shell,\r
null);\r
}\r
-\r
-\r
-}\r
+}
\ No newline at end of file