use of org.eclipse.e4.ui.model.application.ui.menu.MMenu 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.MMenu in project whole by wholeplatform.
the class E4ModelProcessor method initialize.
@Execute
protected void initialize() throws CoreException {
try {
ClasspathPersistenceProvider pp = new ClasspathPersistenceProvider("org/whole/product/e4/lw/WorkspaceConfiguration.xwl");
InterpreterOperation.interpret(XmlBuilderPersistenceKit.instance().readModel(pp));
MUIElement placeholderWindow = modelService.find(PLACEHOLDER_WINDOW_ID, application);
if (placeholderWindow == null || !placeholderWindow.getParent().getChildren().remove(placeholderWindow))
throw new IllegalStateException("Unable to remove placeholder window with id: '" + PLACEHOLDER_WINDOW_ID + "'");
MTrimmedWindow window = MBasicFactory.INSTANCE.createTrimmedWindow();
window.setLabel("Whole Language Workbench Window");
window.setX(500);
window.setY(20);
window.setWidth(800);
window.setHeight(1000);
MMenu mainMenu = MMenuFactory.INSTANCE.createMenu();
mainMenu.setElementId("menu:org.eclipse.ui.main.menu");
mainMenu.getChildren().add(createFileMenu());
mainMenu.getChildren().add(createEditMenu());
mainMenu.getChildren().add(createHelpMenu());
window.setMainMenu(mainMenu);
MTrimBar trimBar = MBasicFactory.INSTANCE.createTrimBar();
trimBar.setSide(SideValue.TOP);
trimBar.getChildren().add(createToolBar());
window.getTrimBars().add(trimBar);
MPerspectiveStack perspectiveStack = MAdvancedFactory.INSTANCE.createPerspectiveStack();
MPerspective perspective = MAdvancedFactory.INSTANCE.createPerspective();
perspective.setLabel("P1");
MPartSashContainer partSashContainer = MBasicFactory.INSTANCE.createPartSashContainer();
partSashContainer.setHorizontal(false);
MPartStack partStack = MBasicFactory.INSTANCE.createPartStack();
MPart part = MBasicFactory.INSTANCE.createPart();
part.setContributionURI("bundleclass://org.whole.lang.e4.ui/org.whole.lang.e4.ui.parts.E4GraphicalPart");
part.setLabel("Part1a");
part.setCloseable(true);
Map<String, String> persistedState = part.getPersistedState();
persistedState.put("basePersistenceKitId", "org.whole.lang.xml.codebase.XmlBuilderPersistenceKit");
persistedState.put("filePath", "/BaseProject/src/org/whole/lang/ExampleModel.xwl");
persistedState.put("overridePersistenceKitId", "org.whole.lang.xml.codebase.XmlBuilderPersistenceKit");
partStack.getChildren().add(part);
partSashContainer.getChildren().add(partStack);
perspective.getChildren().add(partSashContainer);
perspectiveStack.getChildren().add(perspective);
window.getChildren().add(perspectiveStack);
application.getChildren().add(window);
} catch (Exception e) {
System.out.println("Unable to configure the initial workspace");
e.printStackTrace();
}
}
use of org.eclipse.e4.ui.model.application.ui.menu.MMenu in project whole by wholeplatform.
the class E4ModelProcessor method createHelpMenu.
protected MMenu createHelpMenu() {
MMenu helpMenu = MMenuFactory.INSTANCE.createMenu();
helpMenu.setLabel("File");
helpMenu.getChildren().add(createHandledMenuItem("about", "About", "org.eclipse.ui.help.aboutAction"));
helpMenu.getChildren().add(createHandledMenuItem("preferences", "Preferences", "org.eclipse.ui.window.preferences"));
return helpMenu;
}
use of org.eclipse.e4.ui.model.application.ui.menu.MMenu in project portfolio by buchen.
the class CopyMenuToNewWindowAddon method onEvent.
@Inject
@Optional
public void onEvent(@UIEventTopic(UIEvents.Window.TOPIC_ALL) Event event) {
if (UIEvents.isADD(event)) {
MTrimmedWindow origin = (MTrimmedWindow) event.getProperty(EventTags.ELEMENT);
MTrimmedWindow window = (MTrimmedWindow) event.getProperty(EventTags.NEW_VALUE);
MMenu mainMenu = (MMenu) EcoreUtil.copy((EObject) origin.getMainMenu());
mainMenu.setVisible(true);
window.setMainMenu(mainMenu);
}
}
use of org.eclipse.e4.ui.model.application.ui.menu.MMenu 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;
}
Aggregations