use of org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem in project ibex_gui by ISISComputingGroup.
the class EditConfigurationsHandler method aboutToShow.
/**
* Generate the menu item as the menu is about to be shown.
*
* It must be dynamic because the menu has a different label depending on
* the state of the config pv.
*
* @param items
* menu items to add to
*/
@AboutToShow
public void aboutToShow(List<MMenuElement> items) {
String menuText;
String tooltipText;
if (canWrite) {
menuText = EDIT_MENU_TEXT;
tooltipText = editTooltip;
} else {
menuText = READ_ONLY_TEXT;
tooltipText = viewTooltip;
}
MDirectMenuItem dynamicItem = MMenuFactory.INSTANCE.createDirectMenuItem();
dynamicItem.setLabel(menuText);
dynamicItem.setTooltip(tooltipText);
dynamicItem.setMnemonics(MENU_MNEMONIC);
// Plugin in which this menu item exists
dynamicItem.setContributorURI(BundleConstants.getPlatformPlugin());
dynamicItem.setContributionURI(BundleConstants.getClassURI(getClass()));
items.add(dynamicItem);
}
use of org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem in project portfolio by buchen.
the class NewTransactionMenuContribution method create.
private MMenuElement create(PortfolioPart part, Class<? extends AbstractTransactionDialog> dialog, Object parameter) {
MDirectMenuItem menuItem = modelService.createModelElement(MDirectMenuItem.class);
// $NON-NLS-1$
menuItem.setLabel(parameter.toString() + "...");
// $NON-NLS-1$
menuItem.setContributorURI("platform:/plugin/" + PortfolioPlugin.PLUGIN_ID);
menuItem.setContributionURI(// $NON-NLS-1$//$NON-NLS-2$
"bundleclass://" + PortfolioPlugin.PLUGIN_ID + "/" + NewTransactionHandler.class.getName());
menuItem.getTransientData().put(PortfolioPart.class.getName(), part);
menuItem.getTransientData().put(AbstractTransactionDialog.class.getName(), dialog);
menuItem.getTransientData().put(UIConstants.Parameter.NAME, parameter);
return menuItem;
}
use of org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem in project portfolio by buchen.
the class SelectReportingCurrencyMenuContribution method createMenu.
private MMenuElement createMenu(CurrencyUnit currency, PortfolioPart part) {
MDirectMenuItem menuItem = modelService.createModelElement(MDirectMenuItem.class);
menuItem.setLabel(currency.getLabel());
menuItem.setType(ItemType.CHECK);
// $NON-NLS-1$
menuItem.setContributorURI("platform:/plugin/" + PortfolioPlugin.PLUGIN_ID);
menuItem.setContributionURI(// $NON-NLS-1$//$NON-NLS-2$
"bundleclass://" + PortfolioPlugin.PLUGIN_ID + "/" + SelectReportingCurrencyHandler.class.getName());
menuItem.getTransientData().put(CurrencyUnit.class.getName(), currency);
menuItem.getTransientData().put(PortfolioPart.class.getName(), part);
return menuItem;
}
use of org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem in project osgifx by amitjoy.
the class EventReceiveMenuContributionHandler method prepareMenu.
private void prepareMenu(final List<MMenuElement> items, final boolean value) {
final MDirectMenuItem eventActionMenu;
if (value) {
eventActionMenu = createEventActionMenu(Type.STOP);
} else {
eventActionMenu = createEventActionMenu(Type.START);
}
items.add(eventActionMenu);
}
use of org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem in project eclipse.platform.ui by eclipse-platform.
the class RenderedElementUtil method createRenderedMenuItem.
/**
* Create a 'rendered' menu item instance
*
* @return the new instance
*/
public static MMenuItem createRenderedMenuItem() {
final MDirectMenuItem object = MMenuFactory.INSTANCE.createDirectMenuItem();
object.getTags().add(RENDERED_TAG);
return object;
}
Aggregations