Very often you need to find out if some Element has a presentation element in a diagram. You also might need to collect all existing presentation elements for Element. There are different approaches for doing it. Choose the one which suites your needs.
Keep in mind that diagrams in MagicDraw uses lazy content loading approach. It means that content (presentation elements) are loaded only on demand. For example when diagram is opened.
Use SymbolElementMap
You can take this map using com.nomagic.magicdraw.core.Project.getSymbolElementMap(). Map has API for collecting all symbols in all diagrams for some specific Element.
Find element usages in loaded and not loaded diagrams (do not load diagrams)
Use this approach if you are not sure if presentation element exists in a diagram. This approach checks existing of presentation elements without loading a diagram.
DiagramPresentationElement API provides very useful methods for that. This API works both in loaded and not loaded diagrams.
DiagramPresentationElement.getUsedModelElements(boolean) to get all displayed elements in the diagram
Use DiagramPresentationElement.isElementInDiagram( Element) to check if Element has a presentation element in a diagram
Find presentation elements in diagrams and load them
Use this approach only if you are sure that presentation element of Element exists in diagram, because diagram will be loaded always.
Use DiagramPresentationElement.findPresentationElement(Element, java.lang.Class) method
More information is available in javadoc.