コード例 #1
0
 /**
  * Creates and returns an SWT menu bar control for this menu, for use in the given <code>
  * Decorations</code>, and installs all registered contributions. Does not create a new control if
  * one already exists.
  *
  * @param parent the parent decorations
  * @return the menu control
  * @since 2.1
  */
 public Menu createMenuBar(Decorations parent) {
   if (!menuExist()) {
     menu = new Menu(parent, SWT.BAR);
     menu.setData(MANAGER_KEY, this);
     update(false);
   }
   return menu;
 }
コード例 #2
0
 /** Notifies all listeners that this menu is about to appear. */
 private void handleAboutToShow() {
   if (removeAllWhenShown) {
     removeAll();
   }
   MenuManagerEventHelper.showEventPreHelper(this);
   fireAboutToShow(this);
   MenuManagerEventHelper.showEventPostHelper(this);
   update(false, false);
 }
コード例 #3
0
 protected void update(final boolean force, final boolean recursive) {
   super.update(force, recursive);
   if (menuParent != null && (force || isDirty())) {
     disposeToolItems();
     IContributionItem[] items = getItems();
     if (items.length > 0 && menuParent != null) {
       for (int i = 0; i < items.length; i++) {
         IContributionItem item = items[i];
         if (item.isVisible()) {
           makeEntry(item);
         }
       }
     }
     menuParent.layout(true, true);
   }
 }
コード例 #4
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer#processContents
   * (org.eclipse.e4.ui.model.application.ui.MElementContainer)
   */
  @Override
  public void processContents(MElementContainer<MUIElement> container) {
    // I can either simply stop processing, or we can walk the model
    // ourselves like the "old" days
    // EMF gives us null lists if empty
    if (container == null) return;

    // this is in direct violation of good programming
    MenuManager parentManager = getManager((MMenu) ((Object) container));
    if (parentManager == null) {
      return;
    }
    // Process any contents of the newly created ME
    List<MUIElement> parts = container.getChildren();
    if (parts != null) {
      MUIElement[] plist = parts.toArray(new MUIElement[parts.size()]);
      for (int i = 0; i < plist.length; i++) {
        MUIElement childME = plist[i];
        modelProcessSwitch(parentManager, (MMenuElement) childME);
      }
    }
    parentManager.update(false);
  }
コード例 #5
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.action.IMenuManager#updateAll(boolean)
  */
 public void updateAll(boolean force) {
   update(force, true);
 }
コード例 #6
0
 /**
  * The <code>MenuManager</code> implementation of this <code>IContributionManager</code> updates
  * this menu, but not any of its submenus.
  *
  * @see #updateAll
  */
 public void update(boolean force) {
   update(force, false);
 }
コード例 #7
0
 /**
  * @param part
  * @param point
  */
 protected void showPaneMenu(IPresentablePart part, Point point) {
   systemMenuManager.update(false);
   Menu aMenu = systemMenuManager.createContextMenu(tabFolder.getParent());
   aMenu.setLocation(point.x, point.y);
   aMenu.setVisible(true);
 }