use of org.freeplane.features.url.NodeAndMapReference in project freeplane by freeplane.
the class MMapController method newDocumentationMap.
public void newDocumentationMap(final String file) {
final NodeAndMapReference nodeAndMapReference = new NodeAndMapReference(file);
final ResourceController resourceController = ResourceController.getResourceController();
final File userDir = new File(resourceController.getFreeplaneUserDirectory());
final File baseDir = new File(resourceController.getInstallationBaseDir());
final String languageCode = resourceController.getLanguageCode();
final File localFile = ConfigurationUtils.getLocalizedFile(new File[] { userDir, baseDir }, nodeAndMapReference.getMapReference(), languageCode);
if (localFile == null) {
String errorMessage = TextUtils.format("invalid_file_msg", file);
UITools.errorMessage(errorMessage);
return;
}
try {
final URL endUrl = localFile.toURL();
try {
if (endUrl.getFile().endsWith(".mm")) {
Controller.getCurrentController().selectMode(MModeController.MODENAME);
newDocumentationMap(endUrl);
if (nodeAndMapReference.hasNodeReference())
select(nodeAndMapReference.getNodeReference());
} else {
Controller.getCurrentController().getViewController().openDocument(endUrl);
}
} catch (final Exception e1) {
LogUtils.severe(e1);
}
} catch (final MalformedURLException e1) {
LogUtils.warn(e1);
}
}
Aggregations