use of org.eclipse.sirius.diagram.DDiagram in project Palladio-Editors-Sirius by PalladioSimulator.
the class SemanticElementsValidateAction method getFileToMark.
/*
* The marker should reference the main aird file, to be sure to load all the user session when clicking on the marker
* if the corresponding session is closed (referenced analysis cases or CDO for which the main aird is local file with
* information concerning the server).
* @was-generated NOT
*/
private static IFile getFileToMark(DiagramEditPart diagramEditPart, View view) {
Resource targetResource = view.eResource();
if (diagramEditPart instanceof IDDiagramEditPart) {
Option<DDiagram> ddiagram = ((IDDiagramEditPart) diagramEditPart).resolveDDiagram();
Session session = ddiagram.some() && ddiagram.get() instanceof DSemanticDiagram ? SessionManager.INSTANCE.getSession(((DSemanticDiagram) ddiagram.get()).getTarget()) : null;
if (session != null) {
targetResource = session.getSessionResource();
}
}
IFile target = targetResource != null ? WorkspaceSynchronizer.getFile(targetResource) : null;
return target;
}
use of org.eclipse.sirius.diagram.DDiagram in project Palladio-Editors-Sirius by PalladioSimulator.
the class SemanticElementsValidateAction method getDSemanticDecorator.
private static DSemanticDecorator getDSemanticDecorator(EObject element, DiagramEditPart diagramEditPart) {
DSemanticDecorator dSemanticDecorator = null;
if (!(element instanceof DSemanticDecorator)) {
Collection<EObject> xrefs = new EObjectQuery(element).getInverseReferences(ViewpointPackage.Literals.DSEMANTIC_DECORATOR__TARGET);
if (xrefs.isEmpty() && element.eContainer() != null) {
xrefs = new EObjectQuery(element.eContainer()).getInverseReferences(ViewpointPackage.Literals.DSEMANTIC_DECORATOR__TARGET);
}
DDiagram dDiagram = (DDiagram) diagramEditPart.getDiagramView().getElement();
for (EObject eObject : xrefs) {
if (eObject == dDiagram || eObject instanceof DSemanticDecorator && EcoreUtil.isAncestor(dDiagram, eObject)) {
dSemanticDecorator = (DSemanticDecorator) eObject;
break;
}
}
} else {
dSemanticDecorator = (DSemanticDecorator) element;
}
return dSemanticDecorator;
}
use of org.eclipse.sirius.diagram.DDiagram in project Palladio-Editors-Sirius by PalladioSimulator.
the class SemanticElementsValidateAction method getDRepresentationDescriptorURIFromDiagram.
private static String getDRepresentationDescriptorURIFromDiagram(Object object) {
String diagramDescriptorUri = null;
if (object instanceof Diagram) {
Optional<DRepresentationDescriptor> optional = Optional.of((Diagram) object).map(View::getElement).filter(DDiagram.class::isInstance).map(d -> {
DRepresentationQuery query = new DRepresentationQuery((DDiagram) d);
return query.getRepresentationDescriptor();
});
if (optional.isPresent()) {
final URI uri = EcoreUtil.getURI(optional.get());
diagramDescriptorUri = uri.toString();
}
}
return diagramDescriptorUri;
}
Aggregations