Disable media view for taxon bulk editor with no selection (#5162)
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 9 Sep 2015 13:17:00 +0000 (15:17 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 9 Sep 2015 13:17:00 +0000 (15:17 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java

index f3c1714..e0520f0 100644 (file)
@@ -40,24 +40,17 @@ import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
 import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
 
 /**
- * <p>MediaViewPart class.</p>
- *
  * @author n.hoffmann
  * @created Jun 15, 2010
  * @version 1.0
  */
 public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartContentHasDetails, IPartContentHasSupplementalData {
 
-       /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.medi"{trunked}</code> */
        public static final String ID = "eu.etaxonomy.taxeditor.editor.view.media";
 
 
        private TreeViewer viewer;
 
-       /*
-        * (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createViewer(org.eclipse.swt.widgets.Composite)
-        */
        /** {@inheritDoc} */
        @Override
        public void createViewer(Composite parent) {
@@ -83,9 +76,6 @@ public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartCon
 
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#getInitialSelection()
-        */
        /** {@inheritDoc} */
        @Override
        protected ISelection getInitialSelection() {
@@ -116,22 +106,21 @@ public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartCon
                    if(part instanceof MultiPageTaxonEditor){
                        IEditorInput input = ((IEditorPart) part).getEditorInput();
                        showViewer(part, new StructuredSelection(input));
+                       return;
                    }
                    else if(selection instanceof IStructuredSelection){
                        Object firstElement = ((IStructuredSelection) selection).getFirstElement();
                        if(firstElement instanceof TreeNode){
                            showViewer(part, new StructuredSelection(((TreeNode) firstElement).getValue()));
+                           return;
                        }
-                       else{
+                       else if(firstElement!=null){
                            showViewer(part, (IStructuredSelection) selection);
+                           return;
                        }
-                   }else{
-                       showEmptyPage();
                    }
                }
-               else{
-                   showEmptyPage();
-               }
+               showEmptyPage();
        }
 
        /** {@inheritDoc} */
@@ -158,11 +147,6 @@ public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartCon
                return viewer;
        }
 
-       /**
-        * <p>onComplete</p>
-        *
-        * @return a boolean.
-        */
        @Override
     public boolean onComplete() {
                return true;