Fix potential Widget is disposed exception
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / AbstractCdmViewPart.java
index 03acaeb247bdf7d4af4a919fcf122eb5820d784e..4367e2b835c2863bbe8ffcac66720b81c2c1657d 100644 (file)
@@ -12,6 +12,7 @@ package eu.etaxonomy.taxeditor.view;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
@@ -108,9 +109,11 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
         this.part = part;
 
         Object element = selection.getFirstElement();
-
+      //avoid widget is disposed exceptions
+        if (getViewer().getControl()==null || getViewer().getControl().isDisposed()){
+            return;
+        }
         getViewer().setInput(element);
-
         showViewer();
     }
 
@@ -185,7 +188,7 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
     }
 
     @Override
-    public  List<CdmBase> getRootEntities() {
+    public  List<? extends CdmBase> getRootEntities() {
         return Arrays.asList((CdmBase)getViewer().getInput());
     }
 
@@ -209,4 +212,14 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
     public void forceDirty() {
         changed(null);
     }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+     */
+    @Override
+    public Map<Object, List<String>> getPropertyPathsMap() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }