Search in sources :

Example 6 with WorkspaceTransferable

use of org.freeplane.plugin.workspace.dnd.WorkspaceTransferable 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

WorkspaceTransferable (org.freeplane.plugin.workspace.dnd.WorkspaceTransferable)6 AWorkspaceTreeNode (org.freeplane.plugin.workspace.model.AWorkspaceTreeNode)6 ArrayList (java.util.ArrayList)4 File (java.io.File)3 URI (java.net.URI)3 Vector (java.util.Vector)3 IWorkspaceTransferableCreator (org.freeplane.plugin.workspace.dnd.IWorkspaceTransferableCreator)2