public IStatus handleDrop(CommonDropAdapter dropAdapter, DropTargetEvent dropTargetEvent, Object target) { if (LocalSelectionTransfer.getInstance().isSupportedType( dropAdapter.getCurrentTransfer())) { try { switch (dropAdapter.getCurrentOperation()) { case (DND.DROP_COPY): handleDropCopy(target); break; case (DND.DROP_MOVE): handleDropMove(target); break; } } catch (ConnectionProfileException e) { e.printStackTrace(); } catch (CoreException e) { e.printStackTrace(); } } return Status.CANCEL_STATUS; }
status = performFileDrop(aDropAdapter, aDropTargetEvent.data); } else if (resources != null && resources.length > 0) { if ((aDropAdapter.getCurrentOperation() == DND.DROP_COPY) || (aDropAdapter.getCurrentOperation() == DND.DROP_LINK)) { if (Policy.DEBUG_DND) { System.out
/** * Performs a drop using the FileTransfer transfer type. */ private IStatus performFileDrop(final CommonDropAdapter anAdapter, Object data) { final int currentOperation = anAdapter.getCurrentOperation(); MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 0, WorkbenchNavigatorMessages.DropAdapter_problemImporting, null); mergeStatus(problems, validateTarget(anAdapter.getCurrentTarget(), anAdapter .getCurrentTransfer(), currentOperation)); final IContainer target = getActualTarget((IResource) anAdapter .getCurrentTarget()); final String[] names = (String[]) data; // Run the import operation asynchronously. // Otherwise the drag source (e.g., Windows Explorer) will be blocked // while the operation executes. Fixes bug 16478. Display.getCurrent().asyncExec(() -> { getShell().forceActive(); new CopyFilesAndFoldersOperation(getShell()).copyOrLinkFiles(names, target, currentOperation); }); return problems; }
public void drop(DropTargetEvent event) { if (PluginTransfer.getInstance().isSupportedType(event.currentDataType)) { super.drop(event); } else { Object target = getCurrentTarget() != null ? getCurrentTarget() : getViewer().getInput(); CommonDropAdapterAssistant[] assistants = dndService .findCommonDropAdapterAssistants(target, getCurrentTransfer()); IStatus valid = null; for (int i = 0; i < assistants.length; i++) { try { valid = assistants[i].validateDrop(getCurrentTarget(), getCurrentOperation(), getCurrentTransfer()); if (valid != null && valid.isOK()) { assistants[i].handleDrop(this, event, getCurrentTarget()); return; } } catch (Throwable t) { NavigatorPlugin.logError(0, t.getMessage(), t); } } } }
WorkbenchNavigatorMessages.DropAdapter_problemsMoving, null); mergeStatus(problems, validateTarget(dropAdapter.getCurrentTarget(), dropAdapter.getCurrentTransfer(), dropAdapter.getCurrentOperation())); ImportTypeDialog dialog = new ImportTypeDialog(getShell(), dropAdapter.getCurrentOperation(), sources, target); dialog.setResource(target); if (dialog.open() == Window.OK) {
try { switch (dropAdapter.getCurrentOperation()) { case DND.DROP_MOVE : handleDropMove(target);
@Override public IStatus handleDrop(CommonDropAdapter dropAdapter, DropTargetEvent dropTargetEvent, Object target) { int currentOperation= dropAdapter.getCurrentOperation(); if (LocalSelectionTransfer.getInstance().isSupportedType(dropAdapter.getCurrentTransfer())) { try {
@Override public IStatus handleDrop(CommonDropAdapter dropAdapter, DropTargetEvent dropTargetEvent, Object target) { int currentOperation= dropAdapter.getCurrentOperation(); if (LocalSelectionTransfer.getInstance().isSupportedType(dropAdapter.getCurrentTransfer())) { try {
WorkbenchNavigatorMessages.DropAdapter_problemsMoving, null); mergeStatus(problems, validateTarget(dropAdapter.getCurrentTarget(), dropAdapter.getCurrentTransfer(), dropAdapter.getCurrentOperation()));