use of org.eclipse.jface.action.MenuManager in project linuxtools by eclipse.
the class GcovTest method testGcovSummaryByLaunch.
@Test
public void testGcovSummaryByLaunch() {
display.syncExec(() -> {
try {
CommonNavigator vc = (CommonNavigator) window.getActivePage().showView(ProjectExplorer.VIEW_ID);
vc.selectReveal(new StructuredSelection(project.getFile(getBinName())));
Menu menu = new MenuManager().createContextMenu(vc.getCommonViewer().getControl());
new ProfileContextualLaunchAction(menu);
for (MenuItem item : menu.getItems()) {
if (item.getText().endsWith("Profile Code Coverage")) {
((ActionContributionItem) item.getData()).getAction().run();
break;
}
}
} catch (PartInitException e1) {
Assert.fail("Cannot show Project Explorer.");
}
try {
window.getActivePage().showView("org.eclipse.linuxtools.gcov.view");
} catch (PartInitException e2) {
Assert.fail("Cannot show GCov View.");
}
});
// Wait for the build job to finish (note: DebugUIPlugin doesn't put launch jobs in a family)
Job[] jobs = Job.getJobManager().find(null);
for (Job job : jobs) {
if (job.getName().contains("Gcov")) {
try {
job.join();
} catch (InterruptedException e) {
}
break;
}
}
}
use of org.eclipse.jface.action.MenuManager in project linuxtools by eclipse.
the class SystemTapView method addFileMenu.
/**
* Create File menu -- calls the abstract protected methods
* <code>createOpenAction()</code> and <code>createOpenDefaultAction()</code>. Have
* these methods return false if you do not wish to create an Open or Open Default
* option in the File menu of your view.
*/
public void addFileMenu() {
IMenuManager menu = getViewSite().getActionBars().getMenuManager();
if (file == null) {
// $NON-NLS-1$
file = new MenuManager(Messages.getString("SystemTapView.FileMenu"));
menu.add(file);
}
if (createOpenAction()) {
file.add(openFile);
}
if (createOpenDefaultAction()) {
file.add(openDefault);
}
createSaveAction();
file.add(saveFile);
}
use of org.eclipse.jface.action.MenuManager in project linuxtools by eclipse.
the class UIUtils method createContextMenu.
/**
* Creates context menu to a given control.
*
* @param control
* the control
*
* @return the i menu manager
*/
public static IMenuManager createContextMenu(final Control control) {
Assert.isTrue(control != null && !control.isDisposed());
MenuManager menuManager = new MenuManager();
menuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
Menu menu = menuManager.createContextMenu(control);
control.setMenu(menu);
return menuManager;
}
use of org.eclipse.jface.action.MenuManager in project linuxtools by eclipse.
the class DockerImagesView method hookContextMenu.
private void hookContextMenu() {
// $NON-NLS-1$
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
// menuMgr.addMenuListener(new IMenuListener() {
// public void menuAboutToShow(IMenuManager manager) {
// DockerContainersView.this.fillContextMenu(manager);
// }
// });
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
}
use of org.eclipse.jface.action.MenuManager in project knime-core by knime.
the class KNIMEApplicationActionBarAdvisor method fillMenuBar.
/**
* Fills the menu bar with the main menus for the windows. Some anchors were
* added below the last action of each division for convenience.
* These anchors are named after the action above them, e.g.:
* "file/ImportPreferences" is located below "Import Preferences..."
* but above the separator.
*
* {@inheritDoc}
*/
@Override
protected void fillMenuBar(final IMenuManager menuBar) {
menuBar.remove(IWorkbenchActionConstants.MB_ADDITIONS);
final MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
MenuManager viewMenu = new MenuManager("&View", IWorkbenchActionConstants.M_VIEW);
MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP);
// 1. File menu
menuBar.add(fileMenu);
// 2. Edit menu
menuBar.add(editMenu);
// 3. View menu
menuBar.add(viewMenu);
// Add a group marker indicating where action set menus will appear.
GroupMarker marker = new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS);
marker.setVisible(false);
menuBar.add(marker);
// last: Help menu
menuBar.add(helpMenu);
// File menu
fileMenu.add(m_newAction);
fileMenu.add(m_saveAction);
fileMenu.add(m_saveAsAction);
fileMenu.add(m_saveAllAction);
fileMenu.add(m_closeAllAction);
fileMenu.add(m_print);
fileMenu.add(m_importWorkflowAction);
fileMenu.add(m_exportWorkflowAction);
fileMenu.add(new GroupMarker("ExportWorkflow"));
fileMenu.add(new Separator());
fileMenu.add(m_changeWorkspaceAction);
fileMenu.add(new GroupMarker("SwitchWorkspace"));
fileMenu.add(new Separator());
fileMenu.add(m_preferencesAction);
fileMenu.add(m_exportPrefAction);
fileMenu.add(m_importPrefAction);
fileMenu.add(new GroupMarker("ImportPreferences"));
fileMenu.add(new Separator());
fileMenu.add(m_installFeaturesAction);
fileMenu.add(m_updateKnimeAction);
fileMenu.add(new GroupMarker("UpdateKNIME"));
fileMenu.add(new Separator());
fileMenu.add(m_exitAction);
// Edit menu
editMenu.add(m_undoAction);
editMenu.add(m_redoAction);
fileMenu.add(new GroupMarker("Redo"));
editMenu.add(new Separator());
editMenu.add(m_cutAction);
editMenu.add(m_copyAction);
editMenu.add(m_pasteAction);
fileMenu.add(new GroupMarker("Paste"));
editMenu.add(new Separator());
editMenu.add(m_deleteAction);
editMenu.add(m_selectAllAction);
editMenu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
// View menu
addMultiViewsToMenu(viewMenu);
viewMenu.add(m_showViewShortlistContributionItem);
viewMenu.add(m_resetPerspective);
// Help menu
// helpMenu.add(m_introAction);
helpMenu.add(m_helpAction);
helpMenu.add(m_helpSearchAction);
helpMenu.add(m_introAction);
// menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
helpMenu.add(m_aboutAction);
final String[] unwanted = new String[] { "org.eclipse.birt.report.designer.ui.LibraryPublisAction", "org.eclipse.birt.report.designer.ui.TemplatepublisAction" };
fileMenu.addMenuListener(new IMenuListener() {
/**
* {@inheritDoc}
*/
@Override
public void menuAboutToShow(final IMenuManager mgr) {
for (String id : unwanted) {
fileMenu.remove(id);
}
}
});
}
Aggregations