MagicDraw itself has many default drag and drop handlers for doing various things. Such handlers consist of :
- Dropping elements from various UI components(trees, specification windows, etc.) diagram or its presentation elements.
- Dropping external application items onto trees or diagrams.
Default drag and drop handlers for example create new presentation elements, change the properties of elements, external application image drop on diagram creates an image and etc. Same is true if presentation elements are dropped on top of other presentation elements.
API allows to register a custom drag and drop handler for doing some specific things using drag and drop mechanism.
OpenAPI drag and drop handler registrations:
- Use com.nomagic.magicdraw.ui.dnd.CustomDropDiagramHandlerFactory.register(com.nomagic.magicdraw.ui.dnd.CustomDragAndDropHandlerFactory) to register a factory which creates a handler for dropping elements from browser(trees) into diagram.
- Use com.nomagic.magicdraw.ui.dnd.CustomShapeMoveHandlerFactory.register(com.nomagic.magicdraw.ui.dnd.CustomDragAndDropHandlerFactory) to register a factory which creates a handler for dropping one presentation element on other presentation element in the same diagram
- Use com.nomagic.magicdraw.ui.dnd.BrowserTabTreeDragAndDropHandlerRegistry#register(com.nomagic.magicdraw.ui.dnd.BrowserTabTreeDragAndDropHandlerFactory) to register a factory which creates a handler for dropping external application items into the browser tree nodes(elements).
- Use com.nomagic.magicdraw.ui.dnd.DiagramTransferableDragAndDropHandlerRegistry#register(com.nomagic.magicdraw.ui.dnd.DiagramTransferableDragAndDropHandlerFactory) to register a factory which creates a handler for dropping external application items into the diagram.
You can find the code examples in
- <installation_directory>\openapi\examples\customdraganddrop