in eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/dnd/assistant/JcrDropAdapterAssistant.java [66:105]
public IStatus handleDrop(CommonDropAdapter aDropAdapter,
DropTargetEvent aDropTargetEvent, Object aTarget) {
if (aTarget==null) {
return Status.CANCEL_STATUS;
}
if (!(aTarget instanceof JcrNode)) {
StatusLineUtils.setErrorMessage(5000, "Cannot drop on this type of element");
return Status.CANCEL_STATUS;
}
JcrNode node = (JcrNode)aTarget;
if (LocalSelectionTransfer.getTransfer().isSupportedType(aDropAdapter.getCurrentTransfer())) {
try {
IStatus status = node.handleDrop(aDropTargetEvent.data, aDropTargetEvent.detail);
if (!status.isOK()) {
final String message = status.getMessage();
if (message!=null && message.trim().length()>0) {
StatusLineUtils.setErrorMessage(5000, message);
}
}
return status;
} catch(Exception e) {
Activator.getDefault().getPluginLogger().error("Error handling drop: "+e, e);
StatusLineUtils.setErrorMessage(5000, "Could not drop due to: "+e);
return Status.CANCEL_STATUS;
}
} else if (FileTransfer.getInstance().isSupportedType(aDropAdapter.getCurrentTransfer())) {
final IContainer targetContainer = node.getDropContainer();
if (targetContainer == null)
return Status.CANCEL_STATUS;
getShell().forceActive();
final Object data= FileTransfer.getInstance().nativeToJava(aDropAdapter.getCurrentTransfer());
new CopyFilesAndFoldersOperation(getShell()).copyOrLinkFiles((String[])data, targetContainer, aDropAdapter.getCurrentOperation());
return Status.OK_STATUS;
}
return Status.CANCEL_STATUS;
}