private boolean processDrop(AWorkspaceTreeNode targetNode, DropTargetDropEvent event) { event.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); final Transferable transferable = event.getTransferable(); final int dropAction = event.getDropAction(); try { if (!targetNode.getAllowsChildren()) { targetNode = targetNode.getParent(); } if (!DnDController.isDropAllowed(targetNode)) { event.dropComplete(false); return false; } if (handleDrop(targetNode, transferable, dropAction)) { event.dropComplete(true); return true; } } catch (NoDropHandlerFoundExeption e) { LogUtils.info( "org.freeplane.plugin.workspace.dnd.WorkspaceTransferHandler.processDrop(targetNode, event): " + e.getMessage()); } event.dropComplete(false); return false; }
public boolean importData(JComponent comp, Transferable transf) { if (comp instanceof JTree) { JTree t = (JTree) comp; for (TreePath p : t.getSelectionPaths()) { AWorkspaceTreeNode targetNode = (AWorkspaceTreeNode) p.getLastPathComponent(); if (DnDController.isDropAllowed(targetNode)) { if (transf == null) { return false; } try { return handleDrop(targetNode, transf, DnDConstants.ACTION_COPY); } catch (NoDropHandlerFoundExeption e) { LogUtils.info( "org.freeplane.plugin.workspace.dnd.WorkspaceTransferHandler.importData(comp, transf): " + e.getMessage()); } } } } return false; }