use of org.eclipse.jface.util.TransferDragSourceListener in project tdi-studio-se by Talend.
the class NodeTransferDragSourceListener method getNodeTransferDragSourceListener.
public TransferDragSourceListener getNodeTransferDragSourceListener() {
if (dragDropListener == null)
dragDropListener = new TransferDragSourceListener() {
TextTransfer transfer;
public Transfer getTransfer() {
transfer = TextTransfer.getInstance();
return transfer;
}
public void dragFinished(final DragSourceEvent event) {
}
public void dragSetData(final DragSourceEvent event) {
if (currentEditPart != null && currentEditPart.getParent() != null) {
INode node = (INode) currentEditPart.getParent().getModel();
String value = ElementParameterParser.parse(node, ((INodeReturn) currentEditPart.getModel()).getVarName());
event.data = value;
}
}
public void dragStart(final DragSourceEvent event) {
if (currentEditPart != null && currentEditPart.getParent() != null) {
// Make sure the process node can not be dragged and dropped.
if (currentEditPart.getParent().getModel() instanceof org.talend.designer.core.ui.editor.nodes.Node) {
event.doit = true;
return;
}
}
event.doit = false;
}
};
return dragDropListener;
}
Aggregations