136715277
MD2024x
3
Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
The Model Browser (Containment tree, Diagrams tree, etc.) is a based GUI part for displaying various model trees and panels
Code Block | ||
---|---|---|
| ||
Browser browser = Application.getInstance().getMainFrame().getBrowser(); |
The browser has five trees by default (some of them are be default hidden):
- containment
- diagrams
- inheritance
- extensions
- search results
The browser has 3 panel by default
- documentation
- properties
- zoom
Last activated tree is marked as active:
Code Block | ||
---|---|---|
| ||
BrowserTabTree activeTree = browser.getActiveTree(); |
Every tree is based on Swing JTree and all manipulations can be done by using the API provided by Swing:
Code Block | ||
---|---|---|
| ||
JTree tree = activeTree.getTree(); |
Selected nodes are accessible in the following way:
Code Block | ||
---|---|---|
| ||
Node[] nodes = activeTree.getSelectedNodes(); |
Node is derived from javax.swing.tree.DefaultMutableTreeNode.
Selecting/opening element in tree
In order to select some element in tree, you need
- Open(activate) a tree using com.nomagic.magicdraw.ui.browser.Browser#getContainmentTree;
- Call com.nomagic.magicdraw.ui.browser.Tree#openNode(com.nomagic.magicdraw.uml.BaseElement).
Panel | ||
---|---|---|
| ||
|