- implemented functionality to reuse media in MediaView (#2385)
authorPatric Plitzner <p.plitzner@bgbm.org>
Mon, 1 Sep 2014 08:49:28 +0000 (08:49 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Mon, 1 Sep 2014 08:49:28 +0000 (08:49 +0000)
.gitattributes
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddExistingMediaHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/CreateMediaHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/AddExistingMediaToImageGalleryOperation.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/AddMediaToImageGalleryOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AmplificationSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/MediaSelectionDialog.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/PrimerSelectionDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java

index 5cfc4161ec0aec9b0c6a464d4cdb9e8c62c1bd27..d1a4e8f89ccf26cfc561ee3e98ccd929650ea237 100644 (file)
@@ -560,11 +560,13 @@ eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/d
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaContentProvider.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaLabelProvider.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddExistingMediaHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddImageGalleryHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/CreateMediaHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/DeleteMediaHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageDownInListHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageUpInListHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/AddExistingMediaToImageGalleryOperation.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/AddMediaToImageGalleryOperation.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/CreateImageOperation.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/DeleteMediaOperation.java -text
@@ -1383,6 +1385,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/sele
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/GrantedAuthoritySelectionDialog.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/GroupSelectionDialog.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/InstitutionSelectionDialog.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/MediaSelectionDialog.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NameSelectionDialog.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NamedAreaSelectionDialog.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorTeamSelectionDialog.java -text
index 63f730a7e5648d3a75a74583f94752b6b10d4c3d..38a6a28bd610f62294a13e53790d6ced5c30b453 100644 (file)
                </reference>
             </visibleWhen>
          </command>
+         <command
+               commandId="taxeditor-editor.useExistingImage"
+               label="Use Existing Image"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="isImageGallery">
+               </reference>
+            </visibleWhen>
+         </command>
          <command
                commandId="taxeditor-editor.command.moveimgdown"
                label="%command.label.39"
             id="taxeditor-editor.newimage"
             name="%command.name.21">
       </command>
+      <command
+            categoryId="eu.etaxonomy.taxeditor.editor.media.category"
+            defaultHandler="eu.etaxonomy.taxeditor.editor.view.media.handler.AddExistingMediaHandler"
+            id="taxeditor-editor.useExistingImage"
+            name="Use Existing Image">
+      </command>
       <command
             categoryId="eu.etaxonomy.taxeditor.editor.media.category"
             defaultHandler="eu.etaxonomy.taxeditor.editor.view.media.handler.MoveImageUpInListHandler"
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddExistingMediaHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddExistingMediaHandler.java
new file mode 100644 (file)
index 0000000..67910e1
--- /dev/null
@@ -0,0 +1,40 @@
+package eu.etaxonomy.taxeditor.editor.view.media.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.common.NotDefinedException;
+
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.media.operation.AddExistingMediaToImageGalleryOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.MediaSelectionDialog;
+
+public class AddExistingMediaHandler extends CreateMediaHandler {
+
+    /**
+     * @param event
+     * @param postOperationEnabled
+     * @param description
+     */
+    @Override
+    protected void executeOperation(ExecutionEvent event, IPostOperationEnabled postOperationEnabled,
+            DescriptionBase description) {
+        AbstractPostOperation operation = null;
+        try {
+
+            //select media
+            Media media = MediaSelectionDialog.select(AbstractUtility.getShell(), null, null);
+            // TODO use undo context specific to editor
+            operation = new AddExistingMediaToImageGalleryOperation(media, event.getCommand().getName(),
+                    EditorUtil.getUndoContext(), description, postOperationEnabled);
+            AbstractUtility.executeOperation(operation);
+        } catch (NotDefinedException e) {
+            MessagingUtils.warn(getClass(), "Command name not set.");
+        }
+    }
+
+}
index b2aeebf4d07ee6ae24f45116104f9b83ca95c771..0bd72b3f1fc6b732b46d0db00bf661e3d95d0bb5 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package eu.etaxonomy.taxeditor.editor.view.media.handler;
 
@@ -18,6 +18,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.view.media.operation.AddMediaToImageGalleryOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
@@ -34,24 +35,25 @@ public class CreateMediaHandler extends AbstractHandler {
         * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
         */
        /** {@inheritDoc} */
-       public Object execute(ExecutionEvent event) throws ExecutionException {
+       @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
                IWorkbenchPart part = HandlerUtil.getActivePart(event);
                IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
-               
-               
+
+
                DescriptionBase description = null;
-               
+
                IEditorPart editor = HandlerUtil.getActiveEditor(event);
                if (editor instanceof FormEditor) {
                        editor = ((FormEditor) editor).getActiveEditor();
                }
-               
+
                ISelection selection = HandlerUtil.getCurrentSelection(event);
                if (selection instanceof TreeSelection) {
                        TreePath[] paths = ((TreeSelection) selection).getPaths();
-                       
+
                        int count = paths[0].getSegmentCount();
-                       
+
                        for (int i = 0; i < count; i++ ) {
                                if (paths[0].getSegment(i) instanceof DescriptionBase) {
                                        description = (DescriptionBase) paths[0].getSegment(i);
@@ -59,20 +61,30 @@ public class CreateMediaHandler extends AbstractHandler {
                                }
                        }
                }
-               
+
                if(description != null){
-                       AbstractPostOperation operation = null;
-                       try {
-                               // TODO use undo context specific to editor
-                               operation = new AddMediaToImageGalleryOperation(event.getCommand().getName(), 
-                                               EditorUtil.getUndoContext(), description, postOperationEnabled);
-                               EditorUtil.executeOperation(operation);
-                       } catch (NotDefinedException e) {
-                               MessagingUtils.warn(getClass(), "Command name not set.");
-                       }
+                       executeOperation(event, postOperationEnabled, description);
                }
-               
+
                return null;
        }
 
+    /**
+     * @param event
+     * @param postOperationEnabled
+     * @param description
+     */
+    protected void executeOperation(ExecutionEvent event, IPostOperationEnabled postOperationEnabled,
+            DescriptionBase description) {
+        AbstractPostOperation operation = null;
+        try {
+               // TODO use undo context specific to editor
+               operation = new AddMediaToImageGalleryOperation(event.getCommand().getName(),
+                               EditorUtil.getUndoContext(), description, postOperationEnabled);
+               AbstractUtility.executeOperation(operation);
+        } catch (NotDefinedException e) {
+               MessagingUtils.warn(getClass(), "Command name not set.");
+        }
+    }
+
 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/AddExistingMediaToImageGalleryOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/AddExistingMediaToImageGalleryOperation.java
new file mode 100644 (file)
index 0000000..473bc15
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.view.media.operation;
+
+import org.eclipse.core.commands.operations.IUndoContext;
+
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+
+/**
+ *
+ * This operation adds an already existing  {@link Media} to the currently selected {@link DescriptionBase}.
+ * @author pplitzner
+ * @date 01.09.2014
+ *
+ */
+public class AddExistingMediaToImageGalleryOperation extends AddMediaToImageGalleryOperation {
+
+       public AddExistingMediaToImageGalleryOperation(Media media, String label,
+                       IUndoContext undoContext, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
+           super(media, label, undoContext, description, postOperationEnabled);
+
+       }
+}
index eb8f66380b6cf03b8e4b0fc53d5b5268b0d77013..ed396f0a9de4b1ae1dc082fb8888e54b2e84a378 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -21,7 +21,7 @@ import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 /**
- * <p>AddMediaToImageGalleryOperation class.</p>
+ * This operation creates a new {@link Media} and adds it to the currently selected {@link DescriptionBase}.
  *
  * @author p.ciardelli
  * @author n.hoffmann
@@ -29,8 +29,8 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
  * @version 1.0
  */
 public class AddMediaToImageGalleryOperation extends AbstractPostTaxonOperation {
-       
-       private DescriptionBase description;
+
+       private final DescriptionBase<?> description;
        private Media media;
 
        /**
@@ -43,11 +43,17 @@ public class AddMediaToImageGalleryOperation extends AbstractPostTaxonOperation
         * @param description a {@link eu.etaxonomy.cdm.model.description.DescriptionBase} object.
         */
        public AddMediaToImageGalleryOperation(String label,
-                       IUndoContext undoContext, DescriptionBase description, IPostOperationEnabled postOperationEnabled) {
-               super(label, undoContext, postOperationEnabled);
+                       IUndoContext undoContext, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
+           this(null, label, undoContext, description, postOperationEnabled);
+           media = Media.NewInstance();
+       }
+
+       protected AddMediaToImageGalleryOperation(Media media, String label,
+               IUndoContext undoContext, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
+           super(label, undoContext, postOperationEnabled);
 
-               this.description = description;
-               media = Media.NewInstance();
+           this.description = description;
+           this.media = media;
        }
 
        /* (non-Javadoc)
@@ -59,11 +65,11 @@ public class AddMediaToImageGalleryOperation extends AbstractPostTaxonOperation
                        throws ExecutionException {
 
                monitor.worked(20);
-               
+
                ImagesUtility.addMediaToGallery(description, media);
-               
+
                monitor.worked(40);
-        
+
                return postExecute(media);
        }
 
index 4cb133747fb395debbe515fab9e08c29fb062ff8..f2e1cd211d05ddd31629b5080c7d124d83d71416 100644 (file)
@@ -32,7 +32,7 @@ AbstractFilteredCdmResourceSelectionDialog<Amplification> {
 
     public static Amplification select(Shell shell, ConversationHolder conversation, Amplification amplification){
         AmplificationSelectionDialog dialog = new AmplificationSelectionDialog(shell, conversation,
-                "Choose Unit", false, AmplificationSelectionDialog.class.getCanonicalName(), amplification);
+                "Choose Amplification", false, AmplificationSelectionDialog.class.getCanonicalName(), amplification);
         return getSelectionFromDialog(dialog);
     }
 
@@ -54,7 +54,7 @@ AbstractFilteredCdmResourceSelectionDialog<Amplification> {
         if(amplification != null){
             return amplification;
         }
-        MessagingUtils.error(this.getClass(), "Selected unit is not an amplification", null);
+        MessagingUtils.error(this.getClass(), "Selected element is not an amplification", null);
         return null;
     }
 
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/MediaSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/MediaSelectionDialog.java
new file mode 100644 (file)
index 0000000..a0df66d
--- /dev/null
@@ -0,0 +1,88 @@
+// $Id$
+/**
+ * Copyright (C) 2014 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.ui.dialog.selection;
+
+import java.util.UUID;
+
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IMediaService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author pplitzner
+ * @date 11.03.2014
+ *
+ */
+public class MediaSelectionDialog extends
+AbstractFilteredCdmResourceSelectionDialog<Media> {
+
+    public static Media select(Shell shell, ConversationHolder conversation, Media media){
+        MediaSelectionDialog dialog = new MediaSelectionDialog(shell, conversation,
+                "Choose Media", false, MediaSelectionDialog.class.getCanonicalName(), media);
+        return getSelectionFromDialog(dialog);
+    }
+
+    /**
+     * <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
+     */
+    protected MediaSelectionDialog(Shell shell, ConversationHolder conversation, String title,
+            boolean multi, String settings, Media cdmObject) {
+        super(shell, conversation, title, multi, settings, cdmObject);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected Media getPersistentObject(UUID uuid) {
+        Object object = CdmStore.getService(IMediaService.class).load(uuid);
+
+        Media media = (Media) HibernateProxyHelper.deproxy(object);
+
+        if(media != null){
+            return media;
+        }
+        MessagingUtils.error(this.getClass(), "Selected element is not media", null);
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected void initModel() {
+        model = CdmStore.getService(IMediaService.class).getUuidAndTitleCache();
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.ui.dialog.selection.AbstractFilteredCdmResourceSelectionDialog#getTitle(eu.etaxonomy.cdm.model.common.ICdmBase)
+     */
+    @Override
+    protected String getTitle(Media cdmObject) {
+        if(cdmObject!=null){
+            return cdmObject.getTitleCache();
+        }
+        return super.getTitle(cdmObject);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected String getNewWizardLinkText() {
+        return "";
+    }
+}
index 4ad99c9ff72fa6ab94b53cfe3a53fbb22a0e3a6f..4409195291a527df825113d6f39d1da2bcfe561d 100644 (file)
@@ -32,7 +32,7 @@ AbstractFilteredCdmResourceSelectionDialog<Primer> {
 
     public static Primer select(Shell shell, ConversationHolder conversation, Primer primer){
         PrimerSelectionDialog dialog = new PrimerSelectionDialog(shell, conversation,
-                "Choose Unit", false, PrimerSelectionDialog.class.getCanonicalName(), primer);
+                "Choose Primer", false, PrimerSelectionDialog.class.getCanonicalName(), primer);
         return getSelectionFromDialog(dialog);
     }
 
@@ -54,7 +54,7 @@ AbstractFilteredCdmResourceSelectionDialog<Primer> {
         if(primer != null){
             return primer;
         }
-        MessagingUtils.error(this.getClass(), "Selected unit is not a primer", null);
+        MessagingUtils.error(this.getClass(), "Selected element is not a primer", null);
         return null;
     }
 
index d33745d887e2b769d06aac3e4fa961a785008fac..e728ad0c1563e9b7b0fe0ac599e9c575386b39e7 100644 (file)
@@ -46,10 +46,10 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils;
  */
 public class SelectionDialogFactory {
 
-       public static <T extends ICdmBase> T getSelectionFromDialog(Class<T> clazz, Shell shell, ConversationHolder conversation, T curentSelection){
+       public static <T extends ICdmBase> T getSelectionFromDialog(Class<T> clazz, Shell shell, ConversationHolder conversation, T currentSelection){
 
                if(clazz.equals(Taxon.class)){
-                       return (T) TaxonBaseSelectionDialog.selectTaxon(shell, conversation, (Taxon) curentSelection);
+                       return (T) TaxonBaseSelectionDialog.selectTaxon(shell, conversation, (Taxon) currentSelection);
                }
                if(clazz.equals(Synonym.class)){
                        return (T) TaxonBaseSelectionDialog.selectSynonym(shell, conversation);
@@ -58,31 +58,31 @@ public class SelectionDialogFactory {
                        return (T) TaxonBaseSelectionDialog.selectTaxonBase(shell, conversation);
                }
                if(clazz.equals(Classification.class)){
-                       return (T) ClassificationSelectionDialog.select(shell, conversation, (Classification) curentSelection);
+                       return (T) ClassificationSelectionDialog.select(shell, conversation, (Classification) currentSelection);
                }
                if(clazz.equals(TaxonNode.class)){
-                       return (T) TaxonNodeSelectionDialog.select(shell, conversation, null, null, (TaxonNode) curentSelection, null);
+                       return (T) TaxonNodeSelectionDialog.select(shell, conversation, null, null, (TaxonNode) currentSelection, null);
                }
                if(clazz.equals(Reference.class)){
-                       return (T) ReferenceSelectionDialog.select(shell, conversation, (Reference) curentSelection);
+                       return (T) ReferenceSelectionDialog.select(shell, conversation, (Reference) currentSelection);
                }
                if(clazz.equals(TaxonNameBase.class)){
-                       return (T) NameSelectionDialog.select(shell, conversation, (TaxonNameBase) curentSelection);
+                       return (T) NameSelectionDialog.select(shell, conversation, (TaxonNameBase) currentSelection);
                }
                if(clazz.equals(Team.class)){
-                       return (T) TeamSelectionDialog.select(shell, conversation, (Team) curentSelection);
+                       return (T) TeamSelectionDialog.select(shell, conversation, (Team) currentSelection);
                }
                if(clazz.equals(AgentBase.class)){
-                       return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) curentSelection);
+                       return (T) AgentSelectionDialog.select(shell, conversation, (AgentBase) currentSelection);
                }
                if(clazz.equals(Feature.class)){
-                       return (T) FeatureSelectionDialog.select(shell, conversation, (Feature) curentSelection);
+                       return (T) FeatureSelectionDialog.select(shell, conversation, (Feature) currentSelection);
                }
                if(clazz.equals(FeatureTree.class)){
-                       return (T) FeatureTreeSelectionDialog.select(shell, conversation, (FeatureTree) curentSelection);
+                       return (T) FeatureTreeSelectionDialog.select(shell, conversation, (FeatureTree) currentSelection);
                }
                if(clazz.equals(PolytomousKey.class)){
-                       return (T) PolytomousKeySelectionDialog.select(shell, conversation, (PolytomousKey) curentSelection);
+                       return (T) PolytomousKeySelectionDialog.select(shell, conversation, (PolytomousKey) currentSelection);
                }
                if(clazz.equals(PolytomousKeyNode.class)){
                        MessagingUtils.warningDialog("Not implemented yet", SelectionDialogFactory.class,
@@ -90,37 +90,37 @@ public class SelectionDialogFactory {
                        return null;
                }
                if(clazz.equals(DerivedUnit.class)){
-                       return (T) DerivedUnitSelectionDialog.select(shell, conversation, (DerivedUnit) curentSelection);
+                       return (T) DerivedUnitSelectionDialog.select(shell, conversation, (DerivedUnit) currentSelection);
                }
                if(clazz.equals(FieldUnit.class)){
-                       return (T) FieldUnitSelectionDialog.select(shell, conversation, (FieldUnit) curentSelection);
+                       return (T) FieldUnitSelectionDialog.select(shell, conversation, (FieldUnit) currentSelection);
                }
                if(clazz.equals(NamedArea.class)){
-                       return (T) NamedAreaSelectionDialog.select(shell, conversation, (NamedArea) curentSelection);
+                       return (T) NamedAreaSelectionDialog.select(shell, conversation, (NamedArea) currentSelection);
                }
                if(clazz.equals(Collection.class)){
-                       return (T) CollectionSelectionDialog.select(shell, conversation, (Collection) curentSelection);
+                       return (T) CollectionSelectionDialog.select(shell, conversation, (Collection) currentSelection);
                }
                if(clazz.equals(User.class)){
-                       return (T) UserSelectionDialog.select(shell, conversation, (User) curentSelection);
+                       return (T) UserSelectionDialog.select(shell, conversation, (User) currentSelection);
                }
                if(clazz.equals(GrantedAuthorityImpl.class)){
-                       return (T) GrantedAuthoritySelectionDialog.select(shell, conversation, (GrantedAuthorityImpl) curentSelection);
+                       return (T) GrantedAuthoritySelectionDialog.select(shell, conversation, (GrantedAuthorityImpl) currentSelection);
                }
                if (clazz.equals(Person.class)){
-                       return (T) PersonSelectionDialog.select(shell, conversation, (Person) curentSelection);
+                       return (T) PersonSelectionDialog.select(shell, conversation, (Person) currentSelection);
                }
                if(clazz.equals(Group.class)){
-                       return (T) GroupSelectionDialog.select(shell, conversation, (Group) curentSelection);
+                       return (T) GroupSelectionDialog.select(shell, conversation, (Group) currentSelection);
                }
                if(clazz.equals(Institution.class)){
-                       return (T) InstitutionSelectionDialog.select(shell, conversation, (Institution) curentSelection);
+                       return (T) InstitutionSelectionDialog.select(shell, conversation, (Institution) currentSelection);
                }
                if(clazz.equals(Primer.class)){
-                   return (T) PrimerSelectionDialog.select(shell, conversation, (Primer) curentSelection);
+                   return (T) PrimerSelectionDialog.select(shell, conversation, (Primer) currentSelection);
                }
                if(clazz.equals(Amplification.class)){
-                   return (T) AmplificationSelectionDialog.select(shell, conversation, (Amplification) curentSelection);
+                   return (T) AmplificationSelectionDialog.select(shell, conversation, (Amplification) currentSelection);
                }
 
                return null;