use of org.eclipse.sirius.diagram.business.api.query.EObjectQuery 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.business.api.query.EObjectQuery in project InformationSystem by ObeoNetwork.
the class RequirementsServices method isBorderedNode.
/**
* Checks whether a DNode is a bordered node
* @param semanticDecorator
* @return
*/
private boolean isBorderedNode(DSemanticDecorator semanticDecorator) {
if (semanticDecorator instanceof DNode) {
Collection<EObject> inverseReferences = new EObjectQuery((DNode) semanticDecorator).getInverseReferences(org.eclipse.gmf.runtime.notation.NotationPackage.Literals.VIEW__ELEMENT);
Iterator<EObject> iterator = inverseReferences.iterator();
if (iterator.hasNext()) {
EObject next = iterator.next();
if (next instanceof Node) {
return new NodeQuery((Node) next).isBorderedNode();
}
}
}
return false;
}
Aggregations