Class DisplayRelatedSymbols


  • @OpenApiAll
    public class DisplayRelatedSymbols
    extends java.lang.Object

    Provides API to the display related symbols functionality.

    MagicDraw allows displaying symbols that are related to a given symbol via relationships. The DisplayRelatedSymbols class provides API methods for this. Using this class you can control any of the following behaviors for displaying related symbols logic:

    • What relationship types should be included.
    • Depth of a relationship tree.
    • Whether or not existing symbols should be reused.

        Example: Displaying related generalizations and interface realizations

         SessionManager sessionManager = SessionManager.getInstance();
         sessionManager.createSession("Display related");
        
         Set linkTypes = new HashSet();
         linkTypes.add(new LinkType(Generalization.class));
         linkTypes.add(new LinkType(InterfaceRealization.class));
        
         DisplayRelatedSymbolsInfo info = new DisplayRelatedSymbolsInfo(linkTypes);
         info.setDepthLimited(true);
         info.setDepthLimit(3);
        
         PresentationElement view = ...; // A symbol for which you need to invoke the displaying related symbols action.
        
         DisplayRelatedSymbols.displayRelatedSymbols(view, info);
        
         //For multiple symbol selection to display related symbols use the code below
         List<PresentationElement> viewList = ...; //List of symbols for which you need to invoke the displaying related symbols action.
        
         DisplayRelatedSymbols.displayMultipleRelatedSymbols(viewList, info);
        
         sessionManager.closeSession();
         
    See Also:
    DisplayRelatedSymbolsInfo, LinkType
    • Constructor Detail

      • DisplayRelatedSymbols

        public DisplayRelatedSymbols()
    • Method Detail

      • getPossibleLinkTypes

        public static java.util.Set<LinkType> getPossibleLinkTypes​(PresentationElement pe)
        Given a symbol, gets all relationship types which it has in the model.
        Parameters:
        pe - symbol for which to retrieve possible relationship types
        Returns:
        possible relationship types for a given symbol