Search in sources :

Example 1 with IDDiagramEditPart

use of org.eclipse.sirius.diagram.ui.edit.api.part.IDDiagramEditPart 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;
}
Also used : DSemanticDiagram(org.eclipse.sirius.diagram.DSemanticDiagram) IFile(org.eclipse.core.resources.IFile) DDiagram(org.eclipse.sirius.diagram.DDiagram) IDDiagramEditPart(org.eclipse.sirius.diagram.ui.edit.api.part.IDDiagramEditPart) Resource(org.eclipse.emf.ecore.resource.Resource) Session(org.eclipse.sirius.business.api.session.Session)

Aggregations

IFile (org.eclipse.core.resources.IFile)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 Session (org.eclipse.sirius.business.api.session.Session)1 DDiagram (org.eclipse.sirius.diagram.DDiagram)1 DSemanticDiagram (org.eclipse.sirius.diagram.DSemanticDiagram)1 IDDiagramEditPart (org.eclipse.sirius.diagram.ui.edit.api.part.IDDiagramEditPart)1