use of org.eclipse.e4.ui.model.application.ui.menu.MMenuElement in project whole by wholeplatform.
the class E4ModelProcessor method createFileMenu.
protected MMenu createFileMenu() {
MMenu fileMenu = MMenuFactory.INSTANCE.createMenu();
fileMenu.setLabel("File");
List<MMenuElement> menuItems = fileMenu.getChildren();
menuItems.add(createHandledMenuItem("save", "Save", "org.eclipse.ui.file.save", "platform:/plugin/org.whole.product.e4.lw/icons/save_edit.png"));
menuItems.add(createHandledMenuItem("quit", "Quit", "org.eclipse.ui.file.exit"));
menuItems.add(createHandledMenuItem("revert", "Revert", "org.eclipse.ui.file.revert"));
return fileMenu;
}
use of org.eclipse.e4.ui.model.application.ui.menu.MMenuElement in project whole by wholeplatform.
the class E4ModelProcessor method createEditMenu.
protected MMenu createEditMenu() {
MMenu editMenu = MMenuFactory.INSTANCE.createMenu();
editMenu.setLabel("Edit");
List<MMenuElement> menuItems = editMenu.getChildren();
menuItems.add(createHandledMenuItem("undo", "Undo", "org.eclipse.ui.edit.undo"));
menuItems.add(createHandledMenuItem("redo", "Redo", "org.eclipse.ui.edit.redo"));
menuItems.add(MMenuFactory.INSTANCE.createMenuSeparator());
menuItems.add(createHandledMenuItem("cut", "Cut", "org.eclipse.ui.edit.cut"));
menuItems.add(createHandledMenuItem("copy", "Copy", "org.eclipse.ui.edit.copy"));
menuItems.add(createHandledMenuItem("paste", "Paste", "org.eclipse.ui.edit.paste"));
menuItems.add(createHandledMenuItem("delete", "Delete", "org.eclipse.ui.edit.delete"));
menuItems.add(createHandledMenuItem("selectAll", "Select All", "org.eclipse.ui.edit.selectAll"));
menuItems.add(createHandledMenuItem("findReplace", "Find/Replace...", "org.eclipse.ui.edit.findReplace"));
return editMenu;
}
use of org.eclipse.e4.ui.model.application.ui.menu.MMenuElement in project whole by wholeplatform.
the class E4Utils method findMenu.
@SuppressWarnings("unchecked")
public static <T> T findMenu(String elementId, EModelService modelService, MApplication application, Class<T> type) {
for (MWindow window : modelService.findElements(application, null, MWindow.class, null)) {
MMenu mainMenu = window.getMainMenu();
if (mainMenu == null)
continue;
MMenuElement menuElement = findMenu(elementId, mainMenu);
if (menuElement != null)
return (T) menuElement;
}
return null;
}
use of org.eclipse.e4.ui.model.application.ui.menu.MMenuElement in project portfolio by buchen.
the class RecentFilesMenuContribution method aboutToShow.
@AboutToShow
public void aboutToShow(List<MMenuElement> items) {
if (mCommand == null || mParameter == null)
return;
for (String file : recentFiles.getRecentFiles()) {
MParameter parameter = modelService.createModelElement(MParameter.class);
parameter.setName(mParameter.getElementId());
Map<String, Object> parameters = new HashMap<>();
parameters.put(UIConstants.Parameter.FILE, file);
ParameterizedCommand command = commandService.createCommand(UIConstants.Command.OPEN_RECENT_FILE, parameters);
MHandledMenuItem menuItem = MMenuFactory.INSTANCE.createHandledMenuItem();
menuItem.setToBeRendered(true);
menuItem.setLabel(file);
// $NON-NLS-1$
menuItem.setTooltip("");
// $NON-NLS-1$
menuItem.setContributorURI("platform:/plugin/" + PortfolioPlugin.PLUGIN_ID);
menuItem.getParameters().add(parameter);
menuItem.setWbCommand(command);
menuItem.setCommand(mCommand);
items.add(menuItem);
}
}
Aggregations