Package org.freeplane.core.ui

Examples of org.freeplane.core.ui.MenuBuilder$ActionHolder


  public UserInputListenerFactory(final ModeController modeController, boolean useRibbons) {
    useRibbonMenu = useRibbons;
    Controller controller = Controller.getCurrentController();
    mapsMenuActionListener = new MapsMenuActionListener(controller);
    menuBuilderList.put(MenuBuilder.class, new MenuBuilder(modeController, getAcceleratorManager()));
    menuBuilderList.put(RibbonBuilder.class, new RibbonBuilder(modeController, getAcceleratorManager()));
    controller.getMapViewManager().addMapSelectionListener(new IMapSelectionListener() {
      public void afterMapChange(final MapModel oldMap, final MapModel newMap) {
        if(modeController.equals(Controller.getCurrentModeController()))
          getMenuBuilder(MenuBuilder.class).afterMapChange(newMap);
View Full Code Here


  private void updateMenus() {
    Controller controller = Controller.getCurrentController();
    final ModeController modeController = controller.getModeController();
    if(!modeController.getUserInputListenerFactory().useRibbonMenu()) {
      final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
      menuBuilder.removeChildElements(MENU_CATEGORY);
      List<AFreeplaneAction> openMapActions = createOpenLastMapActionList();
      for(AFreeplaneAction openMapAction:openMapActions)
      {
        final IFreeplaneAction acceleratableAction = menuBuilder.acceleratableAction(openMapAction);
        final JMenuItem item = new JFreeplaneMenuItem(acceleratableAction);
        item.setMnemonic(0);
        menuBuilder.addMenuItem(MENU_CATEGORY, item, MENU_CATEGORY + '/' + openMapAction.getKey(),
            UIBuilder.AS_CHILD);
      }
    }
  }
View Full Code Here

      modeController.addAction(new SetBooleanMapPropertyAction(MapStyle.FIT_TO_VIEWPORT));
      modeController.addAction(new CopyMapStylesAction());
    }
    if(! modeController.getController().getViewController().isHeadless()){
      final IUserInputListenerFactory userInputListenerFactory = modeController.getUserInputListenerFactory();
      final MenuBuilder menuBuilder = userInputListenerFactory.getMenuBuilder(MenuBuilder.class);
      //TODO RIBBONS - apply to ribbons as well
      Controller.getCurrentController().getMapViewManager().addMapSelectionListener(new IMapSelectionListener() {
        public void beforeMapChange(final MapModel oldMap, final MapModel newMap) {
          removeStyleMenu(menuBuilder, "main_menu_styles");
          removeStyleMenu(menuBuilder, "node_popup_styles");
View Full Code Here

    addStandardConditions();
    filterConditions.addListDataListener(filterChangeListener);
    applyFilter(false);
    Controller controller = Controller.getCurrentController();
    final ModeController modeController = controller.getModeController();
    final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
    filterMenuBuilder.updateMenus(modeController, menuBuilder);
    //TODO RIBBONS: apply to ribbons as well, if necessary
  }
View Full Code Here

    Controller controller = Controller.getCurrentController();
    final Set<String> modes = controller.getModes();
    for (final String mode : modes) {
      ModeController modeController = controller.getModeController(mode);
      if(!modeController.getUserInputListenerFactory().useRibbonMenu()) { 
        final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory()
            .getMenuBuilder(MenuBuilder.class);
        if (lastVersion == null || lastVersion.compareTo(FreeplaneVersion.getVersion()) <= 0) {
          ResourceController.getResourceController().setProperty(LAST_UPDATE_VERSION, "");
          if (menuBuilder.get(UPDATE_BUTTON_PATH) != null) {
            menuBuilder.removeElement(UPDATE_BUTTON_PATH);
          }
          continue;
        }
        ResourceController.getResourceController().setProperty(LAST_UPDATE_VERSION, lastVersion.toString());
        final String updateAvailable = TextUtils.format("new_version_available", lastVersion.toString());
        controller.getViewController().out(updateAvailable);
        putValue(SHORT_DESCRIPTION, updateAvailable);
        putValue(LONG_DESCRIPTION, updateAvailable);
        if (menuBuilder.get(UPDATE_BUTTON_PATH) == null) {
          menuBuilder.addAction(UPDATE_BUTTON_LOCATION, UPDATE_BUTTON_PATH, UpdateCheckAction.this,
              MenuBuilder.AS_CHILD);
        }
      }
    }
  }
View Full Code Here

  final static public void install() {
    final File[] dirs = { LoadAcceleratorPresetsAction.getAcceleratorsUserDirectory(),
            LoadAcceleratorPresetsAction.getAcceleratorsSysDirectory() };
    final Controller controller = Controller.getCurrentController();
    ModeController modecontroller = controller.getModeController(MModeController.MODENAME);
    final MenuBuilder menuBuilder = modecontroller.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
    //TODO RIBBONS: impl. eventually
    for (final File dir : dirs) {
      final File[] fileList = dir.listFiles();
      if (fileList == null) {
        continue;
      }
      for (final File prop : fileList) {
        final String fileName = prop.getName();
        if (prop.isDirectory()) {
          continue;
        }
        if (!fileName.endsWith(".properties")) {
          continue;
        }
        try {
          final int propNameLength = fileName.lastIndexOf('.');
          final String propName = fileName.substring(0, propNameLength);
          final String key = "LoadAcceleratorPresetsAction." + propName;
          if (controller.getAction(key) == null) {
            final String title = TextUtils.getText(key + ".text", propName);
            final LoadAcceleratorPresetsAction loadAcceleratorPresetsAction = new LoadAcceleratorPresetsAction(
              prop.toURL(), key, title);
            controller.addAction(loadAcceleratorPresetsAction);
            menuBuilder.addAction("main_menu_new_load_accelerator_presets", key,
              loadAcceleratorPresetsAction, MenuBuilder.AS_CHILD);
          }
        }
        catch (final Exception e) {
          UITools.errorMessage(TextUtils.format("accelerators_loading_error", prop.getPath()));
View Full Code Here

  public void updateMenus(String menuStructure, final Set<String> plugins) {
    final IUserInputListenerFactory userInputListenerFactory = getUserInputListenerFactory();
    userInputListenerFactory.getAcceleratorManager().loadDefaultAcceleratorPresets();
    userInputListenerFactory.updateMenus(menuStructure, plugins);
    final MenuBuilder menuBuilder = userInputListenerFactory.getMenuBuilder(MenuBuilder.class);
    final Iterator<IMenuContributor> iterator = menuContributors.iterator();
    while (iterator.hasNext()) {
      iterator.next().updateMenus(this, menuBuilder);
    }
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public void actionPerformed(ActionEvent e) {
    // use the MModeController for the mindmap mode menu if possible - the browse menu doesn't have much entries!
    final ModeController modeController = ResourceController.getResourceController().isApplet() ? Controller
        .getCurrentModeController() : MModeController.getMModeController();
    final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
    //TODO - find a similar way to outline the hotkeys for the ribbons
    final DefaultMutableTreeNode menuEntryTree = MenuUtils.createAcceleratebleMenuEntryTree(
        FreeplaneMenuBar.MENU_BAR_PREFIX, menuBuilder);
    final String title = TextUtils.getText("hot_keys_table");
    final String html = formatAsHtml(menuEntryTree.children());
View Full Code Here

      ModeController modeController = Controller.getCurrentModeController();
      if (LinkController.isMenuItemLink(link)) {
        if (e == null) {
          throw new IllegalArgumentException("ActionEvent is needed for menu item links");
        }
        final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
        final DefaultMutableTreeNode treeNode = menuBuilder.get(LinkController.parseMenuItemLink(link));
        if (treeNode == null || !treeNode.isLeaf() || !(treeNode.getUserObject() instanceof JMenuItem)) {
          LogUtils.warn("node " + link + " should have been an executable action");
          return;
        }
        final JMenuItem menuItem = (JMenuItem) treeNode.getUserObject();
View Full Code Here

      return;
    }
    final Controller controller = Controller.getCurrentController();
    final Set<String> modes = controller .getModes();
    for (final String mode : modes) {
      final MenuBuilder builder = controller.getModeController(mode).getUserInputListenerFactory()
          .getMenuBuilder(MenuBuilder.class);
      final String[] keys = {
          "MB_ToggleMenubarAction",
          "MP_ToggleMenubarAction",
          "MB_QuitAction",
              "MB_PropertyAction",
              "MB_AboutAction"
      };
      for (final String key : keys) {
        if (builder.contains(key)) {
          builder.removeElement(key);
        }
      }
    }
  }
View Full Code Here

TOP

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

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.