Class Project

java.lang.Object
com.dassault_systemes.modeler.foundation.project.ModelElementProjectImpl
com.nomagic.magicdraw.core.Project
All Implemented Interfaces:
com.dassault_systemes.modeler.foundation.model.ModelElementRegistry, com.dassault_systemes.modeler.foundation.project.ModelElementProject, BaseElement, MDElement, com.nomagic.uml2.ext.jmi.reflect.ElementRegistry, com.nomagic.uml2.ext.jmi.reflect.RepositoryProvider, com.nomagic.uml2.project.ElementProject, Cloneable, Comparable

@OpenApi public class Project extends com.dassault_systemes.modeler.foundation.project.ModelElementProjectImpl implements com.nomagic.uml2.project.ElementProject, MDElement
The Project class represents main storage of all project data like: main package, all diagrams and diagram windows.
  • Field Details

    • COMMAND_EXECUTED

      @OpenApi public static final String COMMAND_EXECUTED
      The any command (adding object, deleting object, changing specifications) executing event type and naming.
      See Also:
    • SELECTION_CHANGED

      @OpenApi @Deprecated public static final String SELECTION_CHANGED
      Deprecated.
      now SelectionProvider fires selection changed, use SelectionProvider.SelectionChangedListener The diagram objects selecting event type and naming.
      See Also:
    • DIAGRAM_OPENED

      @OpenApi public static final String DIAGRAM_OPENED
      The diagram window opening event type and naming.
      See Also:
    • DIAGRAM_CLOSED

      @OpenApi public static final String DIAGRAM_CLOSED
      The diagram window closing event type and naming.
      See Also:
    • DIAGRAM_EDITED

      @OpenApi @Deprecated public static final String DIAGRAM_EDITED
      Deprecated.
      not used anymore
      Any diagram properties editing event type and naming.
      See Also:
    • DIAGRAM_ACTIVATED

      @OpenApi public static final String DIAGRAM_ACTIVATED
      The diagram focus on event type and naming.
      See Also:
    • DIAGRAM_WINDOW_ACTIVATED

      @OpenApi public static final String DIAGRAM_WINDOW_ACTIVATED
      The diagram window focus on event type and naming.
      See Also:
  • Method Details

    • getProxyManager

      @OpenApi public ProxyManager getProxyManager()
      Returns:
      proxy manager of the project
    • getBrowser

      @OpenApi public Browser getBrowser()
      Get browser.
      Returns:
      browser.
    • getOptions

      @OpenApi public ProjectOptions getOptions()
      Getter for project options.
      Returns:
      project options
    • getActiveDiagram

      @CheckForNull @OpenApi public DiagramPresentationElement getActiveDiagram()
      Returns currently active diagram.
      Returns:
      currently active diagram presentation element.
      See Also:
    • getDiagrams

      @OpenApi public Collection<DiagramPresentationElement> getDiagrams()
      Returns all existing diagrams stored in this Project.
      Returns:
      all existing DiagramPresentationElements. The collection is unmodifiable.
      See Also:
    • getDiagrams

      @OpenApi public Collection<DiagramPresentationElement> getDiagrams(@CheckForNull String type)
      Returns existing diagrams of given type stored in Project.

      Parameters:
      type - the given diagrams type. Returns all diagrams if type is null.
      Returns:
      collection of all diagram views.

      See Also:
    • getDiagram

      @CheckForNull @OpenApi public DiagramPresentationElement getDiagram(Diagram diagramElement)
      Returns diagram presentation element for specified diagram model element.
      Parameters:
      diagramElement - diagram model element
      Returns:
      diagram presentation element.
    • getFileName

      @CheckForNull @OpenApi public String getFileName()
      Method returns file name of this project. If file name is undefined returns project name.
      Returns:
      file name of this project.
    • isRemote

      @OpenApi public boolean isRemote()
      Returns the remote or not remote state of the project.
      Returns:
      true if project is a remote project, false otherwise.
    • isEsiProject

      @OpenApi public boolean isEsiProject()
      Determines whether this is an ESI project
      Returns:
      true if ESI project, false otherwise
    • isDirty

      @OpenApi public boolean isDirty()
      Returns true if this project was modified after last save/load.
      Returns:
      true if this project was modified after last save/load.
    • setDirty

      @Deprecated @OpenApi public void setDirty(boolean dirty)
      Marks this project modified.
      Parameters:
      dirty - new dirty flag.
    • setDirty

      @OpenApi public void setDirty(boolean dirty, @CheckForNull StateChangeHandler.DirtyType dirtyType)
      Marks this project modified and sets modification type depending on previous type.
      Parameters:
      dirty - new dirty flag.
      dirtyType - specifies how much dirty is project.
      If dirtyType == null, then default dirtyType value (DirtyType.HARD_DIRTY) is set.
      If dirty == true && dirtyType == DirtyType.SOFT_DIRTY and project is already in state
      dirty == true && dirtyType == DirtyType.HARD_DIRTY, then project's state is not going to be changed.
    • getDirtyType

      @CheckForNull @OpenApi public StateChangeHandler.DirtyType getDirtyType()
      Returns project dirty type if project is dirty, otherwise - null.
      Returns:
      project dirty type
    • reSetDirty

      @OpenApi public void reSetDirty(boolean dirty, @CheckForNull StateChangeHandler.DirtyType dirtyType)
      Marks this project modified and sets modification type without checking previous project's dirty type.
      Parameters:
      dirty - new dirty flag.
      dirtyType - specifies how much dirty is project. If dirtyType == null, then default dirtyType value (DirtyType.HARD_DIRTY) is set.
    • addToProjectRepository

      @OpenApi public void addToProjectRepository(Element element)
      Adds element into this project repository and removes it from previous project repository. If element does not have an ID then it will be created.
      After this operation element can be retrieved from project by getElementByID(String).
      Parameters:
      element - any element
    • getElementByID

      @OpenApi @CheckForNull public BaseElement getElementByID(@CheckForNull String id)
      Return the element with given id.
      Specified by:
      getElementByID in interface com.dassault_systemes.modeler.foundation.model.ModelElementRegistry
      Parameters:
      id - the id of the element.
      Returns:
      the element with given id or null if element with such id is not registered in the project.
    • isElementDisposed

      @OpenApi public static boolean isElementDisposed(@CheckForNull com.dassault_systemes.modeler.foundation.model.ModelElement element)
      Check if given element is unregistered from project.
      Parameters:
      element - element
      Returns:
      true if element is disposed
    • isDisposed

      @OpenApi public boolean isDisposed(BaseElement element)
      Check if given element is unregistered from project.
      Specified by:
      isDisposed in interface com.dassault_systemes.modeler.foundation.model.ModelElementRegistry
      Parameters:
      element - element
      Returns:
      true if element is disposed
    • getStateChangeHandler

      @OpenApi public StateChangeHandler getStateChangeHandler()
      Returns:
      StateChangeHandler for this project.
    • getRepository

      @OpenApi public AbstractRepository getRepository()
      Get project repository.
      Specified by:
      getRepository in interface com.nomagic.uml2.ext.jmi.reflect.RepositoryProvider
      Returns:
      repository.
    • getElementsFactory

      @OpenApi public ElementsFactory getElementsFactory()
      Description copied from interface: com.nomagic.uml2.project.ElementProject
      Provides UML elements factory
      Specified by:
      getElementsFactory in interface com.nomagic.uml2.project.ElementProject
      Returns:
      Class for creating uml model elements.
    • getSmartEventSupport

      @OpenApi public SmartEventSupport getSmartEventSupport()
      Returns registry that allows to register smart listener configurations by element type.
      Returns:
      smart listener registry.
    • getModel

      @OpenApi @Deprecated @CheckForNull public Model getModel()
      Deprecated.
      deprecated because of ambiguity with historical API evolution
      Returns root primary model - root container of all model structure. This method should not be called anymore for TWC projects, because the returned model does not include the root models of modules (attached projects). getModels() or getPrimaryModel() should be used instead as needed.
      Returns:
      root model element
      Throws:
      IllegalStateException - in case root element is not a Model, but a Package
    • getPrimaryModel

      @OpenApi public Package getPrimaryModel()
      Description copied from interface: com.nomagic.uml2.project.ElementProject
      Returns a primary model of this project. Other models comes from modules (attached projects).
      Specified by:
      getPrimaryModel in interface com.nomagic.uml2.project.ElementProject
      Returns:
      primary model
      See Also:
      • ElementProject.getModels()
    • getModels

      @OpenApi public List<Package> getModels()
    • getSymbolElementMap

      @OpenApi public SymbolElementMap getSymbolElementMap()
      Get element symbol map.
      Returns:
      symbol element map
    • getRepositoryListenerRegistry

      @OpenApi public RepositoryListenerRegistry getRepositoryListenerRegistry()
      Return listener registry for repository.
      Returns:
      listener registry for repository.
    • getProject

      @OpenApi public static Project getProject(@CheckForNull Collection<? extends BaseElement> elements)
      Returns Project from first given element
      Parameters:
      elements - project elements
      Returns:
      project in which first given element exists
    • getProject

      @OpenApi public static Project getProject(@CheckForNull BaseElement element)
      Returns Project for given element
      Parameters:
      element - project element.
      Returns:
      project in which given element exists.
      See Also:
      • ProjectProvider
    • getPrimaryProject

      @OpenApi public com.nomagic.ci.persistence.IPrimaryProject getPrimaryProject()
      Primary project of MagicDraw project.
      Returns:
      primary project.
    • getName

      @OpenApi public String getName()
      Returns project name.
      Specified by:
      getName in interface MDElement
      Returns:
      project name.