commit 7b1abbc3dfc350ea2c3e21bfc5b3989d1b51963a
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Mon Mar 18 09:40:50 2019 +0100

    Fix term type check for feature drop adapter

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeDropAdapter.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeDropAdapter.java
index c5c7b22bb..ddba0518c 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeDropAdapter.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeDropAdapter.java
@@ -20,13 +20,13 @@ import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerDropAdapter;
 import org.eclipse.swt.dnd.TransferData;
 
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.term.FeatureNode;
+import eu.etaxonomy.cdm.model.term.FeatureTree;
 import eu.etaxonomy.cdm.model.term.IHasTermType;
 import eu.etaxonomy.cdm.model.term.OrderedTermVocabulary;
 import eu.etaxonomy.cdm.model.term.TermType;
 import eu.etaxonomy.cdm.model.term.TermVocabulary;
-import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.term.FeatureNode;
-import eu.etaxonomy.cdm.model.term.FeatureTree;
 import eu.etaxonomy.cdm.persistence.dto.TermDto;
 import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
 import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermDropAdapterE4;
@@ -110,12 +110,16 @@ public class FeatureTreeDropAdapter extends ViewerDropAdapter {
 		for (Object droppedObject : droppedObjects) {
 		    //check term type compatibility
 		    TermType targetType = target.getTermType();
+		    TermType droppedType = null;
 		    if(droppedObject instanceof IHasTermType){
-		        TermType droppedType = ((IHasTermType)droppedObject).getTermType();
-		        if(!droppedType.equals(targetType)){
-                    MessagingUtils.warningDialog(DefinedTermDropAdapterE4.TERM_TYPE_ERROR_TITLE, this, DefinedTermDropAdapterE4.TERM_TYPE_ERROR_MESSAGE);
-		            continue;
-		        }
+		        droppedType = ((IHasTermType)droppedObject).getTermType();
+		    }
+		    else if(droppedObject instanceof TermDto){
+		        droppedType = ((TermDto)droppedObject).getTermType();
+		    }
+		    if(droppedType!=null && !droppedType.equals(targetType)){
+		        MessagingUtils.warningDialog(DefinedTermDropAdapterE4.TERM_TYPE_ERROR_TITLE, this, DefinedTermDropAdapterE4.TERM_TYPE_ERROR_MESSAGE);
+		        continue;
 		    }
 		    if(droppedObject instanceof FeatureNode){
 		        FeatureNode droppedNode = (FeatureNode) droppedObject;
@@ -134,22 +138,16 @@ public class FeatureTreeDropAdapter extends ViewerDropAdapter {
 		        AbstractUtility.executeOperation(operation, sync);
 		    }
 		    else if(droppedObject instanceof TermDto){
-		            TermDto termDto = (TermDto) droppedObject;
-		            // check if a feature or sub type is dropped
-		            if(termDto.getTermType().equals(TermType.Feature) || termDto.getTermType().isKindOf(TermType.Feature)){
-		                // check if target feature tree has the same type as the dropped term
-		                if(!termDto.getTermType().equals(targetType)){
-		                    MessagingUtils.warningDialog(DefinedTermDropAdapterE4.TERM_TYPE_ERROR_TITLE, this, DefinedTermDropAdapterE4.TERM_TYPE_ERROR_MESSAGE);
-		                    continue;
-		                }
-		                AddFeatureOperation operation = new AddFeatureOperation(
-		                        termDto.getUuid(),
-		                        target, position, editor, editor);
-		                AbstractUtility.executeOperation(operation, sync);
-		            }
-		            else{
-		                MessagingUtils.warningDialog(DefinedTermDropAdapterE4.MOVE_FAILED, this, Messages.FeatureTreeDropAdapter_ONLY_MOVE_FEATURES);
-		            }
+		        TermDto termDto = (TermDto) droppedObject;
+		        // check if target feature tree has the same type as the dropped term
+		        if(!termDto.getTermType().equals(targetType)){
+		            MessagingUtils.warningDialog(DefinedTermDropAdapterE4.TERM_TYPE_ERROR_TITLE, this, DefinedTermDropAdapterE4.TERM_TYPE_ERROR_MESSAGE);
+		            continue;
+		        }
+		        AddFeatureOperation operation = new AddFeatureOperation(
+		                termDto.getUuid(),
+		                target, position, editor, editor);
+		        AbstractUtility.executeOperation(operation, sync);
 		    }
 		    else if(droppedObject instanceof OntologyTermWrapper){
 		        OntologyTermWrapper wrapper = (OntologyTermWrapper)droppedObject;
