/** Notifies the listener that the menu is about to be shown. */ public void menuAboutToShow(IMenuManager mgr) { registerE4Support(); // Add this menu as a visible menu. final IWorkbenchPartSite site = part.getSite(); if (site != null) { final IWorkbench workbench = site.getWorkbenchWindow().getWorkbench(); if (workbench instanceof Workbench) { final Workbench realWorkbench = (Workbench) workbench; runCleanUp(realWorkbench); ISelection input = null; if ((bitSet & INCLUDE_EDITOR_INPUT) != 0) { if (part instanceof IEditorPart) { final IEditorPart editorPart = (IEditorPart) part; input = new StructuredSelection(new Object[] {editorPart.getEditorInput()}); } } ISelection s = (selProvider == null ? null : selProvider.getSelection()); realWorkbench.addShowingMenus(getMenuIds(), s, input); } } addMenuContributions(mgr); readStaticActions(); // test for additions removed to comply with menu contributions if (menuWrapper != null) { mgr = menuWrapper; menuWrapper.removeAll(); } if ((bitSet & INCLUDE_EDITOR_INPUT) != 0) { addEditorActions(mgr); } addObjectActions(mgr); addStaticActions(mgr); }