use of org.eclipse.jface.action.MenuManager in project knime-core by knime.
the class WorkflowContextMenuProvider method getSubNodeMenuManager.
private static IMenuManager getSubNodeMenuManager(final IMenuManager subNodeManagerOrNull, final IMenuManager parentMenuManager) {
if (subNodeManagerOrNull == null) {
MenuManager m = new MenuManager("Wrapped Metanode", ImageRepository.getIconDescriptor(KNIMEEditorPlugin.PLUGIN_ID, "/icons/meta/meta_menu.png"), null);
m.add(new Separator(GROUP_SUBNODE));
m.add(new Separator(GROUP_SUBNODE_LINKS));
parentMenuManager.appendToGroup(IWorkbenchActionConstants.GROUP_APP, m);
return m;
}
return subNodeManagerOrNull;
}
use of org.eclipse.jface.action.MenuManager in project dbeaver by dbeaver.
the class QueryLogViewer method createContextMenu.
private void createContextMenu() {
MenuManager menuMgr = new MenuManager();
Menu menu = menuMgr.createContextMenu(logTable);
menuMgr.addMenuListener(manager -> {
IAction editorAction = new Action("Open in SQL console", DBeaverIcons.getImageDescriptor(UIIcon.SQL_CONSOLE)) {
@Override
public void run() {
openSelectionInEditor();
}
};
IAction copyAction = new Action(CoreMessages.controls_querylog_action_copy) {
@Override
public void run() {
copySelectionToClipboard(false);
}
};
copyAction.setEnabled(logTable.getSelectionCount() > 0);
copyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
IAction copyAllAction = new Action(CoreMessages.controls_querylog_action_copy_all_fields) {
@Override
public void run() {
copySelectionToClipboard(true);
}
};
copyAllAction.setEnabled(logTable.getSelectionCount() > 0);
copyAllAction.setActionDefinitionId(CoreCommands.CMD_COPY_SPECIAL);
IAction selectAllAction = new Action(CoreMessages.controls_querylog_action_select_all) {
@Override
public void run() {
selectAll();
}
};
selectAllAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_SELECT_ALL);
IAction clearLogAction = new Action(CoreMessages.controls_querylog_action_clear_log) {
@Override
public void run() {
clearLog();
}
};
boolean hasStatements = false;
for (TableItem item : logTable.getSelection()) {
if (((QMMetaEvent) item.getData()).getObject() instanceof QMMStatementExecuteInfo) {
hasStatements = true;
break;
}
}
if (hasStatements) {
manager.add(editorAction);
manager.add(new Separator());
}
manager.add(copyAction);
manager.add(copyAllAction);
manager.add(selectAllAction);
manager.add(clearLogAction);
// manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
});
menuMgr.setRemoveAllWhenShown(true);
logTable.setMenu(menu);
site.registerContextMenu(menuMgr, this);
}
use of org.eclipse.jface.action.MenuManager in project dbeaver by dbeaver.
the class GenericFilterValueEdit method addContextMenu.
void addContextMenu(Action[] actions) {
MenuManager menuMgr = new MenuManager();
menuMgr.addMenuListener(manager -> {
UIUtils.fillDefaultTableContextMenu(manager, table.getTable());
manager.add(new Separator());
for (Action act : actions) {
manager.add(act);
}
});
menuMgr.setRemoveAllWhenShown(true);
table.getTable().setMenu(menuMgr.createContextMenu(table.getTable()));
}
use of org.eclipse.jface.action.MenuManager in project yamcs-studio by yamcs.
the class ApplicationActionBarAdvisor method fillMenuBar.
@Override
protected void fillMenuBar(IMenuManager menuBar) {
beforeFillMenuBar();
MenuManager fileMenu = new MenuManager("File", IWorkbenchActionConstants.M_FILE);
MenuManager windowMenu = new MenuManager("Window", IWorkbenchActionConstants.M_WINDOW);
MenuManager helpMenu = new MenuManager("Help", IWorkbenchActionConstants.M_HELP);
menuBar.add(fileMenu);
menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menuBar.add(windowMenu);
menuBar.add(helpMenu);
// File
fileMenu.add(new Separator());
fileMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
fileMenu.add(new Separator());
// fileMenu.add(exitAction);
// Window
windowMenu.add(bringAllToFrontAction);
// Help
helpMenu.add(onlineHelpAction);
helpMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
helpMenu.add(new Separator());
helpMenu.add(raiseIssueAction);
helpMenu.add(new Separator());
helpMenu.add(aboutAction);
}
use of org.eclipse.jface.action.MenuManager in project vorto by eclipse.
the class AbstractModelRepositoryViewPart method initContextMenu.
/**
* Create the context menu
*/
private void initContextMenu() {
final MenuManager menuMgr = new MenuManager("#PopupMenu");
Menu menu = menuMgr.createContextMenu(viewer.getControl());
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
if (viewer.getStructuredSelection().isEmpty()) {
return;
}
ModelResource model = (ModelResource) viewer.getStructuredSelection().getFirstElement();
if (model.getId().getModelType() == ModelType.InformationModel || model.getId().getModelType() == ModelType.Functionblock) {
addListGeneratorsToMenu(manager, model);
}
menuMgr.add(new PreviewSharedModelAction(model));
}
});
menuMgr.setRemoveAllWhenShown(true);
viewer.getControl().setMenu(menu);
}
Aggregations