use of org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem in project whole by wholeplatform.
the class E4ModelProcessor method createHandledMenuItem.
protected MHandledMenuItem createHandledMenuItem(String elementId, String label, String commandId, String iconURI) {
MHandledMenuItem handledMenuItem = MMenuFactory.INSTANCE.createHandledMenuItem();
handledMenuItem.setElementId(elementId);
handledMenuItem.setLabel(label);
handledMenuItem.setIconURI(iconURI);
handledMenuItem.setCommand(E4Utils.findCommand(commandId, application));
return handledMenuItem;
}
use of org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem 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