use of org.osate.ge.internal.AgeDiagramProvider in project osate2 by osate.
the class DefaultDiagramService method getReferences.
@Override
public ReferenceCollection getReferences(final Set<IProject> relevantProjects, final Set<CanonicalBusinessObjectReference> originalCanonicalReferences) {
final InternalReferencesToUpdate references = new InternalReferencesToUpdate();
Display.getDefault().syncExec(() -> {
// Create updateable reference for open diagrams
for (final InternalDiagramEditor editor : getOpenEditorsMap(relevantProjects).values()) {
final AgeDiagramProvider diagramProvider = editor.getAdapter(AgeDiagramProvider.class);
if (diagramProvider == null) {
continue;
}
final AgeDiagram diagram = diagramProvider.getAgeDiagram();
if (diagram == null) {
continue;
}
// Update the diagram immediately. This is intended to ensure the diagram doesn't have any proxies
editor.updateNowIfModelHasChanged();
final CanonicalBusinessObjectReference diagramContextRef = diagram.getConfiguration().getContextBoReference();
if (diagramContextRef != null && originalCanonicalReferences.contains(diagramContextRef)) {
references.addReference(editor, diagramContextRef, new OpenDiagramContextReference(diagram));
}
// Get references from the diagram elements
getRuntimeReferencesFromChildren(editor, diagram, originalCanonicalReferences, references);
}
// Create updateable references for saved diagrams
savedDiagramIndex.getDiagramsByContexts(relevantProjects.stream(), originalCanonicalReferences).forEach(e -> references.addReference(e.getDiagramFile(), e.getContext(), new SavedDiagramContextReference()));
savedDiagramIndex.getDiagramElementUrisByReferences(relevantProjects.stream(), originalCanonicalReferences).forEach(e -> references.addReference(e.diagramFile, e.reference, new SavedDiagramElementReference(e.diagramElementUri)));
});
return references;
}
Aggregations