use of org.eclipse.e4.ui.model.application.ui.MUIElement in project nebula.widgets.nattable by eclipse.
the class LifecycleManager method preSave.
@PreSave
void preSave(EModelService modelService, MApplication app) {
List<String> tags = new ArrayList<>();
tags.add(CLOSE_ON_SHUTDOWN_TAG);
List<MPart> elementsWithTags = modelService.findElements(app, null, MPart.class, tags);
for (MPart part : elementsWithTags) {
try {
part.setToBeRendered(false);
part.setVisible(false);
MElementContainer<MUIElement> parent = part.getParent();
parent.getChildren().remove(part);
} catch (Exception e) {
e.printStackTrace();
}
}
}
use of org.eclipse.e4.ui.model.application.ui.MUIElement 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.MUIElement in project portfolio by buchen.
the class LifeCycleManager method removePortfolioPartsWithoutPersistedFile.
private void removePortfolioPartsWithoutPersistedFile(MApplication app, EPartService partService, EModelService modelService) {
List<MPart> parts = modelService.findElements(app, MPart.class, EModelService.IN_ACTIVE_PERSPECTIVE, new Selector() {
@Override
public boolean select(MApplicationElement element) {
if (// $NON-NLS-1$
!"name.abuchen.portfolio.ui.part.portfolio".equals(element.getElementId()))
return false;
// $NON-NLS-1$
return element.getPersistedState().get("file") == null;
}
});
for (MPart part : parts) {
MElementContainer<MUIElement> parent = part.getParent();
if (parent.getSelectedElement().equals(part))
parent.setSelectedElement(null);
parent.getChildren().remove(part);
}
}
Aggregations