use of org.eclipse.e4.ui.di.AboutToShow 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