avoid NPE when using new node as parent for d&d
authorKatja Luther <k.luther@bgbm.org>
Fri, 4 Dec 2020 09:58:42 +0000 (10:58 +0100)
committerKatja Luther <k.luther@bgbm.org>
Fri, 4 Dec 2020 12:34:56 +0000 (13:34 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeDtoDropAdapter.java

index eaf93e032e9b55cc86e1f2f0c7d5af52280f86a1..11d668cb90668db2b6aaa8ea9ac31dfdd971c091 100755 (executable)
@@ -37,7 +37,6 @@ import eu.etaxonomy.taxeditor.featuretree.e4.operation.AddOntologyTermOperation;
 import eu.etaxonomy.taxeditor.featuretree.e4.operation.MoveFeatureOperation;
 import eu.etaxonomy.taxeditor.l10n.Messages;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.TermVocabularySelectionDialog;
 import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.OntologyTermWrapper;
 
@@ -133,10 +132,9 @@ public class FeatureTreeDtoDropAdapter extends ViewerDropAdapter {
                 }
                    }
                    if(droppedObject instanceof TermNodeDto){
-                       if (((TermNodeDto)droppedObject).getUuid() == null){
-                           if(StoreUtil.promptCheckIsDirty(editor)){
-                               return false;
-                           }
+                       if (((TermNodeDto)droppedObject).getUuid() == null || target.getUuid() == null){
+                           MessagingUtils.warningDialog("The new imported node needs to be saved first", this, "Newly created nodes can not be moved or used as parent without saving");
+                           return false;
                        }
                        TermNodeDto droppedNode = editor.getNodeDtoForUuid(((TermNodeDto) droppedObject).getUuid());
                        TermNodeDto oldParent = editor.getNodeDtoForUuid(droppedNode.getParentUuid());