use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class ActionAcceleratorManager method loadAcceleratorPreset.
private void loadAcceleratorPreset(final String shortcutKey, final String keystrokeString, Properties allPresets) {
if (!shortcutKey.startsWith(SHORTCUT_PROPERTY_PREFIX)) {
LogUtils.warn("wrong property key " + shortcutKey);
return;
}
final int pos = shortcutKey.indexOf("/", SHORTCUT_PROPERTY_PREFIX.length());
if (pos <= 0) {
LogUtils.warn("wrong property key " + shortcutKey);
return;
}
final String modeName = shortcutKey.substring(SHORTCUT_PROPERTY_PREFIX.length(), pos);
final String itemKey = shortcutKey.substring(pos + 1);
Controller controller = Controller.getCurrentController();
final ModeController modeController = controller.getModeController(modeName);
if (modeController != null) {
final KeyStroke keyStroke;
if (!keystrokeString.equals("")) {
keyStroke = UITools.getKeyStroke(keystrokeString);
final AFreeplaneAction oldAction = accelerators.get(key(modeController, keyStroke));
if (!acceleratorIsDefinedByUserProperties(oldAction, modeController, allPresets))
setAccelerator(modeController, oldAction, null);
} else {
keyStroke = null;
}
final AFreeplaneAction action = modeController.getAction(itemKey);
if (action != null) {
setAccelerator(modeController, action, keyStroke);
}
}
setKeysetProperty(shortcutKey, keystrokeString);
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class ColorTracker method showCommonJColorChooserDialog.
public static Color showCommonJColorChooserDialog(final NodeModel nodeModel, final String title, final Color initialColor, Color defaultColor) throws HeadlessException {
Controller controller = Controller.getCurrentController();
final Component component = controller.getMapViewManager().getComponent(nodeModel);
return ColorTracker.showCommonJColorChooserDialog(component, title, initialColor, defaultColor);
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class ImportAttributesDialog method createMapSubTrees.
private void createMapSubTrees(final DefaultMutableTreeNode top) {
top.removeAllChildren();
final TreeNodeInfo topInfo = (TreeNodeInfo) top.getUserObject();
topInfo.setSelected(TreeNodeInfo.NOT_SELECTED);
Controller controller = Controller.getCurrentController();
final IMapViewManager mapViewManager = controller.getMapViewManager();
final MapModel currentMap = controller.getMap();
currentAttributes = AttributeRegistry.getRegistry(currentMap);
final Iterator<Entry<String, MapModel>> iterator = mapViewManager.getMaps().entrySet().iterator();
while (iterator.hasNext()) {
final Entry<String, MapModel> entry = iterator.next();
final String nextmapName = entry.getKey();
final MapModel nextMap = entry.getValue();
if (nextMap == currentMap) {
continue;
}
final TreeNodeInfo treeNodeInfo = new TreeNodeInfo(nextmapName);
final DefaultMutableTreeNode mapInfo = new DefaultMutableTreeNode(treeNodeInfo);
createAttributeSubTrees(mapInfo, AttributeRegistry.getRegistry(nextMap));
if (mapInfo.getChildCount() != 0) {
top.add(mapInfo);
}
}
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class MAttributeController method performReplaceAttributeValue.
@Override
public void performReplaceAttributeValue(final String name, final Object oldValue, final Object newValue) {
Controller controller = Controller.getCurrentController();
final MapModel map = controller.getMap();
ModeController modeController = controller.getModeController();
final AttributeRegistry registry = AttributeRegistry.getRegistry(map);
final IActor actor = new ReplaceAttributeValueActor(registry, name, oldValue, newValue);
Controller.getCurrentModeController().execute(actor, map);
final IVisitor replacer = new AttributeChanger(name, oldValue, newValue);
final Iterator iterator = new Iterator(replacer);
final NodeModel root = modeController.getMapController().getRootNode();
iterator.iterate(root);
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class CopyAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final Controller controller = Controller.getCurrentController();
final ModeController modeController = Controller.getCurrentModeController();
final IMapSelection selection = controller.getSelection();
if (selection != null) {
final ClipboardController clipboardController = (ClipboardController) modeController.getExtension(ClipboardController.class);
final Transferable copy = clipboardController.copy(selection);
if (copy != null) {
clipboardController.setClipboardContents(copy);
}
}
}
Aggregations