Download MagicDraw Open API User Guide
Transcript
UML MODEL
Changing UML model
ments have multiple inheritance). Open API users should not work with visitor context. All tracking is done in
InheritanceVisitor and Visitor classes.
Changing UML model
SessionManager
SessionManager
<<getter>>+getInstance() : SessionManager
+closeSession() : void
+createSession( sessionName : String ) : void
<<getter>>+isSessionCreated() : boolean
...
SessionManager is the singleton manager used for editing model Elements.
All modifications to model elements should be performed between createSession(sessionName) and closeSession() method calls.
To edit some Element, a session with this manager must be created.
After editing model element, a session must be closed. After that all changes will be applied to the model and
registered in command history (for undo/redo) as one command with a session name.
Only one session can be active.
The following code can be used for accessing, checking and creating the session:
// access singleton instance by using getInstance()
// only one session can be active, so check this.
if (!SessionManager.getInstance().isSessionCreated())
{
// create new session.
SessionManager.getInstance().createSession();
}
If other session is already created and not closed, createSession method throws IllegalStateException runtime
exception.
ModelElementsManager
ModelElementsManager
<<getter>>+getInstance() : ModelElementsManager
+addElement( element : Element, parent : Element ) : void
+moveElement( element : Element, parent : Element ) : void
+removeElement( element : Element ) : void
+createDiagram( type : String, parent : Namespace ) : Diagram
...
ModelElementsManager is the singleton utility class for adding and removing model or moving them to other
parents.
52
Copyright © 2003-2011 No Magic, Inc..