1
|
/**
|
2
|
* Copyright (C) 2017 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.editor.workingSet;
|
10
|
|
11
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
12
|
import org.eclipse.jface.viewers.TreeViewer;
|
13
|
import org.eclipse.swt.dnd.DragSourceEvent;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.description.FeatureNode;
|
16
|
import eu.etaxonomy.taxeditor.featuretree.FeatureNodeTransfer;
|
17
|
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureNodeDragListener;
|
18
|
|
19
|
/**
|
20
|
* @author pplitzner
|
21
|
* @since Jun 2, 2017
|
22
|
*
|
23
|
*/
|
24
|
public class CharacterDragListener extends FeatureNodeDragListener {
|
25
|
|
26
|
private TreeViewer structureViewer;
|
27
|
private TreeViewer propertyViewer;
|
28
|
|
29
|
/**
|
30
|
* @param propertyViewer
|
31
|
*/
|
32
|
public CharacterDragListener(TreeViewer structureViewer, TreeViewer propertyViewer) {
|
33
|
super(propertyViewer);
|
34
|
this.structureViewer = structureViewer;
|
35
|
this.propertyViewer = propertyViewer;
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* {@inheritDoc}
|
40
|
*/
|
41
|
@Override
|
42
|
public void dragSetData(DragSourceEvent event) {
|
43
|
FeatureNode structure = (FeatureNode) ((IStructuredSelection) structureViewer.getSelection()).getFirstElement();
|
44
|
FeatureNode property = (FeatureNode) ((IStructuredSelection) propertyViewer.getSelection()).getFirstElement();
|
45
|
FeatureNode[] character = new FeatureNode[2];
|
46
|
character[0] = structure;
|
47
|
character[1] = property;
|
48
|
if (FeatureNodeTransfer.getInstance().isSupportedType(event.dataType)) {
|
49
|
event.data = character;
|
50
|
}
|
51
|
}
|
52
|
|
53
|
}
|