Package org.eclipse.jface.action

Examples of org.eclipse.jface.action.ContributionManager


        final HyperlinkGroup group = new HyperlinkGroup(sectionClient.getDisplay());
       
        final IEditorPart fEditor = editor;
       
    IMenuService ms = (IMenuService)editor.getSite().getService(IMenuService.class);
    ContributionManager manager = new ContributionManager() {

      public void update(boolean force) {
        IContributionItem[] items = getItems();
        for (IContributionItem item : items) {
          if (item instanceof MenuManager) {
            final MenuManager menu = (MenuManager) item;
            ImageHyperlink link = new ImageHyperlink(sectionClient, SWT.None);
            link.setText(menu.getMenuText());           
            if (menu.getImageDescriptor() != null) {
              link.setImage(menu.getImageDescriptor().createImage());
            }
            link.addHyperlinkListener(new HyperlinkAdapter() {
              public void linkActivated(HyperlinkEvent e) {
                IHandlerService handlerService = (IHandlerService) fEditor.getSite().getService(IHandlerService.class);
                if (handlerService != null) {
                  try {
                    handlerService.executeCommand(menu.getId(), null);
                  } catch (Exception ex) {
                    WorkbenchUtils.showErrorDialog(Plugin.getDefault(), fEditor.getSite().getShell(), "Execution of hyperlink failed", "Unable to execute hyperlink command '" + menu.getId() + "'.", ex);
                  }
                }
              }
            });   
            group.add(link);
          }
        }           
      }

     
    };   
    ms.populateContributionManager(manager, _menuId);
    manager.update(true);
  }
View Full Code Here


    if (menuService == null) {
      return;
    }
    if ((mgr.getRemoveAllWhenShown() || !contributionsPopulated)
        && mgr instanceof ContributionManager) {
      ContributionManager manager = (ContributionManager) mgr;
      contributionsPopulated = true;
      menuService
          .populateContributionManager(manager, MenuUtil.ANY_POPUP);
      Iterator i = getMenuIds().iterator();
      WindowMenuService realService = (WindowMenuService) menuService;
View Full Code Here

         * @param actionSetId the action to fill
         * @param item the item to fill
         */
        public void fillMenusFor(String actionSetId, IContributionItem item) {
            if (item instanceof ContributionManager) {
                ContributionManager mgr = (ContributionManager) item;
                IContributionItem[] items = mgr.getItems();
                for (int i = 0; i < items.length; i++) {
                    IContributionItem mgrItem = items[i];
                    if (mgrItem instanceof ActionSetContributionItem) {
                        ActionSetContributionItem actionSetItem = (ActionSetContributionItem) mgrItem;
                        if (actionSetItem.getActionSetId().equals(actionSetId)) {
View Full Code Here

  private void addContributions(IToolBarManager toolBarManager) {
    IMenuService menuService = CommonUtils.getService(getSite(), IMenuService.class);
    if (menuService != null
        && toolBarManager instanceof ContributionManager) {
      ContributionManager contributionManager = (ContributionManager) toolBarManager;
      String toolbarUri = "toolbar:" + TOOLBAR_HEADER_ID; //$NON-NLS-1$
      menuService.populateContributionManager(contributionManager,
          toolbarUri);
    }
  }
View Full Code Here

TOP

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

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.