Class DiagramType

All Implemented Interfaces:
DiagramTypeConstants, DiagramTypes, Cloneable

@OpenApi public class DiagramType extends AbstractDiagramType implements DiagramTypeConstants
The DiagramType class represents the diagram type
  • Field Details

    • DIAGRAMS_WITHOUT_AUTOMATIC_CONTEXT_SET

      public static final List<String> DIAGRAMS_WITHOUT_AUTOMATIC_CONTEXT_SET
  • Constructor Details

  • Method Details

    • getShortType

      public static String getShortType(String diagramType)
      Returns short type for given normal diagram type. For example "Activity Diagram" will be "activity".
      Parameters:
      diagramType - type
      Returns:
      short type
    • getAbbreviatedType

      public static String getAbbreviatedType(String diagramType)
      Returns abbreviated type for given normal diagram type. For example "Activity Diagram" will be "act".
      Parameters:
      diagramType - type
      Returns:
      abbreviated type
    • getDiagramType

      @OpenApi public static DiagramType getDiagramType(Diagram diagram)
      Return diagram type for a given diagram
      Parameters:
      diagram - diagram
      Returns:
      diagram type
    • setType

      @OpenApi public void setType(String type)
      Sets the diagram type, according given diagram type string representation
      Parameters:
      type - diagram type string representation
      See Also:
    • getType

      @OpenApi public String getType()
      Returns the diagram type string representation
      Specified by:
      getType in class AbstractDiagramType
      Returns:
      diagram type string representation
      See Also:
    • isEqualType

      @OpenApi public boolean isEqualType(DiagramType type)
      Checks if diagram type is equal to given diagram type.
      Parameters:
      type - diagram type
      Returns:
      true if this diagram type is equal to given diagram type; otherwise - false.
      See Also:
    • isEqualType

      @OpenApi public boolean isEqualType(String type)
      Checks if diagram type is equal to given diagram type.
      Parameters:
      type - diagram type string representation
      Returns:
      true if this diagram type is equal to given diagram type; otherwise - false.
      See Also:
    • isTypeOf

      @OpenApi public boolean isTypeOf(DiagramType type)
      Checks if diagram type is of given diagram type (analogy of instanceof operator)
      Parameters:
      type - diagram type.
      Returns:
      true if this diagram type is a 'subtype' of given diagram type or equal to given diagram type; otherwise - false.
      See Also:
    • isTypeOf

      @OpenApi public boolean isTypeOf(String type)
      Checks if diagram type is of given diagram type (analogy of instanceof operator)
      Specified by:
      isTypeOf in class AbstractDiagramType
      Parameters:
      type - diagram type string representation.
      Returns:
      true if this diagram type is a 'subtype' of given diagram type or equal to given diagram type; otherwise - false.
      See Also:
    • getRootType

      @OpenApi public String getRootType()
      Returns root type of this diagram type.
      Returns:
      root type.
    • clone

      @OpenApi public DiagramType clone()
      Overrides:
      clone in class AbstractDiagramType
    • getAllDiagramTypes

      @OpenApi public static List<String> getAllDiagramTypes()
      Returns list of all diagram types.
      Returns:
      list of all diagram types.
      See Also:
    • getCreatableDiagramTypes

      @OpenApi public static List<String> getCreatableDiagramTypes()
      Returns list of available to create (creatable) diagram types.
      Returns:
      list of available to create (creatable) diagram types.
      See Also:
    • addIgnoredDiagramType

      public static void addIgnoredDiagramType(String diagramType)
      Add diagram type, which will be ignored if descriptor for this diagram type not registered. Ignored means that it will not show messages about not loaded diagrams when is loading diagram.
      Parameters:
      diagramType - type of diagram.
    • addIgnoredDiagramType

      public static void addIgnoredDiagramType(String diagramType, boolean symbolDiagram)
      Add diagram type, which will be ignored if descriptor for this diagram type not registered. Ignored means that it will not show messages about not loaded diagrams when is loading diagram.
      Parameters:
      diagramType - type of diagram.
      symbolDiagram - true if diagram is symbolic
    • addIgnoredDiagramType

      public static void addIgnoredDiagramType(Collection<String> diagramTypes)
      Add diagram types, which will be ignored if descriptor for this diagram type not registered. Ignored means that it will not show messages about not loaded diagrams when is loading diagram.
      Parameters:
      diagramTypes - type of diagram.
    • addIgnoredDiagramTypes

      public static void addIgnoredDiagramTypes(Collection<String> diagramTypes, boolean symbolDiagram)
      Add diagram types, which will be ignored if descriptor for this diagram type not registered. Ignored means that it will not show messages about not loaded diagrams when is loading diagram.
      Parameters:
      diagramTypes - type of diagram.
      symbolDiagram - true if diagram is symbolic
    • getIgnoredDiagramTypes

      public static Set<String> getIgnoredDiagramTypes()
      Types of diagrams must be ignored.
      Returns:
      set of diagrams types which are ignored to show warnings about missing resources.
    • isIgnoredSymbolDiagram

      public static boolean isIgnoredSymbolDiagram(DiagramPresentationElement diagramPresentationElement)
      Checks if diagram is ignored symbol diagram
      Parameters:
      diagramPresentationElement - diagram
      Returns:
      true if diagram is ignored symbol diagram
    • createDiagramType

      @OpenApi public static DiagramType createDiagramType(String type)
      Creates diagram type of given type string representation.
      Parameters:
      type - diagram type string representation
      Returns:
      created diagram type.
      See Also:
    • isCreatableDiagramType

      @OpenApi public static boolean isCreatableDiagramType(String type)
      Check, whether diagram type is creatable.
      Parameters:
      type - diagram type string representation
      Returns:
      true, if type is creatable.
      See Also:
    • getSuperType

      public static String getSuperType(String derivedType)
      Returns registered super type for given diagram type.
      Parameters:
      derivedType - the given derived type.
      Returns:
      the super diagram type or null.
    • getSuperType

      @CheckForNull public String getSuperType()
      Returns registered super type for diagram type.
      Returns:
      the super diagram type or null.
    • registerDiagramType

      public static void registerDiagramType(String newType, String superType, boolean creatable)
      Adds and registers new diagram type.
      Parameters:
      newType - the new diagram type.
      superType - the 'super diagram' type of the new diagram type. E.g. Interaction Diagram is a 'super diagram' for Collaboration Diagram and Sequence Diagram.
      creatable - flag indicating if the registering type diagrams will be creatable.
    • unregisterDiagramType

      public static void unregisterDiagramType(String type)
      Unregisters diagram type.
      Parameters:
      type - the diagram type.
    • registerHumanNames

      public static void registerHumanNames(String newType, String singularName, String pluralName)
    • getSingularHumanName

      public static String getSingularHumanName(String type)
      Returns singular human name of the given type.
      Parameters:
      type - the given type.
      Returns:
      singular name.
    • getPluralHumanName

      public static String getPluralHumanName(String type)
      Returns plural human name of the given type.
      Parameters:
      type - the given type.
      Returns:
      plural name.
    • getUMLDiagramType

      public String getUMLDiagramType()
      Returns UML diagram type.
      Returns:
      UML diagram type.
    • getStandardType

      public final String getStandardType()
      Specified by:
      getStandardType in class AbstractDiagramType
    • getDiagramActualElementType

      public static Class getDiagramActualElementType(String diagramType, Element owner)
    • isTypeOf

      public static boolean isTypeOf(String unknown, String type)
      Description copied from interface: DiagramTypes
      Checks if given specific type extends given generic type
      Parameters:
      unknown - specific type
      type - generic type
      Returns:
      true if extends
    • isTypeOf

      public static boolean isTypeOf(String unknown, List<String> types)
    • getPossibleDiagramOwnerTypes

      public static Collection<Class> getPossibleDiagramOwnerTypes(@CheckForNull String type)
    • getPossibleDiagramOwnerTypes

      public static Collection<Class> getPossibleDiagramOwnerTypes(@CheckForNull String type, boolean includeSuperTypeOwners)
      Parameters:
      type - diagram type
      includeSuperTypeOwners - should possible owners of provided diagram type's super-type's be included
      Returns:
      collection of class types
    • getAllSubtypes

      public static List<String> getAllSubtypes(String root, boolean creatable)
      collect all subtypes of the given root diagram type. root is inclusive in results
      Parameters:
      root - rot diagram type of the returned result
      creatable - if true, then only creatable types are returned
      Returns:
      subtypes of given rood diagram type. root is inclusive in results
    • getRootType

      public static String getRootType(String diagramType)
      Returns root type of given diagram type.
      Returns:
      root type.
    • getRootUMLType

      public static String getRootUMLType(String diagramType)
      Returns root type of the UML type diagram.
      Returns:
      root type one of the UML diagram type.
    • configureContextTypeByDiagramType

      public static List<?> configureContextTypeByDiagramType(Project project, String diagramType, List<Class> contextTypes)
      Configure owner types. Appends allowed DSLed context types (Stereotypes), may remove passed metaclasses.
      Parameters:
      project - project
      diagramType - diagram type
      contextTypes - collection of java.lang.Class or Stereotype (for DSL) objects
      Returns:
      types
    • filterByHiddenSuggestedDSLDiagramTypes

      public static void filterByHiddenSuggestedDSLDiagramTypes(String diagramType, Collection<?> contextTypes)
      Filters hidden suggested DSL diagram context types.
      Parameters:
      diagramType - type of the diagram.
      contextTypes - diagram context types.
    • unregisterContextTypeByDiagramTypeConfigurator

      public static void unregisterContextTypeByDiagramTypeConfigurator(com.nomagic.magicdraw.uml.DiagramType.ContextTypesConfigurator configurator)
      Unregisters a new context type by diagram type configurator
      Parameters:
      configurator - configurator
    • registerContextTypeByDiagramTypeConfigurator

      public static void registerContextTypeByDiagramTypeConfigurator(com.nomagic.magicdraw.uml.DiagramType.ContextTypesConfigurator configurator)
      Registers a new context type by diagram type configurator
      Parameters:
      configurator - configurator