SystemBrowser.st
changeset 3131 883d7b34bb86
parent 3125 ed9aa14fe97b
child 3151 910fd5bcfb6e
equal deleted inserted replaced
3130:a803802a9e41 3131:883d7b34bb86
    12 
    12 
    13 "{ Package: 'stx:libtool' }"
    13 "{ Package: 'stx:libtool' }"
    14 
    14 
    15 ApplicationModel subclass:#SystemBrowser
    15 ApplicationModel subclass:#SystemBrowser
    16 	instanceVariableNames:''
    16 	instanceVariableNames:''
    17 	classVariableNames:'CheckForInstancesWhenRemovingClasses Icons'
    17 	classVariableNames:'CheckForInstancesWhenRemovingClasses Icons ClassHistory'
    18 	poolDictionaries:''
    18 	poolDictionaries:''
    19 	category:'Interface-Browsers'
    19 	category:'Interface-Browsers'
       
    20 !
       
    21 
       
    22 Object subclass:#BrowserHistoryEntry
       
    23 	instanceVariableNames:'className meta selector'
       
    24 	classVariableNames:''
       
    25 	poolDictionaries:''
       
    26 	privateIn:SystemBrowser
    20 !
    27 !
    21 
    28 
    22 !SystemBrowser class methodsFor:'documentation'!
    29 !SystemBrowser class methodsFor:'documentation'!
    23 
    30 
    24 copyright
    31 copyright
   192 
   199 
   193 newOnClass:aClass
   200 newOnClass:aClass
   194     ^ self browseClass:aClass
   201     ^ self browseClass:aClass
   195 
   202 
   196     "Created: / 27.10.1997 / 20:10:39 / cg"
   203     "Created: / 27.10.1997 / 20:10:39 / cg"
       
   204 ! !
       
   205 
       
   206 !SystemBrowser class methodsFor:'accessing - history'!
       
   207 
       
   208 addToHistory:aClass selector:aSelectorOrNil
       
   209     |newEntry|
       
   210 
       
   211     (newEntry := self historyEntryForClass:aClass selector:aSelectorOrNil) isNil ifTrue:[^ self].
       
   212 
       
   213     ClassHistory isNil ifTrue:[
       
   214         ClassHistory := OrderedCollection new
       
   215     ].
       
   216     ClassHistory := ClassHistory select:[:entry | entry className ~= newEntry className].
       
   217     ClassHistory addFirst:newEntry.
       
   218     ClassHistory size > self visitedHistoryMaxSize ifTrue:[
       
   219         ClassHistory removeLast
       
   220     ].
       
   221 !
       
   222 
       
   223 checkClassHistory
       
   224     "checks the class history for non-existing classes"
       
   225 
       
   226     "/ reverse, since we might modify while enumerating
       
   227     self classHistory reverseDo:[:histEntry|
       
   228         (Smalltalk at: (histEntry className) asSymbol) isBehavior
       
   229         ifFalse:[
       
   230             self classHistory remove: histEntry
       
   231         ]
       
   232     ]
       
   233 !
       
   234 
       
   235 classHistory
       
   236     ^ ClassHistory ? #()
       
   237 !
       
   238 
       
   239 classHistory:newCollection
       
   240     ClassHistory := newCollection
       
   241 !
       
   242 
       
   243 emptyClassHistory
       
   244     "removes all class history entries"
       
   245 
       
   246     self classHistory removeAll
       
   247 !
       
   248 
       
   249 historyEntryForClass:aClass selector:aSelectorOrNil
       
   250     |newEntry meta cls|
       
   251 
       
   252     aClass isBehavior ifFalse:[^ nil].
       
   253 
       
   254     newEntry := BrowserHistoryEntry new.
       
   255     newEntry meta:(meta := aClass isMeta).
       
   256     meta ifTrue:[
       
   257         cls := aClass theNonMetaclass.
       
   258     ] ifFalse:[
       
   259         cls := aClass
       
   260     ].
       
   261     newEntry className:cls name.
       
   262     newEntry selector:aSelectorOrNil.
       
   263     ^ newEntry
       
   264 
       
   265     "Modified: / 24.2.2000 / 18:03:52 / cg"
       
   266 ! !
       
   267 
       
   268 !SystemBrowser class methodsFor:'defaults'!
       
   269 
       
   270 classHistoryMaxLevels
       
   271     ^ 3
       
   272 !
       
   273 
       
   274 classHistoryMaxSize
       
   275     ^ 15
       
   276 !
       
   277 
       
   278 visitedHistoryMaxSize
       
   279     "the maximum number of remembered visited-class-history entries"
       
   280 
       
   281     ^ 15
   197 ! !
   282 ! !
   198 
   283 
   199 !SystemBrowser class methodsFor:'image specs'!
   284 !SystemBrowser class methodsFor:'image specs'!
   200 
   285 
   201 abstractMethodIcon
   286 abstractMethodIcon
  3291 
  3376 
  3292     "Created: / 6.2.2000 / 00:49:44 / cg"
  3377     "Created: / 6.2.2000 / 00:49:44 / cg"
  3293     "Modified: / 6.2.2000 / 00:57:08 / cg"
  3378     "Modified: / 6.2.2000 / 00:57:08 / cg"
  3294 ! !
  3379 ! !
  3295 
  3380 
       
  3381 !SystemBrowser::BrowserHistoryEntry methodsFor:'accessing'!
       
  3382 
       
  3383 className
       
  3384     "return the value of the instance variable 'className' (automatically generated)"
       
  3385 
       
  3386     ^ className
       
  3387 !
       
  3388 
       
  3389 className:something
       
  3390     "set the value of the instance variable 'className' (automatically generated)"
       
  3391 
       
  3392     className := something.
       
  3393 !
       
  3394 
       
  3395 meta
       
  3396     "return the value of the instance variable 'meta' (automatically generated)"
       
  3397 
       
  3398     ^ meta
       
  3399 !
       
  3400 
       
  3401 meta:something
       
  3402     "set the value of the instance variable 'meta' (automatically generated)"
       
  3403 
       
  3404     meta := something.
       
  3405 !
       
  3406 
       
  3407 selector
       
  3408     "return the value of the instance variable 'selector' (automatically generated)"
       
  3409 
       
  3410     ^ selector
       
  3411 !
       
  3412 
       
  3413 selector:something
       
  3414     "set the value of the instance variable 'selector' (automatically generated)"
       
  3415 
       
  3416     selector := something.
       
  3417 !
       
  3418 
       
  3419 theClass
       
  3420     ^ Smalltalk at:className asSymbol
       
  3421 ! !
       
  3422 
       
  3423 !SystemBrowser::BrowserHistoryEntry methodsFor:'comparing'!
       
  3424 
       
  3425 = anEntry
       
  3426     ^ className = anEntry className
       
  3427       and:[meta = anEntry meta
       
  3428       and:[selector = anEntry selector]]
       
  3429 ! !
       
  3430 
  3296 !SystemBrowser class methodsFor:'documentation'!
  3431 !SystemBrowser class methodsFor:'documentation'!
  3297 
  3432 
  3298 version
  3433 version
  3299     ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.131 2001-09-07 17:12:01 cg Exp $'
  3434     ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.132 2001-09-10 09:05:55 cg Exp $'
  3300 ! !
  3435 ! !
  3301 SystemBrowser initialize!
  3436 SystemBrowser initialize!