@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); } } } }
public void editorContextMenuAboutToShow(IMenuManager menu) { super.editorContextMenuAboutToShow(menu); try { MenuManager subInsertTemplate = new MenuManager("Insert Template"); TemplatesDocument templatesDocument = new TemplatesDocument(); for (int i = 0; i < templatesDocument.numOfTemplates; i++) { addAction(subInsertTemplate, INSERT_TEMPLATES[i]); } menu.add(subInsertTemplate); } catch (Exception e) { e.printStackTrace(); } // minchin MenuManager refactMenu = new MenuManager("Refactor"); menu.add(refactMenu); addAction(refactMenu, SELECT_INTO_INF_ELEMENT); addAction(refactMenu, REPLACE_WITH_NEST); addAction(refactMenu, EXTRACT_INSERT_AFTER); addAction(refactMenu, EXTRACT_INSERT_BEFORE); addAction(refactMenu, INSERT_INTO_DICTIONARY); addAction(refactMenu, SEARCH_DICT_ENTRY); addAction(refactMenu, INSERT_INTO_DIRECTORY); addAction(refactMenu, SEARCH_DIR_REF); addAction(refactMenu, REPLACE_WITH_INFELMREF); // lebedkova addAction(refactMenu, RENAME); addAction(refactMenu, SELECT_INTO_INF_PRODUCT); addAction(refactMenu, SELECT_INTO_COND_BLOCK); addAction(refactMenu, SPLIT_INF_ELEM); addAction(refactMenu, MAKE_REF_OPTIONAL); addAction(refactMenu, MAKE_REF_REQUIRED); // smazhevsky addAction(refactMenu, HANDLE_DIFF_WITH_ANOTHER_INF_ELEM); // shutak addAction(refactMenu, FIND_CLONES_IN_INF_ELEM); // DRLMenuListener.instance.editor = this; // dluciv addAction(refactMenu, FIND_AND_BROWSE_VARIATIONS); menuListener.menuAboutToShow(menu); }