Search in sources :

Example 6 with DRepresentation

use of org.eclipse.sirius.viewpoint.DRepresentation in project InformationSystem by ObeoNetwork.

the class Activator method refreshDecorationsOnSession.

private void refreshDecorationsOnSession(final Session session, boolean forceRefresh) {
    if (!forceRefresh) {
        // Fail fast the decoration is disabled
        if (!ObjectWithRequirement.isDecoratorEnabled()) {
            return;
        }
    }
    IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session);
    // We look for open diagram editors to refresh the diagrams
    if (uiSession != null) {
        Collection<ISiriusEditor> editors = uiSession.getSiriusEditors();
        for (ISiriusEditor siriusEditor : editors) {
            if (siriusEditor instanceof DDiagramEditor) {
                DDiagramEditor diagramEditor = (DDiagramEditor) siriusEditor;
                DRepresentation representation = diagramEditor.getRepresentation();
                if (representation instanceof DSemanticDiagram) {
                    DSemanticDiagram diagram = (DSemanticDiagram) representation;
                    refreshDecorationsOnDiagram(diagram, session);
                }
            }
        }
    }
}
Also used : DDiagramEditor(org.eclipse.sirius.diagram.ui.tools.api.editor.DDiagramEditor) DSemanticDiagram(org.eclipse.sirius.diagram.DSemanticDiagram) IEditingSession(org.eclipse.sirius.ui.business.api.session.IEditingSession) ISiriusEditor(org.eclipse.sirius.ui.business.api.editor.ISiriusEditor) DRepresentation(org.eclipse.sirius.viewpoint.DRepresentation)

Example 7 with DRepresentation

use of org.eclipse.sirius.viewpoint.DRepresentation in project InformationSystem by ObeoNetwork.

the class BusinessProjectImporter method getImpactedReferences.

public Collection<ReferenceData> getImpactedReferences(IProgressMonitor parentMonitor) throws CoreException {
    SubMonitor monitor = SubMonitor.convert(parentMonitor, 2);
    saveAndCloseEditorsOnTargetProject(monitor.newChild(1));
    initializeImportData();
    // Compute the target existing roots that will be replaced
    Collection<EObject> existingTargetSemanticRoots = getAllImpactedTargetSemanticRoots();
    // Collect representations related to the existing target semantic content
    Collection<DRepresentationDescriptor> existingTargetRepresentationDescriptors = ImporterUtil.getRelatedRepresentationDescriptors(targetSession, ImporterUtil.getAllElementsWithChildren(existingTargetSemanticRoots));
    Collection<DRepresentation> existingTargetRepresentations = new ArrayList<DRepresentation>();
    for (DRepresentationDescriptor existingTargetRepresentationDescriptor : existingTargetRepresentationDescriptors) {
        existingTargetRepresentations.add(existingTargetRepresentationDescriptor.getRepresentation());
    }
    // Collect references
    Collection<ReferenceData> allReferences = ImporterUtil.getReferencingElements(existingTargetSemanticRoots, targetSession);
    // Filter references not impacted by the removal
    Collection<ReferenceData> filteredReferences = filterOutOfConcernReferences(allReferences, existingTargetSemanticRoots, existingTargetRepresentations);
    monitor.worked(1);
    monitor.done();
    return filteredReferences;
}
Also used : EObject(org.eclipse.emf.ecore.EObject) SubMonitor(org.eclipse.core.runtime.SubMonitor) ArrayList(java.util.ArrayList) DRepresentationDescriptor(org.eclipse.sirius.viewpoint.DRepresentationDescriptor) DRepresentation(org.eclipse.sirius.viewpoint.DRepresentation)

Aggregations

DRepresentation (org.eclipse.sirius.viewpoint.DRepresentation)7 Session (org.eclipse.sirius.business.api.session.Session)5 RepresentationDescription (org.eclipse.sirius.viewpoint.description.RepresentationDescription)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)4 Viewpoint (org.eclipse.sirius.viewpoint.description.Viewpoint)4 ArrayList (java.util.ArrayList)2 EObject (org.eclipse.emf.ecore.EObject)2 RecordingCommand (org.eclipse.emf.transaction.RecordingCommand)2 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)2 InputDialog (org.eclipse.jface.dialogs.InputDialog)2 Shell (org.eclipse.swt.widgets.Shell)2 HashSet (java.util.HashSet)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 URI (org.eclipse.emf.common.util.URI)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 DSemanticDiagram (org.eclipse.sirius.diagram.DSemanticDiagram)1 DDiagramEditor (org.eclipse.sirius.diagram.ui.tools.api.editor.DDiagramEditor)1 ISiriusEditor (org.eclipse.sirius.ui.business.api.editor.ISiriusEditor)1 IEditingSession (org.eclipse.sirius.ui.business.api.session.IEditingSession)1 UserSession (org.eclipse.sirius.ui.business.api.session.UserSession)1