Package org.eclipse.jface.action

Examples of org.eclipse.jface.action.MenuManager


    /* Select the input Folder and expand */
    fFolderViewer.setSelection(new StructuredSelection(fSelectedFolder));
    fFolderViewer.setExpandedState(fSelectedFolder, true);

    /* Add Menu: "New Folder" */
    MenuManager menuManager = new MenuManager();
    menuManager.add(new Action("New Folder...") {
      @Override
      public void run() {
        onNewFolder();
      }
    });

    Menu menu = menuManager.createContextMenu(fFolderViewer.getTree());
    fFolderViewer.getTree().setMenu(menu);

    /* Register Model Listeners */
    registerListeners();
  }
View Full Code Here


    createHelpMenu(menuBar);
  }

  /* Menu: File */
  private void createFileMenu(IMenuManager menuBar) {
    MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
    menuBar.add(fileMenu);

    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
    fileMenu.add(new Separator());

    fileMenu.add(getAction(ActionFactory.CLOSE.getId()));
    fileMenu.add(getAction(ActionFactory.CLOSE_ALL.getId()));
    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
    fileMenu.add(new Separator());
    fileMenu.add(getAction(ActionFactory.SAVE_AS.getId()));
    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
    fileMenu.add(new Separator());
    fileMenu.add(getAction(ActionFactory.PRINT.getId()));

    fileMenu.add(new Separator());
    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));

    fileMenu.add(fReopenEditors); // TODO Consider moving into a "Go" Menu!

    fileMenu.add(new Separator());
    fileMenu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
    fileMenu.add(new Separator());

    fileMenu.add(getAction(ActionFactory.QUIT.getId()));
  }
View Full Code Here

      }
    };
  }

  private void hookContextualMenu() {
    MenuManager manager = new MenuManager();
    manager.setRemoveAllWhenShown(true);
    manager.addMenuListener(new IMenuListener() {
      public void menuAboutToShow(IMenuManager manager) {
        manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
        manager.add(new Separator("open"));
        manager.add(new Separator("mark"));
        manager.add(new Separator("edit"));
        manager.add(new Separator("copy"));
        manager.add(new Separator("label"));

        IStructuredSelection selection = (IStructuredSelection) fViewer.getSelection();

        /* Need a Selection here */
        if (selection.isEmpty())
          return;

        /* Show in Feed (only for searchmarks) */
        if (fViewer.getInput() instanceof SearchMarkReference) {
          OpenNewsAction showInFeedAction = new OpenNewsAction(selection);
          showInFeedAction.setText("Show in Feed");
          manager.appendToGroup("open", showInFeedAction);
        }

        /* Sticky */
        manager.appendToGroup("label", new MakeTypesStickyAction(selection));

        /* Label */
        MenuManager labelMenu = new MenuManager("Label");
        manager.appendToGroup("label", labelMenu);

        /* Retrieve selected Labels from Selection (including NULL!) */
        Set<ILabel> selectedLabels = ModelUtils.getLabels(selection);
        ILabel commonLabel = null;
        if (selectedLabels.size() == 1)
          commonLabel = selectedLabels.iterator().next();

        IAction labelNone = new Action("None", IAction.AS_RADIO_BUTTON) {
          @Override
          public void run() {
            new LabelAction(null, (IStructuredSelection) fViewer.getSelection()).run();
          }
        };
        labelNone.setChecked(selectedLabels.size() == 0 || (selectedLabels.size() == 1 && commonLabel == null));

        labelMenu.add(labelNone);
        labelMenu.add(new Separator());

        Collection<ILabel> labels = DynamicDAO.loadAll(ILabel.class);
        for (final ILabel label : labels) {
          IAction labelAction = new Action(label.getName(), IAction.AS_RADIO_BUTTON) {
            @Override
            public void run() {
              new LabelAction(label, (IStructuredSelection) fViewer.getSelection()).run();
            }
          };

          labelAction.setChecked(label.equals(commonLabel));
          labelMenu.add(labelAction);
        }
      }
    });

    /* Create and Register with Workbench */
 
View Full Code Here

    fileMenu.add(getAction(ActionFactory.QUIT.getId()));
  }

  /* Menu: Edit */
  private void createEditMenu(IMenuManager menuBar) {
    MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
    menuBar.add(editMenu);

    editMenu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
    editMenu.add(new Separator());
    editMenu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
    editMenu.add(new Separator());

    editMenu.add(getAction(ActionFactory.CUT.getId()));
    editMenu.add(getAction(ActionFactory.COPY.getId()));
    editMenu.add(getAction(ActionFactory.PASTE.getId()));
    editMenu.add(new Separator());
    editMenu.add(getAction(ActionFactory.DELETE.getId()));
    editMenu.add(getAction(ActionFactory.SELECT_ALL.getId()));

    editMenu.add(new Separator());
    editMenu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
    editMenu.add(new Separator());

    editMenu.add(getAction(ActionFactory.PROPERTIES.getId()));
  }
View Full Code Here

    editMenu.add(getAction(ActionFactory.PROPERTIES.getId()));
  }

  /* Menu: View */
  private void createViewMenu(IMenuManager menuBar) {
    MenuManager viewMenu = new MenuManager("&View", M_VIEW);
    menuBar.add(viewMenu);

    viewMenu.add(getAction(ActionFactory.TOGGLE_COOLBAR.getId()));
    viewMenu.add(new GroupMarker(M_VIEW_START));
    viewMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    viewMenu.add(new GroupMarker(M_VIEW_START));
  }
View Full Code Here

    viewMenu.add(new GroupMarker(M_VIEW_START));
  }

  /* Menu: Go */
  private void createGoMenu(IMenuManager menuBar) {
    MenuManager viewMenu = new MenuManager("&Go", IWorkbenchActionConstants.M_NAVIGATE);
    menuBar.add(viewMenu);

    viewMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
  }
View Full Code Here

    viewMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
  }

  /* Menu: Tools */
  private void createToolsMenu(IMenuManager menuBar) {
    MenuManager toolsMenu = new MenuManager("&Tools", OwlUI.M_TOOLS);
    menuBar.add(toolsMenu);

    toolsMenu.add(new Separator());
    toolsMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    toolsMenu.add(new Separator());

    toolsMenu.add(getAction(ActionFactory.PREFERENCES.getId()));
  }
View Full Code Here

    toolsMenu.add(getAction(ActionFactory.PREFERENCES.getId()));
  }

  /* Menu: Window */
  private void createWindowMenu(IMenuManager menuBar) {
    MenuManager windowMenu = new MenuManager("&Window", IWorkbenchActionConstants.M_WINDOW);
    menuBar.add(windowMenu);

    windowMenu.add(getAction(ActionFactory.OPEN_NEW_WINDOW.getId()));
    windowMenu.add(new Separator());

    MenuManager showViewMenu = new MenuManager("&Show View");
    windowMenu.add(showViewMenu);
    showViewMenu.add(fShowViewMenu);
    //    windowMenu.add(new Separator());

    //    windowMenu.add(getAction(ActionFactory.EDIT_ACTION_SETS.getId()));
    //    windowMenu.add(getAction(ActionFactory.RESET_PERSPECTIVE.getId()));
    //    windowMenu.add(new Separator());
View Full Code Here

    windowMenu.add(fOpenWindowsItem);
  }

  /* Menu: Help */
  private void createHelpMenu(IMenuManager menuBar) {
    MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP);
    menuBar.add(helpMenu);

    helpMenu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
    helpMenu.add(new Separator());

    // helpMenu.add(getAction(ActionFactory.INTRO.getId())); TODO Enable
    helpMenu.add(new Separator());

    helpMenu.add(new Separator());
    helpMenu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
    helpMenu.add(new Separator());

    helpMenu.add(getAction(ActionFactory.ABOUT.getId()));
  }
View Full Code Here

   */
  @Override
  protected void fillCoolBar(ICoolBarManager coolBar) {

    /* CoolBar Context Menu */
    MenuManager coolBarContextMenuManager = new MenuManager(null, "org.rssowl.ui.CoolBarContextMenu"); //$NON-NLS-1$
    coolBar.setContextMenuManager(coolBarContextMenuManager);
    coolBarContextMenuManager.add(getAction(ActionFactory.LOCK_TOOL_BAR.getId()));
    //    coolBarContextMenuManager.add(getAction(ActionFactory.EDIT_ACTION_SETS.getId()));
    coolBarContextMenuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.action.MenuManager

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.