Search in sources :

Example 1 with TransferDragSourceListener

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;
}
Also used : DragSourceEvent(org.eclipse.swt.dnd.DragSourceEvent) INode(org.talend.core.model.process.INode) INode(org.talend.core.model.process.INode) TransferDragSourceListener(org.eclipse.jface.util.TransferDragSourceListener) TextTransfer(org.eclipse.swt.dnd.TextTransfer)

Aggregations

TransferDragSourceListener (org.eclipse.jface.util.TransferDragSourceListener)1 DragSourceEvent (org.eclipse.swt.dnd.DragSourceEvent)1 TextTransfer (org.eclipse.swt.dnd.TextTransfer)1 INode (org.talend.core.model.process.INode)1