Skip to content

Commit

Permalink
Merge branch 'feature/MAGICDRAW-1101' into release/3.6.3
Browse files Browse the repository at this point in the history
* feature/MAGICDRAW-1101:
  MAGICDRAW-1101 Ensure diagram is loaded when calling getElementsOnDiagram.
  • Loading branch information
ivan-gomes committed May 20, 2019
2 parents 3e0a219 + b465476 commit 6a2eb31
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/gov/nasa/jpl/mbee/mdk/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ public static <T> List<T> removeDuplicates(Collection<T> elements) {
* @return
*/
public static Collection<Element> getElementsOnDiagram(Diagram diagram) {
return Project.getProject(diagram).getDiagram(diagram).getUsedModelElements(true);
DiagramPresentationElement diagramPresentationElement = Project.getProject(diagram).getDiagram(diagram);
if (diagramPresentationElement == null) {
return Collections.emptyList();
}
diagramPresentationElement.ensureLoaded();
return diagramPresentationElement.getUsedModelElements();
}

/**
Expand Down

0 comments on commit 6a2eb31

Please sign in to comment.