use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class UrlManager method loadOtherURI.
private void loadOtherURI(URI uri, final boolean hasFreeplaneFileExtension) {
try {
if (!uri.isAbsolute()) {
URI absoluteUri = getAbsoluteUri(uri);
if (absoluteUri == null) {
final MapModel map = Controller.getCurrentController().getMap();
if (map.getURL() == null)
UITools.errorMessage(TextUtils.getText("map_not_saved"));
else
UITools.errorMessage(TextUtils.format("link_not_found", String.valueOf(uri)));
return;
}
uri = absoluteUri;
}
// DOCEAR: mindmaps can be linked in a mindmap --> therefore project-relative-paths are possible
if (!asList(FILE_SCHEME, SMB_SCHEME, FREEPLANE_SCHEME).contains(uri.getScheme())) {
try {
uri = uri.toURL().openConnection().getURL().toURI().normalize();
} catch (Exception e) {
// ignore all exceptions due to unknown protocols
}
}
try {
if (hasFreeplaneFileExtension) {
FreeplaneUriConverter freeplaneUriConverter = new FreeplaneUriConverter();
final URL url = freeplaneUriConverter.freeplaneUrl(uri);
final ModeController modeController = Controller.getCurrentModeController();
modeController.getMapController().newMap(url);
return;
}
Controller.getCurrentController().getViewController().openDocument(uri);
} catch (final Exception e) {
LogUtils.warn("link " + uri + " not found", e);
UITools.errorMessage(TextUtils.format("link_not_found", uri.toString()));
}
return;
} catch (final MalformedURLException ex) {
LogUtils.warn("URL " + uri + " not found", ex);
UITools.errorMessage(TextUtils.format("link_not_found", uri));
}
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class UrlManager method load.
/**
*@deprecated -- use {@link MapIO#load(URL url, MapModel map)}
*/
@Deprecated
public InputStreamReader load(final URL url, final MapModel map) throws IOException, XMLException {
InputStreamReader urlStreamReader;
setURL(map, url);
InputStream inputStream = getLocation(url).openStream();
urlStreamReader = new InputStreamReader(inputStream);
final ModeController modeController = Controller.getCurrentModeController();
modeController.getMapController().getMapReader().createNodeTreeFromXml(map, urlStreamReader, Mode.FILE);
return urlStreamReader;
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class OpenAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final ModeController modeController = Controller.getCurrentController().getModeController(MModeController.MODENAME);
MFileManager.getController(modeController).open();
Controller.getCurrentController().getMapViewManager().setMapTitles();
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class SaveAll method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final Controller controller = Controller.getCurrentController();
final Component initialMapView = controller.getMapViewManager().getMapViewComponent();
final Map<String, MapModel> mapViews = getMapViews();
final Iterator<Entry<String, MapModel>> iterator = mapViews.entrySet().iterator();
while (iterator.hasNext()) {
final Entry<String, MapModel> entry = iterator.next();
controller.getMapViewManager().changeToMapView(entry.getKey());
final ModeController modeController = controller.getModeController();
if (modeController instanceof MModeController) {
((MModeController) modeController).save();
}
}
if (initialMapView != null) {
controller.getMapViewManager().changeToMapView(initialMapView);
}
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class AddOnsController method registerInstalledAddOn.
public void registerInstalledAddOn(final AddOnProperties addOn) {
installedAddOns.add(addOn);
final ResourceController resourceController = ResourceController.getResourceController();
if (addOn.getDefaultProperties() != null)
resourceController.addDefaults(addOn.getDefaultProperties());
if (addOn.getTranslations() != null)
registerAddOnResources(addOn, resourceController);
if (addOn.getPreferencesXml() != null) {
final ModeController modeController = Controller.getCurrentModeController();
if (modeController instanceof MModeController) {
((MModeController) modeController).getOptionPanelBuilder().load(new StringReader(addOn.getPreferencesXml()));
}
}
}
Aggregations