Search in sources :

Example 1 with PreSave

use of org.eclipse.e4.ui.workbench.lifecycle.PreSave 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();
        }
    }
}
Also used : MPart(org.eclipse.e4.ui.model.application.ui.basic.MPart) ArrayList(java.util.ArrayList) MUIElement(org.eclipse.e4.ui.model.application.ui.MUIElement) PreSave(org.eclipse.e4.ui.workbench.lifecycle.PreSave)

Aggregations

ArrayList (java.util.ArrayList)1 MUIElement (org.eclipse.e4.ui.model.application.ui.MUIElement)1 MPart (org.eclipse.e4.ui.model.application.ui.basic.MPart)1 PreSave (org.eclipse.e4.ui.workbench.lifecycle.PreSave)1