Package com.nomagic.magicdraw.core
Class Project
- java.lang.Object
-
- com.nomagic.uml2.project.ElementProjectImpl
-
- com.nomagic.magicdraw.core.Project
-
- All Implemented Interfaces:
BaseElement
,MDElement
,ElementRegistry
,RepositoryProvider
,com.nomagic.uml2.project.ElementProject
,java.lang.Cloneable
,java.lang.Comparable
@OpenApi public class Project extends com.nomagic.uml2.project.ElementProjectImpl implements ElementRegistry, RepositoryProvider, MDElement
TheProject
class represents main storage of all project data like: main package, all diagrams and diagram windows.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
com.nomagic.magicdraw.core.Project.ElementByIDFetcher
private class
com.nomagic.magicdraw.core.Project.ElementByIDQuerier
private class
com.nomagic.magicdraw.core.Project.ElementByIDTaker
private class
com.nomagic.magicdraw.core.Project.QueryChangeRegistryUpdater
-
Field Summary
Fields Modifier and Type Field Description private com.nomagic.magicdraw.core.BinaryStreamAtticCleaner
binaryStreamAtticCleaner
private Browser
browser
private boolean
closed
Is project disposedprivate boolean
closing
Is project closingstatic java.lang.String
COMMAND_EXECUTED
The any command (adding object, deleting object, changing specifications) executing event type and naming.private com.nomagic.magicdraw.commands.CommandHistory
commandHistory
Command history of project instance.private CookieSet
cookies
private com.nomagic.magicdraw.core.MDCounter
counter
Counter for IDprivate static boolean
createBrowser
Create project with or without browser.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
The any diagram properties editing event type and naming.static 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.private com.nomagic.utils.ExtendedPropertyChangeSupport
diagramContentListeners
private com.nomagic.magicdraw.ui.ProjectDiagramWindowsManager
diagramWindowsManager
The window managerstatic java.lang.String
DIRTY_PROPERTY
Project "dirty" flag changeprivate com.nomagic.magicdraw.ui.dsl.DSLManager
dslManager
Project customization managerprivate com.nomagic.magicdraw.core.Project.ElementByIDFetcher
elementByIDFetcher
private ElementsFactory
elementsFactory
private static java.util.Set<java.lang.String>
FEATURES
A set of ci features available in runtimeprivate com.nomagic.magicdraw.utils.ExtendedFile
file
static java.lang.String
FILE_NAME_PROPERTY
Project file name propertyprivate boolean
frozen
Is project frozen - some project data may not be accessible if project is frozenprivate java.lang.Boolean
hasUnloadedManuallyReachableModules
Determines whether there are manually reachable modules that are unloaded currently in this projectprivate java.lang.String
id
The ID of the element.private boolean
intensiveActionExecuted
private com.nomagic.utils.AList<java.beans.PropertyChangeListener>
listeners
The element can registry a property change listeners and fire property change events on some property value change.private boolean
loaded
private com.nomagic.magicdraw.teamwork2.esi.EsiLockProjectService
lockProjectService
static java.lang.String
MANY_CLASSES_UPDATED
Event type when many elements in project are changed (for example after project update,massive source reverse operation and etc)private boolean
needLocallySave
private java.util.Map<java.lang.String,java.lang.Object>
objectsByID
The map of all objects registered by id.private IPrimaryProject
primaryProject
Storage where project is loaded from or saved to.private java.lang.String
projectTitle
Preset project titleprivate ProxyManager
proxyManager
Proxy managerprivate java.util.concurrent.atomic.AtomicReference<com.nomagic.ci.persistence.local.query.IQueryChangeRegistry>
queryChangeRegistry
private com.nomagic.ci.persistence.local.query.IQueryFactory
queryFactory
private boolean
reloadRecommended
private boolean
relocatingIn
Is project relocatingprivate Package
rootPackage
static java.lang.String
SELECTION_CHANGED
Deprecated.now SelectionProvider fires selection changed, useSelectionProvider.SelectionChangedListener
The diagram objects selecting event type and naming.private com.nomagic.uml2.project.service.ProjectServiceProvider
serviceProvider
private SmartEventSupport
smartEventSupport
private com.nomagic.magicdraw.uml.SortKeys
sortKeys
Holds sorting keys.private StateChangeHandler
stateChangeHandler
State changes handler.private com.nomagic.magicdraw.uml.symbols.StereotypesStyleChangeManager
stereotypesStyleChangeManager
private SymbolElementMap
symbolElementMap
private com.nomagic.magicdraw.commands.SymbolUpdater
symbolUpdater
Explicitly set symbol updater.private java.util.Map<java.lang.String,ProjectWindow>
windows
-
Constructor Summary
Constructors Constructor Description Project()
Constructor creates project.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
accept(AbstractVisitor visitor)
Method accepts visitor, and calls method visit < class name > ( this ) of visitor .void
accept(Visitor visitor)
Method accepts visitor, and calls method visit<class name>(this) of visitor .void
addElementByID(BaseElement obj, java.lang.String oldID)
Register the object by id.static void
addFeature(java.lang.String feature)
Register a feature for a new project.void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Registers the listener to the element.void
addToProjectRepository(Element element)
Adds element into this project repository and removes it from previous project repository.void
addWindow(ProjectWindow window)
void
atInsert()
This method is called then this element is added into the project.boolean
canAdd(BaseElement element)
Checks if this element can add given element.boolean
canAdd(BaseElement element, boolean checkPermissions)
Checks if this element can add given element.boolean
canAddChild()
Checks if new elements can be added to this elementboolean
canAddChild(BaseElement o)
boolean
canAddInstance(BaseElement o)
Checks if this object can add element of given type.boolean
canBeDeleted()
Checks if element can be deleted from project.boolean
canChangeParent(java.util.Collection elements, BaseElement newParent)
Returns true, if element can change parent.boolean
canDeleteChild(BaseElement child)
Checks if given element can be deleted from this element.private void
checkDuplicates(BaseElement obj, java.lang.String newID)
java.lang.Object
clone()
int
compareTo(java.lang.Object o)
Compares sort key at index 1 with given element's sort key at index 1.com.nomagic.magicdraw.uml.ElementSortKeys
createSortKeys()
void
dispose()
Destroys the project.void
elementAdded(BaseElement element)
Marks element as added, if it was previously removed its id is removed from id collection.void
elementRemoved(BaseElement obj)
Marks element removed, its id added to mDeletedObjectIDS.private void
ensureLocalIDSet(BaseElement obj)
boolean
executeIntensiveAction(java.lang.String reason)
Executes time-intensive action if user agrees to.void
firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
DelegatesfirePropertyChange
to thePropertyChangeSupport
, the member of this class, which reports a bound property update to any registered listeners.java.lang.String
generateID()
Generate ID.DiagramPresentationElement
getActiveDiagram()
Returns currently active diagram.java.util.Collection<BaseElement>
getAllElements()
Gets collection of all model elements in the projectjava.util.Collection<java.lang.String>
getAllIDS()
Returns the collection of all ids in the project.com.nomagic.magicdraw.core.BinaryStreamAtticCleaner
getBinaryStreamAtticCleaner()
Browser
getBrowser()
Get browser.java.lang.Class
getClassType()
Gets the type of the element class.com.nomagic.magicdraw.commands.MacroCommand
getCommandForAppending()
com.nomagic.magicdraw.commands.CommandHistory
getCommandHistory()
CookieSet
getCookieSet()
com.nomagic.magicdraw.core.MDCounter
getCounter()
DiagramPresentationElement
getDiagram(Diagram diagramElement)
Returns diagram presentation element for specified diagram model element.com.nomagic.utils.ExtendedPropertyChangeSupport
getDiagramContentListeners()
Returns listeners of all diagrams content.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.java.lang.String
getDirectory()
Deprecated.use #getFile.getParentStateChangeHandler.DirtyType
getDirtyType()
Returns project dirty type if project is dirty, otherwise - null.com.nomagic.magicdraw.ui.dsl.DSLManager
getDSLManager()
Returns project customization manager.BaseElement
getElementByID(java.lang.String id)
Return the element with given id.com.nomagic.magicdraw.core.Project.ElementByIDFetcher
getElementByIDQuerier()
java.util.Collection<? extends BaseElement>
getElementsByIDs(java.util.Collection<java.lang.String> ids)
Return the objects by given ids.java.util.Collection<? extends BaseElement>
getElementsByIDs(java.util.Collection<java.lang.String> ids, java.util.function.Supplier<java.util.Collection<BaseElement>> collectionFactory)
Return the objects by given ids.ElementsFactory
getElementsFactory()
static java.util.Collection<java.lang.String>
getElementsIDs(java.util.Collection<? extends BaseElement> elements)
Retrieves the elements ids from DTObjects collection.private com.nomagic.magicdraw.teamwork2.esi.EsiLockProjectService
getEsiLockProjectService()
XmiExporterDescription
getExporterDescription()
static java.util.Set<java.lang.String>
getFeatures()
Return registered features for a new project.com.nomagic.magicdraw.utils.ExtendedFile
getFile()
Method returns file of this project.java.lang.String
getFileName()
Method returns file name of this project.boolean
getHasUnloadedManuallyReachableModules()
java.lang.String
getHumanName()
Returns human representation of the element.java.lang.String
getHumanType()
Returns human representation of the element type.java.lang.String
getID()
Returns the ID of theElement
.ProjectDescriptor
getLoadedFrom()
Return location from were project was loaded.org.eclipse.emf.common.util.URI
getLocationUri()
Get URI location according the primary project.Model
getModel()
Deprecated.deprecated because of ambiguity with historical API evolutionjava.util.List<Package>
getModels()
java.lang.String
getName()
Returns project name.BaseElement
getObjectParent()
Returns the element parent.<T> T
getOptionalService(java.lang.Class<T> type)
Returns project service of the specified type.ProjectOptions
getOptions()
Getter for project options.BaseElement
getPresentationElementByID(java.lang.String elementID)
Return the presentation element with given id from currently registered elements.Package
getPrimaryModel()
IPrimaryProject
getPrimaryProject()
Primary project of MagicDraw project.Project
getProject()
static Project
getProject(BaseElement element)
Returns Project for given elementcom.nomagic.magicdraw.ui.ProjectDiagramWindowsManager
getProjectDiagramWindowsManager()
Project
getProjectImpl()
ProxyManager
getProxyManager()
private com.nomagic.ci.persistence.local.query.IQueryChangeRegistry
getQueryChangeRegistry()
private com.nomagic.ci.persistence.local.query.IQueryService
getQueryService()
java.lang.String
getRemoteID()
AbstractRepository
getRepository()
Get project repository.RepositoryListenerRegistry
getRepositoryListenerRegistry()
Return listener registry for repository.java.lang.String
getResourceID()
<T> T
getService(java.lang.Class<T> type)
Returns project service of the specified type.com.nomagic.uml2.project.service.ProjectServiceProvider
getServiceProvider()
SmartEventSupport
getSmartEventSupport()
Returns registry that allows to register smart listener configurations by element type.com.nomagic.magicdraw.uml.SortKeys
getSortKeys()
Implementation of getSortKeys() from Sortable interface.StateChangeHandler
getStateChangeHandler()
com.nomagic.magicdraw.uml.symbols.StereotypesStyleChangeManager
getStereotypesStyleChangeHandler()
StyleManager
getStyleManager()
Returns style managerSymbolElementMap
getSymbolElementMap()
Get element symbol map.com.nomagic.magicdraw.commands.SymbolUpdater
getSymbolUpdater()
java.lang.String
getTitle()
TransactionManager
getTransactionsManager()
Return transaction manager.com.nomagic.magicdraw.uml.UMLModelProjectFeature
getUMLModelStorageFeature()
ProjectWindow
getWindow(java.lang.String id)
java.util.Collection<ProjectWindow>
getWindows()
boolean
hasListeners()
boolean
hasWindow(java.lang.String id)
void
invalidateHasUnloadedManuallyReachableModules()
Invalidates thegetHasUnloadedManuallyReachableModules()
flagboolean
isClosing()
static boolean
isCreateBrowser()
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.boolean
isEditable()
Checks if element can be edited.static boolean
isElementDisposed(Element element)
Check if given element is unregistered from project.boolean
isElementInProject(java.lang.String id)
Check if element with a given id is in this project.boolean
isEMFProxiesSupported()
Returns whether the registry supports EMF proxies.boolean
isEsiProject()
Determines whether this is an ESI projectboolean
isFrozen()
boolean
isLoaded()
Return value of "loaded" flagboolean
isModel(BaseElement element)
Checks if the given element is a one of the models in this project.boolean
isModel(Package element)
boolean
isNeedLocallySave()
Teamwork projects after commit can be saved locally, using flag to hold state about teamwork projects were saved locally.boolean
isNew()
boolean
isParentOf(BaseElement obj)
Returns true, if current element is parent of given element.boolean
isPreloadProject()
boolean
isProjectClosed()
Checks if this project was already disposed(closed).boolean
isProjectDisposed()
Deprecated.use #isProjectClosedboolean
isReady()
boolean
isReloadRecommended()
Indicates whether project reload is recommended to see the full effects of some user action.boolean
isRelocatedIn()
boolean
isRemote()
Returns the remote or not remote state of the project.boolean
isUpdatingProjectsInCurrentThread()
private BaseElement
queryElementByID(java.lang.String id)
void
refAddInstance(javax.jmi.reflect.RefBaseObject instance)
java.util.Collection<javax.jmi.reflect.RefBaseObject>
refAllOfClasses(java.util.Set<AbstractRefClass> classes)
void
refRemoveInstance(javax.jmi.reflect.RefBaseObject instance)
<T> void
register(java.lang.Class<T> type, T service)
Registers the specified service.void
removeAllPropertyChangeListeners()
Removes all property change listeners from this element.void
removeElementByID(BaseElement obj)
Unregister the object by id.private void
removeElementByID(BaseElement obj, java.lang.String oldID)
Remove object from map by idstatic void
removeFeature(java.lang.String feature)
Unregister a feature for a new project.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Unregisters the given listener from the element.void
removeWindow(ProjectWindow window)
void
reSetDirty(boolean dirty, StateChangeHandler.DirtyType dirtyType)
Marks this project modified and sets modification type without checking previous project's dirty type.void
resetDynamicRepository()
Removes current dynamic repository if such exist and installs a new dynamic repository.private void
resetElementsByID()
Resets all records about objects and theirs ids.void
setClosing(boolean closing)
Set closing project statevoid
setCounter(com.nomagic.magicdraw.core.MDCounter c)
Sets the counter for the project.static void
setCreateBrowser(boolean createBrowser)
void
setDirectory(java.lang.String dir)
Deprecated.void
setDirty(boolean dirty)
Deprecated.void
setDirty(boolean dirty, StateChangeHandler.DirtyType dirtyType)
Marks this project modified and sets modification type depending on previous type.void
setExporterDescription(XmiExporterDescription exporterDescription)
void
setFileName(java.lang.String fileName)
Set the name of file as location of this project.void
setFrozen(boolean frozen)
Set frozen flag.void
setID(java.lang.String id)
Sets the specified ID to theElement
.void
setLoaded(boolean loaded)
Set "Loaded" flag for project.void
setModel(Package p)
void
setName(java.lang.String name)
Deprecated.void
setNeedLocallySave(boolean locallySaved)
void
setPrimaryProject(IProject primaryProject)
void
setPrimaryProject(IProject primaryProject, boolean closeOldProject, boolean changeModel)
Set primary project.void
setReloadRecommended(boolean reloadRecommended)
Sets new value forisReloadRecommended()
void
setRelocatingIn(boolean relocating)
Set project state to relocating.void
setSpecificSymbolUpdater(com.nomagic.magicdraw.commands.SymbolUpdater symbolUpdater)
void
setTitle(java.lang.String title)
java.lang.String
sGetID()
Returns the actual ID of theElement
.java.lang.String
toString()
Returns string representation of this element.private void
updateElementLockState(BaseElement obj)
-
-
-
Field Detail
-
sortKeys
private com.nomagic.magicdraw.uml.SortKeys sortKeys
Holds sorting keys. The element has predefined set of sort keys(for example name, stereotype name, visibility and etc)
-
id
private java.lang.String id
The ID of the element.
-
listeners
@CheckForNull private com.nomagic.utils.AList<java.beans.PropertyChangeListener> listeners
The element can registry a property change listeners and fire property change events on some property value change. This member keeps a reference to thePropertyChangeSupport
.
-
cookies
private final CookieSet cookies
-
FEATURES
private static final java.util.Set<java.lang.String> FEATURES
A set of ci features available in runtime
-
closed
private volatile boolean closed
Is project disposed
-
frozen
private volatile boolean frozen
Is project frozen - some project data may not be accessible if project is frozen
-
closing
private volatile boolean closing
Is project closing
-
relocatingIn
private volatile boolean relocatingIn
Is project relocating
-
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 public static final java.lang.String DIAGRAM_EDITED
The any 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
-
MANY_CLASSES_UPDATED
public static final java.lang.String MANY_CLASSES_UPDATED
Event type when many elements in project are changed (for example after project update,massive source reverse operation and etc)- See Also:
- Constant Field Values
-
FILE_NAME_PROPERTY
public static final java.lang.String FILE_NAME_PROPERTY
Project file name property- See Also:
- Constant Field Values
-
DIRTY_PROPERTY
public static final java.lang.String DIRTY_PROPERTY
Project "dirty" flag change- See Also:
- Constant Field Values
-
counter
private com.nomagic.magicdraw.core.MDCounter counter
Counter for ID
-
needLocallySave
private boolean needLocallySave
-
createBrowser
private static boolean createBrowser
Create project with or without browser.
-
browser
private Browser browser
-
windows
private final java.util.Map<java.lang.String,ProjectWindow> windows
-
commandHistory
private final com.nomagic.magicdraw.commands.CommandHistory commandHistory
Command history of project instance. It performs command executing, storing, undoing.
-
symbolUpdater
@CheckForNull private com.nomagic.magicdraw.commands.SymbolUpdater symbolUpdater
Explicitly set symbol updater. By default command history is used.
-
diagramWindowsManager
private final com.nomagic.magicdraw.ui.ProjectDiagramWindowsManager diagramWindowsManager
The window manager
-
objectsByID
private final java.util.Map<java.lang.String,java.lang.Object> objectsByID
The map of all objects registered by id.
-
stateChangeHandler
private StateChangeHandler stateChangeHandler
State changes handler.
-
stereotypesStyleChangeManager
private final com.nomagic.magicdraw.uml.symbols.StereotypesStyleChangeManager stereotypesStyleChangeManager
-
smartEventSupport
private final SmartEventSupport smartEventSupport
-
elementsFactory
private final ElementsFactory elementsFactory
-
rootPackage
private Package rootPackage
-
symbolElementMap
private SymbolElementMap symbolElementMap
-
proxyManager
private final ProxyManager proxyManager
Proxy manager
-
dslManager
private com.nomagic.magicdraw.ui.dsl.DSLManager dslManager
Project customization manager
-
loaded
private boolean loaded
-
file
private com.nomagic.magicdraw.utils.ExtendedFile file
-
elementByIDFetcher
private final com.nomagic.magicdraw.core.Project.ElementByIDFetcher elementByIDFetcher
-
binaryStreamAtticCleaner
private final com.nomagic.magicdraw.core.BinaryStreamAtticCleaner binaryStreamAtticCleaner
-
primaryProject
private IPrimaryProject primaryProject
Storage where project is loaded from or saved to.
-
queryFactory
private com.nomagic.ci.persistence.local.query.IQueryFactory queryFactory
-
hasUnloadedManuallyReachableModules
@CheckForNull private java.lang.Boolean hasUnloadedManuallyReachableModules
Determines whether there are manually reachable modules that are unloaded currently in this project
-
reloadRecommended
private boolean reloadRecommended
-
projectTitle
private java.lang.String projectTitle
Preset project title
-
intensiveActionExecuted
private volatile boolean intensiveActionExecuted
-
serviceProvider
private final com.nomagic.uml2.project.service.ProjectServiceProvider serviceProvider
-
queryChangeRegistry
private final java.util.concurrent.atomic.AtomicReference<com.nomagic.ci.persistence.local.query.IQueryChangeRegistry> queryChangeRegistry
-
lockProjectService
private com.nomagic.magicdraw.teamwork2.esi.EsiLockProjectService lockProjectService
-
diagramContentListeners
private final com.nomagic.utils.ExtendedPropertyChangeSupport diagramContentListeners
-
-
Method Detail
-
isCreateBrowser
public static boolean isCreateBrowser()
-
setCreateBrowser
public static void setCreateBrowser(boolean createBrowser)
-
getElementsIDs
public static java.util.Collection<java.lang.String> getElementsIDs(java.util.Collection<? extends BaseElement> elements)
Retrieves the elements ids from DTObjects collection.- Parameters:
elements
- collection of elements to get ID's for- Returns:
- the collection of elements ids from the DTObjects collection.
-
executeIntensiveAction
public boolean executeIntensiveAction(java.lang.String reason)
Executes time-intensive action if user agrees to.- Parameters:
reason
- reason why the action might take a long time- Returns:
- true if execute action
-
getProxyManager
@OpenApi public ProxyManager getProxyManager()
- Returns:
- proxy manager of the project
-
getDSLManager
public com.nomagic.magicdraw.ui.dsl.DSLManager getDSLManager()
Returns project customization manager.- Returns:
- the manager.
-
getBrowser
@OpenApi public Browser getBrowser()
Get browser.- Returns:
- browser.
-
getOptions
@OpenApi public ProjectOptions getOptions()
Getter for project options.- Returns:
- project options
-
getCommandHistory
public com.nomagic.magicdraw.commands.CommandHistory getCommandHistory()
- Returns:
- project command history.
-
setSpecificSymbolUpdater
public void setSpecificSymbolUpdater(@CheckForNull com.nomagic.magicdraw.commands.SymbolUpdater symbolUpdater)
-
getSymbolUpdater
public com.nomagic.magicdraw.commands.SymbolUpdater getSymbolUpdater()
-
getElementByIDQuerier
public com.nomagic.magicdraw.core.Project.ElementByIDFetcher getElementByIDQuerier()
-
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.
-
setModel
public void setModel(Package p)
-
getTitle
@CheckForNull public java.lang.String getTitle()
- Returns:
- project title
-
setTitle
public void setTitle(java.lang.String title)
-
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.
-
getDirectory
@Deprecated public java.lang.String getDirectory()
Deprecated.use #getFile.getParentReturns project directory.- Returns:
- project location directory.
-
setDirectory
@Deprecated public void setDirectory(java.lang.String dir)
Deprecated.Sets the project directory.- Parameters:
dir
- the new project directory.
-
setName
@Deprecated public void setName(java.lang.String name)
Deprecated.Sets the project name.- Parameters:
name
- the new project name.
-
getFile
public com.nomagic.magicdraw.utils.ExtendedFile getFile()
Method returns file of this project.- Returns:
- file of this project
-
setFileName
public void setFileName(java.lang.String fileName)
Set the name of file as location of this project. Only local projects or locally saved remote projects can have file name.- Parameters:
fileName
- absolute file path
-
getCounter
public com.nomagic.magicdraw.core.MDCounter getCounter()
- Returns:
- id counter
-
getStyleManager
@CheckForNull public StyleManager getStyleManager()
Returns style manager- Returns:
- style manager
-
getProjectDiagramWindowsManager
public com.nomagic.magicdraw.ui.ProjectDiagramWindowsManager getProjectDiagramWindowsManager()
- Returns:
- diagrams windows manager
-
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, 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.
-
setCounter
public void setCounter(com.nomagic.magicdraw.core.MDCounter c)
Sets the counter for the project.- Parameters:
c
- the new counter;
-
addElementByID
public void addElementByID(BaseElement obj, @CheckForNull java.lang.String oldID)
Register the object by id. The record about this object and its old id is removed.- Specified by:
addElementByID
in interfaceElementRegistry
- Parameters:
obj
- the object to register.oldID
- the old id of the object.
-
getEsiLockProjectService
private com.nomagic.magicdraw.teamwork2.esi.EsiLockProjectService getEsiLockProjectService()
-
updateElementLockState
private void updateElementLockState(BaseElement obj)
-
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
-
ensureLocalIDSet
private void ensureLocalIDSet(BaseElement obj)
-
checkDuplicates
private void checkDuplicates(BaseElement obj, java.lang.String newID)
-
removeElementByID
private void removeElementByID(BaseElement obj, java.lang.String oldID)
Remove object from map by id- Parameters:
obj
- objectoldID
- old object id
-
removeElementByID
public void removeElementByID(BaseElement obj)
Unregister the object by id. The record about this object and is removed.- Specified by:
removeElementByID
in interfaceElementRegistry
- Parameters:
obj
- the object.
-
getQueryService
private com.nomagic.ci.persistence.local.query.IQueryService getQueryService()
-
getQueryChangeRegistry
private com.nomagic.ci.persistence.local.query.IQueryChangeRegistry getQueryChangeRegistry()
-
getElementByID
@OpenApi @CheckForNull public BaseElement getElementByID(@CheckForNull java.lang.String id)
Return the element with given id.- Specified by:
getElementByID
in interfaceElementRegistry
- 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.
-
getPresentationElementByID
@CheckForNull public BaseElement getPresentationElementByID(java.lang.String elementID)
Return the presentation element with given id from currently registered elements.- Parameters:
elementID
- the id of the element, cannot be null- Returns:
- the element with given id or null if element with such id is not registered in the project.
-
queryElementByID
private BaseElement queryElementByID(java.lang.String id)
-
isElementDisposed
@OpenApi public static boolean isElementDisposed(@CheckForNull Element 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 interfaceElementRegistry
- Parameters:
element
- element- Returns:
- true if element is disposed
-
getElementsByIDs
public java.util.Collection<? extends BaseElement> getElementsByIDs(java.util.Collection<java.lang.String> ids)
Return the objects by given ids.- Parameters:
ids
- the collection of the ids of the objects.- Returns:
- the collection of objects with given ids.
-
getElementsByIDs
public java.util.Collection<? extends BaseElement> getElementsByIDs(java.util.Collection<java.lang.String> ids, java.util.function.Supplier<java.util.Collection<BaseElement>> collectionFactory)
Return the objects by given ids.- Parameters:
ids
- the collection of the ids of the objects.- Returns:
- the collection of objects with given ids.
-
resetElementsByID
private void resetElementsByID()
Resets all records about objects and theirs ids.
-
getAllIDS
public java.util.Collection<java.lang.String> getAllIDS()
Returns the collection of all ids in the project.- Returns:
- the collection of all ids in the project.
-
getAllElements
public java.util.Collection<BaseElement> getAllElements()
Gets collection of all model elements in the project- Specified by:
getAllElements
in interfaceElementRegistry
- Returns:
- collection of elements
-
isProjectClosed
public boolean isProjectClosed()
Checks if this project was already disposed(closed). Such project cannot be activated any more.- Returns:
- true if project was disposed (closed)
-
isProjectDisposed
@Deprecated public boolean isProjectDisposed()
Deprecated.use #isProjectClosedChecks if this project was already disposed(closed). Such project cannot be activated any more.- Returns:
- true if project was disposed (closed)
-
isClosing
public boolean isClosing()
- Returns:
- true if project is closing (preCloseFinal event is fired)
-
setClosing
public void setClosing(boolean closing)
Set closing project state- Parameters:
closing
- true if project is closing
-
getStateChangeHandler
public StateChangeHandler getStateChangeHandler()
- Returns:
- StateChangeHandler for this project.
-
elementAdded
public void elementAdded(BaseElement element)
Marks element as added, if it was previously removed its id is removed from id collection.- Parameters:
element
- element id which was added.
-
elementRemoved
public void elementRemoved(BaseElement obj)
Marks element removed, its id added to mDeletedObjectIDS.- Parameters:
obj
- element which was removed.
-
isElementInProject
public boolean isElementInProject(java.lang.String id)
Check if element with a given id is in this project.- Parameters:
id
- element id- Returns:
- true if element with given id is registered in project and is not removed.
-
addWindow
public void addWindow(ProjectWindow window)
-
removeWindow
public void removeWindow(ProjectWindow window)
-
getWindows
public java.util.Collection<ProjectWindow> getWindows()
-
hasWindow
public boolean hasWindow(java.lang.String id)
-
getWindow
public ProjectWindow getWindow(java.lang.String id)
-
getStereotypesStyleChangeHandler
public com.nomagic.magicdraw.uml.symbols.StereotypesStyleChangeManager getStereotypesStyleChangeHandler()
-
getRepository
@OpenApi public AbstractRepository getRepository()
Get project repository.- Specified by:
getRepository
in interfaceRepositoryProvider
- Overrides:
getRepository
in classcom.nomagic.uml2.project.ElementProjectImpl
- Returns:
- repository.
-
resetDynamicRepository
public void resetDynamicRepository()
Removes current dynamic repository if such exist and installs a new dynamic repository.
-
getElementsFactory
@OpenApi public ElementsFactory getElementsFactory()
- 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.
-
isModel
public boolean isModel(@CheckForNull BaseElement element)
Checks if the given element is a one of the models in this project.- Parameters:
element
- element to check.- Returns:
- true if given element is a one of the models in this project.
-
isModel
public boolean isModel(Package element)
- Specified by:
isModel
in interfacecom.nomagic.uml2.project.ElementProject
-
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()
- Specified by:
getPrimaryModel
in interfacecom.nomagic.uml2.project.ElementProject
-
getModels
@OpenApi public java.util.List<Package> getModels()
- Specified by:
getModels
in interfacecom.nomagic.uml2.project.ElementProject
-
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.
-
getRemoteID
@CheckForNull public java.lang.String getRemoteID()
-
isLoaded
public boolean isLoaded()
Return value of "loaded" flag- Returns:
- true if this project was loaded from some location or is saved to some location (is not just created from template)
-
getLoadedFrom
public ProjectDescriptor getLoadedFrom()
Return location from were project was loaded. For Teamwork project returns local file if project was saved into file (or was loaded from file).- Returns:
- location of project
-
setLoaded
public void setLoaded(boolean loaded)
Set "Loaded" flag for project. Project created from template is not "loaded"- Parameters:
loaded
- loaded flag
-
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.
-
getExporterDescription
@CheckForNull public XmiExporterDescription getExporterDescription()
-
setExporterDescription
public void setExporterDescription(XmiExporterDescription exporterDescription)
-
getTransactionsManager
public TransactionManager getTransactionsManager()
Return transaction manager.- Returns:
- transaction manager
-
isNeedLocallySave
public boolean isNeedLocallySave()
Teamwork projects after commit can be saved locally, using flag to hold state about teamwork projects were saved locally.- Returns:
- true if project was not locally saved. Should be used only for teamwork projects.
-
setNeedLocallySave
public void setNeedLocallySave(boolean locallySaved)
-
setPrimaryProject
public void setPrimaryProject(IProject primaryProject)
-
setPrimaryProject
public void setPrimaryProject(IProject primaryProject, boolean closeOldProject, boolean changeModel)
Set primary project.- Parameters:
primaryProject
- project to set.closeOldProject
- close old project (do not close project when adding to teamwork).changeModel
- dispose old model (do not dispose UML model when adding to teamwork)
-
getPrimaryProject
@OpenApi public IPrimaryProject getPrimaryProject()
Primary project of MagicDraw project.- Returns:
- primary project.
-
addFeature
public static void addFeature(java.lang.String feature)
Register a feature for a new project.- Parameters:
feature
- feature name
-
removeFeature
public static void removeFeature(java.lang.String feature)
Unregister a feature for a new project.- Parameters:
feature
- name
-
getFeatures
public static java.util.Set<java.lang.String> getFeatures()
Return registered features for a new project.- Returns:
- registered features for a new project.
-
getUMLModelStorageFeature
public com.nomagic.magicdraw.uml.UMLModelProjectFeature getUMLModelStorageFeature()
-
getDiagramContentListeners
public com.nomagic.utils.ExtendedPropertyChangeSupport getDiagramContentListeners()
Returns listeners of all diagrams content.- Returns:
- diagrams content listeners
-
isNew
public boolean isNew()
- Returns:
- true if project is new and was never saved
-
getLocationUri
public org.eclipse.emf.common.util.URI getLocationUri()
Get URI location according the primary project.- Returns:
- URI.
-
isFrozen
public boolean isFrozen()
- Returns:
- true if project is frozen
-
setFrozen
public void setFrozen(boolean frozen)
Set frozen flag. Frozen projects do not provide some data.- Parameters:
frozen
- frozen flag
-
isReady
public boolean isReady()
- Returns:
- true if project is ready to use. It has primary project, it is not closed.
-
isRelocatedIn
public boolean isRelocatedIn()
- Returns:
- true if project is in relocating state
-
setRelocatingIn
public void setRelocatingIn(boolean relocating)
Set project state to relocating. Project is relocating if project content is coming from other project. This other project is in "relocated" state.- Parameters:
relocating
- relocating state
-
refAddInstance
public void refAddInstance(javax.jmi.reflect.RefBaseObject instance)
- Specified by:
refAddInstance
in interfaceElementRegistry
-
refRemoveInstance
public void refRemoveInstance(javax.jmi.reflect.RefBaseObject instance)
- Specified by:
refRemoveInstance
in interfaceElementRegistry
-
refAllOfClasses
public java.util.Collection<javax.jmi.reflect.RefBaseObject> refAllOfClasses(java.util.Set<AbstractRefClass> classes)
- Specified by:
refAllOfClasses
in interfaceElementRegistry
-
isUpdatingProjectsInCurrentThread
public boolean isUpdatingProjectsInCurrentThread()
- Specified by:
isUpdatingProjectsInCurrentThread
in interfaceElementRegistry
-
isPreloadProject
public boolean isPreloadProject()
- Specified by:
isPreloadProject
in interfaceElementRegistry
-
getBinaryStreamAtticCleaner
public com.nomagic.magicdraw.core.BinaryStreamAtticCleaner getBinaryStreamAtticCleaner()
-
getHasUnloadedManuallyReachableModules
public boolean getHasUnloadedManuallyReachableModules()
- Returns:
- the hasUnloadedManuallyReachableModules
-
isReloadRecommended
public boolean isReloadRecommended()
Indicates whether project reload is recommended to see the full effects of some user action. This is set when certain conditions are detected during, for example, project save. So that code that controls the save can check the flag after the save and reload if possible- Returns:
true
if project reload is recommended,false
otherwise
-
setReloadRecommended
public void setReloadRecommended(boolean reloadRecommended)
Sets new value forisReloadRecommended()
- Parameters:
reloadRecommended
- the new value
-
invalidateHasUnloadedManuallyReachableModules
public void invalidateHasUnloadedManuallyReachableModules()
Invalidates thegetHasUnloadedManuallyReachableModules()
flag
-
getCookieSet
public CookieSet getCookieSet()
-
getOptionalService
@CheckForNull public <T> T getOptionalService(java.lang.Class<T> type)
Returns project service of the specified type.- Specified by:
getOptionalService
in interfacecom.nomagic.uml2.project.ElementProject
- Overrides:
getOptionalService
in classcom.nomagic.uml2.project.ElementProjectImpl
- Type Parameters:
T
- type.- Parameters:
type
- class of a service.- Returns:
- service.
-
getService
public <T> T getService(java.lang.Class<T> type)
Returns project service of the specified type.- Specified by:
getService
in interfacecom.nomagic.uml2.project.ElementProject
- Overrides:
getService
in classcom.nomagic.uml2.project.ElementProjectImpl
- Type Parameters:
T
- type.- Parameters:
type
- class of a service.- Returns:
- service.
- Throws:
java.lang.IllegalArgumentException
- if the requested service is not registered.
-
register
public <T> void register(java.lang.Class<T> type, T service)
Registers the specified service.- Type Parameters:
T
- type of the service.- Parameters:
type
- service type.service
- the service.
-
getServiceProvider
public com.nomagic.uml2.project.service.ProjectServiceProvider getServiceProvider()
- Specified by:
getServiceProvider
in interfacecom.nomagic.uml2.project.ElementProject
- Overrides:
getServiceProvider
in classcom.nomagic.uml2.project.ElementProjectImpl
-
isEMFProxiesSupported
public boolean isEMFProxiesSupported()
Description copied from interface:ElementRegistry
Returns whether the registry supports EMF proxies.- Specified by:
isEMFProxiesSupported
in interfaceElementRegistry
- Returns:
- true if the element registry supports EMF proxies, otherwise - false.
-
generateID
public java.lang.String generateID()
Generate ID.
-
getID
public java.lang.String getID()
Description copied from interface:BaseElement
Returns the ID of theElement
. If the ID isnull
, new id for element is generated. Element id is persistence and do not changes during project save/load.- Specified by:
getID
in interfaceBaseElement
- Returns:
- the ID of the
Element
.
-
sGetID
public final java.lang.String sGetID()
Description copied from interface:BaseElement
Returns the actual ID of theElement
. May return null if ID was not generated or set for this element.- Specified by:
sGetID
in interfaceBaseElement
- Returns:
- the ID of the
Element
. - See Also:
BaseElement.getID()
-
setID
public void setID(java.lang.String id)
Description copied from interface:BaseElement
Sets the specified ID to theElement
.- Specified by:
setID
in interfaceBaseElement
- Parameters:
id
- the id to be set.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
- Specified by:
clone
in interfaceBaseElement
- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:BaseElement
Registers the listener to the element. The given listener will get notifications about property changes in this element.- Specified by:
addPropertyChangeListener
in interfaceBaseElement
- Parameters:
listener
- thePropertyChangeListener
to be added.- See Also:
PropertyChangeSupport
-
hasListeners
public boolean hasListeners()
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Description copied from interface:BaseElement
Unregisters the given listener from the element. The given listener will not get any notifications about property changes in this element.- Specified by:
removePropertyChangeListener
in interfaceBaseElement
- Parameters:
listener
- the PropertyChangeListener to be removed.- See Also:
PropertyChangeSupport
-
removeAllPropertyChangeListeners
public void removeAllPropertyChangeListeners()
Description copied from interface:BaseElement
Removes all property change listeners from this element.- Specified by:
removeAllPropertyChangeListeners
in interfaceBaseElement
-
firePropertyChange
public void firePropertyChange(java.lang.String propertyName, @CheckForNull java.lang.Object oldValue, @CheckForNull java.lang.Object newValue)
Description copied from interface:BaseElement
DelegatesfirePropertyChange
to thePropertyChangeSupport
, the member of this class, which reports a bound property update to any registered listeners. No event is fired if old and new values are equal or null.- Specified by:
firePropertyChange
in interfaceBaseElement
- Parameters:
propertyName
- the programmatic name of the property that was changed.oldValue
- the old value of the propertynewValue
- the new value of the property- See Also:
PropertyChangeSupport
-
atInsert
public void atInsert()
Description copied from interface:BaseElement
This method is called then this element is added into the project.- Specified by:
atInsert
in interfaceBaseElement
-
dispose
public void dispose()
Destroys the project. After this method call project can not be used any more.- Specified by:
dispose
in interfaceBaseElement
-
accept
public void accept(Visitor visitor) throws java.lang.Exception
Description copied from interface:MDElement
Method accepts visitor, and calls method visit<class name>(this) of visitor . See Visitor pattern for more details.
-
accept
public void accept(AbstractVisitor visitor) throws java.lang.Exception
Description copied from interface:BaseElement
Method accepts visitor, and calls method visit < class name > ( this ) of visitor . (see Visitor pattern for more details).- Specified by:
accept
in interfaceBaseElement
- Parameters:
visitor
- which visits this element.- Throws:
java.lang.Exception
-
getName
@OpenApi public java.lang.String getName()
Returns project name.
-
getHumanName
public java.lang.String getHumanName()
Description copied from interface:BaseElement
Returns human representation of the element. Usually human name is constructed from element class type and name.- Specified by:
getHumanName
in interfaceBaseElement
- Returns:
- the human name of the element.
-
getProject
public Project getProject()
- Specified by:
getProject
in interfaceMDElement
-
getProjectImpl
public Project getProjectImpl()
- Specified by:
getProjectImpl
in interfaceMDElement
-
getSortKeys
public final com.nomagic.magicdraw.uml.SortKeys getSortKeys()
Description copied from interface:MDElement
Implementation of getSortKeys() from Sortable interface.- Specified by:
getSortKeys
in interfaceMDElement
- Returns:
- the array of predefined sort keys.
-
createSortKeys
public com.nomagic.magicdraw.uml.ElementSortKeys createSortKeys()
- Specified by:
createSortKeys
in interfaceMDElement
-
getHumanType
public java.lang.String getHumanType()
Description copied from interface:BaseElement
Returns human representation of the element type. Contains only element type without element name.- Specified by:
getHumanType
in interfaceBaseElement
- Returns:
- the human type of the element.
-
getResourceID
public java.lang.String getResourceID()
- Specified by:
getResourceID
in interfaceMDElement
-
getCommandForAppending
@CheckForNull public com.nomagic.magicdraw.commands.MacroCommand getCommandForAppending()
- Specified by:
getCommandForAppending
in interfaceMDElement
-
canAdd
public final boolean canAdd(BaseElement element)
Description copied from interface:BaseElement
Checks if this element can add given element.- Specified by:
canAdd
in interfaceBaseElement
- Parameters:
element
- the given element.- Returns:
- true if this element can add given element.
- See Also:
BaseElement.canAdd(BaseElement, boolean)
-
canAdd
public final boolean canAdd(BaseElement element, boolean checkPermissions)
Description copied from interface:BaseElement
Checks if this element can add given element.
Following rules must be true in order to have result true:
1.if checkTeamworkLock == true, this element must be locked for edit.
2.element can add given element as instance (class types are checked).
3.element can add given element as child (given element is not a parent of current element and etc).- Specified by:
canAdd
in interfaceBaseElement
- Parameters:
element
- the element to add.checkPermissions
- check or not permissions.- Returns:
- true if element can add given element as child.
-
canDeleteChild
public boolean canDeleteChild(BaseElement child)
Description copied from interface:BaseElement
Checks if given element can be deleted from this element. Follofing rules must be true in order to have result true: 1.this element must be editable. 2.project must be editable. 3.the type of given child must be valid for teamwork lock for edit operation (for example class, package and etc, not Attribute).- Specified by:
canDeleteChild
in interfaceBaseElement
- Parameters:
child
- a given child- Returns:
- true, if given element can be deleted from current element.
-
canBeDeleted
public boolean canBeDeleted()
Description copied from interface:BaseElement
Checks if element can be deleted from project. Element cannot be deleted if it is not isEditable(), parent is not set or parent does not allow to remove this element.- Specified by:
canBeDeleted
in interfaceBaseElement
- Returns:
- true, if element can be deleted from project.
- See Also:
BaseElement.isEditable()
-
canAddInstance
public boolean canAddInstance(BaseElement o)
Description copied from interface:BaseElement
Checks if this object can add element of given type. Current implementation returns false.- Specified by:
canAddInstance
in interfaceBaseElement
- Returns:
- true if this object can elements of given type.
-
canAddChild
public boolean canAddChild(BaseElement o)
- Specified by:
canAddChild
in interfaceMDElement
-
isEditable
public boolean isEditable()
Description copied from interface:BaseElement
Checks if element can be edited. Element can not be edited in teamwork project, or it is used "by reference" from module.- Specified by:
isEditable
in interfaceBaseElement
- Returns:
- true, if element can be edited.
-
canAddChild
public boolean canAddChild()
Description copied from interface:BaseElement
Checks if new elements can be added to this element- Specified by:
canAddChild
in interfaceBaseElement
- Returns:
- true, if new sub elements can be added.
-
getObjectParent
@CheckForNull public BaseElement getObjectParent()
Description copied from interface:BaseElement
Returns the element parent. This implementation returns null. Should be overridden in subclasses.- Specified by:
getObjectParent
in interfaceBaseElement
- Returns:
- the parent of the element.
-
compareTo
public int compareTo(@Nonnull java.lang.Object o)
Compares sort key at index 1 with given element's sort key at index 1.- Specified by:
compareTo
in interfacejava.lang.Comparable
- Parameters:
o
- the given object to compare to.- Returns:
- key's comparison result(String.compareTo()).
-
isParentOf
public boolean isParentOf(BaseElement obj)
Description copied from interface:BaseElement
Returns true, if current element is parent of given element. Return false in this implementation.- Specified by:
isParentOf
in interfaceBaseElement
- Parameters:
obj
- the given element(possible child).- Returns:
- true if obj is parent of this object.
-
getClassType
public java.lang.Class getClassType()
Description copied from interface:BaseElement
Gets the type of the element class. Every element has its own ClassType. Usually this class type is class of element or class interface of element. All types are registered in ClassTypes.- Specified by:
getClassType
in interfaceBaseElement
- Returns:
- the type of the element.
-
toString
public java.lang.String toString()
Returns string representation of this element. Useful for debugging purposes.- Overrides:
toString
in classjava.lang.Object
-
canChangeParent
public boolean canChangeParent(java.util.Collection elements, BaseElement newParent)
Description copied from interface:BaseElement
Returns true, if element can change parent.- Specified by:
canChangeParent
in interfaceBaseElement
- Parameters:
elements
- collection of the elements, whose will change the parent together with this.newParent
- new parent object.- Returns:
- true if element can change parent.
-
-