@Override
public void dragSetData(DragSourceEvent event) {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- FeatureNode[] featureNodes = (FeatureNode[]) selection.toList().toArray(new FeatureNode[selection.size()]);
- if (FeatureNodeTransfer.getInstance().isSupportedType(event.dataType)) {
- event.data = featureNodes;
+ if(selection!=null && !selection.isEmpty()){
+ FeatureNode[] featureNodes = (FeatureNode[]) selection.toList().toArray(new FeatureNode[selection.size()]);
+ if (FeatureNodeTransfer.getInstance().isSupportedType(event.dataType)) {
+ event.data = featureNodes;
+ }
}
}
*/
@Override
public void dragStart(DragSourceEvent event) {
- event.doit = !viewer.getSelection().isEmpty();
+ event.doit = !viewer.getSelection().isEmpty()
+ && ((IStructuredSelection) viewer.getSelection()).toList()
+ .stream().allMatch(element -> element instanceof FeatureNode);
}
}
\ No newline at end of file