use of org.eclipse.jface.action.MenuManager in project sling by apache.
the class JcrPropertiesView method hookContextMenu.
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
JcrPropertiesView.this.fillContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
IWorkbenchPartSite site = getSite();
if (site != null) {
site.registerContextMenu(menuMgr, viewer);
}
}
use of org.eclipse.jface.action.MenuManager in project eclipse.platform.text by eclipse.
the class EncodingActionGroup method fillActionBars.
@Override
public void fillActionBars(IActionBars actionBars) {
IMenuManager menuManager = actionBars.getMenuManager();
IMenuManager editMenu = menuManager.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
if (editMenu != null && fRetargetActions.size() > 0) {
MenuManager subMenu = new MenuManager(TextEditorMessages.Editor_ConvertEncoding_submenu_label);
subMenu.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
update();
}
});
Iterator<RetargetTextEditorAction> e = fRetargetActions.iterator();
subMenu.add(e.next());
subMenu.add(new Separator());
while (e.hasNext()) subMenu.add(e.next());
editMenu.add(subMenu);
}
}
use of org.eclipse.jface.action.MenuManager in project eclipse.platform.text by eclipse.
the class FileSearchPage method addSortActions.
private void addSortActions(IMenuManager mgr) {
if (getLayout() != FLAG_LAYOUT_FLAT)
return;
MenuManager sortMenu = new MenuManager(SearchMessages.FileSearchPage_sort_by_label);
sortMenu.add(fSortByNameAction);
sortMenu.add(fSortByPathAction);
fSortByNameAction.setChecked(fCurrentSortOrder == fSortByNameAction.getSortOrder());
fSortByPathAction.setChecked(fCurrentSortOrder == fSortByPathAction.getSortOrder());
mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenu);
}
use of org.eclipse.jface.action.MenuManager in project eclipse.platform.text by eclipse.
the class NewTextSearchActionGroup method addOpenWithMenu.
private void addOpenWithMenu(IMenuManager menu, IStructuredSelection selection) {
if (selection == null)
return;
fOpenAction.selectionChanged(selection);
if (fOpenAction.isEnabled()) {
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, fOpenAction);
}
if (selection.size() != 1) {
return;
}
Object o = selection.getFirstElement();
if (!(o instanceof IAdaptable))
return;
// Create menu
IMenuManager submenu = new MenuManager(SearchMessages.OpenWithMenu_label);
submenu.add(new OpenWithMenu(fPage, (IAdaptable) o));
// Add the submenu.
menu.appendToGroup(IContextMenuConstants.GROUP_OPEN, submenu);
}
use of org.eclipse.jface.action.MenuManager in project eclipse.platform.text by eclipse.
the class TextSearchGroup method fillContextMenu.
@Override
public void fillContextMenu(IMenuManager menu) {
MenuManager textSearchMM = new MenuManager(fMenuText, CTX_MENU_ID);
int i = 0;
for (i = 0; i < fActions.length - 1; i++) {
textSearchMM.add(fActions[i]);
}
textSearchMM.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
textSearchMM.add(new Separator());
textSearchMM.add(fActions[i]);
menu.appendToGroup(fAppendToGroup, textSearchMM);
}
Aggregations