commit e461037f6e4ea8c4a18c9a54fd564adde1d66a8f
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Wed Aug 23 14:05:40 2017 +0200

    fix #6922 Migrate Term Editor

diff --git a/eu.etaxonomy.taxeditor.store/fragment.e4xmi b/eu.etaxonomy.taxeditor.store/fragment.e4xmi
index 373347fa8..f47dfaedd 100644
--- a/eu.etaxonomy.taxeditor.store/fragment.e4xmi
+++ b/eu.etaxonomy.taxeditor.store/fragment.e4xmi
@@ -39,6 +39,23 @@
         <children xsi:type="menu:HandledMenuItem" xmi:id="_BE4OUIcqEee-HITNnU9cVw" elementId="eu.etaxonomy.taxeditor.store.datasource.handledmenuitem.refresh" label="%command.label.11" command="_ShWvcIcuEee-HITNnU9cVw"/>
       </menus>
     </elements>
+    <elements xsi:type="basic:PartDescriptor" xmi:id="_YZ2J0IdPEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedTerm" label="%editor.name" allowMultiple="true" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4">
+      <handlers xmi:id="_87dsoIdPEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.CreateTermVocabularyHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.CreateTermVocabularyHandlerE4" command="_5mFFMIdPEeecZ4F2Y9Z0Og"/>
+      <handlers xmi:id="_b8sJAIdQEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.DeleteTermBaseHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.DeleteTermBaseHandlerE4" command="_Z_XgsIdQEeecZ4F2Y9Z0Og"/>
+      <handlers xmi:id="_B7cTkIfSEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.CreateDefinedTermHandlerE4.newDefinedTerm" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.CreateDefinedTermHandlerE4" command="_GTbAcIfSEeecZ4F2Y9Z0Og"/>
+      <handlers xmi:id="_NqtXEIfSEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.CreateDefinedTermHandlerE4.newKindOfTerm" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.CreateDefinedTermHandlerE4" command="_LMwG4IfSEeecZ4F2Y9Z0Og"/>
+      <handlers xmi:id="_rW41oIfeEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.OpenDefinedTermEditorHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.OpenDefinedTermEditorHandlerE4" command="_qEMrsIdPEeecZ4F2Y9Z0Og"/>
+      <menus xsi:type="menu:PopupMenu" xmi:id="_CoJioIdQEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.popupmenu.termeditor">
+        <children xsi:type="menu:Menu" xmi:id="_DR1Y0IdQEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.menulabel0" label="%menu.label.0">
+          <children xsi:type="menu:HandledMenuItem" xmi:id="_N22PsIdQEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabel12" label="%command.label.12" command="_5mFFMIdPEeecZ4F2Y9Z0Og"/>
+          <children xsi:type="menu:HandledMenuItem" xmi:id="_QOD-sIdQEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabel13" label="%command.label.13" command="_GTbAcIfSEeecZ4F2Y9Z0Og"/>
+          <children xsi:type="menu:HandledMenuItem" xmi:id="_R4pRMIdQEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.kindofterm" label="Kind Of Term" command="_LMwG4IfSEeecZ4F2Y9Z0Og">
+            <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_2G0O8IfREeecZ4F2Y9Z0Og" coreExpressionId="isShowExperimentalFeatures"/>
+          </children>
+        </children>
+        <children xsi:type="menu:HandledMenuItem" xmi:id="_W94ssIdQEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabel14" label="%command.label.14" command="_Z_XgsIdQEeecZ4F2Y9Z0Og"/>
+      </menus>
+    </elements>
   </fragments>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_3rW8wCXaEeex9MwMOgUeWw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:bulkeditor.menus.openmenu">
     <elements xsi:type="menu:HandledMenuItem" xmi:id="_K6sowCaGEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.details" label="%command.label.0" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/accessories-text-editor.png" command="_bnVKsCZxEeeQLpuomSmVoQ">
@@ -71,8 +88,24 @@
     <elements xsi:type="commands:Command" xmi:id="_yJiTkIctEee-HITNnU9cVw" elementId="eu.etaxonomy.taxeditor.store.datasource.create" commandName="%command.name.1"/>
     <elements xsi:type="commands:Command" xmi:id="_-g_YcIctEee-HITNnU9cVw" elementId="eu.etaxonomy.taxeditor.view.datasource.delete" commandName="%command.name.13"/>
     <elements xsi:type="commands:Command" xmi:id="_ShWvcIcuEee-HITNnU9cVw" elementId="eu.etaxonomy.taxeditor.store.datasource.update" commandName="%command.name.3"/>
+    <elements xsi:type="commands:Command" xmi:id="_qEMrsIdPEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.openDefinedTermEditor" commandName="%command.name.5"/>
+    <elements xsi:type="commands:Command" xmi:id="_5mFFMIdPEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedTerms.newTermVocabulary" commandName="%command.name.7"/>
+    <elements xsi:type="commands:Command" xmi:id="_Z_XgsIdQEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedTerms.delete" commandName="%command.name.14"/>
+    <elements xsi:type="commands:Command" xmi:id="_GTbAcIfSEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedTerms.newDefinedTerm" commandName="%command.name.6"/>
+    <elements xsi:type="commands:Command" xmi:id="_LMwG4IfSEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedTerms.newKindOfTerm" commandName="New kind-of term"/>
   </fragments>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
     <elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
+    <elements xsi:type="commands:Handler" xmi:id="_tyCPYIdPEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.handler.0" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.OpenDefinedTermEditorHandlerE4" command="_qEMrsIdPEeecZ4F2Y9Z0Og"/>
+  </fragments>
+  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window">
+    <elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="Term Editor">
+      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_Rk37AIfcEeecZ4F2Y9Z0Og" coreExpressionId="isCdmStoreConnected"/>
+      <children xsi:type="menu:DynamicMenuContribution" xmi:id="_HIptYIfUEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.dynamicmenucontribution.0" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermMenuE4"/>
+      <children xsi:type="menu:MenuSeparator" xmi:id="_yRINcIfqEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menuseparator.3"/>
+      <children xsi:type="menu:HandledMenuItem" xmi:id="_rwfDkIftEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.termEditorMenu.featureTreeEditor" label="Feature Tree Editor" command="_bnVKsCZxEeeQLpuomSmVoQ">
+        <parameters xmi:id="_3acJQIftEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.featureTreeEditor" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor"/>
+      </children>
+    </elements>
   </fragments>
 </fragment:ModelFragments>
diff --git a/eu.etaxonomy.taxeditor.store/plugin.xml b/eu.etaxonomy.taxeditor.store/plugin.xml
index efc41a5b3..615341c2c 100755
--- a/eu.etaxonomy.taxeditor.store/plugin.xml
+++ b/eu.etaxonomy.taxeditor.store/plugin.xml
@@ -247,31 +247,8 @@
         name="%view.name.8">
    	  </view>
    </extension>
-   <extension
-         point="org.eclipse.ui.editors">
-      <editor
-            class="eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor"
-            default="false"
-            id="eu.etaxonomy.taxeditor.editor.definedTerm"
-            name="%editor.name">
-      </editor>
-   </extension>
    <extension
          point="org.eclipse.ui.menus">
-      <menuContribution 
-         allPopups="false" 
-                 locationURI="menu:eu.etaxonomy.taxeditor.workbench.menu.window?before=eu.etaxonomy.taxeditor.application.windowMenu.last"> 
-           <dynamic 
-                    class="eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermMenu" 
-                   id="eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermMenu"> 
-              <visibleWhen 
-                      checkEnabled="true"> 
-                  <reference 
-                        definitionId="isCdmStoreConnected"> 
-                  </reference> 
-             </visibleWhen> 
-        </dynamic> 
-      </menuContribution>
       <menuContribution
             locationURI="menu:eu.etaxonomy.taxeditor.workbench.menu.file?after=eu.etaxonomy.taxeditor.application.filemenu.io">
          <command
@@ -413,50 +390,6 @@
             </control>
          </toolbar>
       </menuContribution>
-      <menuContribution
-            locationURI="popup:eu.etaxonomy.taxeditor.editor.definedTerm">
-         <menu
-               label="%menu.label.0">
-            <command
-                  commandId="eu.etaxonomy.taxeditor.editor.definedTerms.newTermVocabulary"
-                  label="%command.label.12"
-                  style="push">
-            </command>
-            <command
-                  commandId="eu.etaxonomy.taxeditor.editor.definedTerms.newDefinedTerm"
-                  label="%command.label.13"
-                  style="push">
-               <visibleWhen
-                     checkEnabled="true">
-                  <reference
-                        definitionId="isModifiable">
-                  </reference>
-               </visibleWhen>
-            </command>
-            <command
-                  commandId="eu.etaxonomy.taxeditor.editor.definedTerms.newKindOfTerm"
-                  label="Kind Of Term"
-                  style="push">
-               <visibleWhen
-                     checkEnabled="true">
-                  <reference
-                        definitionId="isShowExperimentalFeatures">
-                  </reference>
-               </visibleWhen>
-            </command>
-         </menu>
-         <command
-               commandId="eu.etaxonomy.taxeditor.editor.definedTerms.delete"
-               label="%command.label.14"
-               style="push">
-            <visibleWhen
-                  checkEnabled="true">
-               <reference
-                     definitionId="isModifiable">
-               </reference>
-            </visibleWhen>
-         </command>
-      </menuContribution>
    </extension>
    <extension
          point="org.eclipse.ui.handlers">
@@ -541,31 +474,6 @@
             id="eu.etaxonomy.taxeditor.store.operations.reconnect"
             name="%command.name.RE_CONNECT">
       </command>
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.editor.definedterm.handler.OpenDefinedTermEditorHandler"
-            id="eu.etaxonomy.taxeditor.store.openDefinedTermEditor"
-            name="%command.name.5">
-         <commandParameter
-               id="eu.etaxonomy.taxeditor.store.openDefinedTermEditor.termTypeUuid"
-               name="%commandParameter.name.0"
-               optional="true">
-         </commandParameter>
-      </command>
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.editor.definedterm.handler.CreateDefinedTermHandler"
-            id="eu.etaxonomy.taxeditor.editor.definedTerms.newDefinedTerm"
-            name="%command.name.6">
-      </command>
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.editor.definedterm.handler.CreateDefinedTermHandler"
-            id="eu.etaxonomy.taxeditor.editor.definedTerms.newKindOfTerm"
-            name="New kind-of term">
-      </command>
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.editor.definedterm.handler.CreateTermVocabularyHandler"
-            id="eu.etaxonomy.taxeditor.editor.definedTerms.newTermVocabulary"
-            name="%command.name.7">
-      </command>
       <command
             id="eu.etaxonomy.taxeditor.store.openPasswordWizzard"
             name="%command.name.10">
@@ -579,11 +487,6 @@
             id="eu.etaxonomy.taxeditor.datasource.connect"
             name="%command.name.12">
       </command>
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.editor.definedterm.handler.DeleteTermBaseHandler"
-            id="eu.etaxonomy.taxeditor.editor.definedTerms.delete"
-            name="%command.name.14">
-      </command>
       <command
             defaultHandler="eu.etaxonomy.taxeditor.handler.OpenInspectSessionsHandler"
             id="eu.etaxonomy.taxeditor.store.open.InspectSessionsDialog"
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermDragListenerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermDragListenerE4.java
new file mode 100644
index 000000000..08d8b4b09
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermDragListenerE4.java
@@ -0,0 +1,65 @@
+/**
+* Copyright (C) 2009 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.definedterm.e4;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.dnd.DragSourceAdapter;
+import org.eclipse.swt.dnd.DragSourceEvent;
+
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 22, 2017
+ *
+ */
+public class DefinedTermDragListenerE4 extends DragSourceAdapter {
+
+	private Viewer viewer;
+
+	public DefinedTermDragListenerE4(Viewer viewer) {
+		this.viewer = viewer;
+	}
+
+	@Override
+	public void dragStart(DragSourceEvent event) {
+	    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+	    List list = selection.toList();
+	    for (Object object : list) {
+            if(!(object instanceof DefinedTermBase)){
+                event.doit = false;
+                return;
+            }
+        }
+		event.doit = true;
+	}
+
+	@Override
+	public void dragSetData(DragSourceEvent event) {
+
+		IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+		List<DefinedTermBase> definedTerms = new ArrayList<DefinedTermBase>();
+
+		for (Object object : selection.toList()){
+				definedTerms.add((DefinedTermBase)object);
+			}
+
+		if (TermTransfer.getInstance().isSupportedType(
+				event.dataType)) {
+			event.data = definedTerms.toArray(new DefinedTermBase[definedTerms.size()]);
+		}
+	}
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermDropAdapterE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermDropAdapterE4.java
new file mode 100644
index 000000000..afe20ea94
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermDropAdapterE4.java
@@ -0,0 +1,90 @@
+/**
+* Copyright (C) 2009 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.definedterm.e4;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.TransferData;
+
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.OrderedTermBase;
+import eu.etaxonomy.cdm.model.common.TermBase;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
+import eu.etaxonomy.taxeditor.editor.definedterm.operation.MoveDefinedTermOperation;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 22, 2017
+ *
+ */
+public class DefinedTermDropAdapterE4 extends ViewerDropAdapter {
+
+	private final DefinedTermEditorE4 editor;
+
+	protected DefinedTermDropAdapterE4(DefinedTermEditorE4 editor) {
+		super(editor.getViewer());
+		this.editor = editor;
+	}
+
+	@Override
+	public boolean performDrop(Object data) {
+
+		TermBase target = (TermBase) getCurrentTarget();//can be vocab
+		int currentLocation = getCurrentLocation();
+		Object[] droppedTerms = (Object[]) data;
+		Collection<DefinedTermBase> sourceTerms = new ArrayList<DefinedTermBase>(); //Arrays.asList(droppedElements)
+
+		for (Object droppedTerm : droppedTerms) {
+			DefinedTermBase term = (DefinedTermBase) droppedTerm;
+			sourceTerms.add(term);
+		}
+
+		AbstractPostOperation operation = new MoveDefinedTermOperation("Move Descriptions",
+		        StoreUtil.getUndoContext(),
+		        target,
+		        sourceTerms,
+		        editor,
+		        currentLocation);
+		//TODO: implement execute
+		StoreUtil.executeOperation(operation);
+		// select the newly moved objects
+		editor.getViewer().setSelection(new StructuredSelection(sourceTerms.toArray(new TermBase[sourceTerms.size()])));
+
+		return true;
+	}
+
+	@Override
+	public boolean validateDrop(Object target, int operation,
+			TransferData transferType) {
+		boolean transferDataIsSupported = TermTransfer.getInstance().isSupportedType(transferType);
+		// maybe don't need this - they will be all TermBase anyway
+		return target instanceof TermBase && transferDataIsSupported;
+	}
+
+	@Override
+	public void dragOver(DropTargetEvent event) {
+	    super.dragOver(event);
+	    TermBase target = (TermBase) getCurrentTarget();
+	    if(!(target instanceof OrderedTermBase)) {
+	        // this is to only disable insert between items
+	        event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL;
+	    }
+
+
+	}
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermEditorE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermEditorE4.java
new file mode 100644
index 000000000..632abc33d
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermEditorE4.java
@@ -0,0 +1,218 @@
+/**
+ * Copyright (C) 2009 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.editor.definedterm.e4;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
+import org.eclipse.e4.ui.di.Focus;
+import org.eclipse.e4.ui.di.Persist;
+import org.eclipse.e4.ui.model.application.ui.MDirtyable;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.OrderedTermBase;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermContentProvider;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermLabelProvider;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
+import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 22, 2017
+ *
+ */
+public class DefinedTermEditorE4 implements IConversationEnabled, IDirtyMarkable, IPostOperationEnabled {
+
+	public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.store.openDefinedTermEditor";
+
+	protected TreeViewer viewer;
+
+	protected ConversationHolder conversation;
+
+    @Inject
+    private ESelectionService selService;
+
+    @Inject
+    private MDirtyable dirty;
+
+    private ISelectionChangedListener selectionChangedListener;
+	private final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
+
+    private TermEditorInput input =null;
+
+	@Inject
+	public DefinedTermEditorE4() {
+	}
+
+	@PostConstruct
+	public void createPartControl(Composite parent, EMenuService menuService) {
+	    if (CdmStore.isActive()){
+            if(conversation == null){
+                conversation = CdmStore.createConversation();
+            }
+        }
+        else{
+            return;
+        }
+	    FillLayout layout = new FillLayout();
+	    layout.marginHeight = 0;
+	    layout.marginWidth = 0;
+	    layout.type = SWT.VERTICAL;
+
+	    parent.setLayout(layout);
+	    viewer = new TreeViewer(parent);
+	    viewer.getControl().setLayoutData(LayoutConstants.FILL());
+	    viewer.setContentProvider(new TermContentProvider());
+	    viewer.setLabelProvider(new TermLabelProvider());
+	    viewer.setSorter(new DefinedTermSorter());
+
+	    Transfer[] transfers = new Transfer[] { TermTransfer.getInstance() };
+	    viewer.addDragSupport(dndOperations, transfers, new DefinedTermDragListenerE4(viewer));
+	    viewer.addDropSupport(dndOperations, transfers, new DefinedTermDropAdapterE4(this));
+
+	    //FIXME E4 migrate
+	    //			setPartName(getEditorInput().getName());
+
+	    //propagate selection
+	    selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event)));
+	    viewer.addSelectionChangedListener(selectionChangedListener);
+
+	    //create context menu
+	    menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.store.popupmenu.termeditor");
+
+	}
+
+	@Override
+	public boolean postOperation(CdmBase objectAffectedByOperation) {
+		viewer.refresh();
+
+		if(objectAffectedByOperation != null){
+			viewer.setSelection(new StructuredSelection(objectAffectedByOperation));
+		}
+		setDirty(true);
+
+		return true;
+	}
+
+	public void init(TermEditorInput input){
+	    this.input = input;
+
+        input.initialiseVocabularies();
+        viewer.setInput(input.getVocabularies());
+	}
+
+	@Persist
+	public void doSave() {
+		getConversationHolder().commit();
+		input.merge();
+		setDirty(false);
+		input.initialiseVocabularies();
+		viewer.refresh();
+	}
+
+	public boolean isDirty() {
+		return dirty.isDirty();
+	}
+
+	@Focus
+	public void setFocus() {
+	    viewer.getControl().setFocus();
+		getConversationHolder().bind();
+		if(input!=null){
+		    input.bind();
+		}
+	}
+
+	@Override
+	public void update(CdmDataChangeMap changeEvents) {
+	}
+
+	@Override
+	public ConversationHolder getConversationHolder() {
+		return conversation;
+	}
+
+	@Override
+	public void changed(Object element) {
+		setDirty(true);
+		viewer.update(element, null);
+	}
+
+	@Override
+	public void forceDirty() {
+	    changed(null);
+	}
+
+	public void setDirty(boolean dirty) {
+		this.dirty.setDirty(dirty);
+	}
+
+	@Override
+	public boolean onComplete() {
+		return false;
+	}
+
+	public TreeViewer getViewer() {
+		return viewer;
+	}
+
+	private class DefinedTermSorter extends ViewerSorter {
+
+	    @Override
+	    public int compare(Viewer viewer, Object e1, Object e2) {
+	        // the comparison value in this method determines the
+	        // location <-> add term method used in the MoveDefinedTermOperation
+	        // execute call
+	        if(e1 instanceof OrderedTermBase && e2 instanceof OrderedTermBase) {
+	            OrderedTermBase otbe1 = (OrderedTermBase)e1;
+	            OrderedTermBase otbe2 = (OrderedTermBase)e2;
+	            if(otbe1.getOrderIndex() == otbe2.getOrderIndex()) {
+	                return 0;
+	            } else if (otbe1.getOrderIndex() < otbe2.getOrderIndex()){
+	            	return -1;
+	            } else{
+	            	return 1;
+	            }
+	        } else {
+	            return super.compare(viewer, e1, e2);
+	        }
+	    }
+	}
+
+	@PreDestroy
+	public void dispose() {
+	    input.dispose();
+	}
+
+    public TermEditorInput getDefinedTermEditorInput() {
+        return input;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermMenuE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermMenuE4.java
new file mode 100644
index 000000000..d133ff033
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermMenuE4.java
@@ -0,0 +1,204 @@
+/**
+* Copyright (C) 2009 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.definedterm.e4;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.ui.di.AboutToShow;
+import org.eclipse.e4.ui.model.application.commands.MCommand;
+import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * Menu to dynamically generate menu (sub-menu) contribution items
+ * for term types which when clicked open the defined term editor for the chosen term type
+ *
+ * @author pplitzner
+ * @since Aug 23, 2017
+ *
+ */
+public class DefinedTermMenuE4 {
+
+    private static final String COMMAND_ID = "eu.etaxonomy.taxeditor.store.openDefinedTermEditor";
+
+    /** {@inheritDoc} */
+    @AboutToShow
+    public void aboutToShow(List<MMenuElement> items, @Named(IServiceConstants.ACTIVE_SELECTION) Object selection) {
+
+        if(CdmStore.isActive()){
+
+            //add Feature and NamedArea to top level
+            addChildTermsToMenuManager(items, TermType.Feature);
+            addChildTermsToMenuManager(items, TermType.NamedArea);
+            items.add(MMenuFactory.INSTANCE.createMenuSeparator());
+
+            MMenu otherMenu = MMenuFactory.INSTANCE.createMenu();
+            otherMenu.setLabel(Messages.DefinedTermMenu_OTHERS);
+            items.add(otherMenu);
+
+            //FIXME E4: This should be removed during e4 migration. dynamic menu should be declared in model fragment
+            items.add(MMenuFactory.INSTANCE.createMenuSeparator());
+//            createFeatureTreeMenuItem(menu);
+
+            List<TermType> ttList = new ArrayList<TermType>(EnumSet.allOf(TermType.class));
+            Collections.sort(ttList,new SortByTermTypeMessage());
+            for (TermType tt : ttList)
+            {
+                //skip Feature and NamedArea as they have already been added to top level
+                if(tt.equals(TermType.Feature) || tt.equals(TermType.NamedArea)){
+                    continue;
+                }
+                // if term type has a parent, do not add it
+                // it will be added in the recursive call
+                if(tt.getKindOf() == null) {
+                    addChildTermsToMenuManager(otherMenu.getChildren(), tt);
+                }
+            }
+        }
+	}
+
+    private void addChildTermsToMenuManager(List<MMenuElement> items, TermType termType) {
+
+        //FIXME : need a better way to find out if a term type can be editable (ticket 3853)
+        if(termType.getEmptyDefinedTermBase() != null) {
+            Set<TermType> children = termType.getGeneralizationOf();
+            // term type has no children, so create menu item
+            if(children.isEmpty()) {
+                items.add(createMenuItem(termType));
+            }
+            else{
+                MMenu subMenu = MMenuFactory.INSTANCE.createMenu();
+                subMenu.setLabel(termType.getMessage(PreferencesUtil.getGlobalLanguage()));
+                items.add(subMenu);
+                // term type has children, so create sub menu
+                subMenu.getChildren().add(createDefaultMenuItem(termType));
+
+                subMenu.getChildren().add(MMenuFactory.INSTANCE.createMenuSeparator());
+
+                // add child items to the sub menu
+                for(TermType tt : children) {
+                    addChildTermsToMenuManager(subMenu.getChildren(), tt);
+                }
+            }
+        }
+
+    }
+
+	private MHandledMenuItem createMenuItem(TermType termType) {
+
+	    MHandledMenuItem menuItem = MMenuFactory.INSTANCE.createHandledMenuItem();
+        menuItem.setLabel(termType.getMessage());
+        MCommand mCommand = MCommandsFactory.INSTANCE.createCommand();
+        mCommand.setElementId(COMMAND_ID);
+
+        //set params
+        menuItem.getTransientData().put(COMMAND_ID+".termTypeUuid", termType.getUuid());
+
+        menuItem.setCommand(mCommand);
+        return menuItem;
+	}
+
+	private void createFeatureTreeMenuItem() {
+
+//	       String commandId = "eu.etaxonomy.taxeditor.workbench.commandparameter.partName";
+//
+//	       MDirectMenuItem directMenuItem = MMenuFactory.INSTANCE.createDirectMenuItem();
+//	       directMenuItem.
+//	        MHandledMenuItem menuItem = MMenuFactory.INSTANCE.createHandledMenuItem();
+//	        menuItem.setLabel(Messages.DefinedTermMenu_FEATURE_TREE);
+//	        MCommand mCommand = MCommandsFactory.INSTANCE.createCommand();
+//	        mCommand.setElementId(commandId);
+//	        mCommand.getParameters().add(MCommandsFactory.INSTANCE.createCommandParameter().);
+//
+//	        MCommandParameter commandParameter = MCommandsFactory.INSTANCE.createCommandParameter();
+//	        commandParameter.setName("eu.etaxonomy.taxeditor.workbench.commandparameter.partName");
+//	        commandParameter.set
+//
+//	        //set params
+//	        menuItem.getTransientData().put(commandId+"termTypeUuid", termType.getUuid());
+//
+//	        menuItem.setCommand(mCommand);
+//	        menu.getChildren().add(menuItem);
+//
+//
+//		Map<String, String> params = new HashMap<String, String>();
+//		params.put("eu.etaxonomy.taxeditor.workbench.commandparameter.partName", //$NON-NLS-1$
+//				"eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor"); //$NON-NLS-1$
+//
+//        CommandContributionItemParameter p = new CommandContributionItemParameter(
+//                PlatformUI.getWorkbench(),
+//                "eu.etaxonomy.taxeditor.featuretree.commandContributionItemParameter", //$NON-NLS-1$
+//                "eu.etaxonomy.taxeditor.command.openPart", //$NON-NLS-1$
+//                params,
+//                null,
+//                null,
+//                null,
+//                Messages.DefinedTermMenu_FEATURE_TREE,
+//                "", //$NON-NLS-1$
+//                "", //$NON-NLS-1$
+//                SWT.PUSH,
+//                "", //$NON-NLS-1$
+//                true);
+//
+//
+//
+//        CommandContributionItem item = new CommandContributionItem(p);
+//        return item;
+
+	}
+
+	private MHandledMenuItem createDefaultMenuItem(TermType termType) {
+
+        MHandledMenuItem menuItem = MMenuFactory.INSTANCE.createHandledMenuItem();
+        menuItem.setLabel(String.format(Messages.DefinedTermMenu_OTHER_S, termType.getMessage()));
+        MCommand mCommand = MCommandsFactory.INSTANCE.createCommand();
+        mCommand.setElementId(COMMAND_ID);
+
+        //set params
+        menuItem.getTransientData().put(COMMAND_ID+".termTypeUuid", termType.getUuid());
+
+        menuItem.setCommand(mCommand);
+
+        return menuItem;
+	}
+
+	private class SortByTermTypeMessage implements Comparator<TermType> {
+	    @Override
+        public int compare(TermType t1, TermType t2) {
+	        if (t1.equals(t2)){
+	            return 0;
+	        }
+	        int result = t1.getMessage().compareTo(t2.getMessage());
+	        if (result == 0){
+	            return t1.compareTo(t2);
+	        }
+	        return result;
+	    }
+	}
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/CreateDefinedTermHandlerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/CreateDefinedTermHandlerE4.java
new file mode 100644
index 000000000..c67e4babf
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/CreateDefinedTermHandlerE4.java
@@ -0,0 +1,90 @@
+/**
+ * Copyright (C) 2009 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.editor.definedterm.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.Marker;
+import eu.etaxonomy.cdm.model.common.MarkerType;
+import eu.etaxonomy.cdm.model.common.TermBase;
+import eu.etaxonomy.cdm.model.common.TermVocabulary;
+import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4;
+import eu.etaxonomy.taxeditor.editor.definedterm.operation.CreateDefinedTermOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 22, 2017
+ *
+ */
+public class CreateDefinedTermHandlerE4 {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
+            @Optional@Named(IServiceConstants.ACTIVE_SELECTION) TermBase termBase, MHandledMenuItem menuItem) throws NotDefinedException {
+
+        DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) activePart.getObject();
+
+        boolean addTermAsKindOf =
+                menuItem.getCommand().getElementId().equals("eu.etaxonomy.taxeditor.editor.definedTerms.newKindOfTerm")?true:false;
+
+        String label = menuItem.getLocalizedLabel();
+        IUndoContext undoContext = StoreUtil.getUndoContext();
+
+        AbstractPostOperation operation =
+                new CreateDefinedTermOperation(label,
+                        undoContext,
+                        termBase,
+                        termEditor.getDefinedTermEditorInput(),
+                        termEditor, addTermAsKindOf);
+        AbstractUtility.executeOperation(operation);
+
+    }
+
+    @CanExecute
+    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION) TermBase termBase){
+        if (termBase == null){
+            return true;
+        }
+
+        TermVocabulary vocabulary = null;
+
+        if(termBase instanceof DefinedTermBase){
+            vocabulary = ((DefinedTermBase) termBase).getVocabulary();
+        }else if(termBase instanceof TermVocabulary){
+            vocabulary = (TermVocabulary) termBase;
+        }
+
+        if(vocabulary == null){
+            return true;
+        }
+
+        for(Marker vocabularyMarker : vocabulary.getMarkers()){
+            if(vocabularyMarker.getMarkerType().equals(MarkerType.MODIFIABLE())){
+                return vocabularyMarker.getValue();
+            }
+        }
+
+        return true;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/CreateTermVocabularyHandlerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/CreateTermVocabularyHandlerE4.java
new file mode 100644
index 000000000..8cf06f13d
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/CreateTermVocabularyHandlerE4.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (C) 2009 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.editor.definedterm.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.common.TermBase;
+import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4;
+import eu.etaxonomy.taxeditor.editor.definedterm.operation.CreateTermVocabularyOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 22, 2017
+ *
+ */
+public class CreateTermVocabularyHandlerE4 {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
+            @Optional@Named(IServiceConstants.ACTIVE_SELECTION) TermBase termBase, MMenuItem menuItem) throws NotDefinedException {
+
+        DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) activePart.getObject();
+
+        String label = menuItem.getLocalizedLabel();
+        IUndoContext undoContext = StoreUtil.getUndoContext();
+
+        AbstractPostOperation operation =
+                new CreateTermVocabularyOperation(label,
+                        undoContext,
+                        termEditor.getDefinedTermEditorInput(),
+                        termEditor);
+        AbstractUtility.executeOperation(operation);
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/DeleteTermBaseHandlerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/DeleteTermBaseHandlerE4.java
new file mode 100644
index 000000000..1853883af
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/DeleteTermBaseHandlerE4.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright (C) 2009 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.editor.definedterm.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.Marker;
+import eu.etaxonomy.cdm.model.common.MarkerType;
+import eu.etaxonomy.cdm.model.common.TermBase;
+import eu.etaxonomy.cdm.model.common.TermVocabulary;
+import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4;
+import eu.etaxonomy.taxeditor.editor.definedterm.operation.DeleteTermBaseOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 22, 2017
+ *
+ */
+public class DeleteTermBaseHandlerE4 {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
+            @Optional@Named(IServiceConstants.ACTIVE_SELECTION) TermBase termBase, MMenuItem menuItem) throws NotDefinedException {
+
+        DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) activePart.getObject();
+
+        if (termEditor.isDirty()){
+            boolean proceed = MessageDialog.openQuestion(null,
+                    "Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?");
+            if (proceed) {
+                termEditor.doSave();
+            } else {
+                return;
+            }
+        }
+        String label = menuItem.getLocalizedLabel();
+        IUndoContext undoContext = StoreUtil.getUndoContext();
+        AbstractPostOperation operation =
+                new DeleteTermBaseOperation(label,
+                        undoContext,
+                        termBase,
+                        termEditor.getDefinedTermEditorInput(),
+                        termEditor);
+        AbstractUtility.executeOperation(operation);
+    }
+
+    @CanExecute
+    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION) TermBase termBase){
+        if (termBase == null){
+            return true;
+        }
+
+        TermVocabulary vocabulary = null;
+
+        if(termBase instanceof DefinedTermBase){
+            vocabulary = ((DefinedTermBase) termBase).getVocabulary();
+        }else if(termBase instanceof TermVocabulary){
+            vocabulary = (TermVocabulary) termBase;
+        }
+
+        if(vocabulary == null){
+            return true;
+        }
+
+        for(Marker vocabularyMarker : vocabulary.getMarkers()){
+            if(vocabularyMarker.getMarkerType().equals(MarkerType.MODIFIABLE())){
+                return vocabularyMarker.getValue();
+            }
+        }
+
+        return true;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/OpenDefinedTermEditorHandlerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/OpenDefinedTermEditorHandlerE4.java
new file mode 100644
index 000000000..99776ec20
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/OpenDefinedTermEditorHandlerE4.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright (C) 2009 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+
+package eu.etaxonomy.taxeditor.editor.definedterm.e4.handler;
+import java.util.UUID;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4;
+import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
+
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 22, 2017
+ *
+ */
+public class OpenDefinedTermEditorHandlerE4 {
+
+	@Execute
+	public void execute(EPartService partService, MHandledMenuItem menuItem) {
+
+	    String commandId = menuItem.getCommand().getElementId();
+        UUID termTypeUuid = (UUID) menuItem.getTransientData().get(commandId+".termTypeUuid");
+
+		TermEditorInput termEditorInput = new TermEditorInput(TermType.getByUuid(termTypeUuid));
+		MPart mPart = partService.showPart("eu.etaxonomy.taxeditor.editor.definedTerm", PartState.ACTIVATE);
+		DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) mPart.getObject();
+		termEditor.init(termEditorInput);
+	}
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/DeleteTermBaseOperation.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/DeleteTermBaseOperation.java
index d49c2f695..91f55ab6d 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/DeleteTermBaseOperation.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/DeleteTermBaseOperation.java
@@ -22,7 +22,7 @@ import eu.etaxonomy.cdm.api.service.IVocabularyService;
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
 import eu.etaxonomy.cdm.model.common.TermBase;
 import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;
+import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4;
 import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
@@ -39,12 +39,7 @@ public class DeleteTermBaseOperation extends AbstractPostTaxonOperation {
 
 	private final TermEditorInput definedEditorInput;
 	private final TermBase termBase;
-	private DefinedTermEditor definedTermEditor;
-	/**
-	 * @param label
-	 * @param undoContext
-	 * @param postOperationEnabled
-	 */
+
 	public DeleteTermBaseOperation(String label,
 			IUndoContext undoContext,
 			TermBase termBase,
@@ -55,15 +50,9 @@ public class DeleteTermBaseOperation extends AbstractPostTaxonOperation {
 		this.definedEditorInput = definedEditorInput;
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-	 */
 	@Override
 	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
 			throws ExecutionException {
-
-
-
 		if (termBase instanceof TermVocabulary) {
 			if (((TermVocabulary)termBase).getCreatedBy() == null) {
 				IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "This is a CDM system vocabulary");
@@ -134,9 +123,6 @@ public class DeleteTermBaseOperation extends AbstractPostTaxonOperation {
 		return postExecute(termBase);
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-	 */
 	@Override
 	public IStatus redo(IProgressMonitor monitor, IAdaptable info)
 			throws ExecutionException {
@@ -144,9 +130,6 @@ public class DeleteTermBaseOperation extends AbstractPostTaxonOperation {
 		return null;
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
-	 */
 	@Override
 	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
 			throws ExecutionException {
