use of org.eclipse.emf.ecore.util.EcoreUtil in project Palladio-Editors-Sirius by PalladioSimulator.
the class RemoveDiagramAction method execute.
@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
EObject element = (EObject) parameters.get("element");
String viewpointName = (String) parameters.get("Viewpoint");
Session session = SessionManager.INSTANCE.getSession(element);
Set<DRepresentationDescriptor> toDelete = session.getOwnedViews().stream().filter(v -> viewpointName.equals(v.getViewpoint().getName())).map(DView::getOwnedRepresentationDescriptors).flatMap(Collection::stream).filter(d -> d.getTarget() == element).collect(Collectors.toSet());
toDelete.forEach(EcoreUtil::delete);
}
Aggregations