commit f13a970a6f10f19bfba2e96ff735cb9334d4037e
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Wed May 31 15:33:05 2017 +0200

    ref #6596 Refactored selection handling to support e3 and e4 parts

diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java
index 229a48724..d0922b833 100644
--- a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java
+++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java
@@ -20,10 +20,7 @@ import org.apache.log4j.Logger;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.IJobChangeListener;
 import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.jface.viewers.ICellModifier;
@@ -41,7 +38,6 @@ import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.IWorkbenchPart;
 import org.springframework.remoting.RemoteAccessException;
 
@@ -80,8 +76,6 @@ import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.model.DescriptionHelper;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
 
@@ -109,7 +103,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
 
 	public ReferencingObjectsView() {
 	  // cdmEntitySession = CdmStore.getCurrentSessionManager().getNullSession();
-	    
+
 		//cdmEntitySession = CdmStore.getCurrentSessionManager().bindNullSession();
 	}
 
@@ -123,7 +117,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
 		createColumns(viewer);
 		viewer.setContentProvider(new ReferencingObjectsContentProvider());
 		viewer.setLabelProvider(new ReferencingObjectsLabelProvider());
-		
+
 		viewer.setCellModifier(new ICellModifier() {
             @Override
             public void modify(Object element, String property, Object value) {
@@ -197,7 +191,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
 	    if (actualUuid == entityUUID){
 	        return ;
 	    }
-	    
+
 	    if(actualMonitor!=null && !actualMonitor.isCanceled()){
 //	        boolean success = false;
 //	        //wait for cancel to be done
@@ -257,18 +251,18 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
 	                    return Status.CANCEL_STATUS;
 	                }
 	                monitor.worked(80);
-                    
+
 	                updateView();
 //	                if(previousCdmEntitySession != null) {
 //	                    previousCdmEntitySession.bind();
 //	                }else{
-//	                	CdmStore.getCurrentSessionManager().bind(null); 
+//	                	CdmStore.getCurrentSessionManager().bind(null);
 //	                }
 	               // actualUuid = entityUUID;
 				}
 				monitor.done();
 				actualMonitor = null;
-				
+
 				return Status.OK_STATUS;
 
 
@@ -388,7 +382,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
 	    Display.getDefault().asyncExec(new Runnable() {
             @Override
             public void run() {
-            	
+
         		if (viewer != null && !viewer.getControl().isDisposed()){
         			try{
         				viewer.setInput(referencingObjects);
@@ -418,7 +412,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
                 } else {
                     setContentDescription(description);
                 }
-        	    
+
             }
 
          });
@@ -439,7 +433,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
 
 	/** {@inheritDoc} */
 	@Override
-	public void showViewer(IWorkbenchPart part, IStructuredSelection selection) {
+	public void showViewer(Object part, IStructuredSelection selection) {
 	//	this.part = part;
 
 		Object firstElement = selection.getFirstElement();
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java
index a368fc48d..4b24599c6 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java
@@ -258,7 +258,7 @@ public class EditorUtil extends AbstractUtility {
 	 * @return the taxon editor that has focus
 	 */
 	public static MultiPageTaxonEditor getActiveMultiPageTaxonEditor() {
-		IEditorPart editorPart = getActiveEditor();
+		Object editorPart = getActiveE4Editor();
 		if (editorPart != null && editorPart instanceof MultiPageTaxonEditor) {
 			MultiPageTaxonEditor editor = (MultiPageTaxonEditor) editorPart;
 			editor.getConversationHolder().bind();
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/handler/EditCdmAuthoritiesHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/handler/EditCdmAuthoritiesHandler.java
index a52db81ca..bd046f63f 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/handler/EditCdmAuthoritiesHandler.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/handler/EditCdmAuthoritiesHandler.java
@@ -44,7 +44,7 @@ public class EditCdmAuthoritiesHandler  extends AbstractHandler {
 	 */
 	@Override
 	public Object execute(ExecutionEvent event) throws ExecutionException {
-		BulkEditor editor = (BulkEditor) EditorUtil.getActiveEditor();
+		BulkEditor editor = (BulkEditor) EditorUtil.getActiveE4Editor();
 
 		ISelection selection = editor.getSite().getSelectionProvider().getSelection();
 		if(selection instanceof LineSelection){
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java
index 859552af7..da9d5fe98 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java
@@ -857,8 +857,7 @@ public class TaxonNameEditor extends EditorPart implements
 	 * @return a boolean.
 	 */
 	public boolean isActive() {
-		IWorkbenchPart activePart = AbstractUtility.getActivePart();
-		return editor.equals(activePart);
+		return editor.equals(AbstractUtility.getActiveE4Part());
 	}
 
 	/**
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/OpenDistributionHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/OpenDistributionHandler.java
index e0576c34d..45eec0ca3 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/OpenDistributionHandler.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/OpenDistributionHandler.java
@@ -36,7 +36,7 @@ public class OpenDistributionHandler extends AbstractHandler {
     public Object execute(ExecutionEvent event) throws ExecutionException {
 
         ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
-        ChecklistEditor editor = (ChecklistEditor) EditorUtil.getActiveEditor();
+        ChecklistEditor editor = (ChecklistEditor) EditorUtil.getActiveE4Editor();
 
         if (currentSelection instanceof IStructuredSelection) {
 
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java
index a4b8ff6f9..7b7811061 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java
@@ -59,7 +59,7 @@ implements IPartContentHasDetails, IPartContentHasSupplementalData{
 		if(part == this){
 		    return;
 		}
-		if(AbstractUtility.getActiveEditor() == null){
+		if(AbstractUtility.getActiveE4Editor() == null){
 			showEmptyPage();
 			return;
 		}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java
index 3ad4d3e84..14243a721 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java
@@ -45,7 +45,7 @@ public class ConceptGraphView extends AbstractCdmEditorViewPart {
 //			return;
 //		}
 
-		if(EditorUtil.getActiveEditor() == null){
+		if(EditorUtil.getActiveE4Editor() == null){
 			showEmptyPage();
 			return;
 		}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java
index 6e945a24f..db4522632 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java
@@ -18,7 +18,6 @@ import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 
@@ -48,7 +47,7 @@ public class CreateConceptRelationHandler extends AbstractHandler {
 	    IUndoContext undoContext = null;
 	    ConversationHolder conversationHolder = null;
 	    Taxon taxon = null;
-		IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+		Object activeEditor = AbstractUtility.getActiveE4Editor();
 		if(activeEditor instanceof MultiPageTaxonEditor){
 		    MultiPageTaxonEditor taxonEditor = (MultiPageTaxonEditor)activeEditor;
 		    taxon = taxonEditor.getTaxon();
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptHandler.java
index 186b25bf6..9ece4d966 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptHandler.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptHandler.java
@@ -14,7 +14,6 @@ import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.handlers.HandlerUtil;
 
@@ -46,7 +45,7 @@ public class OpenRelatedConceptHandler extends AbstractHandler {
             Object selectedElement = structuredSelection.getFirstElement();
 
             if(selectedElement instanceof TaxonRelationship){
-                IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+                Object activeEditor = AbstractUtility.getActiveE4Editor();
                 if(activeEditor instanceof MultiPageTaxonEditor){
                     relatedTaxon = getRelatedTaxon((TaxonRelationship) selectedElement, ((MultiPageTaxonEditor) activeEditor).getTaxon());
                 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java
index 6e180d34b..83c798eab 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java
@@ -153,7 +153,7 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
 	/** {@inheritDoc} */
 	@Override
     protected void selectionChanged_internal(IWorkbenchPart part, ISelection selection) {
-		if(AbstractUtility.getActiveEditor() == null){
+		if(AbstractUtility.getActiveE4Editor() == null){
 			showEmptyPage();
 			return;
 		}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java
index d47ff9006..0d1da780d 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java
@@ -160,21 +160,21 @@ public class DescriptionsMenuPropertyTester extends PropertyTester {
 	}
 
 	private boolean isTaxonEditor() {
-	    if(AbstractUtility.getActiveEditor() instanceof MultiPageTaxonEditor){
+	    if(AbstractUtility.getActiveE4Editor() instanceof MultiPageTaxonEditor){
 	        return true;
 	    }
 	    return false;
 	}
 
 	private boolean isBulkEditor() {
-	    if(AbstractUtility.getActiveEditor() instanceof BulkEditor){
+	    if(AbstractUtility.getActiveE4Editor() instanceof BulkEditor){
 	        return true;
 	    }
 	    return false;
 	}
 
 	private boolean isDerivateEditor() {
-	    if(AbstractUtility.getActiveEditor() instanceof DerivateView){
+	    if(AbstractUtility.getActiveE4Editor() instanceof DerivateView){
 	        return true;
 	    }
 	    return false;
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DynamicFeatureMenu.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DynamicFeatureMenu.java
index d6347efab..66af4c76f 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DynamicFeatureMenu.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DynamicFeatureMenu.java
@@ -28,7 +28,7 @@ import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
 import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.FeatureNode;
 import eu.etaxonomy.cdm.model.description.FeatureTree;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateDescriptionElementOperation;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
@@ -47,10 +47,8 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  */
 public class DynamicFeatureMenu extends CompoundContributionItem {
 
-	private final ISelectionService selectionService = EditorUtil.getActivePart()
-			.getSite().getWorkbenchWindow().getSelectionService();
-	private final IHandlerService handlerService = (IHandlerService) EditorUtil
-			.getService(IHandlerService.class);
+	private final ISelectionService selectionService = TaxeditorEditorPlugin.getDefault().getWorkbench().getService(ISelectionService.class);
+	private final IHandlerService handlerService = TaxeditorEditorPlugin.getDefault().getWorkbench().getService(IHandlerService.class);
 
 	/*
 	 * (non-Javadoc)
@@ -105,7 +103,7 @@ public class DynamicFeatureMenu extends CompoundContributionItem {
 	private void createMenuItem(Menu menu, final Feature feature) {
 		MenuItem menuItem = new MenuItem(menu, -1);
 		final Feature deproxiedFeature = HibernateProxyHelper.deproxy(feature, Feature.class);
-				
+
 		String label = deproxiedFeature.getLabel(PreferencesUtil.getGlobalLanguage());
 		if (label == null){
 			menuItem.setText(deproxiedFeature.getLabel());
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java
index 1572119d5..cbb052e5a 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java
@@ -92,7 +92,7 @@ public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartCon
 	    if(part==this){
 	        return;
 	    }
-		if(AbstractUtility.getActiveEditor() == null){
+		if(AbstractUtility.getActiveE4Editor() == null){
 			showEmptyPage();
 			return;
 		}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java
index c845700b1..8dedfb8c9 100644
--- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java
+++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java
@@ -12,7 +12,6 @@ package eu.etaxonomy.taxeditor.molecular.handler;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.ui.IEditorPart;
 
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
@@ -29,7 +28,7 @@ import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
  */
 public abstract class AbstractAlignmentEditorHandler extends AbstractHandler {
 	public static AlignmentEditor getActiveAlignmentEditor() {
-        IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+	    Object activeEditor = AbstractUtility.getActiveE4Editor();
         if (activeEditor instanceof AlignmentEditor) {
             return (AlignmentEditor)activeEditor;
         }
@@ -37,8 +36,8 @@ public abstract class AbstractAlignmentEditorHandler extends AbstractHandler {
         	return null;
         }
 	}
-	
-	
+
+
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
     	AlignmentEditor editor = getActiveAlignmentEditor();
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractPherogramComponentHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractPherogramComponentHandler.java
index e7151aa45..8589c7f28 100644
--- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractPherogramComponentHandler.java
+++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractPherogramComponentHandler.java
@@ -9,20 +9,18 @@
 package eu.etaxonomy.taxeditor.molecular.handler;
 
 
-import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
-import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea;
-import info.bioinfweb.libralign.pherogram.PherogramComponent;
-
 import java.util.Iterator;
 
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.ui.IWorkbenchPart;
 
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
 import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart;
+import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
+import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea;
+import info.bioinfweb.libralign.pherogram.PherogramComponent;
 
 
 
@@ -36,7 +34,7 @@ import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart;
 public abstract class AbstractPherogramComponentHandler extends AbstractHandler {
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
-        IWorkbenchPart activePart = AbstractUtility.getActivePart();
+        Object activePart = AbstractUtility.getActiveE4Part();
 
         if (activePart instanceof AlignmentEditor) {
             AlignmentEditor editor = (AlignmentEditor)activePart;
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java
index f89d68c3c..2168d57ed 100644
--- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java
+++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java
@@ -17,7 +17,6 @@ import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.ui.IEditorPart;
 
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
@@ -36,12 +35,9 @@ import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
 public class LoadPherogramHandler extends AbstractHandler {
 	//TODO Change so that also URIs which do not point to files can be specified.
 
-	/* (non-Javadoc)
-     * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-     */
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
-        IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+        Object activeEditor = AbstractUtility.getActiveE4Editor();
         if (activeEditor instanceof AlignmentEditor) {
             AlignmentEditor alignmentEditor = (AlignmentEditor)activeEditor;
 
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java
index cff86d734..2867fd49a 100644
--- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java
+++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java
@@ -15,7 +15,6 @@ import java.util.Map;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.commands.ICommandService;
 import org.eclipse.ui.commands.IElementUpdater;
@@ -50,7 +49,7 @@ public class ToggleInsertOverwriteHandler extends AbstractAlignmentEditorHandler
 
 	@Override
 	public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
-        IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+	    Object activeEditor = AbstractUtility.getActiveE4Editor();
 		if (activeEditor instanceof AlignmentEditor) {
 			if (((AlignmentEditor)activeEditor).isInsertMode()) {
 			    element.setIcon(INSERT_DESCRIPTOR);
@@ -62,7 +61,7 @@ public class ToggleInsertOverwriteHandler extends AbstractAlignmentEditorHandler
 				element.setText("OVR"); //$NON-NLS-1$
 				element.setTooltip(Messages.ToggleInsertOverwriteHandler_SWITCH_INSERTION);
 			}
-            ((ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(
+            PlatformUI.getWorkbench().getService(ICommandService.class).refreshElements(
                     ToggleLeftRightInsertionHandler.COMMAND_ID, null);
 		}
 	}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java
index 9dbf660e5..5ea69c778 100644
--- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java
+++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java
@@ -14,7 +14,6 @@ import java.util.Map;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.commands.IElementUpdater;
 import org.eclipse.ui.menus.UIElement;
 
@@ -53,7 +52,7 @@ public class ToggleLeftRightInsertionHandler extends AbstractAlignmentEditorHand
 
     @Override
     public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
-        IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+        Object activeEditor = AbstractUtility.getActiveE4Editor();
         if (activeEditor instanceof AlignmentEditor) {
             setBaseEnabled(((AlignmentEditor)activeEditor).isInsertMode());
             if (((AlignmentEditor)activeEditor).isInsertLeftInPherogram()) {
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveFactualDataHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveFactualDataHandler.java
index 9f2283c98..f7c95687a 100644
--- a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveFactualDataHandler.java
+++ b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveFactualDataHandler.java
@@ -12,7 +12,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.handlers.HandlerUtil;
 
@@ -40,7 +39,7 @@ public class MoveFactualDataHandler extends AbstractHandler {
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
         ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
-        IWorkbenchPart activePart = AbstractUtility.getActivePart();
+        Object activePart = AbstractUtility.getActiveE4Part();
         TaxonNavigator navigator = null;
         if(activePart instanceof TaxonNavigator){
             navigator = (TaxonNavigator)activePart;
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
index 03429575a..75af4ef73 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
@@ -9,6 +9,7 @@
 
 package eu.etaxonomy.taxeditor.model;
 
+import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -34,6 +35,7 @@ import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.core.runtime.jobs.ISchedulingRule;
 import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.jface.action.IStatusLineManager;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.resource.ColorRegistry;
@@ -53,6 +55,7 @@ import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.handlers.IHandlerService;
 import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
+import org.eclipse.ui.internal.E4PartWrapper;
 import org.eclipse.ui.part.EditorPart;
 import org.eclipse.ui.progress.IProgressConstants;
 import org.eclipse.ui.progress.IProgressService;
@@ -77,9 +80,6 @@ import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
 import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
 
 /**
- * <p>
- * Abstract AbstractUtility class.
- * </p>
  *
  * @author n.hoffmann
  * @created 11.05.2009
@@ -93,13 +93,6 @@ public abstract class AbstractUtility {
     protected static IStatusLineManager statusLineManager;
 
 
-    /**
-     * <p>
-     * closeAll
-     * </p>
-     *
-     * @return a boolean.
-     */
     public static boolean closeAll() {
         if(getActivePage()!=null){
             return getActivePage().closeAllEditors(true);
@@ -118,26 +111,12 @@ public abstract class AbstractUtility {
         return getActivePage() != null ? getActivePage().closeEditor(editor, true):false;
     }
 
-    /**
-     * <p>
-     * getShell
-     * </p>
-     *
-     * @return a {@link org.eclipse.swt.widgets.Shell} object.
-     */
     public static Shell getShell() {
 
         return TaxeditorStorePlugin.getDefault().getWorkbench()
                 .getActiveWorkbenchWindow().getShell();
     }
 
-    /**
-     * <p>
-     * getActivePage
-     * </p>
-     *
-     * @return a {@link org.eclipse.ui.IWorkbenchPage} object.
-     */
     public static IWorkbenchPage getActivePage() {
         try{
             return TaxeditorStorePlugin.getDefault().getWorkbench()
@@ -147,28 +126,48 @@ public abstract class AbstractUtility {
         }
     }
 
-    /**
-     * <p>
-     * getActivePart
-     * </p>
-     *
-     * @return a {@link org.eclipse.ui.IWorkbenchPart} object.
-     */
-    public static IWorkbenchPart getActivePart() {
-        return getActivePage() != null ? getActivePage().getActivePart() : null;
+    public static IWorkbenchPart getActiveWorkbenchPart() {
+        IWorkbenchPage activePage = getActivePage();
+        if(activePage!=null){
+            IWorkbenchPart activePart = activePage.getActivePart();
+            if(activePart!=null){
+                return activePart;
+            }
+        }
+        return null;
+    }
+
+    public static Object getActiveE4Part() {
+        IWorkbenchPage activePage = getActivePage();
+        if(activePage!=null){
+            IWorkbenchPart activePart = activePage.getActivePart();
+            Object e4WrappedPart = getE4WrappedPart(activePart);
+            return e4WrappedPart!=null?e4WrappedPart:activePart;
+        }
+        return null;
+    }
+
+    public static Object getE4WrappedPart(Object activePart){
+        if(activePart instanceof E4PartWrapper){
+            //FIXME can be removed when E4 migration is complete
+            try {
+                Field field = activePart.getClass().getDeclaredField("wrappedPart");
+                field.setAccessible(true);
+                Object object = field.get(activePart);
+                if(object instanceof MPart){
+                    return ((MPart) object).getObject();
+                }
+            } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
+        return null;
     }
 
     public static IWorkbench getWorkbench() {
         return TaxeditorStorePlugin.getDefault().getWorkbench();
     }
 
-    /**
-     * <p>
-     * getWorkbenchWindow
-     * </p>
-     *
-     * @return a {@link org.eclipse.jface.window.ApplicationWindow} object.
-     */
     public static IWorkbenchWindow getWorkbenchWindow() {
         if (getWorkbench().getWorkbenchWindowCount() > 1) {
             throw new IllegalStateException("More than one workbench window");
@@ -176,15 +175,6 @@ public abstract class AbstractUtility {
         return getWorkbench().getWorkbenchWindows()[0];
     }
 
-    /**
-     * <p>
-     * showView
-     * </p>
-     *
-     * @param id
-     *            a {@link java.lang.String} object.
-     * @return a {@link org.eclipse.ui.IViewPart} object.
-     */
     public static IViewPart showView(String id) {
         try {
             return PlatformUI.getWorkbench().getActiveWorkbenchWindow()
@@ -196,30 +186,11 @@ public abstract class AbstractUtility {
         }
     }
 
-    /**
-     * <p>
-     * hideView
-     * </p>
-     *
-     * @param view
-     *            a {@link org.eclipse.ui.IViewPart} object.
-     */
     public static void hideView(IViewPart view) {
         PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
         .hideView(view);
     }
 
-    /**
-     * <p>
-     * getView
-     * </p>
-     *
-     * @param id
-     *            a {@link java.lang.String} object.
-     * @param restore
-     *            a boolean.
-     * @return a {@link org.eclipse.ui.IViewPart} object.
-     */
     public static IViewPart getView(String id, boolean restore) {
     	IWorkbench workbench = PlatformUI.getWorkbench();
         IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
@@ -240,26 +211,10 @@ public abstract class AbstractUtility {
         return null;
     }
 
-    /**
-     * <p>
-     * getService
-     * </p>
-     *
-     * @param api
-     *            a {@link java.lang.Class} object.
-     * @return a {@link java.lang.Object} object.
-     */
     public static Object getService(Class api) {
         return TaxeditorStorePlugin.getDefault().getWorkbench().getService(api);
     }
 
-    /**
-     * <p>
-     * getCurrentTheme
-     * </p>
-     *
-     * @return a {@link org.eclipse.ui.themes.ITheme} object.
-     */
     public static ITheme getCurrentTheme() {
         IThemeManager themeManager = TaxeditorStorePlugin.getDefault()
                 .getWorkbench().getThemeManager();
@@ -277,15 +232,6 @@ public abstract class AbstractUtility {
         return getCurrentTheme().getFontRegistry();
     }
 
-    /**
-     * <p>
-     * getFont
-     * </p>
-     *
-     * @param symbolicName
-     *            a {@link java.lang.String} object.
-     * @return a {@link org.eclipse.swt.graphics.Font} object.
-     */
     public static Font getFont(String symbolicName) {
         return getFontRegistry().get(symbolicName);
     }
@@ -301,30 +247,10 @@ public abstract class AbstractUtility {
         return getCurrentTheme().getColorRegistry();
     }
 
-    /**
-     * <p>
-     * getColor
-     * </p>
-     *
-     * @param symbolicName
-     *            a {@link java.lang.String} object.
-     * @return a {@link org.eclipse.swt.graphics.Color} object.
-     */
     public static Color getColor(String symbolicName) {
         return getColorRegistry().get(symbolicName);
     }
 
-    /**
-     * <p>
-     * executeOperation
-     * </p>
-     *
-     * @param operation
-     *            a
-     *            {@link eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation}
-     *            object.
-     * @return a {@link org.eclipse.core.runtime.IStatus} object.
-     */
     public static IStatus executeOperation(final AbstractPostOperation operation) {
         if (getOperationHistory() == null) {
             throw new IllegalArgumentException(
@@ -508,27 +434,10 @@ public abstract class AbstractUtility {
         return Status.OK_STATUS;
     }
 
-
-    /**
-     * <p>
-     * getOperationHistory
-     * </p>
-     *
-     * @return a {@link org.eclipse.core.commands.operations.IOperationHistory}
-     *         object.
-     */
     public static IOperationHistory getOperationHistory() {
         return getWorkbench().getOperationSupport().getOperationHistory();
     }
 
-    /**
-     * <p>
-     * setStatusLine
-     * </p>
-     *
-     * @param message
-     *            a {@link java.lang.String} object.
-     */
     public static void setStatusLine(final String message) {
         Display.getDefault().asyncExec(new Runnable() {
 
@@ -541,13 +450,6 @@ public abstract class AbstractUtility {
 
     }
 
-    /**
-     * <p>
-     * getMonitor
-     * </p>
-     *
-     * @return a {@link org.eclipse.core.runtime.IProgressMonitor} object.
-     */
     public static IProgressMonitor getMonitor() {
         statusLineManager.setCancelEnabled(false);
         return statusLineManager.getProgressMonitor();
@@ -636,127 +538,55 @@ public abstract class AbstractUtility {
         getProgressService().busyCursorWhile(runnable);
     }
 
-    /**
-     * <p>
-     * runInUI
-     * </p>
-     *
-     * @see {@link IProgressService#runInUI(org.eclipse.jface.operation.IRunnableContext, IRunnableWithProgress, ISchedulingRule)}
-     * @param runnable
-     *            a {@link org.eclipse.jface.operation.IRunnableWithProgress}
-     *            object.
-     * @param rule
-     *            a {@link org.eclipse.core.runtime.jobs.ISchedulingRule}
-     *            object.
-     * @throws java.lang.reflect.InvocationTargetException
-     *             if any.
-     * @throws java.lang.InterruptedException
-     *             if any.
-     */
     public static void runInUI(IRunnableWithProgress runnable,
             ISchedulingRule rule) throws InvocationTargetException,
             InterruptedException {
         getProgressService().runInUI(getWorkbenchWindow(), runnable, rule);
     }
 
-    /**
-     * <p>
-     * run
-     * </p>
-     *
-     * @param fork
-     *            a boolean.
-     * @param cancelable
-     *            a boolean.
-     * @param runnable
-     *            a {@link org.eclipse.jface.operation.IRunnableWithProgress}
-     *            object.
-     * @throws java.lang.reflect.InvocationTargetException
-     *             if any.
-     * @throws java.lang.InterruptedException
-     *             if any.
-     */
     public static void run(boolean fork, boolean cancelable,
             IRunnableWithProgress runnable) throws InvocationTargetException,
             InterruptedException {
         getProgressService().run(fork, cancelable, runnable);
     }
 
-    /**
-     * <p>
-     * getProgressService
-     * </p>
-     *
-     * @return a {@link org.eclipse.ui.progress.IProgressService} object.
-     */
     public static IProgressService getProgressService() {
         IWorkbench workbench = PlatformUI.getWorkbench();
         return workbench.getProgressService();
     }
 
-    /**
-     * <p>
-     * getProgressService2
-     * </p>
-     *
-     * @return a {@link org.eclipse.ui.progress.IWorkbenchSiteProgressService}
-     *         object.
-     */
     public static IWorkbenchSiteProgressService getProgressService2() {
         return (IWorkbenchSiteProgressService) getService(IWorkbenchSiteProgressService.class);
     }
 
-    /**
-     * <p>
-     * getPluginId
-     * </p>
-     *
-     * @return a {@link java.lang.String} object.
-     */
     public static String getPluginId() {
         return "eu.taxeditor";
     }
 
-    /**
-     * <p>
-     * getActiveEditor
-     * </p>
-     *
-     * @return a {@link org.eclipse.ui.IEditorPart} object.
-     */
     public static IEditorPart getActiveEditor() {
         return getActivePage() != null ? getActivePage().getActiveEditor()
                 : null;
     }
 
-    /**
-     * <p>
-     * getDetailsView
-     * </p>
-     *
-     * @return a {@link eu.etaxonomy.taxeditor.view.detail.DetailsViewPart}
-     *         object.
-     */
+    public static Object getActiveE4Editor() {
+        if(getActivePage()!=null){
+            IEditorPart activeEditor = getActivePage().getActiveEditor();
+            Object wrappedPart = getE4WrappedPart(getActivePage().getActivePart());
+            return wrappedPart!=null?wrappedPart:activeEditor;
+        }
+        return null;
+    }
+
     public static DetailsViewPart getDetailsView() {
         return (DetailsViewPart) getView(DetailsViewPart.ID, false);
     }
 
-    /**
-     * <p>
-     * refreshDetailsViewer
-     * </p>
-     */
     public static void refreshDetailsViewer() {
         if (getDetailsView() != null) {
             ((AbstractCdmDataViewer) getDetailsView().getViewer()).refresh();
         }
     }
 
-    /**
-     * <p>
-     * reflowDetailsViewer
-     * </p>
-     */
     public static void reflowDetailsViewer() {
         if (getDetailsView() != null) {
             ((AbstractCdmDataViewer) getDetailsView().getViewer()).reflow();
@@ -870,10 +700,6 @@ public abstract class AbstractUtility {
         private final T term;
         private final TreeSet<TermNode<T>> children;
 
-        /**
-         * @param term
-         * @param children
-         */
         public TermNode(T term) {
             super();
             this.term = term;
@@ -884,23 +710,14 @@ public abstract class AbstractUtility {
             this.children.add(child);
         }
 
-        /**
-         * @return the children
-         */
         public TreeSet<TermNode<T>> getChildren() {
             return children;
         }
 
-        /**
-         * @return the term
-         */
         public T getTerm() {
             return term;
         }
 
-        /* (non-Javadoc)
-         * @see java.lang.Object#hashCode()
-         */
         @Override
         public int hashCode() {
             final int prime = 31;
@@ -909,9 +726,6 @@ public abstract class AbstractUtility {
             return result;
         }
 
-        /* (non-Javadoc)
-         * @see java.lang.Object#equals(java.lang.Object)
-         */
         @Override
         public boolean equals(Object obj) {
             if (this == obj) {
@@ -934,9 +748,6 @@ public abstract class AbstractUtility {
             return true;
         }
 
-        /* (non-Javadoc)
-         * @see java.lang.Comparable#compareTo(java.lang.Object)
-         */
         @Override
         public int compareTo(TermNode<T> that) {
             return this.term.getMessage().compareTo(that.term.getMessage());
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java
index 009c0b9ab..482476491 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java
@@ -25,7 +25,6 @@ import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.TypedListener;
 import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.forms.events.ExpansionEvent;
 import org.eclipse.ui.forms.events.IExpansionListener;
 import org.eclipse.ui.forms.widgets.Section;
@@ -574,14 +573,14 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements ISe
 	 */
 	@Override
     public ConversationHolder getConversationHolder() {
-	    if(AbstractUtility.getActivePart() instanceof IConversationEnabled){
-            return ((IConversationEnabled) AbstractUtility.getActivePart()).getConversationHolder();
+	    if(AbstractUtility.getActiveE4Part() instanceof IConversationEnabled){
+            return ((IConversationEnabled) AbstractUtility.getActiveE4Part()).getConversationHolder();
         }
 	    if(getParentElement() instanceof RootElement || getParentElement() == null){
 
-	        IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+	        Object activeEditor = AbstractUtility.getActiveE4Editor();
 	        if(activeEditor instanceof IConversationEnabled){
-	            ConversationHolder conversation = ((IConversationEnabled) AbstractUtility.getActiveEditor()).getConversationHolder();
+	            ConversationHolder conversation = ((IConversationEnabled) AbstractUtility.getActiveE4Editor()).getConversationHolder();
 	            return conversation;
 	        }
 	    }else if(getParentElement() instanceof IConversationEnabled){
@@ -599,7 +598,7 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements ISe
     public void update(CdmDataChangeMap changeEvents) {
 
 	}
-	
+
     private class ExpandListener implements IExpansionListener{
 		@Override
 		public void expansionStateChanging(ExpansionEvent e) {
@@ -617,7 +616,7 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements ISe
 	private void addExpandListener() {
 		PreferencesUtil.getPreferenceStore().setDefault(getPrefKey(), isExpanded());
 		setExpanded(PreferencesUtil.getPreferenceStore().getBoolean(getPrefKey()));
-		addExpansionListener(new ExpandListener());		
+		addExpansionListener(new ExpandListener());
 	}
 
 	private String getPrefKey() {
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CommandHandlerButton.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CommandHandlerButton.java
index e938063fe..f9395eaa3 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CommandHandlerButton.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CommandHandlerButton.java
@@ -22,19 +22,19 @@ import org.eclipse.ui.handlers.IHandlerService;
 
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.store.LoginManager;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 
 /**
  * A Button which executes a <code>IHandler</code> managed through a
  * <code>org.eclipse.ui.handlers</code> extension point
- * 
+ *
  * see http://wiki.eclipse.org/Platform_Command_Framework#Commands
- * 
+ *
  * @author a.kohlbecker
- * 
+ *
  */
 public class CommandHandlerButton extends Composite implements Observer {
-	
+
 	String commandId;
 	Button button;
 
@@ -46,16 +46,16 @@ public class CommandHandlerButton extends Composite implements Observer {
 	public CommandHandlerButton(Composite parent, int style, String commandId)  {
 		super(parent, SWT.NONE);
 		this.commandId = commandId;
-		
+
 		setLayout(new GridLayout());
 		setLayoutData(new GridData());
-	
+
 		button = new Button(this, style);
 		button.addSelectionListener(new SelectionAdapter() {
 			@Override
 			public void widgetSelected(SelectionEvent se) {
 				// you can execute a command directly ... but to get the proper environment it's better to execute it through the IHandlerService:
-				IHandlerService handlerService =  (IHandlerService) StoreUtil.getActivePart().getSite().getService(IHandlerService.class);
+				IHandlerService handlerService =  TaxeditorStorePlugin.getDefault().getWorkbench().getService(IHandlerService.class);
 				try {
 					handlerService.executeCommand(CommandHandlerButton.this.commandId, null);
 				} catch (ExecutionException e) {
@@ -72,10 +72,10 @@ public class CommandHandlerButton extends Composite implements Observer {
 					e.printStackTrace();
 				}
 			}
-			
+
 		});
 		updateButtonEnabledState();
-		
+
 		CdmStore.getLoginManager().addObserver(this);
         addDisposeListener(new DisposeListener() {
 			@Override
@@ -94,14 +94,14 @@ public class CommandHandlerButton extends Composite implements Observer {
 		if(o instanceof LoginManager){
 			updateButtonEnabledState();
 		}
-		
+
 	}
 
 	private void updateButtonEnabledState() {
-		ICommandService commandService =  (ICommandService) StoreUtil.getActivePart().getSite().getService(ICommandService.class);
+		ICommandService commandService =  TaxeditorStorePlugin.getDefault().getWorkbench().getService(ICommandService.class);
 		Command command = commandService.getCommand(commandId);
 		if(!button.isDisposed()){
-			button.setEnabled(command != null && command.isEnabled());			
+			button.setEnabled(command != null && command.isEnabled());
 		}
 	}
 
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java
index 854481faa..94a1629fc 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java
@@ -92,8 +92,8 @@ public abstract class AbstractCdmEditorViewPart extends AbstractCdmViewPart {
             Display.getCurrent().asyncExec(delaySelection);
         }
     }
-    
-    
+
+
 
     /** {@inheritDoc} */
     @Override
@@ -127,9 +127,10 @@ public abstract class AbstractCdmEditorViewPart extends AbstractCdmViewPart {
     /** {@inheritDoc} */
     @Override
     public void changed(Object object) {
-        if (part instanceof AbstractCdmViewPart) {
-            ((AbstractCdmViewPart) part).changed(object);
-        } else {
+        if(part instanceof IDirtyMarkable){
+            ((IDirtyMarkable) part).changed(object);
+        }
+        else {
             IEditorPart editor = getEditor();
             if (editor != null && editor instanceof IDirtyMarkable) {
                 ((IDirtyMarkable) editor).changed(object);
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java
index ed0f1863d..978859801 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java
@@ -23,7 +23,6 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.part.PageBook;
 import org.eclipse.ui.part.ViewPart;
 
@@ -50,7 +49,7 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
 
     public static IStructuredSelection EMPTY_SELECTION = new StructuredSelection();
 
-    protected IWorkbenchPart part;
+    protected Object part;
 
     private PageBook pageBook;
 
@@ -75,11 +74,8 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
         setInitialSelection();
     }
 
-    /**
-     *
-     */
     private void setInitialSelection() {
-        selectionChanged(AbstractUtility.getActivePart(), getInitialSelection());
+        selectionChanged(AbstractUtility.getActiveWorkbenchPart(), getInitialSelection());
     }
 
     /**
@@ -105,7 +101,7 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
      * @param part a {@link org.eclipse.ui.IWorkbenchPart} object.
      * @param selection a {@link org.eclipse.jface.viewers.ISelection} object.
      */
-    public void showViewer(IWorkbenchPart part, IStructuredSelection selection){
+    public void showViewer(Object part, IStructuredSelection selection){
         this.part = part;
 
         Object element = selection.getFirstElement();
@@ -224,13 +220,13 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
         // TODO Auto-generated method stub
         return null;
     }
-    
+
 	protected String createPartTitle(Object selectedObject){
 	    if(selectedObject!=null){
 	        return getViewName()+": "+selectedObject; //$NON-NLS-1$
 	    }
         return getViewName();
 	}
-	
+
     protected abstract String getViewName();
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/DataImportEditorContextMenu.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/DataImportEditorContextMenu.java
index 66623732a..56feee5c1 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/DataImportEditorContextMenu.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/DataImportEditorContextMenu.java
@@ -6,10 +6,6 @@ import java.util.Set;
 
 import org.apache.http.client.ClientProtocolException;
 import org.apache.log4j.Logger;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.action.ContributionItem;
 import org.eclipse.jface.action.IContributionItem;
 import org.eclipse.jface.viewers.ISelection;
@@ -19,13 +15,11 @@ import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.CompoundContributionItem;
 
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
 import eu.etaxonomy.cdm.ext.occurrence.gbif.DataSetResponse;
 import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifDataSetProtocol;
 import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifQueryServiceWrapper;
@@ -48,7 +42,7 @@ public class DataImportEditorContextMenu extends CompoundContributionItem {
                     @Override
                     public void fill(Menu menu, int index) {
                         final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-                        final IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+                        final Object activeEditor = AbstractUtility.getActiveE4Editor();
                         final ISelection selection = window.getActivePage().getSelection();
                         if(selection instanceof StructuredSelection){
                             final StructuredSelection structuredSelection = (StructuredSelection)selection;
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java
index 0af479c61..b41cf48c8 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java
@@ -9,7 +9,11 @@
 
 package eu.etaxonomy.taxeditor.view.detail;
 
+import java.util.Collection;
+
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.TreeNode;
@@ -30,6 +34,7 @@ import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.model.IContextListener;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
 
 /**
@@ -46,6 +51,9 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
 
 	private DetailsViewer viewer;
 
+	//FIXME E4: this can be removed when working with E4 event system
+	private Object selectionProvidingPart;
+
 	/** {@inheritDoc} */
 	@Override
 	public void createViewer(Composite parent) {
@@ -55,21 +63,42 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
 	}
 
 	@Override
-    protected void selectionChanged_internal(IWorkbenchPart part, ISelection selection){
-	    if(AbstractUtility.getActiveEditor() == null && !(AbstractUtility.getActivePart() instanceof IConversationEnabled)){
+    protected void selectionChanged_internal(IWorkbenchPart workbenchPart, ISelection selection){
+	    Object part = workbenchPart;
+	    Object wrappedPart = AbstractUtility.getE4WrappedPart(part);
+	    if(wrappedPart!=null){
+	        part = wrappedPart;
+	    }
+	    if(AbstractUtility.getActiveE4Editor() == null && !(AbstractUtility.getActiveE4Part() instanceof IConversationEnabled)){
             showEmptyPage();
             return;
         }
 
-	    if(AbstractUtility.getActiveEditor() == null &&
-	            selection instanceof IStructuredSelection && ((IStructuredSelection) selection).getFirstElement() !=null){
-	        //special case where the details view still open with details about the closed object #5495
-	        showEmptyPage();
+	    //special case where the details view still open with details about the closed object #5495
+	    try{
+	        boolean isSelectionProvidingPartStillActive = false;
+	        if(selectionProvidingPart!=null){
+	            EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class);
+	            Collection<MPart> parts = partService.getParts();
+	            for (MPart mPart : parts) {
+	                if(selectionProvidingPart.equals(mPart.getObject())){
+	                    isSelectionProvidingPartStillActive = true;
+	                    break;
+	                }
+	            }
+	            if(!isSelectionProvidingPartStillActive &&
+	                    selection instanceof IStructuredSelection && ((IStructuredSelection) selection).getFirstElement() !=null){
+	                showEmptyPage();
+	                return;
+	            }
+	        }
+	    }catch(IllegalStateException e){
+	        //nothing
+	    }
+
+	    if(part == this){
 	        return;
 	    }
-        if(part == this){
-            return;
-        }
 
         if(!(selection instanceof IStructuredSelection)){
             return;
@@ -92,6 +121,7 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
                     return;
                 }
             }
+            selectionProvidingPart = part;
             showViewer(part, structuredSelection);
         }else{
             showEmptyPage();
@@ -122,6 +152,7 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
 
 	@Override
 	public void showEmptyPage() {
+	    selectionProvidingPart = null;
 	    viewer.setSelection(null);
 	    super.showEmptyPage();
 	}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
index 05e4199ba..6d0987bda 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
@@ -573,7 +573,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
         DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
         //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
-        if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
+        if(!(AbstractUtility.getActiveE4Part() instanceof IDerivedUnitFacadePart)){
             derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
         }
         addPart(derivedUnitGeneralDetailSection);
@@ -584,7 +584,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         addPart(derivedUnitBaseDetailSection);
 
         //for editors working with facades
-        if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
+        if(AbstractUtility.getActiveE4Part() instanceof IDerivedUnitFacadePart){
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
             GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
             addPart(gatheringEventDetailSection);
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java
index 8b9af2d3c..6df401482 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java
@@ -55,7 +55,7 @@ public class SupplementalDataViewPart extends AbstractCdmEditorViewPart {
 	/** {@inheritDoc} */
 	@Override
 	protected void selectionChanged_internal(IWorkbenchPart part, ISelection selection) {
-		if(AbstractUtility.getActiveEditor() == null){
+		if(AbstractUtility.getActiveE4Editor() == null){
 			showEmptyPage();
 			return;
 		}
