use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class SetShortenerStateAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
setShortened = !isShortened();
final Controller controller = Controller.getCurrentController();
final IMapSelection selection = controller.getSelection();
final NodeModel node = selection.getSelected();
controller.getMapViewManager().getComponent(node).requestFocusInWindow();
selection.keepNodePosition(node, 0.0f, 0.0f);
super.actionPerformed(e);
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class EditDetailsAction method actionPerformed.
/*
* (non-Javadoc)
* @see
* freeplane.controller.actions.ActorXml#act(freeplane.controller.actions.
* generated.instance.XmlAction)
*/
public void actionPerformed(final ActionEvent arg0) {
final Controller controller = Controller.getCurrentController();
final NodeModel nodeModel = controller.getSelection().getSelected();
final IMapViewManager viewController = controller.getMapViewManager();
final Component node = viewController.getComponent(nodeModel);
node.requestFocus();
final IMapSelection selection = Controller.getCurrentController().getSelection();
selection.keepNodePosition(nodeModel, 0.0f, 0.0f);
final MTextController textController = (MTextController) MTextController.getController();
textController.editDetails(nodeModel, null, useDialog);
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class ReminderHook method runScript.
public void runScript(ReminderExtension reminderExtension) {
final String script = reminderExtension.getScript();
if (script == null || script.equals(""))
return;
final IScriptStarter starter = (IScriptStarter) modeController.getExtension(IScriptStarter.class);
if (starter == null)
return;
final NodeModel node = reminderExtension.getNode();
final MapModel map = node.getMap();
final Controller controller = modeController.getController();
if (!controller.getMapViewManager().getMaps(modeController.getModeName()).containsValue(map))
return;
starter.executeScript(node, script);
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class ViewerController method createURI.
protected URI createURI(final NodeModel node) {
final Controller controller = Controller.getCurrentController();
final ViewController viewController = controller.getViewController();
final MapModel map = node.getMap();
final File file = map.getFile();
final boolean useRelativeUri = ResourceController.getResourceController().getProperty("links").equals("relative");
if (file == null && useRelativeUri) {
JOptionPane.showMessageDialog(viewController.getCurrentRootComponent(), TextUtils.getText("not_saved_for_image_error"), "Freeplane", JOptionPane.WARNING_MESSAGE);
return null;
}
final UrlManager urlManager = controller.getModeController().getExtension(UrlManager.class);
final JFileChooser chooser = urlManager.getFileChooser(null, false);
chooser.setAcceptAllFileFilterUsed(false);
final FileFilter fileFilter;
if (factories.size() > 1) {
fileFilter = getCombiFileFilter();
chooser.addChoosableFileFilter(fileFilter);
for (final IViewerFactory factory : factories) {
chooser.addChoosableFileFilter(new FactoryFileFilter(factory));
}
} else {
fileFilter = new FactoryFileFilter(factories.iterator().next());
}
chooser.setFileFilter(fileFilter);
chooser.putClientProperty(FactoryFileFilter.class, fileFilter);
chooser.setAccessory(new ImagePreview(chooser));
final int returnVal = chooser.showOpenDialog(Controller.getCurrentController().getViewController().getCurrentRootComponent());
if (returnVal != JFileChooser.APPROVE_OPTION) {
return null;
}
final File input = chooser.getSelectedFile();
if (input == null) {
return null;
}
URI uri = uriOf(input);
if (uri == null) {
return null;
}
if (useRelativeUri && uri.getScheme().equals("file")) {
uri = LinkController.toLinkTypeDependantURI(map.getFile(), input);
}
return uri;
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class NodeHistory method install.
public static void install(final ModeController modeController) {
final Controller controller = modeController.getController();
final NodeHistory history = (NodeHistory) controller.getExtension(NodeHistory.class);
modeController.getMapController().addNodeSelectionListener(history.getMapSelectionListener());
LinkController.getController(modeController).addNodeSelectionListener(history.getLinkSelectionListener());
history.backAction = new BackAction(controller, history);
modeController.addAction(history.backAction);
history.forwardAction = new ForwardAction(controller, history);
modeController.addAction(history.forwardAction);
}
Aggregations