Package com.nomagic.magicdraw.uml
Class Refactoring.Moving
java.lang.Object
com.nomagic.magicdraw.uml.Refactoring.Moving
- Enclosing class:
- Refactoring
Moves elements in model to a new owner element with or without connected relations
An example how to move elements together with their relations:
// Decide what elements needs to be moved and put them in a collection CollectionelementsToMove = ...; // Define new owner to move elements (and relations) into Element newOwner = ...; // Element moving should be wrapped with session create/close calls. SessionManager sessionManager = SessionManager.getInstance(); sessionManager.createSession("Move elements"); // Move elements Refactoring.Moving.moveElementsWithRelations(elementsToMove, newOwner); // Close the session. sessionManager.closeSession();
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
moveElements
(Collection<Element> elementsToMove, Element newOwner) Moves all elements to the new owner.static void
moveElementsWithRelations
(Collection<Element> elementsToMove, Element newOwner) Moves all elements to the new owner.
-
Constructor Details
-
Moving
public Moving()
-
-
Method Details
-
moveElements
public static void moveElements(Collection<Element> elementsToMove, Element newOwner) throws ReadOnlyElementException Moves all elements to the new owner. Relations between moved elements are not moved.- Parameters:
elementsToMove
- elements to movenewOwner
- new owner to move elements into- Throws:
ReadOnlyElementException
- if newOwner cannot add children or any of moved elements is not editableIllegalArgumentException
- if any of moved elements cannot be added into new owner
-
moveElementsWithRelations
public static void moveElementsWithRelations(Collection<Element> elementsToMove, Element newOwner) throws ReadOnlyElementException Moves all elements to the new owner. Relation elements whose client is between moved elements are moved together. Read only relations are not moved. Not locked teamwork relations are locked automatically.- Parameters:
elementsToMove
- elements to movenewOwner
- new owner to move elements into- Throws:
ReadOnlyElementException
- if newOwner cannot add children or any of moved elements is not editableIllegalArgumentException
- if any of moved elements cannot be added into new owner
-