@OpenApiAll
public class ModelElementsManager
extends java.lang.Object
SessionManager
.
This manager can be used only if some session was created with SessionManager. See code sample in SessionManager
description for more details.SessionManager
Modifier and Type | Method and Description |
---|---|
void |
addElement(Element element,
Element parent)
Adds given element into the given parent.
|
Diagram |
createDiagram(java.lang.String type,
Namespace parent)
Creates new Diagram of given type.
|
Diagram |
createDiagram(java.lang.String type,
Namespace parent,
boolean openDiagram,
boolean openInActiveTab)
Creates new Diagram of given type.
|
static ModelElementsManager |
getInstance()
Returns an instance of this manager.
|
void |
moveElement(Element element,
Element parent)
Moves given element from current parent into the given one.
|
void |
removeElement(Element element)
Removes given element from the model.
|
public static ModelElementsManager getInstance()
public void addElement(Element element, Element parent) throws ReadOnlyElementException
element
- the given model element to add into the given parent.parent
- the given model element parent.java.lang.IllegalStateException
- if session is not created with SessionManagerjava.lang.IllegalArgumentException
- given model element cannot be added into given parent. For example Operation
cannot be added into Package or Operation cannot be added into not locked for editing Class(in teamwork project).
Also it is thrown if element or parent is null.ReadOnlyElementException
- if given element is not editable(read only).SessionManager.createSession(java.lang.String)
public void moveElement(Element element, Element parent) throws ReadOnlyElementException
element
- the given ModelElement to move into the given parent.parent
- a new parent for given ModelElement.java.lang.IllegalStateException
- if session is not created with SessionManagerjava.lang.IllegalArgumentException
- given ModelElement cannot be added into given parent. For example Operation
cannot be added into Package or Operation cannot be added into not locked for editing Class(in teamwork project).
Also this exception is thrown if new parent already has the same type child with the same name as given element.
It is thrown if element or parent is null, too.ReadOnlyElementException
- if given element is not editable(read only).SessionManager.createSession(java.lang.String)
public void removeElement(Element element) throws ReadOnlyElementException
element
- the given ModelElement to remove.java.lang.IllegalStateException
- if session is not created with SessionManager.java.lang.IllegalArgumentException
- if given element is null.ReadOnlyElementException
- if given element is not editable(read only).SessionManager.createSession(java.lang.String)
public Diagram createDiagram(java.lang.String type, Namespace parent) throws ReadOnlyElementException
type
- diagram typeparent
- diagram ownerjava.lang.IllegalStateException
- if session is not created with SessionManagerjava.lang.IllegalArgumentException
- if given type is unknown. if given model element cannot be added into given parent. For example Operation
cannot be added into Package or Operation cannot be added into not locked for editing Class(in teamwork project).
Also it is thrown if element or parent is null.ReadOnlyElementException
- if parent element is not editable(read only).DiagramTypeConstants.UML_CLASS_DIAGRAM
,
DiagramTypeConstants.UML_USECASE_DIAGRAM
,
DiagramTypeConstants.UML_COMMUNICATION_DIAGRAM
,
DiagramTypeConstants.UML_SEQUENCE_DIAGRAM
,
DiagramTypeConstants.UML_STATECHART_DIAGRAM
,
DiagramTypeConstants.UML_PROTOCOL_STATE_MACHINE_DIAGRAM
,
DiagramTypeConstants.UML_ACTIVITY_DIAGRAM
,
DiagramTypeConstants.UML_OBJECT_DIAGRAM
,
DiagramTypeConstants.UML_PACKAGE_DIAGRAM
,
DiagramTypeConstants.UML_COMPONENT_DIAGRAM
,
DiagramTypeConstants.UML_DEPLOYMENT_DIAGRAM
,
DiagramTypeConstants.UML_PROFILE_DIAGRAM
,
DiagramTypeConstants.UML_COMPOSITE_STRUCTURE_DIAGRAM
public Diagram createDiagram(java.lang.String type, Namespace parent, boolean openDiagram, boolean openInActiveTab) throws ReadOnlyElementException
type
- diagram typeparent
- diagram owneropenDiagram
- if open created diagramopenInActiveTab
- if open diagram in active tab if we open diagramjava.lang.IllegalStateException
- if session is not created with SessionManagerjava.lang.IllegalArgumentException
- if given type is unknown. if given model element cannot be added into given parent. For example Operation
cannot be added into Package or Operation cannot be added into not locked for editing Class(in teamwork project).
Also it is thrown if element or parent is null.ReadOnlyElementException
- if parent element is not editable(read only).DiagramTypeConstants.UML_CLASS_DIAGRAM
,
DiagramTypeConstants.UML_USECASE_DIAGRAM
,
DiagramTypeConstants.UML_COMMUNICATION_DIAGRAM
,
DiagramTypeConstants.UML_SEQUENCE_DIAGRAM
,
DiagramTypeConstants.UML_STATECHART_DIAGRAM
,
DiagramTypeConstants.UML_PROTOCOL_STATE_MACHINE_DIAGRAM
,
DiagramTypeConstants.UML_ACTIVITY_DIAGRAM
,
DiagramTypeConstants.UML_OBJECT_DIAGRAM
,
DiagramTypeConstants.UML_PACKAGE_DIAGRAM
,
DiagramTypeConstants.UML_COMPONENT_DIAGRAM
,
DiagramTypeConstants.UML_DEPLOYMENT_DIAGRAM
,
DiagramTypeConstants.UML_PROFILE_DIAGRAM
,
DiagramTypeConstants.UML_COMPOSITE_STRUCTURE_DIAGRAM