if (save) {
if (!createFolderStructure(f)) {
return null;
}
}
final MMapIO mapIO = (MMapIO) MModeController.getMModeController().getExtension(MapIO.class);
MapModel map = mapIO.newMapFromDefaultTemplate();
if (map == null) {
return null;
}
if (name != null) {
//WORKSPACE - fixme: the updates do not show in mapview (ask dimitry)
//String oldName = map.getRootNode().getText();
map.getRootNode().setText(name);
Controller.getCurrentController().getMapViewManager().getMapViewComponent().repaint();
}
if (save) {
mapIO.save(map, f);
}
else {
if(f != null) {
try {
map.setURL(Compat.fileToUrl(f));
} catch (MalformedURLException e) {
LogUtils.warn(WorkspaceNewMapAction.class + ": " + e.getMessage());
}
}
Controller.getCurrentModeController().getMapController().setSaved(map, false);
}
//WORKSPACE - todo: remove the following when the "fixme" above has been fixed
if(f != null) {
Controller.getCurrentController().close(true);
try {
mapIO.newMap(f.toURI().toURL());
} catch (Exception e) {
LogUtils.severe(e);
}
}
return map;