Search in sources :

Example 1 with IWorkspaceTransferableCreator

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();
// }
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) IWorkspaceTransferableCreator(org.freeplane.plugin.workspace.dnd.IWorkspaceTransferableCreator) WorkspaceTransferable(org.freeplane.plugin.workspace.dnd.WorkspaceTransferable)

Example 2 with IWorkspaceTransferableCreator

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));
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) IWorkspaceTransferableCreator(org.freeplane.plugin.workspace.dnd.IWorkspaceTransferableCreator) WorkspaceTransferable(org.freeplane.plugin.workspace.dnd.WorkspaceTransferable)

Aggregations

IWorkspaceTransferableCreator (org.freeplane.plugin.workspace.dnd.IWorkspaceTransferableCreator)2 WorkspaceTransferable (org.freeplane.plugin.workspace.dnd.WorkspaceTransferable)2 AWorkspaceTreeNode (org.freeplane.plugin.workspace.model.AWorkspaceTreeNode)2