Examples of IMenuService


Examples of org.eclipse.ui.menus.IMenuService

    return saveOnClose;
  }*/
 
  public void createPageToolbar(Form form) {
    ToolBarManager toolbarManager = (ToolBarManager)form.getToolBarManager();
    IMenuService ms = (IMenuService)getSite().getService(IMenuService.class);
    ms.populateContributionManager(toolbarManager, "toolbar:" + ID);
    toolbarManager.update(true);
    /*
      form.getToolBarManager().add(new Action("Export WGA Design", IAction.AS_DROP_DOWN_MENU) {
      @Override
      public ImageDescriptor getImageDescriptor() {
View Full Code Here

Examples of org.eclipse.ui.menus.IMenuService

       
        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

Examples of org.eclipse.ui.menus.IMenuService

    super(location, namespace);
  }

  @Override
  public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
    IMenuService menuService = (IMenuService) serviceLocator.getService(IMenuService.class);
    if (menuService == null) {
      CloudFoundryPlugin
          .logError("Unable to retrieve Eclipse menu service. Cannot add Cloud Foundry context menus."); //$NON-NLS-1$
      return;
    }
View Full Code Here

Examples of org.eclipse.ui.menus.IMenuService

   *            The parent menu service for this window. This parent must
   *            track menu definitions and the regsitry. Must not be
   *            <code>null</code>
   */
  public WindowMenuService(final IServiceLocator serviceLocator) {
    IMenuService menuService = (IMenuService) serviceLocator
        .getService(IMenuService.class);
    if (menuService == null
        || !(menuService instanceof WorkbenchMenuService)) {
      throw new NullPointerException(
          "The parent service must not be null"); //$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.ui.menus.IMenuService

    }
   
    private boolean contributionsPopulated = false;
   
    private void addMenuContributions(IMenuManager mgr) {
    final IMenuService menuService = (IMenuService) part.getSite()
        .getService(IMenuService.class);
    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;
      while (i.hasNext()) {
        String id = "popup:" + i.next(); //$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.ui.menus.IMenuService

     * Dispose of the menu extender. Should only be called when the part
     * is disposed.
     */
    public void dispose() {
    clearStaticActions();
    final IMenuService menuService = (IMenuService) part.getSite()
        .getService(IMenuService.class);
    if (menuService != null) {
      menuService.releaseContributions(menu);
    }
    Platform.getExtensionRegistry().removeRegistryChangeListener(this);
    menu.removeMenuListener(this);
  }
View Full Code Here

Examples of org.eclipse.ui.menus.IMenuService

     * @param scope
     */
    protected void processOperations( IWorkbench workbench ){
        IHandlerService handlers = (IHandlerService)workbench.getService( IHandlerService.class );
        ICommandService commands = (ICommandService)workbench.getService( ICommandService.class );
        IMenuService menuService = (IMenuService) workbench.getService(IMenuService.class);
        IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
       
        List<IConfigurationElement> list = ExtensionPointList.getExtensionPointList("org.locationtech.udig.ui.operation"); //$NON-NLS-1$
        List<IConfigurationElement> categoryElements = listCategories(list);
        if( categoryElements == null || categoryElements.isEmpty() ) return;
       
        for( IConfigurationElement element : categoryElements ) {
            final String ID = element.getAttribute("id");
            final String NAME = element.getName();
            final String DESCRIPTION = element.getName();
            List<IConfigurationElement> operationElements = listOperationsForCategory(list, ID );
            try {
                // Do not create operation category anymore; only worked for one window
                // categories.put(ID, new OperationCategory(element)); //$NON-NLS-1$
                   
                // Create a Command Category
                Category category = commands.getCategory(ID);
                if( !category.isDefined()){
                    category.define(NAME, DESCRIPTION);                   
                }
                // TODO: Create an ActionSet
               
                // TODO: Create a Definition to Check the ActionSet
               
                // TODO: Create the MenuGroup
                AbstractContributionFactory categoryAdditions = operationsMenu( menuService, operationElements, "menu:nav?after=layer.ext", ID);
                menuService.addContributionFactory(categoryAdditions);
            } catch (Exception e) {
                UiPlugin.log("Operation category "+ID+":"+e, e);
            }
        }

View Full Code Here

Examples of org.eclipse.ui.menus.IMenuService

      PartSite site = (PartSite) view.getSite();
      ViewActionBars actionBars = (ViewActionBars) site.getActionBars();
      //
      // 3.3 start
      //
      IMenuService menuService = (IMenuService) site
          .getService(IMenuService.class);
      menuService.releaseContributions((ContributionManager) site.getActionBars()
          .getMenuManager());
      menuService.releaseContributions((ContributionManager) site.getActionBars()
          .getToolBarManager());
      // 3.3 end
      actionBars.dispose();
     
      // and now dispose the delegates since the
View Full Code Here

Examples of org.eclipse.ui.menus.IMenuService

      // Install the part's tools and menu
      {
        //
        // 3.3 start
        //
        IMenuService menuService = (IMenuService) site
            .getService(IMenuService.class);
        menuService.populateContributionManager(
            (ContributionManager) site.getActionBars()
                .getMenuManager(), "menu:" //$NON-NLS-1$
                + site.getId());
        menuService
            .populateContributionManager((ContributionManager) site
                .getActionBars().getToolBarManager(),
                "toolbar:" + site.getId()); //$NON-NLS-1$
        // 3.3 end
View Full Code Here

Examples of org.eclipse.ui.menus.IMenuService

      closeAllPages();

      fireWindowClosed();
     
      // time to wipe our our populate
      IMenuService menuService = (IMenuService) workbench
          .getService(IMenuService.class);
      menuService
          .releaseContributions(((ContributionManager) getActionBars()
              .getMenuManager()));
      ICoolBarManager coolbar = getActionBars().getCoolBarManager();
      if (coolbar != null) {
        menuService
            .releaseContributions(((ContributionManager) coolbar));
      }

      getActionBarAdvisor().dispose();
      getWindowAdvisor().dispose();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.