`Inspector2`: pre-select last selected tab when opening a new inspector jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 25 May 2018 11:05:26 +0100
branchjv
changeset 18225 ef87e31d3308
parent 18224 9cd645552433
child 18226 346376844040
`Inspector2`: pre-select last selected tab when opening a new inspector
Tools__Inspector2.st
--- a/Tools__Inspector2.st	Mon Mar 05 17:45:03 2018 +0000
+++ b/Tools__Inspector2.st	Fri May 25 11:05:26 2018 +0100
@@ -25,7 +25,7 @@
 
 Model subclass:#NavigationState
 	instanceVariableNames:'inspector theObject index tabs selectionIndex displayString'
-	classVariableNames:''
+	classVariableNames:'LastSelectionIndexMap'
 	poolDictionaries:''
 	privateIn:Inspector2
 !
@@ -84,7 +84,7 @@
 
     EvaluationLanguageMap :=  Dictionary new.
 
-    "Modified: / 26-10-2013 / 00:42:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-05-2018 / 10:46:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !Inspector2 class methodsFor:'help specs'!
@@ -1375,6 +1375,16 @@
     ^'$Id$'
 ! !
 
+!Inspector2::NavigationState class methodsFor:'initialization'!
+
+initialize
+    "Invoked at system start or when the class is dynamically loaded."
+
+    LastSelectionIndexMap := WeakIdentityDictionary new.
+
+    "Modified: / 25-05-2018 / 10:48:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !Inspector2::NavigationState methodsFor:'accessing'!
 
 application:anInspectorApp
@@ -1415,10 +1425,12 @@
 
 selectionIndex: anInteger
     selectionIndex := anInteger.
+    LastSelectionIndexMap at: theObject class put: anInteger.
     self changed:#selectionIndex
 
     "Created: / 16-01-2008 / 17:27:52 / janfrog"
     "Modified: / 17-02-2008 / 09:46:45 / janfrog"
+    "Modified: / 25-05-2018 / 10:49:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 selectionView
@@ -1461,10 +1473,12 @@
 
 theObject:anObject
     theObject := anObject.
+    selectionIndex := LastSelectionIndexMap at: theObject class ifAbsent: nil.
     self changed
 
     "Modified: / 17-02-2008 / 08:38:44 / janfrog"
     "Modified: / 19-08-2011 / 09:16:25 / cg"
+    "Modified: / 25-05-2018 / 10:50:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !Inspector2::NavigationState methodsFor:'comparing'!
@@ -1589,3 +1603,4 @@
 
 
 Inspector2 initialize!
+Inspector2::NavigationState initialize!