use of org.freeplane.plugin.workspace.components.IWorkspaceView 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();
}
use of org.freeplane.plugin.workspace.components.IWorkspaceView 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();
}
}
use of org.freeplane.plugin.workspace.components.IWorkspaceView in project freeplane by freeplane.
the class WorkspaceCollapseAction method collapseAll.
private static void collapseAll(WorkspaceTreeModel model) {
TreeNode root = (TreeNode) model.getRoot();
IWorkspaceView view = WorkspaceController.getCurrentModeExtension().getView();
TreePath rootPath = new TreePath(root);
for (Enumeration<?> e = root.children(); e.hasMoreElements(); ) {
TreeNode n = (TreeNode) e.nextElement();
TreePath path = rootPath.pathByAddingChild(n);
collapseAll(view, model, path);
}
}
use of org.freeplane.plugin.workspace.components.IWorkspaceView in project freeplane by freeplane.
the class VirtualFolderDropHandler method processDrop.
/**
*********************************************************************************
* REQUIRED METHODS FOR INTERFACES
*********************************************************************************
*/
@SuppressWarnings("unchecked")
public boolean processDrop(AWorkspaceTreeNode targetNode, Transferable transferable, int dropAction) {
try {
if (transferable.isDataFlavorSupported(WorkspaceTransferable.WORKSPACE_NODE_FLAVOR)) {
processWorkspaceNodeDrop(targetNode, (List<AWorkspaceTreeNode>) transferable.getTransferData(WorkspaceTransferable.WORKSPACE_NODE_FLAVOR), dropAction);
} else if (transferable.isDataFlavorSupported(WorkspaceTransferable.WORKSPACE_FILE_LIST_FLAVOR)) {
processFileListDrop(targetNode, (List<File>) transferable.getTransferData(WorkspaceTransferable.WORKSPACE_FILE_LIST_FLAVOR), dropAction);
} else if (transferable.isDataFlavorSupported(WorkspaceTransferable.WORKSPACE_URI_LIST_FLAVOR)) {
ArrayList<URI> uriList = new ArrayList<URI>();
String uriString = (String) transferable.getTransferData(WorkspaceTransferable.WORKSPACE_URI_LIST_FLAVOR);
if (!uriString.startsWith("file://")) {
return false;
}
String[] uriArray = uriString.split("\r\n");
for (String singleUri : uriArray) {
try {
uriList.add(URIUtils.createURI(singleUri));
} catch (Exception e) {
LogUtils.info("org.freeplane.plugin.workspace.mindmapmode.VirtualFolderDropHandler.processDrop(targetNode, transferable, dropAction)@1:" + e.getMessage());
}
}
processUriListDrop(targetNode, uriList, dropAction);
}
targetNode.refresh();
IWorkspaceView view = WorkspaceController.getCurrentModeExtension().getView();
if (view != null) {
view.expandPath(targetNode.getTreePath());
WorkspaceController.getCurrentModeExtension().getView().refreshView();
}
} catch (Exception e) {
LogUtils.warn("org.freeplane.plugin.workspace.mindmapmode.VirtualFolderDropHandler.processDrop(targetNode, transferable, dropAction)@2", e);
}
return true;
}
use of org.freeplane.plugin.workspace.components.IWorkspaceView in project freeplane by freeplane.
the class FileFolderDropHandler method processDrop.
/**
*********************************************************************************
* REQUIRED METHODS FOR INTERFACES
*********************************************************************************
*/
@SuppressWarnings("unchecked")
public boolean processDrop(AWorkspaceTreeNode targetNode, Transferable transferable, int dropAction) {
try {
if (transferable.isDataFlavorSupported(WorkspaceTransferable.WORKSPACE_NODE_FLAVOR)) {
processWorkspaceNodeDrop(targetNode, (List<AWorkspaceTreeNode>) transferable.getTransferData(WorkspaceTransferable.WORKSPACE_NODE_FLAVOR), dropAction);
} else if (transferable.isDataFlavorSupported(WorkspaceTransferable.WORKSPACE_FILE_LIST_FLAVOR)) {
processFileListDrop(targetNode, (List<File>) transferable.getTransferData(WorkspaceTransferable.WORKSPACE_FILE_LIST_FLAVOR), dropAction);
} else if (transferable.isDataFlavorSupported(WorkspaceTransferable.WORKSPACE_URI_LIST_FLAVOR)) {
ArrayList<URI> uriList = new ArrayList<URI>();
String uriString = (String) transferable.getTransferData(WorkspaceTransferable.WORKSPACE_URI_LIST_FLAVOR);
if (!uriString.startsWith("file://")) {
return false;
}
String[] uriArray = uriString.split("\r\n");
for (String singleUri : uriArray) {
try {
uriList.add(URIUtils.createURI(singleUri));
} catch (Exception e) {
LogUtils.info("org.freeplane.plugin.workspace.mindmapmode.FolderFileDropHandler.processDrop(targetNode, transferable, dropAction)@1" + e.getMessage());
}
}
processUriListDrop(targetNode, uriList, dropAction);
}
targetNode.refresh();
IWorkspaceView view = WorkspaceController.getCurrentModeExtension().getView();
if (view != null) {
view.expandPath(targetNode.getTreePath());
WorkspaceController.getCurrentModeExtension().getView().refreshView();
}
} catch (Exception e) {
LogUtils.warn("org.freeplane.plugin.workspace.mindmapmode.FolderFileDropHandler.processDrop(targetNode, transferable, dropAction)@2", e);
}
return true;
}
Aggregations