Package com.nomagic.magicdraw.core
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
,ElementRegistry
,RepositoryProvider
,com.nomagic.uml2.project.ElementProject
,java.lang.Cloneable
,java.lang.Comparable
@OpenApi public class Project extends com.dassault_systemes.modeler.foundation.project.ModelElementProjectImpl implements com.nomagic.uml2.project.ElementProject, MDElement
TheProject
class represents main storage of all project data like: main package, all diagrams and diagram windows.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COMMAND_EXECUTED
The any command (adding object, deleting object, changing specifications) executing event type and naming.static java.lang.String
DIAGRAM_ACTIVATED
The diagram focus on event type and naming.static java.lang.String
DIAGRAM_CLOSED
The diagram window closing event type and naming.static java.lang.String
DIAGRAM_EDITED
Deprecated.not used anymorestatic java.lang.String
DIAGRAM_OPENED
The diagram window opening event type and naming.static java.lang.String
DIAGRAM_WINDOW_ACTIVATED
The diagram window focus on event type and naming.static java.lang.String
SELECTION_CHANGED
Deprecated.now SelectionProvider fires selection changed, useSelectionProvider.SelectionChangedListener
The diagram objects selecting event type and naming.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addToProjectRepository(Element element)
Adds element into this project repository and removes it from previous project repository.DiagramPresentationElement
getActiveDiagram()
Returns currently active diagram.Browser
getBrowser()
Get browser.DiagramPresentationElement
getDiagram(Diagram diagramElement)
Returns diagram presentation element for specified diagram model element.java.util.Collection<DiagramPresentationElement>
getDiagrams()
Returns all existing diagrams stored in this Project.java.util.Collection<DiagramPresentationElement>
getDiagrams(java.lang.String type)
Returns existing diagrams of given type stored in Project.StateChangeHandler.DirtyType
getDirtyType()
Returns project dirty type if project is dirty, otherwise - null.BaseElement
getElementByID(java.lang.String id)
Return the element with given id.ElementsFactory
getElementsFactory()
Provides UML elements factoryjava.lang.String
getFileName()
Method returns file name of this project.Model
getModel()
Deprecated.deprecated because of ambiguity with historical API evolutionjava.util.List<Package>
getModels()
java.lang.String
getName()
Returns project name.ProjectOptions
getOptions()
Getter for project options.Package
getPrimaryModel()
Returns a primary model of this project.com.nomagic.ci.persistence.IPrimaryProject
getPrimaryProject()
Primary project of MagicDraw project.static Project
getProject(BaseElement element)
Returns Project for given elementstatic Project
getProject(java.util.Collection<? extends BaseElement> elements)
Returns Project from first given elementProxyManager
getProxyManager()
AbstractRepository
getRepository()
Get project repository.RepositoryListenerRegistry
getRepositoryListenerRegistry()
Return listener registry for repository.SmartEventSupport
getSmartEventSupport()
Returns registry that allows to register smart listener configurations by element type.StateChangeHandler
getStateChangeHandler()
SymbolElementMap
getSymbolElementMap()
Get element symbol map.boolean
isDirty()
Returns true if this project was modified after last save/load.boolean
isDisposed(BaseElement element)
Check if given element is unregistered from project.static boolean
isElementDisposed(com.dassault_systemes.modeler.foundation.model.ModelElement element)
Check if given element is unregistered from project.boolean
isEsiProject()
Determines whether this is an ESI projectboolean
isRemote()
Returns the remote or not remote state of the project.void
reSetDirty(boolean dirty, StateChangeHandler.DirtyType dirtyType)
Marks this project modified and sets modification type without checking previous project's dirty type.void
setDirty(boolean dirty)
Deprecated.void
setDirty(boolean dirty, StateChangeHandler.DirtyType dirtyType)
Marks this project modified and sets modification type depending on previous type.-
Methods inherited from class com.dassault_systemes.modeler.foundation.project.ModelElementProjectImpl
getOptionalService, getService, getServiceProvider
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.nomagic.magicdraw.uml.BaseElement
canAdd
-
-
-
-
Field Detail
-
COMMAND_EXECUTED
@OpenApi public static final java.lang.String COMMAND_EXECUTED
The any command (adding object, deleting object, changing specifications) executing event type and naming.- See Also:
- Constant Field Values
-
SELECTION_CHANGED
@OpenApi @Deprecated public static final java.lang.String SELECTION_CHANGED
Deprecated.now SelectionProvider fires selection changed, useSelectionProvider.SelectionChangedListener
The diagram objects selecting event type and naming.- See Also:
- Constant Field Values
-
DIAGRAM_OPENED
@OpenApi public static final java.lang.String DIAGRAM_OPENED
The diagram window opening event type and naming.- See Also:
- Constant Field Values
-
DIAGRAM_CLOSED
@OpenApi public static final java.lang.String DIAGRAM_CLOSED
The diagram window closing event type and naming.- See Also:
- Constant Field Values
-
DIAGRAM_EDITED
@OpenApi @Deprecated public static final java.lang.String DIAGRAM_EDITED
Deprecated.not used anymoreAny diagram properties editing event type and naming.- See Also:
- Constant Field Values
-
DIAGRAM_ACTIVATED
@OpenApi public static final java.lang.String DIAGRAM_ACTIVATED
The diagram focus on event type and naming.- See Also:
- Constant Field Values
-
DIAGRAM_WINDOW_ACTIVATED
@OpenApi public static final java.lang.String DIAGRAM_WINDOW_ACTIVATED
The diagram window focus on event type and naming.- See Also:
- Constant Field Values
-
-
Method Detail
-
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:
DiagramPresentationElement
-
getDiagrams
@OpenApi public java.util.Collection<DiagramPresentationElement> getDiagrams()
Returns all existing diagrams stored in this Project.- Returns:
- all existing DiagramPresentationElements. The collection is unmodifiable.
- See Also:
DiagramPresentationElement
-
getDiagrams
@OpenApi public java.util.Collection<DiagramPresentationElement> getDiagrams(@CheckForNull java.lang.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:
DiagramPresentationElement
-
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 java.lang.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)
Deprecated.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.
IfdirtyType == null
, then default dirtyType value (DirtyType.HARD_DIRTY
) is set.
Ifdirty == 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. IfdirtyType == 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 bygetElementByID(String)
.- Parameters:
element
- any element
-
getElementByID
@OpenApi @CheckForNull public BaseElement getElementByID(@CheckForNull java.lang.String id)
Return the element with given id.- Specified by:
getElementByID
in interfacecom.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 interfacecom.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 interfaceRepositoryProvider
- Returns:
- repository.
-
getElementsFactory
@OpenApi public ElementsFactory getElementsFactory()
Description copied from interface:com.nomagic.uml2.project.ElementProject
Provides UML elements factory- Specified by:
getElementsFactory
in interfacecom.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 evolutionReturns 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()
orgetPrimaryModel()
should be used instead as needed.- Returns:
- root model element
- Throws:
java.lang.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 interfacecom.nomagic.uml2.project.ElementProject
- Returns:
- primary model
- See Also:
ElementProject.getModels()
-
getModels
@OpenApi public java.util.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 java.util.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.
-
-