ref #8111: fix selection of user
authorKatja Luther <k.luther@bgbm.org>
Thu, 4 Apr 2019 08:53:55 +0000 (10:53 +0200)
committerKatja Luther <k.luther@bgbm.org>
Thu, 4 Apr 2019 08:53:55 +0000 (10:53 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java

index d87c1ad1e6c0ecfcdb65860acbb2d6cdd4cff558..c8d9eba8ca668b064b7fdc4c76897294663a502f 100644 (file)
@@ -48,9 +48,13 @@ import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
 import eu.etaxonomy.taxeditor.ui.section.agent.TeamMemberElement;
 import eu.etaxonomy.taxeditor.ui.section.description.CommonNameSourceElement;
 import eu.etaxonomy.taxeditor.ui.section.description.detail.CommonNameDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.name.AuthorshipDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
 
 /**
  * @author n.hoffmann
@@ -174,9 +178,10 @@ public class SelectionDialogFactory {
                        return (T) CollectionSelectionDialog.select(shell, //conversation,
                                (Collection) currentSelection);
                }
-               if(clazz.equals(User.class)){
+               if(clazz.equals(User.class) && parentElement instanceof MemberDetailElement){
+                   MemberDetailSection section = (MemberDetailSection)((MemberDetailElement)parentElement).getParentElement();
                        return (T) UserSelectionDialog.select(shell, //conversation,
-                               (User) currentSelection, null);
+                               (User) currentSelection, section.getEntity());
                }
                if(clazz.equals(GrantedAuthorityImpl.class)){
                        return (T) GrantedAuthoritySelectionDialog.select(shell, //conversation,
@@ -186,9 +191,10 @@ public class SelectionDialogFactory {
                        return (T) PersonSelectionDialog.select(shell, //conversation,
                                (Person) currentSelection);
                }
-               if(clazz.equals(Group.class)){
+               if(clazz.equals(Group.class) &&  parentElement instanceof GroupsByUserDetailElement){
+                   GroupsByUserDetailSection section =(GroupsByUserDetailSection)((GroupsByUserDetailElement)parentElement).getParentElement();
                        return (T) GroupSelectionDialog.select(shell, //conversation,
-                               (Group) currentSelection, null);
+                               (Group) currentSelection, section.getEntity());
                }
                if(clazz.equals(Institution.class)){
                        return (T) InstitutionSelectionDialog.select(shell, //conversation,