svn commit: r12847 - trunk/src_new/org/argouml/ui/DetailsPane.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2007-06-15 09:11:52-0700
New Revision: 12847

Modified:
   trunk/src_new/org/argouml/ui/DetailsPane.java

Log:
Fix for issue 1925: "Selected tab is remembered per fig". Patch supplied by Aleksandar.

Modified: trunk/src_new/org/argouml/ui/DetailsPane.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/DetailsPane.java?view=diff&rev=12847&p1=trunk/src_new/org/argouml/ui/DetailsPane.java&p2=trunk/src_new/org/argouml/ui/DetailsPane.java&r1=12846&r2=12847
==============================================================================
--- trunk/src_new/org/argouml/ui/DetailsPane.java	(original)
+++ trunk/src_new/org/argouml/ui/DetailsPane.java	2007-06-15 09:11:52-0700
@@ -227,15 +227,21 @@
         enableTabs(target);
         if (target != null) {
             boolean tabSelected = false;
-            for (int i = lastNonNullTab; i >= 1; i--) {
-                Component tab = topLevelTabbedPane.getComponentAt(i);
-                if (tab instanceof TabTarget) {
-                    if (((TabTarget) tab).shouldBeEnabled(target)) {
-                        topLevelTabbedPane.setSelectedIndex(i);
-                        tabSelected = true;
-                        lastNonNullTab = i;
-                        break;
-                    }
+
+            // Select prop panel if current panel is not appropriate
+            // for selected target
+            Component selectedTab = topLevelTabbedPane
+                    .getComponentAt(lastNonNullTab);
+            if (selectedTab instanceof TabTarget) {
+                if (((TabTarget) selectedTab).shouldBeEnabled(target)) {
+                    topLevelTabbedPane.setSelectedIndex(lastNonNullTab);
+                    tabSelected = true;
+                } else {
+                    int indexOfPropPanel = topLevelTabbedPane
+                            .indexOfComponent(getTabProps());
+                    topLevelTabbedPane.setSelectedIndex(indexOfPropPanel);
+                    tabSelected = true;
+                    lastNonNullTab = indexOfPropPanel;
                 }
             }
             if (!tabSelected) {
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.