use of org.eclipse.e4.ui.model.application.MApplicationElement 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