Package com.nomagic.magicdraw.uml
Class Refactoring.Converting
- java.lang.Object
-
- com.nomagic.magicdraw.uml.Refactoring.Converting
-
- Enclosing class:
- Refactoring
@OpenApiAll public static class Refactoring.Converting extends java.lang.Object
Converts elements in the model.
-
-
Constructor Summary
Constructors Constructor Description Converting()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Element
convert(Element source, ConvertElementInfo info)
Converts given element according given conversion info.static Element
convert(Element source, Element target, ConvertElementInfo info)
Converts element with another element according given conversion info.private static Element
convert(Element source, Element target, ConvertElementInfo info, boolean checkReadOnly, boolean addDisposeValidator)
Converts element with another element according given conversion info.static ShapeElement
convertCommentToNote(ShapeElement comment)
Converts Comment into Note.static ShapeElement
convertNoteToComment(ShapeElement note, Stereotype commentStereotype)
Converts Note into Comment.static PartView
convertPortToPart(PortView portView)
Converts Port symbol to Part symbolstatic PartView
convertPortToPartAndRemovePortSymbol(PortView portView)
Convert port symbol to part symbol by creating new part symbol for port element After that remove unused port symbolprivate static void
reapplyProperties(PresentationElement source, PresentationElement target)
private static void
reconnectAnchors(ShapeElement source, ShapeElement target)
-
-
-
Method Detail
-
convert
public static Element convert(Element source, ConvertElementInfo info) throws ReadOnlyElementException
Converts given element according given conversion info.- Parameters:
source
- element to convert.info
- conversion rules.- Returns:
- newly created element after conversion, null if conversion didn't succeed.
- Throws:
ReadOnlyElementException
- if given element is not editable (read-only).
-
convert
public static Element convert(Element source, @CheckForNull Element target, ConvertElementInfo info) throws ReadOnlyElementException
Converts element with another element according given conversion info.- Parameters:
source
- element to convert.target
- element with which to convert, can be null, in this case a new element will be created.info
- conversion rules.- Returns:
- target element.
- Throws:
ReadOnlyElementException
- if given element is not editable (read-only).
-
convert
private static Element convert(Element source, @CheckForNull Element target, ConvertElementInfo info, boolean checkReadOnly, boolean addDisposeValidator) throws ReadOnlyElementException
Converts element with another element according given conversion info.- Parameters:
source
- element to convert.target
- element with which to convert, can be null, in this case a new element will be created.info
- conversion rules.checkReadOnly
- indicates if source and target should be checked for editing permissions.addDisposeValidator
- indicates if source disposal should be verified.- Returns:
- target element.
- Throws:
ReadOnlyElementException
- if given element is not editable (read-only).
-
convertNoteToComment
public static ShapeElement convertNoteToComment(ShapeElement note, @CheckForNull Stereotype commentStereotype) throws ReadOnlyElementException
Converts Note into Comment.- Parameters:
note
- note shapecommentStereotype
- apply given stereotypes to created Comment- Returns:
- Comment shape
- Throws:
ReadOnlyElementException
- if given Note symbol is not editable (read-only) or diagram owner is not editablejava.lang.IllegalArgumentException
- if given symbol is not a Note symbol
-
reconnectAnchors
private static void reconnectAnchors(ShapeElement source, ShapeElement target)
-
reapplyProperties
private static void reapplyProperties(PresentationElement source, PresentationElement target) throws ReadOnlyElementException
- Throws:
ReadOnlyElementException
-
convertCommentToNote
public static ShapeElement convertCommentToNote(ShapeElement comment) throws ReadOnlyElementException
Converts Comment into Note.- Parameters:
comment
- comment shape- Returns:
- Note shape
- Throws:
ReadOnlyElementException
- if given Comment symbol is not editable (read-only) or Comment is not editablejava.lang.IllegalArgumentException
- if given symbol is not a Comment symbol
-
convertPortToPartAndRemovePortSymbol
public static PartView convertPortToPartAndRemovePortSymbol(PortView portView) throws ReadOnlyElementException
Convert port symbol to part symbol by creating new part symbol for port element After that remove unused port symbol- Throws:
ReadOnlyElementException
-
convertPortToPart
public static PartView convertPortToPart(PortView portView) throws ReadOnlyElementException
Converts Port symbol to Part symbol- Parameters:
portView
- port symbol- Returns:
- part symbol
- Throws:
ReadOnlyElementException
- if given port symbol is not editable (read-only)
-
-