Package org.freeplane.core.ui

Examples of org.freeplane.core.ui.MenuBuilder


    /** to be used from scripts to execute menu items.
     * Find out the menuItemKey of a menu item with the devtools add-on. It contains a tool for that. */
    public static void executeMenuItems(final List<String> menuItemKeys) {
        LogUtils.info("menu items to execute: " + menuItemKeys);
        final MenuBuilder menuBuilder = getMenuBuilder();
        for (String menuItemKey : menuItemKeys) {
            final DefaultMutableTreeNode treeNode = menuBuilder.get(menuItemKey);
            if (treeNode == null || !treeNode.isLeaf() || !(treeNode.getUserObject() instanceof JMenuItem)) {
                UITools.errorMessage(TextUtils.format("MenuUtils.invalid_menuitem", menuItemKey));
                return;
            }
            final JMenuItem menuItem = (JMenuItem) treeNode.getUserObject();
View Full Code Here


        }
    }

    private static MenuBuilder getMenuBuilder() {
        final ModeController modeController = Controller.getCurrentModeController();
        final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
        return menuBuilder;
    }
View Full Code Here

    props.put("mode", new String[] { MModeController.MODENAME /*TODO: other modes too?*/});
    context.registerService(IModeControllerExtensionProvider.class.getName(),
        new IModeControllerExtensionProvider() {
          @Override
                public void installExtension(ModeController modeController) {
            final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
            final $$$$Action action = new $$$$Action();
          modeController.addAction(action);
            modeController.addMenuContributor(new IMenuContributor() {
            @Override
            public void updateMenus(ModeController modeController, MenuBuilder builder) {
                menuBuilder.addAction("/menu_bar/file", action, MenuBuilder.AS_CHILD);
            }
          });
          }
        /*TODO: further initializations*/}, props);
  }
View Full Code Here

        return UITools.keyStrokeToString(keyStroke);
    }

  private String formatMenuLocation(ScriptAddOnProperties.Script script) {
    final String location = script.menuLocation == null ? "main_menu_scripting" : script.menuLocation;
    MenuBuilder menuBuilder = Controller.getCurrentModeController().getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
    // "/menu_bar/edit/menu_extensions" -> [Node Extensions, Edit]
    final List<String> pathElements = getMenuPathElements(menuBuilder, location);
    Collections.reverse(pathElements);
    pathElements.add(TextUtils.getText(script.menuTitleKey));
    //TODO - impl. ribbons contribution
View Full Code Here

    return button;
  }

  private JTree createTree() {
    final MModeController modeController = (MModeController) Controller.getCurrentModeController();
    final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
    final DefaultMutableTreeNode treeRoot = MenuUtils.createMenuEntryTree(SELECTION_ROOT_KEY, menuBuilder);
    if (treeRoot.getUserObject() == null)
      treeRoot.setUserObject(new MenuEntry(null, TextUtils.getText("select_menu_item_root_node")));
    JTree jTree = new JTree(treeRoot);
    jTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
View Full Code Here

TOP

Related Classes of org.freeplane.core.ui.MenuBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.