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
,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 Summary
Modifier and TypeFieldDescriptionstatic final String
The any command (adding object, deleting object, changing specifications) executing event type and naming.static final String
The diagram focus on event type and naming.static final String
The diagram window closing event type and naming.static final String
Deprecated.not used anymorestatic final String
The diagram window opening event type and naming.static final String
The diagram window focus on event type and naming.static final String
Deprecated.now SelectionProvider fires selection changed, useSelectionProvider.SelectionChangedListener
The diagram objects selecting event type and naming. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToProjectRepository
(Element element) Adds element into this project repository and removes it from previous project repository.Returns currently active diagram.Get browser.getDiagram
(Diagram diagramElement) Returns diagram presentation element for specified diagram model element.Returns all existing diagrams stored in this Project.getDiagrams
(String type) Returns existing diagrams of given type stored in Project.Returns project dirty type if project is dirty, otherwise - null.getElementByID
(String id) Return the element with given id.Provides UML elements factoryMethod returns file name of this project.getModel()
Deprecated.deprecated because of ambiguity with historical API evolutiongetName()
Returns project name.Getter for project options.Returns a primary model of this project.com.nomagic.ci.persistence.IPrimaryProject
Primary project of MagicDraw project.static Project
getProject
(BaseElement element) Returns Project for given elementstatic Project
getProject
(Collection<? extends BaseElement> elements) Returns Project from first given elementGet project repository.Return listener registry for repository.Returns registry that allows to register smart listener configurations by element type.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
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
Methods inherited from interface com.dassault_systemes.modeler.foundation.project.ModelElementProject
getOptionalService, getService, getServiceProvider
-
Field Details
-
COMMAND_EXECUTED
The any command (adding object, deleting object, changing specifications) executing event type and naming.- See Also:
-
SELECTION_CHANGED
Deprecated.now SelectionProvider fires selection changed, useSelectionProvider.SelectionChangedListener
The diagram objects selecting event type and naming.- See Also:
-
DIAGRAM_OPENED
The diagram window opening event type and naming.- See Also:
-
DIAGRAM_CLOSED
The diagram window closing event type and naming.- See Also:
-
DIAGRAM_EDITED
Deprecated.not used anymoreAny diagram properties editing event type and naming.- See Also:
-
DIAGRAM_ACTIVATED
The diagram focus on event type and naming.- See Also:
-
DIAGRAM_WINDOW_ACTIVATED
The diagram window focus on event type and naming.- See Also:
-
-
Method Details
-
getProxyManager
- Returns:
- proxy manager of the project
-
getBrowser
Get browser.- Returns:
- browser.
-
getOptions
Getter for project options.- Returns:
- project options
-
getActiveDiagram
Returns currently active diagram.- Returns:
- currently active diagram presentation element.
- See Also:
-
getDiagrams
Returns all existing diagrams stored in this Project.- Returns:
- all existing DiagramPresentationElements. The collection is unmodifiable.
- See Also:
-
getDiagrams
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
Returns diagram presentation element for specified diagram model element.- Parameters:
diagramElement
- diagram model element- Returns:
- diagram presentation element.
-
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.Marks this project modified.- Parameters:
dirty
- new dirty flag.
-
setDirty
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
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
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
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
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
- Returns:
- StateChangeHandler for this project.
-
getRepository
Get project repository.- Specified by:
getRepository
in interfacecom.nomagic.uml2.ext.jmi.reflect.RepositoryProvider
- Returns:
- repository.
-
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
Returns registry that allows to register smart listener configurations by element type.- Returns:
- smart listener registry.
-
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:
IllegalStateException
- in case root element is not a Model, but a 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
-
getSymbolElementMap
Get element symbol map.- Returns:
- symbol element map
-
getRepositoryListenerRegistry
Return listener registry for repository.- Returns:
- listener registry for repository.
-
getProject
Returns Project from first given element- Parameters:
elements
- project elements- Returns:
- project in which first given element exists
-
getProject
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
Returns project name.
-