ref #6597 Avoid session errors and empty view for unaccepted selections
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 19 Jul 2017 14:47:34 +0000 (16:47 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 19 Jul 2017 14:47:34 +0000 (16:47 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsPartE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java

index 6db8d125febd0adf34c89f1f9086279b1de36214..b9f28fe9eabdb33be4e74386ee070723d288b717 100644 (file)
@@ -25,9 +25,11 @@ import org.eclipse.ui.IEditorPart;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.l10n.Messages;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
@@ -75,14 +77,28 @@ public class DetailsPartE4 implements IConversationEnabled, IDirtyMarkable{
         else{
             structuredSelection = (IStructuredSelection) selection;
         }
-        if((partObject instanceof IEditorPart) || (partObject instanceof IPartContentHasDetails)) {
+        if((partObject instanceof IEditorPart) || (partObject instanceof IPartContentHasDetails)
+                && partObject instanceof IConversationEnabled) {
+            // do not show details for feature nodes TODO strange check to avoid having shown the distribution map for every FeatureNodeContainer
+            if(structuredSelection.getFirstElement() instanceof FeatureNodeContainer){
+                // do show the map for distributions
+                Feature feature = ((FeatureNodeContainer) ((IStructuredSelection) selection).getFirstElement()).getFeature();
+                if(!feature.equals(Feature.DISTRIBUTION())){
+                    showEmptyPage();
+                    return;
+                }
+            }
             showViewer(structuredSelection);
             selectionProvidingPart = activePart;
         }
+        else{
+            showEmptyPage();
+        }
     }
 
     public void showEmptyPage() {
-        viewer.setSelection(null);
+        viewer.showEmptyPage();
+        selectionProvidingPart = null;
     }
 
     protected String getViewName(){
index a0b80dc54acfb3ed368ed9dc78214098df11e737..506e74446de4062e94e85ca06df6bce52864d955 100755 (executable)
@@ -163,6 +163,11 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         super.setInput(input);
     }
 
+    public void showEmptyPage(){
+        destroySections();
+        createEmptySection(rootElement);
+    }
+
 
     /** {@inheritDoc} */
     @Override