When inspecting a new object, try to keep page selection.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 13 Feb 2015 21:43:23 +0100
changeset 15282 18ce7c39bd7d
parent 15281 a94d5ca82ecf
child 15283 f054c39953c2
When inspecting a new object, try to keep page selection. More specifically, pre-select the page with the same label as currently selected one if possible.
Tools__Inspector2.st
--- a/Tools__Inspector2.st	Fri Feb 13 20:49:31 2015 +0100
+++ b/Tools__Inspector2.st	Fri Feb 13 21:43:23 2015 +0100
@@ -1272,9 +1272,23 @@
 !Inspector2 methodsFor:'private'!
 
 navigationStateFor: anObject
-    ^ NavigationState for: anObject
+    | current new |
+
+    new := NavigationState for: anObject.
+    current := self currentState.
+    (current notNil "and:[anObject isKindOf: current theObject class]") ifTrue:[ 
+        | currentTabLabel newSelectionIndex |
+
+        currentTabLabel := current tabLabels at: current selectionIndex.
+        newSelectionIndex := new tabLabels indexOf: currentTabLabel.
+        newSelectionIndex ~~ 0 ifTrue:[ 
+            new selectionIndex: newSelectionIndex.
+        ].
+    ].
+    ^ new
 
     "Created: / 04-02-2015 / 15:27:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 13-02-2015 / 20:44:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 setDoItActionForLanguage: language
@@ -1321,11 +1335,11 @@
 !Inspector2::NavigationState class methodsFor:'documentation'!
 
 version
-    ^'$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.60 2015-02-04 15:25:50 vrany Exp $'
+    ^'$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.61 2015-02-13 20:43:23 vrany Exp $'
 !
 
 version_SVN
-    ^'$Id: Tools__Inspector2.st,v 1.60 2015-02-04 15:25:50 vrany Exp $'
+    ^'$Id: Tools__Inspector2.st,v 1.61 2015-02-13 20:43:23 vrany Exp $'
 ! !
 
 !Inspector2::NavigationState methodsFor:'accessing'!
@@ -1512,19 +1526,19 @@
 !Inspector2 class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.60 2015-02-04 15:25:50 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.61 2015-02-13 20:43:23 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.60 2015-02-04 15:25:50 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.61 2015-02-13 20:43:23 vrany Exp $'
 !
 
 version_CVS_jvrany
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.60 2015-02-04 15:25:50 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.61 2015-02-13 20:43:23 vrany Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__Inspector2.st,v 1.60 2015-02-04 15:25:50 vrany Exp $'
+    ^ '$Id: Tools__Inspector2.st,v 1.61 2015-02-13 20:43:23 vrany Exp $'
 ! !