super("workspace.action.file.new.mindmap", TextUtils.getRawText("workspace.action.file.new.mindmap.label"), icon);
}
public void actionPerformed(final ActionEvent e) {
Controller.getCurrentController().selectMode(MModeController.MODENAME);
AWorkspaceTreeNode targetNode = this.getNodeFromActionEvent(e);
if(targetNode instanceof IFileSystemRepresentation ) {
String fileName = JOptionPane.showInputDialog(Controller.getCurrentController().getViewController().getContentPane(),
TextUtils.getText("add_new_mindmap"), TextUtils.getText("add_new_mindmap_title"),
JOptionPane.OK_CANCEL_OPTION);
if (fileName != null && fileName.length()>0) {
if (!fileName.endsWith(".mm")) {
fileName += ".mm";
}
File file = new File(((IFileSystemRepresentation) targetNode).getFile(), fileName);
try {
file = WorkspaceController.getFileSystemMgr().createFile(fileName, ((IFileSystemRepresentation) targetNode).getFile());
if (createNewMindmap(file)) {
targetNode.refresh();
}
}
catch(Exception ex) {
JOptionPane.showMessageDialog(UITools.getFrame(), ex.getMessage(), "Error ... ", JOptionPane.ERROR_MESSAGE);
ex.printStackTrace();