ref #6554 Reduce details view rendering
authorPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 21 Feb 2019 08:11:54 +0000 (09:11 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 21 Feb 2019 08:11:54 +0000 (09:11 +0100)
 - enhance check against previous selection
 - remove unused methods

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmEditorPartE4.java

index 8d160ca71be5fcba832d0c404ef617dc02696277..56977edca7d3f6e8323f4dc0132445df655c0469 100644 (file)
@@ -23,7 +23,6 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.services.IServiceConstants;
 import org.eclipse.e4.ui.workbench.modeling.EPartService;
 import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
-import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.StructuredSelection;
@@ -114,14 +113,6 @@ public abstract class AbstractCdmEditorPartE4
 
     protected Object previousSelection;
 
-    public Object getPreviousSelection() {
-        return previousSelection;
-    }
-
-    public void setPreviousSelection(Object previousSelection) {
-        this.previousSelection = previousSelection;
-    }
-
     protected ISelectionChangedListener selectionChangedListener;
 
     public ISelectionChangedListener getSelectionChangedListener() {
@@ -150,6 +141,7 @@ public abstract class AbstractCdmEditorPartE4
             showEmptyPage();
             return;
         }
+        // no active editor found
         if(activePart==thisPart && WorkbenchUtility.getActiveEditorPart(partService)==null){
             showEmptyPage();
             return;
@@ -163,14 +155,12 @@ public abstract class AbstractCdmEditorPartE4
 
         }
 
-        if(previousSelection!=null){
-            if(previousSelection==selection || previousSelection.equals(selection)){
-                return;
-            }
-            else if(previousSelection instanceof ISelection &&
-                    previousSelection.equals(selection)){//skip redundant rendering of details view
-                return;
-            }
+        if((previousSelection!=null && selection!=null) &&
+                (previousSelection==selection
+                || previousSelection.equals(selection)
+                || new StructuredSelection(selection).equals(previousSelection))
+                ){
+            return;
         }
         if(delaySelection==null){
             delaySelection = new DelaySelection(selection, activePart, thisPart);