use of org.freeplane.plugin.workspace.dnd.IWorkspaceTransferableCreator in project freeplane by freeplane.
the class NodeCutAction method actionPerformed.
public void actionPerformed(final ActionEvent event) {
AWorkspaceTreeNode[] targetNodes = getSelectedNodes(event);
WorkspaceTransferable transferable = null;
for (AWorkspaceTreeNode targetNode : targetNodes) {
if (targetNode instanceof IWorkspaceTransferableCreator) {
if (transferable == null) {
transferable = ((IWorkspaceTransferableCreator) targetNode).getTransferable();
} else {
transferable.merge(((IWorkspaceTransferableCreator) targetNode).getTransferable());
}
}
}
if (transferable == null) {
return;
}
transferable.setAsCopy(false);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(transferable, new CutClipboardOwner(transferable));
// AWorkspaceTreeNode parent = targetNode.getParent();
//
// targetNode.getModel().cutNodeFromParent(targetNode);
// if(parent != null) {
// parent.refresh();
// //parent.getModel().requestSave();
// }
}
use of org.freeplane.plugin.workspace.dnd.IWorkspaceTransferableCreator in project freeplane by freeplane.
the class NodeCopyAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
AWorkspaceTreeNode[] targetNodes = getSelectedNodes(e);
WorkspaceTransferable transferable = null;
for (AWorkspaceTreeNode targetNode : targetNodes) {
if (targetNode instanceof IWorkspaceTransferableCreator) {
if (transferable == null) {
transferable = ((IWorkspaceTransferableCreator) targetNode).getTransferable();
} else {
transferable.merge(((IWorkspaceTransferableCreator) targetNode).getTransferable());
}
}
}
if (transferable == null) {
return;
}
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(transferable, new CopyClipboardOwner(transferable));
}
Aggregations