use of org.eclipse.e4.ui.model.application.ui.menu.MToolBar in project whole by wholeplatform.
the class E4ModelProcessor method createToolBar.
private MToolBar createToolBar() {
MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar();
toolBar.setElementId("toolbar:org.eclipse.ui.main.toolbar");
List<MToolBarElement> toolItems = toolBar.getChildren();
toolItems.add(createHandledToolItem("save", "Save", "org.eclipse.ui.file.save", "platform:/plugin/org.whole.product.e4.lw/icons/save_edit.png"));
toolItems.add(createHandledToolItem("quit", "Quit", "org.eclipse.ui.file.exit"));
toolItems.add(createHandledToolItem("revert", "Revert", "org.eclipse.ui.file.revert"));
toolItems.add(createHandledToolItem("generateJava", "Generate Java", "org.whole.lang.e4.ui.command::generateJava"));
return toolBar;
}
use of org.eclipse.e4.ui.model.application.ui.menu.MToolBar in project aero.minova.rcp by minova-afis.
the class IconRendering method subscribeTopicChildrenChanged.
@Inject
@Optional
void subscribeTopicChildrenChanged(@UIEventTopic(UIEvents.ElementContainer.TOPIC_CHILDREN) Event event) {
Object objElement = event.getProperty(UIEvents.EventTags.ELEMENT);
// only care of added elements
if (!UIEvents.isADD(event)) {
return;
}
// Ensure that this event is for a MMenuItem or MToolBar
if (!(objElement instanceof MMenuElement && !(objElement instanceof MPopupMenu)) && !(objElement instanceof MToolBar)) {
return;
}
// Ensure that it's a View part's menu or toolbar
MUIElement uiElement = (MUIElement) objElement;
MUIElement parent = modelService.getContainer(uiElement);
if (!(parent instanceof MPart)) {
return;
}
MPart part = (MPart) parent;
ImageUtil.updateIconsForPart(part);
if (uiElement instanceof MToolBar) {
MToolBar toolbar = (MToolBar) uiElement;
ImageUtil.updateIconsForToolbarItems(toolbar);
}
}
use of org.eclipse.e4.ui.model.application.ui.menu.MToolBar in project eclipse.platform.ui by eclipse-platform.
the class PartImpl method basicSetToolbar.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetToolbar(MToolBar newToolbar, NotificationChain msgs) {
MToolBar oldToolbar = toolbar;
toolbar = newToolbar;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BasicPackageImpl.PART__TOOLBAR, oldToolbar, newToolbar);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.e4.ui.model.application.ui.menu.MToolBar in project eclipse.platform.ui by eclipse-platform.
the class ProgrammaticProgressView method createViewMenu.
private void createViewMenu() {
MHandledToolItem clearAllButton = modelService.createModelElement(MHandledToolItem.class);
clearAllButton.setIconURI(CLEAR_ALL_ICON_URI);
clearAllButton.setCommand(clearAllCommand);
MToolBar toolBar = modelService.createModelElement(MToolBar.class);
toolBar.getChildren().add(clearAllButton);
part.setToolbar(toolBar);
MHandledMenuItem clearAllMenuItem = modelService.createModelElement(MHandledMenuItem.class);
// $NON-NLS-1$
clearAllMenuItem.setLabel("Clear All");
clearAllMenuItem.setIconURI(CLEAR_ALL_ICON_URI);
clearAllMenuItem.setCommand(clearAllCommand);
MHandledMenuItem preferencesMenuItem = modelService.createModelElement(MHandledMenuItem.class);
// $NON-NLS-1$
preferencesMenuItem.setLabel("Preferences");
preferencesMenuItem.setCommand(showPreferencesCommand);
MMenu menu = modelService.createModelElement(MMenu.class);
// required //$NON-NLS-1$
menu.getTags().add("ViewMenu");
menu.getChildren().add(clearAllMenuItem);
menu.getChildren().add(preferencesMenuItem);
part.getMenus().add(menu);
}
use of org.eclipse.e4.ui.model.application.ui.menu.MToolBar in project eclipse.platform.ui by eclipse-platform.
the class PartDescriptorImpl method basicSetToolbar.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetToolbar(MToolBar newToolbar, NotificationChain msgs) {
MToolBar oldToolbar = toolbar;
toolbar = newToolbar;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BasicPackageImpl.PART_DESCRIPTOR__TOOLBAR, oldToolbar, newToolbar);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations