private void addDropSupport() { int ops = DND.DROP_COPY | DND.DROP_MOVE; Transfer[] transfers = new Transfer[] { NodeTransfer.getInstance(), PluginTransfer.getInstance() }; tviewer.addDragSupport(ops, transfers, new NodeDragListener(tviewer)); transfers = new Transfer[] { NodeTransfer.getInstance() }; NodeTableDropAdapter dropAdapter = new NodeTableDropAdapter(tviewer) { @Override public boolean performDrop(Object data) { if (data instanceof ANode[]) { ANode[] nodes = (ANode[]) data; List<JRField> fields = (List<JRField>) tviewer.getInput(); for (ANode n : nodes) { JRDesignField f = (JRDesignField) n.getAdapter(JRDesignField.class); if (f != null) { // be sure that the name is ok f.setName(ModelUtils.getNameForField((List<JRDesignField>) tviewer.getInput(), f.getName())); fields.add(f); } } setFields(fields); return true; } return false; } }; tviewer.addDropSupport(ops, transfers, dropAdapter); }
private void addDropAdapters(StructuredViewer viewer) { Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance(), PluginTransfer.getInstance() }; int ops= DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT; DelegatingDropAdapter delegatingDropAdapter= new DelegatingDropAdapter(); delegatingDropAdapter.addDropTargetListener(new CallHierarchyTransferDropAdapter(this, viewer)); delegatingDropAdapter.addDropTargetListener(new PluginTransferDropAdapter(viewer)); viewer.addDropSupport(ops, transfers, delegatingDropAdapter); }
public void start() { Assert.isLegal(!fStarted); int ops= DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK | DND.DROP_DEFAULT; Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance(), FileTransfer.getInstance(), PluginTransfer.getInstance()}; fViewer.addDropSupport(ops, transfers, fDelegatingDropAdapter); fStarted= true; }
private void addDropAdapters(AbstractTreeViewer viewer) { Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance(), PluginTransfer.getInstance() }; int ops= DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT; DelegatingDropAdapter delegatingDropAdapter= new DelegatingDropAdapter(); delegatingDropAdapter.addDropTargetListener(new TypeHierarchyTransferDropAdapter(this, viewer)); delegatingDropAdapter.addDropTargetListener(new PluginTransferDropAdapter(viewer)); viewer.addDropSupport(ops, transfers, delegatingDropAdapter); }
/** * {@inheritDoc} */ public Transfer getTransfer() { return PluginTransfer.getInstance(); }
/** * {@inheritDoc} */ public boolean isEnabled(DropTargetEvent event) { return PluginTransfer.getInstance().isSupportedType(event.currentDataType); }