@Override
 protected void editorContextMenuAboutToShow(IMenuManager menu) {
   super.editorContextMenuAboutToShow(menu);
   // remove editor actions that don't work in Photon
   menu.remove(ITextEditorActionConstants.CONTEXT_PREFERENCES);
   for (IContributionItem item : menu.getItems()) {
     if (item instanceof MenuManager) {
       MenuManager subMenu = (MenuManager) item;
       // Warning: this is a best effort since the menu doesn't have an
       // id
       if (subMenu.getMenuText().startsWith("Sho&w In")) { // $NON-NLS-1$
         menu.remove(subMenu);
       }
     }
   }
 }
Example #2
0
  protected void updatePeriodActions() {
    IActionBars actionBars = getViewSite().getActionBars();

    IMenuManager menuManager = actionBars.getMenuManager();
    if (periodActions != null) {
      for (int i = 0; i < periodActions.length; i++) {
        menuManager.remove(periodActions[i]);
        periodActions[i].dispose();
      }
      periodActions = null;
    }

    createPeriodActions();

    if (periodActions != null) {
      for (int i = 0; i < periodActions.length; i++) {
        menuManager.appendToGroup("periods", periodActions[i]);
      }
    }

    TimeSpan periodTimeSpan = TimeSpan.fromString(dialogSettings.get(K_PERIOD));
    TimeSpan resolutionTimeSpan = TimeSpan.fromString(dialogSettings.get(K_RESOLUTION));
    setPeriodActionSelection(periodTimeSpan, resolutionTimeSpan);

    actionBars.updateActionBars();
  }
 /** @generated */
 public void init(IActionBars bars, IWorkbenchPage page) {
   super.init(bars, page);
   // print preview
   IMenuManager fileMenu =
       bars.getMenuManager().findMenuUsingPath(IWorkbenchActionConstants.M_FILE);
   assert fileMenu != null;
   fileMenu.remove("pageSetupAction"); // $NON-NLS-1$
 }
  private void cleanMenuBar() {
    String contribID = null;

    for (IContributionItem contribItem : myMenuBar.getItems()) {
      contribID = contribItem.getId();

      if ((contribID.startsWith("org.eclipse."))
          || (contribID.startsWith(IWorkbenchActionConstants.MB_ADDITIONS))
          || (contribID.startsWith(IWorkbenchActionConstants.M_NAVIGATE))) {
        myMenuBar.remove(contribItem);
      }
    }

    //
    //	myMenuBar.getgetParent().getParent().getParent().setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW));

    myMenuBar.update(true); // refresh the display of the menu bar
  }
 @Override
 protected void rulerContextMenuAboutToShow(IMenuManager menu) {
   super.rulerContextMenuAboutToShow(menu);
   // remove preferences action that doesn't work
   menu.remove(ITextEditorActionConstants.RULER_PREFERENCES);
 }
Example #6
0
  private void fillNewWizardActions(IMenuManager menu) {
    // Fill the menu from the commonWizard contributions.
    newWizardActionGroup.setContext(getContext());
    newWizardActionGroup.fillContextMenu(menu);

    IContributionItem newResourceFolderItem = null;
    IContributionItem newModelResourceItem = null;
    IContributionItem newBinaryFileItem = null;
    IContributionItem newTextFileItem = null;

    String firstID = null;
    IContributionItem[] newWizardItems = menu.getItems();
    for (IContributionItem newWizardItem : newWizardItems) {
      if (newWizardItem instanceof ActionContributionItem) {
        IAction action = ((ActionContributionItem) newWizardItem).getAction();
        if (action instanceof IPluginContribution) {
          IPluginContribution pluginContribution = (IPluginContribution) action;
          String id = pluginContribution.getLocalId();
          if (NewFolderWizard.ID.equals(id)) {
            newResourceFolderItem = menu.remove(newWizardItem);
            continue;
          }

          if (NewResourceWizard.ID.equals(id)) {
            newModelResourceItem = menu.remove(newWizardItem);
            continue;
          }

          if (NewBinaryResourceWizard.ID.equals(id)) {
            newBinaryFileItem = menu.remove(newWizardItem);
            continue;
          }

          if (NewTextResourceWizard.ID.equals(id)) {
            newTextFileItem = menu.remove(newWizardItem);
            continue;
          }
        }

        // Filter out the dubious "Ecore Diagram" action that appears everywhere.
        if ("Ecore Diagram".equals(action.getText())) {
          menu.remove(newWizardItem);
          continue;
        }
      }

      if (firstID == null) {
        firstID = newWizardItem.getId();
      }
    }

    if (firstID == null) {
      Separator group = new Separator("cdo-new-wizards");
      menu.add(group);
      firstID = group.getId();
    }

    if (newResourceFolderItem != null) {
      menu.insertBefore(firstID, newResourceFolderItem);
    }

    if (newModelResourceItem != null) {
      menu.insertBefore(firstID, newModelResourceItem);
    }

    if (newBinaryFileItem != null) {
      menu.insertBefore(firstID, newBinaryFileItem);
    }

    if (newTextFileItem != null) {
      menu.insertBefore(firstID, newTextFileItem);
    }
  }