Search in sources :

Example 6 with AWorkspaceTreeNode

use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.

the class PhysicalFolderSortOrderAction method actionPerformed.

/**
 *********************************************************************************
 * REQUIRED METHODS FOR INTERFACES
 *********************************************************************************
 */
/**
 */
public void actionPerformed(ActionEvent e) {
    AWorkspaceTreeNode targetNode = getNodeFromActionEvent(e);
    if (targetNode instanceof IFileSystemRepresentation) {
        if (this.isSelected() == ((IFileSystemRepresentation) targetNode).orderDescending()) {
            ((IFileSystemRepresentation) targetNode).orderDescending(!this.isSelected());
            targetNode.refresh();
        }
    }
}
Also used : IFileSystemRepresentation(org.freeplane.plugin.workspace.io.IFileSystemRepresentation) AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode)

Example 7 with AWorkspaceTreeNode

use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.

the class WorkspaceTransferHandler method drop.

/**
 *********************************************************************************
 * REQUIRED METHODS FOR INTERFACES
 *********************************************************************************
 */
/* DropTarget Methods */
public final void drop(DropTargetDropEvent event) {
    IWorkspaceView view = WorkspaceController.getCurrentModeExtension().getView();
    if (view == null) {
        return;
    }
    TreePath targetPath = view.getPathForLocation(event.getLocation().x, event.getLocation().y);
    if (targetPath != null) {
        AWorkspaceTreeNode targetNode = (AWorkspaceTreeNode) targetPath.getLastPathComponent();
        if (processDrop(targetNode, event)) {
            return;
        }
    }
    event.rejectDrop();
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) TreePath(javax.swing.tree.TreePath) IWorkspaceView(org.freeplane.plugin.workspace.components.IWorkspaceView)

Example 8 with AWorkspaceTreeNode

use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.

the class NodeRefreshAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    AWorkspaceTreeNode[] targetNodes = getSelectedNodes(e);
    for (AWorkspaceTreeNode targetNode : targetNodes) {
        if (targetNode == null) {
            targetNode = WorkspaceController.getCurrentModel().getRoot();
        } else {
            targetNode.refresh();
        }
    }
    IWorkspaceView view = WorkspaceController.getCurrentModeExtension().getView();
    if (view != null) {
        view.refreshView();
    }
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) IWorkspaceView(org.freeplane.plugin.workspace.components.IWorkspaceView)

Example 9 with AWorkspaceTreeNode

use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.

the class FileFolderDropHandler method getPostOperation.

private ITask getPostOperation(final AWorkspaceTreeNode targetNode, final AWorkspaceTreeNode node, final File srcFile, final File destFile) {
    return new ITask() {

        public void exec(Properties properties) throws IOException {
            if (onSkipList(destFile.getParentFile(), properties)) {
                throw new SkipTaskException();
            }
            AWorkspaceTreeNode parent = node.getParent();
            targetNode.getModel().cutNodeFromParent(node);
            parent.refresh();
            targetNode.getModel().nodeMoved(node, srcFile, destFile);
        }

        private boolean onSkipList(File dest, Properties properties) {
            if (properties == null || dest == null) {
                return false;
            }
            String list = properties.getProperty("skippedDirs", "");
            String entry = dest.getPath() + ";";
            if (list.contains(entry)) {
                return true;
            }
            return false;
        }
    };
}
Also used : ITask(org.freeplane.plugin.workspace.io.ITask) AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) SkipTaskException(org.freeplane.plugin.workspace.io.SkipTaskException) Properties(java.util.Properties) File(java.io.File)

Example 10 with AWorkspaceTreeNode

use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.

the class LinkTypeFileNode method getTransferable.

public WorkspaceTransferable getTransferable() {
    WorkspaceTransferable transferable = new WorkspaceTransferable();
    try {
        URI uri = URIUtils.getAbsoluteURI(getLinkURI());
        transferable.addData(WorkspaceTransferable.WORKSPACE_URI_LIST_FLAVOR, uri.toString());
        List<File> fileList = new Vector<File>();
        fileList.add(new File(uri));
        transferable.addData(WorkspaceTransferable.WORKSPACE_FILE_LIST_FLAVOR, fileList);
        if (!this.isSystem()) {
            List<AWorkspaceTreeNode> objectList = new ArrayList<AWorkspaceTreeNode>();
            objectList.add(this);
            transferable.addData(WorkspaceTransferable.WORKSPACE_NODE_FLAVOR, objectList);
        }
        return transferable;
    } catch (Exception e) {
        LogUtils.warn(e);
    }
    return null;
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) ArrayList(java.util.ArrayList) WorkspaceTransferable(org.freeplane.plugin.workspace.dnd.WorkspaceTransferable) URI(java.net.URI) File(java.io.File) Vector(java.util.Vector)

Aggregations

AWorkspaceTreeNode (org.freeplane.plugin.workspace.model.AWorkspaceTreeNode)51 File (java.io.File)13 URI (java.net.URI)9 ArrayList (java.util.ArrayList)8 WorkspaceTransferable (org.freeplane.plugin.workspace.dnd.WorkspaceTransferable)7 TreePath (javax.swing.tree.TreePath)6 DefaultFileNode (org.freeplane.plugin.workspace.nodes.DefaultFileNode)6 JTree (javax.swing.JTree)5 IOException (java.io.IOException)4 IWorkspaceView (org.freeplane.plugin.workspace.components.IWorkspaceView)4 IFileSystemRepresentation (org.freeplane.plugin.workspace.io.IFileSystemRepresentation)4 LinkTypeFileNode (org.freeplane.plugin.workspace.nodes.LinkTypeFileNode)4 Vector (java.util.Vector)3 IWorkspaceNodeActionListener (org.freeplane.plugin.workspace.event.IWorkspaceNodeActionListener)3 WorkspaceActionEvent (org.freeplane.plugin.workspace.event.WorkspaceActionEvent)3 SkipTaskException (org.freeplane.plugin.workspace.io.SkipTaskException)3 AWorkspaceProject (org.freeplane.plugin.workspace.model.project.AWorkspaceProject)3 FolderLinkNode (org.freeplane.plugin.workspace.nodes.FolderLinkNode)3 List (java.util.List)2 WorkspacePopupMenu (org.freeplane.plugin.workspace.components.menu.WorkspacePopupMenu)2