BrowserView.st
changeset 3134 c74acae564f3
parent 3125 ed9aa14fe97b
child 3135 98fa832ea88e
--- a/BrowserView.st	Mon Sep 10 11:08:46 2001 +0200
+++ b/BrowserView.st	Mon Sep 10 11:10:25 2001 +0200
@@ -25,7 +25,7 @@
 		showAllNamespaces classInstVarsInVarList coloringProcess
 		codeModified autoSearchIgnoreCase icons environment'
 	classVariableNames:'CheckForInstancesWhenRemovingClasses RememberAspect DefaultIcon
-		ShowResourceIcons ClassHistory LastSearchPatterns
+		ShowResourceIcons LastSearchPatterns
 		ShowMethodCategoryInClassMethodList LastRenames Icons'
 	poolDictionaries:''
 	category:'Interface-Browsers'
@@ -129,20 +129,19 @@
     "Modified: / 27.10.1997 / 17:34:25 / cg"
 ! !
 
-!BrowserView class methodsFor:'cleanup'!
+!BrowserView class methodsFor:'class history'!
+
+addToClassHistory:aClass selector:aSelector
+    SystemBrowser addToHistory:aClass selector:aSelector
+!
 
 checkClassHistory
     "checks the class history for non-existing classes"
 
-    "/ reverse, since we might modify while enumerating
-    self classHistory reverseDo:[:histEntry|
-        (Smalltalk at: (histEntry upTo: $ ) asSymbol) isBehavior
-        ifFalse:[
-            ClassHistory remove: histEntry
-        ]
-    ]
-
-!
+    SystemBrowser checkClassHistory
+! !
+
+!BrowserView class methodsFor:'cleanup'!
 
 lowSpaceCleanup
     Icons := DefaultIcon := nil.
@@ -175,10 +174,13 @@
 classHistory
     "returns the class history"
 
-    ClassHistory isNil ifTrue: [ClassHistory := OrderedCollection new].
-    ^ClassHistory
-
-
+    ^ SystemBrowser classHistory
+!
+
+classHistory:newCollection
+    "returns the class history"
+
+    SystemBrowser classHistory:newCollection
 !
 
 classHistoryMaxSize
@@ -736,12 +738,12 @@
                   #label: '-'
                 )
                #(#MenuItem
-                  #label: 'Find class...'
+                  #label: 'Find Class...'
                   #translateLabel: true
                   #value: #classCategoryFindClass
                 )
                #(#MenuItem
-                  #label: 'Find method...'
+                  #label: 'Find Method...'
                   #translateLabel: true
                   #value: #classCategoryFindMethod
                 )
@@ -2320,7 +2322,7 @@
     ].
     box := self 
                 enterBoxForCodeSelectionTitle:title 
-                withList:(ClassHistory collect: [:clsName| clsName upTo: $ ])
+                withList:(self class classHistory collect: [:histEntry| histEntry className ])
                 okText:okText.
     box label:(resources string:'browse or search class').
     openButton := Button label:(resources string:okText2).
@@ -3562,18 +3564,6 @@
 
 !BrowserView methodsFor:'class history'!
 
-addToClassHistory: aHistoryEntry
-    "adds aHistoryEntry to the class history; aHistoryEntry consists of the class name and the selector name"
-
-    ClassHistory remove: (ClassHistory detect: [:histEntry| (histEntry upTo: $ ) = (aHistoryEntry upTo: $ )] ifNone: nil) ifAbsent: nil.
-    ClassHistory addFirst: aHistoryEntry.
-    [ClassHistory size > self class classHistoryMaxSize] whileTrue: [
-        ClassHistory removeLast
-    ]
-
-
-!
-
 changeHistoryMenu
     "returns a popup menu to navigate
      to the last few changes"
@@ -3661,18 +3651,19 @@
 
     <resource: #programMenu >
 
-    |menu|
+    |menu classHistory|
 
     self class checkClassHistory.
 
-    ClassHistory isEmpty ifTrue: [ ^ self ].
+    classHistory := self class classHistory.
+    classHistory isEmpty ifTrue: [ ^ self ].
 
     menu := Menu new receiver:self.
-    ClassHistory do:[:clsName |
+    classHistory do:[:histEntry |
         menu addItem:(MenuItem new 
-            label: clsName; 
+            label: histEntry className; 
             value: #switchBackToMessageNamed:; 
-            argument: clsName).
+            argument: histEntry className).
     ].    
 
 "/    menu addSeparator.
@@ -3689,16 +3680,17 @@
 
     <resource: #programMenu >
 
-    |labels selectors args|
+    |labels selectors args classHistory|
 
     self class checkClassHistory.
 
-    ClassHistory notEmpty ifTrue: [
-        labels := ClassHistory collect: [:clsName| clsName upTo: $ ].
-        selectors := Array new: ClassHistory size.
+    classHistory := self class classHistory.
+    classHistory notEmpty ifTrue: [
+        labels := classHistory collect: [:histEntry| histEntry className ].
+        selectors := Array new: classHistory size.
         selectors atAllPut:#switchBackToMessageNamed:.
         selectors := selectors asOrderedCollection.
-        args := ClassHistory copy.
+        args := classHistory collect: [:histEntry| histEntry selector ].
 "/        labels add: '-';add:(resources string:'empty history').
 "/        selectors add: nil; add:#emptyClassHistory.
 "/        args add: nil; add: nil.
@@ -3719,7 +3711,7 @@
 emptyClassHistory
     "removes all class history entries"
 
-    ClassHistory removeAll
+    SystemBrowser emptyClassHistory
 !
 
 loadFromMessage:aMessageString
@@ -3739,7 +3731,7 @@
 
     words := aMessage asCollectionOfWords.
 
-    savedHistory := ClassHistory copy.
+    savedHistory := self class classHistory copy.
 
     self switchToClassNamed:(words first).
     self classSelectionChanged.
@@ -3767,7 +3759,7 @@
         ]
     ].
 
-    ClassHistory := savedHistory.
+    self class classHistory:savedHistory.
 ! !
 
 !BrowserView methodsFor:'class list menu'!
@@ -5979,7 +5971,8 @@
     ].
 
     actualClass notNil ifTrue:[
-        self addToClassHistory: actualClass name asString
+        "/ self addToClassHistory: actualClass name asString
+        self class addToClassHistory:actualClass selector:nil
     ]
 
     "Modified: / 10.2.2000 / 14:14:18 / cg"
@@ -6710,7 +6703,8 @@
         ].
 
         actualClass notNil ifTrue:[
-            self addToClassHistory: actualClass name asString
+            "/ self addToClassHistory: actualClass name asString
+            self class addToClassHistory:actualClass selector:nil
         ]
     ]
 
@@ -7481,9 +7475,6 @@
     "inform me, when Smalltalk changes"
     Smalltalk addDependent:self.
 
-    "create a history"
-    self class classHistory.
-
     environment := Smalltalk.
 !
 
@@ -11323,7 +11314,8 @@
 
     self methodSelectionChanged.
     currentSelector notNil ifTrue:[
-        self addToClassHistory: actualClass name asString, ' ', currentSelector
+        "/ self addToClassHistory: actualClass name asString, ' ', currentSelector
+        self class addToClassHistory:actualClass selector:currentSelector
     ]
 
     "Modified: / 27.7.1998 / 11:01:38 / cg"
@@ -14877,6 +14869,6 @@
 !BrowserView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.670 2001-09-07 17:12:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.671 2001-09-10 09:10:25 cg Exp $'
 ! !
 BrowserView initialize!