Class DisplayRelatedSymbols
java.lang.Object
com.nomagic.magicdraw.uml.symbols.DisplayRelatedSymbols
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.displayRelatedSymbols(viewList, info); sessionManager.closeSession();
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<PresentationElement>
Displays related symbols for a given symbol.static Collection<PresentationElement>
displayRelatedSymbols
(List<PresentationElement> viewList, DisplayRelatedSymbolsInfo info) Displays related symbols for given multiple symbols.Given a symbol, gets all relationship types which it has in the model.
-
Constructor Details
-
DisplayRelatedSymbols
public DisplayRelatedSymbols()
-
-
Method Details
-
displayRelatedSymbols
public static Collection<PresentationElement> displayRelatedSymbols(PresentationElement view, DisplayRelatedSymbolsInfo info) throws ReadOnlyElementException Displays related symbols for a given symbol.- Parameters:
view
- symbol for which to display related symbols.info
- configuration of display related behavior.- Returns:
- symbols which were displayed successfully.
- Throws:
ReadOnlyElementException
- if given element is not editable (read-only).
-
displayRelatedSymbols
public static Collection<PresentationElement> displayRelatedSymbols(List<PresentationElement> viewList, DisplayRelatedSymbolsInfo info) throws ReadOnlyElementException Displays related symbols for given multiple symbols.- Parameters:
viewList
- symbol list for which to display related symbols.info
- configuration of display related behavior.- Returns:
- symbols which were displayed successfully.
- Throws:
ReadOnlyElementException
- if given element is not editable (read-only).
-
getPossibleLinkTypes
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
-