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);
}
}
}
}
}
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;
}
Aggregations