use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.
the class VirtualFolderDropHandler method processFileListDrop.
private void processFileListDrop(AWorkspaceTreeNode targetNode, List<File> files, int dropAction) {
try {
for (File srcFile : files) {
AWorkspaceTreeNode node = createFSNodeLinks(targetNode, srcFile);
targetNode.getModel().addNodeTo(node, targetNode);
node.refresh();
}
// WorkspaceUtils.saveCurrentConfiguration();
} catch (Exception e) {
LogUtils.warn(e);
}
}
use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.
the class FileSystemManager method createFileNode.
private AWorkspaceTreeNode createFileNode(final AWorkspaceTreeNode parent, String fileExtension, final File file) {
List<IFileTypeHandler> handlers = getFileTypeHandlers().list(fileExtension);
if (handlers == null) {
fileExtension = FileReadManager.DEFAULT_HANDLE;
handlers = getFileTypeHandlers().list(fileExtension);
}
if (handlers != null && handlers.size() == 1) {
// WORKSPACE - ToDo: what if there is more than one handler for a single type?
IFileTypeHandler nodeCreator = handlers.get(0);
AWorkspaceTreeNode newParent = nodeCreator.createFileNode(parent, fileExtension, file);
return newParent;
}
return parent;
}
use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.
the class FileNodeDeleteAction method actionPerformed.
/**
*********************************************************************************
* REQUIRED METHODS FOR INTERFACES
*********************************************************************************
*/
public void actionPerformed(final ActionEvent e) {
AWorkspaceTreeNode node = this.getNodeFromActionEvent(e);
int yesorno = JOptionPane.showConfirmDialog(UITools.getFrame(), TextUtils.format("workspace.action.file.delete.confirm.text", node.getName()), TextUtils.getText("workspace.action.file.delete.confirm.title"), JOptionPane.YES_NO_OPTION);
if (yesorno == JOptionPane.OK_OPTION) {
deleteFile(node);
}
}
use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode in project freeplane by freeplane.
the class FileNodeDeleteAction method deleteFile.
private void deleteFile(final AWorkspaceTreeNode node) {
if (node instanceof DefaultFileNode) {
((DefaultFileNode) node).delete();
} else if (node instanceof LinkTypeFileNode) {
File file = URIUtils.getAbsoluteFile(((LinkTypeFileNode) node).getLinkURI());
if (file != null) {
if (!file.delete()) {
// show message?
}
}
}
AWorkspaceTreeNode parent = node.getParent();
node.getModel().removeNodeFromParent(node);
parent.refresh();
parent.getModel().requestSave();
}
use of org.freeplane.plugin.workspace.model.AWorkspaceTreeNode 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();
// }
}
Aggregations