Project

General

Profile

Revision fa44b721

IDfa44b72197de1f9420b3443e20411df2671c0f8f
Parent a901ba1e
Child ff46c6ca

Added by Patrick Plitzner over 3 years ago

ref #6805 Add drag and drop from Feature Editor to FeatureTreeEditor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureNodeDropAdapter.java
15 15
import org.eclipse.swt.dnd.TransferData;
16 16

  
17 17
import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
18
import eu.etaxonomy.cdm.model.description.Feature;
18 19
import eu.etaxonomy.cdm.model.description.FeatureNode;
19 20
import eu.etaxonomy.cdm.model.description.FeatureTree;
21
import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
20 22
import eu.etaxonomy.taxeditor.featuretree.FeatureNodeTransfer;
21 23
import eu.etaxonomy.taxeditor.store.CdmStore;
22 24

  
......
64 66
			}
65 67
		}
66 68
		for (Object droppedObject : droppedObjects) {
67
			FeatureNode droppedNode = (FeatureNode) droppedObject;
68
			CdmStore.getService(IFeatureNodeService.class).moveFeatureNode(droppedNode.getUuid(), target.getUuid(), position);
69
			viewer.refresh();
70
			viewer.reveal(droppedNode);
69
		    if(droppedObject instanceof FeatureNode){
70
		        FeatureNode droppedNode = (FeatureNode) droppedObject;
71
		        CdmStore.getService(IFeatureNodeService.class).moveFeatureNode(droppedNode.getUuid(), target.getUuid(), position);
72
		        viewer.reveal(droppedNode);
73
		    }
74
		    else if(droppedObject instanceof Feature){
75
		        Feature droppedFeature = (Feature) droppedObject;
76
		        CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(target.getUuid(), droppedFeature.getUuid());
77

  
78
		    }
79
		    viewer.refresh();
71 80
		}
72 81
        this.dirtyable.setDirty(true);
73 82
		return true;
......
75 84

  
76 85
    @Override
77 86
    public boolean validateDrop(Object target, int operation, TransferData transferData) {
78
        return FeatureNodeTransfer.getInstance().isSupportedType(transferData);
87
        boolean isSupported = FeatureNodeTransfer.getInstance().isSupportedType(transferData);
88
        isSupported |= TermTransfer.getInstance().isSupportedType(transferData);
89
        isSupported &= getViewer().getInput()!=null;
90
        return isSupported;
79 91
    }
80 92

  
81 93
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditorComposite.java
26 26
import org.eclipse.swt.widgets.Tree;
27 27

  
28 28
import eu.etaxonomy.cdm.model.description.FeatureTree;
29
import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
29 30
import eu.etaxonomy.taxeditor.featuretree.FeatureNodeTransfer;
30 31
import eu.etaxonomy.taxeditor.featuretree.FeatureTreeContentProvider;
31 32
import eu.etaxonomy.taxeditor.featuretree.FeatureTreeLabelProvider;
......
114 115

  
115 116
        int ops = DND.DROP_COPY | DND.DROP_MOVE;
116 117
        Transfer[] transfers = new Transfer[] { FeatureNodeTransfer
117
                .getInstance() };
118
                .getInstance(), TermTransfer.getInstance() };
118 119
        if(dragSourceListener!=null){
119 120
            viewer.addDragSupport(ops, transfers, dragSourceListener);
120 121
        }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)