svn commit: r12611 - trunk/modules/dev/src/org/argouml/dev/figinspector/FigInspectorPanel.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2007-05-13 09:55:44-0700
New Revision: 12611

Modified:
   trunk/modules/dev/src/org/argouml/dev/figinspector/FigInspectorPanel.java

Log:
Display the selected Figs encloser info

Modified: trunk/modules/dev/src/org/argouml/dev/figinspector/FigInspectorPanel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/modules/dev/src/org/argouml/dev/figinspector/FigInspectorPanel.java?view=diff&rev=12611&p1=trunk/modules/dev/src/org/argouml/dev/figinspector/FigInspectorPanel.java&p2=trunk/modules/dev/src/org/argouml/dev/figinspector/FigInspectorPanel.java&r1=12610&r2=12611
==============================================================================
--- trunk/modules/dev/src/org/argouml/dev/figinspector/FigInspectorPanel.java	(original)
+++ trunk/modules/dev/src/org/argouml/dev/figinspector/FigInspectorPanel.java	2007-05-13 09:55:44-0700
@@ -80,15 +80,30 @@
     public void selectionChanged(GraphSelectionEvent selectionEvent) {
         removeAll();
         if (selectionEvent.getSelections().size() == 1) {
-            Fig selectedFig = (Fig) selectionEvent.getSelections().get(0);
-            DefaultMutableTreeNode tn =
-                new DefaultMutableTreeNode(getDescr(selectedFig));
-            buildTree(selectedFig, tn);
-            if (selectedFig instanceof FigClassifierRole) {
-                MessageNodeBuilder.addNodeTree(tn,
-                        (FigClassifierRole) selectedFig);
+            // The tree is only built if one item is selected.
+            
+            DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
+
+            // Build the selected Fig first and then iterate up through
+            // its enclosers building those also.
+            for (Fig fig = (Fig) selectionEvent.getSelections().get(0);
+                    fig != null; 
+                    fig = fig.getEnclosingFig()) {
+                DefaultMutableTreeNode figNode =
+                    new DefaultMutableTreeNode(getDescr(fig));
+                rootNode.add(figNode);
+                buildTree(fig, figNode);
+                
+                // For a classifier role on a sequence diagram
+                // show its message nodes
+                if (fig instanceof FigClassifierRole) {
+                    MessageNodeBuilder.addNodeTree(rootNode,
+                            (FigClassifierRole) fig);
+                }
             }
-            FigTree tree = new FigTree(tn);
+            
+            FigTree tree = new FigTree(rootNode);
+            tree.setRootVisible(false);
             tree.expandAll();
 
             JScrollPane scroller = new JScrollPane(tree);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.