public DropTarget createDropTarget ( final Transfer[] transfers, final DropTargetListener dropTargetListener ) { checkWidget (); final DropTarget target = new DropTarget ( this.chartArea, DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_LINK ); target.setTransfer ( transfers ); target.addDropListener ( dropTargetListener ); return target; }
public void preWindowOpen() { IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); configurer.setInitialSize(new Point(800, 600)); configurer.setShowFastViewBars(true); configurer.setShowStatusLine(true); configurer.setShowProgressIndicator(true); configurer.setShowCoolBar(false); // A DropTargetAdapter is need for editor DND support final DropTargetListener dtl = new EditorAreaDropAdapter( configurer.getWindow()); configurer.configureEditorAreaDropListener(dtl); }
protected void hookRecursive(Control child, DropTargetListener dropListener) { DropTarget childTarget = findDropTarget(child); if (childTarget != null) { registerWithExistingTarget(childTarget); registerDropListener(childTarget, dropListener); } if (child instanceof Composite) { Composite composite = (Composite) child; Control[] children = composite.getChildren(); for (Control control : children) { hookRecursive(control, dropListener); } } }
private void hookRecursive(Control child, DropTargetListener dropListener) { DropTarget childTarget = findDropTarget(child); if (childTarget != null) { registerWithExistingTarget(childTarget); registerDropListener(childTarget, dropListener); } if (child instanceof Composite) { Composite composite = (Composite) child; Control[] children = composite.getChildren(); for (Control control : children) { hookRecursive(control, dropListener); } } }
protected void registerDropListener(DropTarget target, DropTargetListener dropListener) { target.removeDropListener(dropListener); target.addDropListener(dropListener); }
@Override public void addDropSupport(int operations, Transfer[] transferTypes, DropTargetListener listener) { fViewer.addDropSupport(operations, transferTypes, listener); }
private void registerDropListener(DropTarget target, DropTargetListener dropListener) { target.removeDropListener(dropListener); target.addDropListener(dropListener); }
/** * Adds support for dropping items into this viewer via a user drag-and-drop * operation. * * @param operations * a bitwise OR of the supported drag and drop operation types ( * <code>DROP_COPY</code>,<code>DROP_LINK</code>, and * <code>DROP_MOVE</code>) * @param transferTypes * the transfer types that are supported by the drop operation * @param listener * the callback that will be invoked after the drag and drop * operation finishes * @see org.eclipse.swt.dnd.DND */ public void addDropSupport(int operations, Transfer[] transferTypes, final DropTargetListener listener) { Control control = getControl(); DropTarget dropTarget = new DropTarget(control, operations); dropTarget.setTransfer(transferTypes); dropTarget.addDropListener(listener); }