use of org.eclipse.swt.dnd.DropTarget in project cogtool by cogtool.
the class ZoomableUI method setUpDropImage.
protected void setUpDropImage(Canvas editorSubstrate, ExternalImageDropTarget dropTarget) {
DropTarget editorAsTarget = new DropTarget(editorSubstrate, DND.DROP_MOVE | DND.DROP_COPY);
editorAsTarget.setTransfer(ClipboardUtil.IMAGE_TRANFERS);
editorAsTarget.addDropListener(dropTarget);
}
use of org.eclipse.swt.dnd.DropTarget in project tdi-studio-se by Talend.
the class SchemasTreeDnD method addDragAndDrop.
public void addDragAndDrop() {
// drag
DragSource source = new DragSource(getTree(), operations);
source.setTransfer(transferTypes);
source.addDragListener(new TreeDragSourceEffect(getTree()));
// drop
DropTarget target = new DropTarget(getTree(), operations);
target.setTransfer(transferTypes);
target.addDropListener(new TreeDropTargetEffect(getTree()) {
private SchemasKeyData source;
@Override
public void dragEnter(DropTargetEvent event) {
super.dragEnter(event);
Widget item = event.item;
if (item != null) {
TreeItem treeItem = (TreeItem) event.item;
Object data = treeItem.getData();
if (data != null && data instanceof SchemasKeyData) {
this.source = (SchemasKeyData) data;
event.feedback = DND.FEEDBACK_EXPAND;
return;
}
}
event.detail = DND.DROP_NONE;
}
@Override
public void drop(DropTargetEvent event) {
super.drop(event);
if (event.item != null && source != null) {
TreeItem item = (TreeItem) event.item;
Object data = item.getData();
if (data != null && data instanceof SchemasKeyData) {
SchemasKeyData target = (SchemasKeyData) data;
target.addChild(source);
schemaTreeViewer.refresh();
}
}
source = null;
}
});
}
use of org.eclipse.swt.dnd.DropTarget in project tdi-studio-se by Talend.
the class DragAndDropForWebService method createDropTarget.
/**
*
* create DropTarget.
*/
private void createDropTarget(DropTargetListener targetListener) {
if (dropTarget != null) {
dropTarget.dispose();
}
dropTarget = new DropTarget(draggableControl, DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK);
dropTarget.setTransfer(new Transfer[] { TableEntriesTransfer.getInstance() });
dropTarget.addDropListener(targetListener);
}
use of org.eclipse.swt.dnd.DropTarget in project tdi-studio-se by Talend.
the class DropContextAnalyzer method init.
/**
* DOC amaumont Comment method "init".
*/
private void init() {
DropTarget dropTarget = (DropTarget) event.widget;
Control controlTarget = dropTarget.getControl();
dataMapTableViewTarget = mapperManager.retrieveDataMapTableView(controlTarget);
if (controlTarget instanceof Table) {
currentTableTarget = (Table) dropTarget.getControl();
} else if (controlTarget instanceof StyledText) {
currentStyledTextTarget = (StyledText) dropTarget.getControl();
} else {
//$NON-NLS-1$
throw new IllegalArgumentException(Messages.getString("DropContextAnalyzer.0", controlTarget.toString()));
}
zoneTarget = dataMapTableViewTarget.getZone();
draggedData = TableEntriesTransfer.getInstance().getDraggedData();
dataMapTableViewSource = (DataMapTableView) draggedData.getDataMapTableViewSource();
tableItemSource = draggedData.getTableItemSource();
zoneSource = dataMapTableViewSource.getZone();
if (currentTableTarget != null) {
analyzeCursorOverExpressionCell();
}
invalidKeyPressed = hasInvalidKeyPressed();
isDropValid = checkDropIsValid();
analyzeForFeedback();
analyzeForDetail();
// System.out.println("isCursorOverExpressionCell="+isCursorOverExpressionCell);
}
use of org.eclipse.swt.dnd.DropTarget in project tdi-studio-se by Talend.
the class DragNDrop method createDropTarget.
/**
*
* create DropTarget.
*/
private void createDropTarget(DropTargetListener targetListener) {
if (dropTarget != null) {
dropTarget.dispose();
}
dropTarget = new DropTarget(draggableControl, DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK);
dropTarget.setTransfer(new Transfer[] { TableEntriesTransfer.getInstance() });
dropTarget.addDropListener(targetListener);
}
Aggregations