Revision 9092e20b
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureNodeDragListener.java | ||
---|---|---|
30 | 30 |
@Override |
31 | 31 |
public void dragSetData(DragSourceEvent event) { |
32 | 32 |
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); |
33 |
FeatureNode[] featureNodes = (FeatureNode[]) selection.toList().toArray(new FeatureNode[selection.size()]); |
|
34 |
if (FeatureNodeTransfer.getInstance().isSupportedType(event.dataType)) { |
|
35 |
event.data = featureNodes; |
|
33 |
if(selection!=null && !selection.isEmpty()){ |
|
34 |
FeatureNode[] featureNodes = (FeatureNode[]) selection.toList().toArray(new FeatureNode[selection.size()]); |
|
35 |
if (FeatureNodeTransfer.getInstance().isSupportedType(event.dataType)) { |
|
36 |
event.data = featureNodes; |
|
37 |
} |
|
36 | 38 |
} |
37 | 39 |
} |
38 | 40 |
|
... | ... | |
41 | 43 |
*/ |
42 | 44 |
@Override |
43 | 45 |
public void dragStart(DragSourceEvent event) { |
44 |
event.doit = !viewer.getSelection().isEmpty(); |
|
46 |
event.doit = !viewer.getSelection().isEmpty() |
|
47 |
&& ((IStructuredSelection) viewer.getSelection()).toList() |
|
48 |
.stream().allMatch(element -> element instanceof FeatureNode); |
|
45 | 49 |
} |
46 | 50 |
|
47 | 51 |
} |
Also available in: Unified diff
ref #6805 Fix term dragging into feature tree editor