"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
"{ Package: 'stx:libtool' }"
ApplicationModel subclass:#SystemBrowser
instanceVariableNames:''
classVariableNames:'CheckForInstancesWhenRemovingClasses Icons'
poolDictionaries:''
category:'Interface-Browsers'
!
!SystemBrowser class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
documentation
"
this class implements all kinds of class browsers.
Typically, it is started with 'SystemBrowser open', but there are many other
startup messages, to launch special browsers.
See the categories 'startup' and 'special search startup' in the classes
protocol.
Alse, see the extra document 'doc/misc/sbrowser.doc' or the HTML online doc
for how to use the browser.
written winter 89 by claus.
Notice: SystemBrowser is currently being rewritten to be an instance
of ApplicationModel - this transition is not yet complete and you see
here an intermediate version. The instance variables defined here are NOT
currently used - instead, everything is really done in the BrowserView
which (currently) keeps the real state of the browser.
This will certainly change ...
[author:]
Claus Gittinger
"
! !
!SystemBrowser class methodsFor:'initialization'!
initialize
"Browser configuration;
(values can be changed from your private startup file)"
"/ self classResources.
"
setting this to false, the removeClass function will remove
classes WITHOUT checking for instances. Otherwise,
it will check and let you confirm in case there are instances.
Checking for instances may be a bit time consuming, though.
The default is true - therefore, it will check
"
CheckForInstancesWhenRemovingClasses := true
"
CheckForInstancesWhenRemovingClasses := true
CheckForInstancesWhenRemovingClasses := false
SystemBrowser initialize
"
! !
!SystemBrowser class methodsFor:'instance creation'!
open
"launch a standard browser"
self == SystemBrowser ifFalse:[
^ super open
].
^ self openOnDevice:(Screen current)
"
SystemBrowser open
"
!
openInClass:aClass
"launch a standard browser which immediately switches
to aClass"
^ self openInClass:aClass selector:nil
"
SystemBrowser openInClass:Object
"
"Created: 30.4.1996 / 14:43:45 / cg"
!
openInClass:aClass selector:aSelector
"launch a standard browser which immediately switches
to aClass>>aSelector."
|brwsr cls|
brwsr := self openOnDevice:(Screen current).
brwsr waitUntilVisible.
cls := aClass.
cls notNil ifTrue:[
cls isMeta ifTrue:[
cls := aClass soleInstance
].
aClass isMeta ifTrue:[
brwsr instanceProtocol:false
].
aClass isJavaClass ifTrue:[
brwsr switchToClassNamed:aClass fullName.
] ifFalse:[
brwsr switchToClassNamed:aClass name.
].
"/ brwsr updateClassCategoryList.
"/ brwsr updateMethodCategoryList.
"/ brwsr updateVariableList.
brwsr classSelectionChanged.
aSelector notNil ifTrue:[
brwsr switchToMethodNamed:aSelector.
]
].
^ brwsr
"
SystemBrowser openInClass:Object selector:#at:put:
SystemBrowser openInClass:Object selector:nil
SystemBrowser openInClass:nil selector:nil
"
"Created: / 22.11.1995 / 21:04:50 / cg"
"Modified: / 14.10.1998 / 15:31:52 / cg"
!
openOnDevice:aDisplay
"launch a standard browser on another display."
self == SystemBrowser ifFalse:[
^ super openOnDevice:aDisplay
].
^ self newWithLabel:(self classResources string:'System Browser')
setupBlock:[:browser | browser setupForAll]
onDevice:aDisplay
"|d|
d := XWorkstation new initializeFor:'porty:0'.
d startDispatch.
SystemBrowser openOnDevice:d
"
! !
!SystemBrowser class methodsFor:'Compatibility - ST80'!
newOnClass:aClass
^ self browseClass:aClass
"Created: / 27.10.1997 / 20:10:39 / cg"
! !
!SystemBrowser class methodsFor:'image specs'!
abstractMethodIcon
<resource: #programImage>
^ self padLockGrayMiniIcon
!
canvasIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
ImageEditor openOnClass:self andSelector:#canvasIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser canvasIcon'
ifAbsentPut:[(Depth4Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@.;.;.;.0@@@@@@@@@@C.;/C.;/@@9&XP9&XP@NY&DNY&D@C&Y!!C&Y!!@@9&XP9&XP@NY&DNY&D@C1DQC1DQ@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 255 0 0 0 255 0 0 0 255 0 255 255 255 255 0 255 0 255 127 0 0 0 127 0 0 0 127 0 127 127 127 127 0 127 0 127 127 127 127 170 170 170]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??#?>O?8??#?>O?8??#?>O?8??#?>@@a') ; yourself); yourself]
!
defaultIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self defaultIcon inspect
ImageEditor openOnClass:self andSelector:#defaultIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser defaultIcon'
ifAbsentPut:[(Depth4Image new) width: 28; height: 28; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
@@@@@@@@@@@@@@@@@@@FY&Y&Y&X0@@@@@@@@@@YDQDQDQB@@@@@@@@@@A$QDQDQDH@@@@@@@@@@CH"H"H"H @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@H@@@
@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@B@@@@@@@@@@@@@@@@@@@@@@@@Y&Y&Y&X0@@@@A H"H"A!!DQDQDR@@@@@@@@@@@CH"H"H"H@@@@@H@@@@@@@@@@@
@@@@@@@ @@@@@@@@@@@@@@@@@B@@@@@@@@@@@@@@@@@@@@@@@@Y&Y&Y&X0@@@@A H"H"A%UUUUUR@@@@@@@@@@@CH"H"H"H@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@H@@@@B@B@ @@H@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@H@@@@@@@@@H@@ @@@@Hb') ; colorMapFromArray:#[0 0 0 0 255 0 127 127 127 170 170 170 255 0 0 255 255 0 255 255 255]; mask:((Depth1Image new) width: 28; height: 28; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
??0@@O?<@@C??@@@??0@@O?<@@C??@@@@ @@@@H@@@@B@?? A0O?8@_??>@G@?? @ O?8@H@@@@B@?? A0O?8@_??>@G@?? @@O?8@@@@@@@@@@@9O\7\IRT
QDBD%DQ@!!OH''HHRQEABT$QPP99]7\@@a') ; yourself); yourself]!
fileImageIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self fileImageIcon inspect
ImageEditor openOnClass:self andSelector:#fileImageIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser fileImageIcon'
ifAbsentPut:[(Depth4Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@H"H"H"@@@BQBH!!D"@@@$P"HQH"@@H"H"DQH @BH"HQDRH@@"H"DQH"@@L3L3DSL0@CL3L1D3L@@3L3L3L3@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 51 153 153 51 255 255 255 153 0 255 255 0]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?<C?8O?0??#?>O?8??#?>O?8??#?>@@a') ; yourself); yourself]!
greenLockIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self greenLockIcon inspect
ImageEditor openOnClass:self andSelector:#greenLockIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser greenLockIcon'
ifAbsentPut:[(Depth2Image new) width: 9; height: 11; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@<@@CC@@CC@@O?0@O?0@O30@O30@O30@OC0@C?@@@@@@') ; colorMapFromArray:#[0 0 0 0 0 0 0 0 0 0 255 0]; mask:((Depth1Image new) width: 9; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'F@@$@BP@_ A>@G8@_ A>@G8@O@@@@@@a') ; yourself); yourself]
!
helpIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self helpIcon inspect
ImageEditor openOnClass:self andSelector:#helpIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser helpIcon'
ifAbsentPut:[(Depth1Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@A?<G#0]7A?\G;0__A?<G72_?@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??#?>O?8??#?>O?8??#?>O?8??#?>@@a') ; yourself); yourself]
!
hierarchicalListIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
ImageEditor openOnClass:self andSelector:#hierarchicalListIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser hierarchicalListIcon'
ifAbsentPut:[(Depth2Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@NAUUU0@R??8@GO?>@A0@C @\??88G@@N@A3?? @^@@8@N***@@@@@C b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??#?>O?8??#?>O?8??#?>O?8??#?>@@a') ; yourself); yourself]
!
imageIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self imageIcon inspect
ImageEditor openOnClass:self andSelector:#imageIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser imageIcon'
ifAbsentPut:[(Depth4Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@H"H"H"H @BQBH!!D"H@@$P"HQH"@@H"H"DQH @BH"HQDRH@@"H"DQH"@@L3L3DSL0@CL3L1D3L@@3L3L3L3@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 51 153 153 51 255 255 255 153 0 255 255 0]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??#?>O?8??#?>O?8??#?>O?8??#?>@@a') ; yourself); yourself]
!
menuIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self menuIcon inspect
ImageEditor openOnClass:self andSelector:#menuIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser menuIcon'
ifAbsentPut:[(Depth2Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@B***P@%UUT@@@@@@B***P@%UUT@@@@@@B***P@%UUT@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 170 170 170 255 255 255]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??#?>O?8??#?>O?8??#?>O?8?? @@@@a') ; yourself); yourself]
!
nameSpaceIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self nameSpaceIcon inspect
ImageEditor openOnClass:self andSelector:#nameSpaceIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser nameSpaceIcon'
ifAbsentPut:[(Depth8Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(8 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
A@PDA@@DA@PDA@PDA@PDA@PDA@P@@@@@A@PDA@PDA@PDA@P@@@@@@@PDA@PDA@PDA@P@@@@@@@@DA@@@@@@DA@PB@@LC@0D@@@@C@0LC@@HD@ @C@0DA@P@A
@0LC@0@BA@H@@0DA@PD@@PLC@0L@@ PB@@LA@PDA@@DA@0LC@@HD@ @C@PDA@P@A@PLC@0@B@@H@@0DA@PD@@PDC@0L@@ @B@@LA@PDA@@DA@PLC@@H@@ @A
@PDA@P@A@PDC@0@B@@@B@@DA@PD@@PDA@P@B@@@@@@H@@@DA@@DA@@@B@@@D@@@@@ H@@@@@@@HBA@PDA@PDA@PD@ HB@ HDA@PDA@@a') ; colorMapFromArray:#[0 0 0 194 194 194 190 190 0 255 255 255 0 0 0]; mask:((ImageMask new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@G#1??7??_?=??7??_?=??7??O?8_?@?8@>@b') ; yourself); yourself]
!
packageIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self packageIcon inspect
ImageEditor openOnClass:self andSelector:#packageIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser packageIcon'
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@ATET@AUEE@APQAP@TDQT@AY%Z@@UUUX@J%*F@@E@I B)Z"X@*V(&@J%*I B)Z"X@*V($@J%*I@B)Z @@@T@@@@a') ; colorMapFromArray:#[0 0 0 132 0 132 255 255 0]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A30O[A%LF?<O?0??G?<??3??O?<??3??O?8??C?8O?@b') ; yourself); yourself]
!
padLockBlueMiniIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self padLockBlueMiniIcon inspect
ImageEditor openOnClass:self andSelector:#padLockBlueMiniIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser padLockBlueMiniIcon'
ifAbsentPut:[(Depth2Image new) width: 12; height: 12; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?0C??F$?<TEO<S1O<@@O2**#2UUS2TES2VES2UUS<@@O????') ; colorMapFromArray:#[0 0 0 128 128 255 212 212 255 255 255 255]; mask:((Depth1Image new) width: 12; height: 12; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
C0@_ C?@N\@?0G? _>A?8G? _>@?0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; yourself); yourself]
!
padLockGrayMiniIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self padLockGrayMiniIcon inspect
ImageEditor openOnClass:self andSelector:#padLockGrayMiniIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser padLockGrayMiniIcon'
ifAbsentPut:[(Depth2Image new) width: 12; height: 12; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?0C??F$?<TEO<S1O<@@O2**#2UUS2TES2VES2UUS<@@O????') ; colorMapFromArray:#[0 0 0 128 128 128 212 212 212 255 255 255]; mask:((Depth1Image new) width: 12; height: 12; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
C0@_ C?@N\@?0G? _>A?8G? _>@?0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; yourself); yourself]
!
padLockGreenMiniIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self padLockGreenMiniIcon inspect
ImageEditor openOnClass:self andSelector:#padLockGreenMiniIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser padLockGreenMiniIcon'
ifAbsentPut:[(Depth2Image new) width: 12; height: 12; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?0C??F$?<TEO<S1O<@@O2**#2UUS2TES2VES2UUS<@@O????') ; colorMapFromArray:#[0 0 0 128 255 128 212 255 212 255 255 255]; mask:((Depth1Image new) width: 12; height: 12; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
C0@_ C?@N\@?0G? _>A?8G? _>@?0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; yourself); yourself]
!
padLockRedMiniIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self padLockRedMiniIcon inspect
ImageEditor openOnClass:self andSelector:#padLockRedMiniIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser padLockRedMiniIcon'
ifAbsentPut:[(Depth2Image new) width: 12; height: 12; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?0C??F$?<TEO<S1O<@@O2**#2UUS2TES2VES2UUS<@@O????') ; colorMapFromArray:#[0 0 0 255 128 128 255 212 212 255 255 255]; mask:((Depth1Image new) width: 12; height: 12; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'
C0@_ C?@N\@?0G? _>A?8G? _>@?0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@') ; yourself); yourself]
!
privateMethodIcon
<resource: #programImage>
^ self padLockRedMiniIcon
!
programImageIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self programImageIcon inspect
ImageEditor openOnClass:self andSelector:#programImageIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser programImageIcon'
ifAbsentPut:[(Depth4Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@H"H"H"H @BQBH!!D"H@@$P"HQH"@@H"H"DQH @BH"HQDRH@@"H"DQH"@@L3L3DSL0@CL3L1D3L@@3L3L3L3@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 25 77 77 51 255 255 128 128 0 128 77 0]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??#?>O?8??#?>O?8??#?>O?8??#?>@@a') ; yourself); yourself]!
programMenuIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self programMenuIcon inspect
ImageEditor openOnClass:self andSelector:#programMenuIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser programMenuIcon'
ifAbsentPut:[(Depth1Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@A?<G?0@@A?<G?0@@A?<G?3@@@@@@@a') ; colorMapFromArray:#[0 0 0 170 170 170]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??#?>O?8??#?>O?8??#?>O?8?? @@@@a') ; yourself); yourself]
!
protectedMethodIcon
<resource: #programImage>
^ self padLockGreenMiniIcon
!
redLockIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self redLockIcon inspect
ImageEditor openOnClass:self andSelector:#redLockIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser redLockIcon'
ifAbsentPut:[(Depth2Image new) width: 9; height: 11; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@T@@AA@@AA@@EUP@EUP@EQP@EQP@EQP@EAP@AU@@@@@@') ; colorMapFromArray:#[0 0 0 255 0 0]; mask:((Depth1Image new) width: 9; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'F@@$@BP@_ A>@G8@_ A>@G8@O@@@@@@a') ; yourself); yourself]
!
stopIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self stopIcon inspect
ImageEditor openOnClass:self andSelector:#stopIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser stopIcon'
ifAbsentPut:[(Depth1Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@N@@8@C @N@@P@@@@N@@8@A@@@@@@a') ; colorMapFromArray:#[255 0 0 255 255 255]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'G0@? G?@?>C?8O? ?>C?8G?@O8@_@@@a') ; yourself); yourself]
!
tabListIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self tabListIcon inspect
ImageEditor openOnClass:self andSelector:#tabListIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser tabListIcon'
ifAbsentPut:[(Depth2Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@D3!!QP@@8TT@@N@@J@C***P@:**$AN**)@C***P@:**$@IUUUB @@@@@b') ; colorMapFromArray:#[0 0 0 127 127 127 170 170 170 255 255 255]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?8C?0O?0??#?>O?8??#?>O?8??#?>@@a') ; yourself); yourself]
!
tableColumnsIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self tableColumnsIcon inspect
ImageEditor openOnClass:self andSelector:#tableColumnsIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser tableColumnsIcon'
ifAbsentPut:[(Depth2Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@C??? @8(($@L@@AHC"""R@0@@D@NJJI@C@@@P@8(($@IUUU@@@@@@@b') ; colorMapFromArray:#[0 0 0 127 127 127 170 170 170 255 255 255]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??#?>O?8??#?>O?8??#?>O?8??#?>@@a') ; yourself); yourself]
!
timeIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self timeIcon inspect
ImageEditor openOnClass:self andSelector:#timeIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser timeIcon'
ifAbsentPut:[(Depth1Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@G@A7@G\@=8C0 O>@_0A?@A0@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A0@_0C? O>A?<G?0_?@?8C? G<@G@@@a') ; yourself); yourself]
!
traceIcon
"This resource specification was automatically generated
by the ImageEditor of ST/X."
"Do not manually edit this!! If it is corrupted,
the ImageEditor may not be able to read the specification."
"
self traceIcon inspect
ImageEditor openOnClass:self andSelector:#traceIcon
"
<resource: #image>
^Icon
constantNamed:#'SystemBrowser traceIcon'
ifAbsentPut:[(Depth1Image new) width: 13; height: 11; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@>@C8@G@@\@@ @B@@@@@@@@@@@a') ; colorMapFromArray:#[255 0 0 255 255 255]; mask:((Depth1Image new) width: 13; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?A?<C? O>@_0A?@C8@O @\@A0@B@@@a') ; yourself); yourself]
! !
!SystemBrowser class methodsFor:'interface specs'!
metaSpec
"UIPainter new openOnClass: self andSelector: #metaSpec"
<resource: #canvas>
^#(#FullSpec
#window:
#(#WindowSpec
#label: 'Unlabeled Canvas'
#bounds: #(#Rectangle 27 249 325 334 ) )
#component:
#(#SpecCollection
#collection: #(
#(#RadioButtonSpec
#layout: #(#LayoutFrame 0 0 4 0 -1 0.575 20 0 )
#name: #instanceSwitch
#model: #metaHolder
#callbacksSpec:
#(#UIEventCallbackSubSpec
#requestValueChangeSelector: #changeRequest )
#label: 'instance'
#select: false )
#(#RadioButtonSpec
#layout: #(#LayoutFrame 1 0.575 4 0 -1 1 20 0 )
#name: #classSwitch
#model: #metaHolder
#callbacksSpec:
#(#UIEventCallbackSubSpec
#requestValueChangeSelector: #changeRequest )
#label: 'class'
#select: true ) ) ) )
"Created: / 30.10.1997 / 19:07:29 / cg"
!
methodMoveDialogSpec
"this window spec was automatically generated by the ST/X UIPainter"
"do not manually edit this - the painter/builder may not be able to
handle the specification if its corrupted."
"
UIPainter new openOnClass:SystemBrowser andSelector:#methodMoveDialogSpec
SystemBrowser new openDialogInterface:#methodMoveDialogSpec
"
<resource: #canvas>
^
#(#FullSpec
#'window:'
#(#WindowSpec
#'name:' 'uIPainterView'
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
#'label:' 'move method'
#'bounds:' #(#Rectangle 0 0 279 118)
)
#'component:'
#(#SpecCollection
#'collection:'
#(
#(#HorizontalPanelViewSpec
#'name:' 'horizontalPanelView'
#'layout:' #(#LayoutFrame 0 0.0 -35 1.0 0 1.0 -2 1.0)
#'component:'
#(#SpecCollection
#'collection:'
#(
#(#ActionButtonSpec
#'name:' 'actionButton2'
#'label:' 'cancel'
#'tabable:' true
#'model:' #cancel
#'extent:' #(#Point 133 27)
)
#(#ActionButtonSpec
#'name:' 'actionButton1'
#'label:' 'move'
#'tabable:' true
#'isDefault:' true
#'model:' #accept
#'extent:' #(#Point 134 27)
)
)
)
#'level:' 0
#'horizontalLayout:' #fitSpace
#'verticalLayout:' #center
#'horizontalSpace:' 4
#'verticalSpace:' 4
)
#(#LabelSpec
#'name:' 'label'
#'layout:' #(#LayoutFrame 2 0 2 0 -2 1.0 25 0)
#'label:' 'move current method to which class:'
#'style:'
#(#Font
'helvetica' 'medium'
'roman' 12
)
#'foregroundColor:' #(#Color 0.0 0.0 0.0)
#'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'adjust:' #left
)
#(#ComboBoxSpec
#'name:' 'comboBox1'
#'layout:' #(#LayoutFrame 2 0 29 0 -2 1.0 51 0)
#'tabable:' true
#'model:' #className
#'comboList:' #classList
)
)
)
)
"Created: 25.6.1997 / 13:45:20 / cg"
"Modified: 25.6.1997 / 13:46:44 / cg"
! !
!SystemBrowser class methodsFor:'private helpers'!
showNoneFound
super warn:(self classResources string:'None found.').
!
showNoneFound:what
|rs|
rs := self classResources.
super information:((rs string:what) , (rs string:'...\\... none found.')) withCRs.
! !
!SystemBrowser class methodsFor:'private instance creation'!
newWithLabel:aString setupBlock:aBlock
"common helper method for all creation methods"
^ self newWithLabel:aString setupBlock:aBlock onDevice:Screen current
!
newWithLabel:aString setupBlock:aBlock onDevice:aWorkstation
"common helper method for all creation methods"
|newBrowser|
newBrowser := BrowserView onDevice:aWorkstation.
newBrowser title:aString.
aBlock value:newBrowser.
newBrowser open.
^ newBrowser
!
newWithLabel:aString setupSelector:aSymbol arg:arg
"common helper method for all creation methods"
^ self newWithLabel:aString setupSelector:aSymbol arg:arg onDevice:Screen current
!
newWithLabel:aString setupSelector:aSymbol arg:arg onDevice:aWorkstation
"common helper method for all creation methods"
|newBrowser|
newBrowser := BrowserView onDevice:aWorkstation.
newBrowser title:aString.
newBrowser perform:aSymbol with:arg.
newBrowser open.
^ newBrowser
! !
!SystemBrowser class methodsFor:'special search startup'!
allCallsOn:aSelectorString
"return a collection of methods which send aSelector."
^ self
allCallsOn:aSelectorString
in:(Smalltalk allClasses)
"
SystemBrowser allCallsOn:#at:put:
"
"Created: 24.1.1997 / 19:42:57 / cg"
!
allCallsOn:aSelectorString in:aCollectionOfClasses
"return a collection of methods which send aSelector.
Methods from classes in aCollectionOfClasses are searched only."
^ self
allCallsOn:aSelectorString
in:aCollectionOfClasses
ignoreCase:false
!
allCallsOn:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase
"return a collection of methods which send aSelector.
Methods from classes in aCollectionOfClasses are searched only."
|sel searchBlock lcString|
((aSelectorString ~= '*')
and:[(aSelectorString includesMatchCharacters or:[ignoreCase])]) ifTrue:[
"/ a matchString - need string matching procedure
searchBlock := [:class :method :s |
|src quickMatch|
ignoreCase ifTrue:[
lcString := aSelectorString asLowercase.
] ifFalse:[
lcString := aSelectorString.
].
quickMatch := aSelectorString.
(quickMatch startsWith:'*') ifTrue:[
quickMatch := quickMatch copyFrom:2
].
(quickMatch endsWith:'*') ifTrue:[
quickMatch := quickMatch copyWithoutLast:1
].
(ignoreCase not and:[quickMatch includesMatchCharacters not]) ifTrue:[
"/ do quick search first
method isLazyMethod ifTrue:[
src := method source.
(src notNil
and:[src includesString:quickMatch]) ifTrue:[
method makeRealMethod.
(method literalsDetect:[:aLiteral|
(aLiteral isMemberOf:Symbol)
and:[(lcString includesString:quickMatch)
and:[(lcString match:aLiteral)]]
] ifNone:nil) notNil
] ifFalse:[
false
]
] ifFalse:[
(method literalsDetect:[:aLiteral|
(aLiteral isMemberOf:Symbol)
and:[(lcString includesString:quickMatch)
and:[(lcString match:aLiteral)]]
] ifNone:nil) notNil
]
] ifFalse:[
"/ expensive search
method isLazyMethod ifTrue:[
src := method source.
(src notNil and:[src includesMatchString:aSelectorString]) ifTrue:[
method makeRealMethod.
(method literalsDetect:[:aLiteral|
(aLiteral isMemberOf:Symbol)
and:[(ignoreCase and:[lcString match:aLiteral asLowercase])
or:[ignoreCase not and:[lcString match:aLiteral]]]
] ifNone:nil) notNil
] ifFalse:[
false
]
] ifFalse:[
(method literalsDetect:[:aLiteral|
(aLiteral isMemberOf:Symbol)
and:[(ignoreCase and:[lcString match:aLiteral asLowercase])
or:[ignoreCase not and:[lcString match:aLiteral]]]
] ifNone:nil) notNil
]
]
].
] ifFalse:[
(aSelectorString = '*') ifTrue:[
searchBlock := [:class :method :s | true].
] ifFalse:[
"/ no matchString - can do it much faster
sel := aSelectorString asSymbolIfInterned.
sel isNil ifTrue:[
^ nil "/ none
].
searchBlock := [:class :method :s |
|src|
method isLazyMethod ifTrue:[
src := method source.
(src notNil and:[src includesString:sel]) ifTrue:[
method makeRealMethod.
method sends:sel.
] ifFalse:[
false
]
] ifFalse:[
method sends:sel
]
].
]
].
^ self allMethodsIn:aCollectionOfClasses where:searchBlock
"
SystemBrowser allCallsOn:#at:put: in:(Smalltalk allClasses)
"
"Modified: 18.4.1997 / 10:32:50 / cg"
!
allMethodsIn:aCollectionOfClasses inst:wantInst class:wantClass where:aBlock
"return a collection of methods which pass the given test.
wantInst/wantClass control if instMethods and/or classMethods are to be
considered.
Only classes in aCollectionOfClasses are inspected in the search"
|list activePriority|
"
since this may take a long time, lower my priority ...
"
activePriority := Processor activePriority.
Processor activeProcess
withPriority:activePriority-1 to:activePriority
do:[
|checkedClasses checkBlock detectedMethods|
checkedClasses := IdentitySet new.
list := OrderedCollection new.
detectedMethods := IdentitySet new.
checkBlock := [:cls |
(checkedClasses includes:cls) ifFalse:[
cls isObsolete ifTrue:[
Transcript showCR:'skipping obsolete class: ' , cls displayString
] ifFalse:[
cls methodDictionary keysAndValuesDo:[:sel :method |
(aBlock value:cls value:method value:sel) ifTrue:[
"/ care for methods being in multiple classes (should not happen)
(detectedMethods includes:method) ifFalse:[
list add:method.
detectedMethods add:method
]
]
].
checkedClasses add:cls.
]
]
].
aCollectionOfClasses do:[:aClass |
"
output disabled - it slows down things too much (when searching for
implementors or senders)
"
wantInst ifTrue:[
"/ Transcript show:'searching '; show:aClass name; showCR:' ...'; endEntry.
checkBlock value:aClass
].
wantClass ifTrue:[
"/ Transcript show:'searching '; show:aClass class name; showCR:' ...'; endEntry.
checkBlock value:(aClass class)
].
Processor yield
]
].
^ list
"Created: / 24.1.1997 / 19:41:12 / cg"
"Modified: / 14.12.1999 / 14:59:02 / cg"
!
allMethodsIn:aCollectionOfClasses where:aBlock
"return a collection of methods which pass the given test.
Only classes in aCollectionOfClasses are inspected in the search"
^ self
allMethodsIn:aCollectionOfClasses
inst:true
class:true
where:aBlock
"Created: 24.1.1997 / 19:41:49 / cg"
!
aproposSearch:aString
"browse all methods, which have aString in their selector."
^ self aproposSearch:aString in:(Smalltalk allClasses)
!
aproposSearch:aString in:aCollectionOfClasses
"browse all methods, which have aString.
This is relatively slow, since all source must be processed."
|matchString list s searchBlock browser|
matchString := '*' , aString , '*'.
list := OrderedCollection new.
(aString includesMatchCharacters) ifTrue:[
s := '*' , aString asLowercase , '*'.
"a matchString"
searchBlock := [:text | (text asCollectionOfLinesfindFirst:[:line | s match:line]) ~~ 0].
] ifFalse:[
searchBlock := [:source | (source findString:aString asLowercase) ~~ 0]
].
browser := self browseMethodsIn:aCollectionOfClasses
where:[:class :method :sel |
|comment|
(searchBlock value:sel asLowercase)
]
title:(self classResources string:'selectors containing: %1' with:aString).
browser notNil ifTrue:[
browser autoSearch:aString
].
^ browser
"
SystemBrowser aproposSearch:'append' in:(Collection withAllSubclasses)
SystemBrowser aproposSearch:'add' in:(Collection withAllSubclasses)
SystemBrowser aproposSearch:'sort' in:(Collection withAllSubclasses)
SystemBrowser aproposSearch:'[Aa]bsent' in:(Collection withAllSubclasses)
"
"Created: 9.12.1995 / 18:02:36 / cg"
!
browseAllCallsOn:aSelectorString
"launch a browser for all senders of aSelector"
^ self
browseAllCallsOn:aSelectorString
in:(Smalltalk allClasses)
"
SystemBrowser browseAllCallsOn:#+
"
"Created: 9.12.1995 / 18:00:41 / cg"
"Modified: 10.7.1996 / 10:26:15 / cg"
!
browseAllCallsOn:aSelectorString in:aSetOfClasses
"launch a browser for all senders of aSelector"
^ self
browseAllCallsOn:aSelectorString
in:aSetOfClasses
title:(self classResources string:'senders of: %1' with:aSelectorString)
"
SystemBrowser browseAllCallsOn:#+ in:(Number withAllSubclasses)
"
"Created: 10.7.1996 / 10:25:49 / cg"
"Modified: 24.1.1997 / 19:49:34 / cg"
!
browseAllCallsOn:aSelectorString in:aSetOfClasses ignoreCase:ignoreCase
"launch a browser for all senders of aSelector"
^ self
browseAllCallsOn:aSelectorString
in:aSetOfClasses
ignoreCase:ignoreCase
title:(self classResources string:'senders of: %1' with:aSelectorString)
"
SystemBrowser browseAllCallsOn:#+ in:(Number withAllSubclasses)
"
"Created: 10.7.1996 / 10:25:49 / cg"
"Modified: 24.1.1997 / 19:49:34 / cg"
!
browseAllCallsOn:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase title:title
"launch a browser for all senders of aSelector in aCollectionOfClasses"
|browser|
browser := self
browseMethods:(self allCallsOn:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase)
title:title.
browser notNil ifTrue:[
|s|
"
kludge for now, if its a multipart selector,
no easy search is (as yet) possible
"
s := aSelectorString.
(s includes:$:) ifTrue:[
s := s copyTo:(s indexOf:$:)
].
browser autoSearch:s
].
^ browser
"
SystemBrowser
browseAllCallsOn:#+
in:(Number withAllSubclasses)
title:'just a test'
"
"Modified: 24.1.1997 / 19:48:54 / cg"
!
browseAllCallsOn:aSelectorString in:aCollectionOfClasses title:title
"launch a browser for all senders of aSelector in aCollectionOfClasses"
^ self
browseAllCallsOn:aSelectorString
in:aCollectionOfClasses
ignoreCase:false
title:title
"
SystemBrowser
browseAllCallsOn:#+
in:(Number withAllSubclasses)
title:'just a test'
"
"Modified: 24.1.1997 / 19:48:54 / cg"
!
browseCallsOn:aSelectorString under:aClass
"launch a browser for all senders of aSelector in aClass and subclasses"
^ self
browseAllCallsOn:aSelectorString
in:(aClass withAllSubclasses)
title:(self classResources
string:'senders of: %1 (in and below %2)'
with:aSelectorString
with:aClass name)
"
SystemBrowser browseCallsOn:#+ under:Number
"
"Created: 9.12.1995 / 17:59:57 / cg"
"Modified: 24.1.1997 / 19:50:33 / cg"
!
browseClassRefsTo:aString in:aCollectionOfClasses modificationsOnly:modsOnly
"launch a browser for all methods in aClass where the classVar named
aString is referenced; if modsOnly is true, browse only methods where the
classvar is modified"
^ self browseRefsTo:aString classVars:true in:aCollectionOfClasses modificationsOnly:modsOnly
!
browseClassRefsTo:varName in:aCollectionOfClasses modificationsOnly:modsOnly title:title
"launch a browser for all methods in aCollectionOfClasses,
where the classVar named aString is referenced;
if modsOnly is true, browse only methods where the classvar is modified"
^ self browseRefsTo:varName classVars:true in:aCollectionOfClasses modificationsOnly:modsOnly title:title
!
browseClassRefsTo:aString under:aClass modificationsOnly:modsOnly
"launch a browser for all methods in aClass and subclasses
where the classVar named aString is referenced;
if modsOnly is true, browse only methods where the classvar is modified"
^ self browseClassRefsTo:aString in:(aClass withAllSubclasses) modificationsOnly:modsOnly
!
browseForResource:aResourceSymbol containing:item in:aCollectionOfClasses title:title
"launch a browser for all methods which have a particular (or any, ifNil)
resource in aCollectionOfClasses.
If aKey is nonNil, only methods which have aKey in the (any) resourceSpec
are parsed.
I.e. to find all methods, which access the styleSheets, use:
browseForResource:#style containing:nil in:... title:...
to find methods which access the 'arrowButtonDownForm' styleSheet entry, use:
browseForResource:#style containing:'arrowButtonDownForm' in:... title:..."
|browser searchBlock|
"/ search for any resource can be done without looking
"/ at the source ...
(aResourceSymbol isNil and:[item isNil]) ifTrue:[
searchBlock := [:class :method :s | method hasResource]
] ifFalse:[
searchBlock := [:class :method :s |
|rsrc val found|
found := false.
method hasResource ifTrue:[
rsrc := method resources.
rsrc notNil ifTrue:[
aResourceSymbol isNil ifTrue:[
item isNil ifTrue:[
found := true
] ifFalse:[
rsrc isCollection ifTrue:[
rsrc keysAndValuesDo:[:rsrc :val |
val isCollection ifTrue:[
val do:[:v |
found := item match:v printString
]
] ifFalse:[
found := item match:val printString
]
]
] ifFalse:[
found := item match:rsrc printString
]
]
] ifFalse:[
(rsrc includesKey:aResourceSymbol) ifTrue:[
item isNil ifTrue:[
found := true
] ifFalse:[
rsrc isCollection ifTrue:[
val := rsrc at:aResourceSymbol.
val isCollection ifTrue:[
val do:[:v |
found := item match:v printString
]
] ifFalse:[
found := item match:val printString
]
] ifFalse:[
found := item match:rsrc printString
]
]
]
]
].
].
found
].
].
browser := self browseMethodsIn:aCollectionOfClasses
where:searchBlock
title:title.
browser notNil ifTrue:[
browser autoSearch:'resource:'
].
^ browser
"
SystemBrowser
browseForResource:nil
in:Smalltalk allClasses
title:'methods with a resource'
"
"
SystemBrowser
browseForResource:#style
containing:nil
in:Smalltalk allClasses
title:'methods with a #style resource'
"
"
SystemBrowser
browseForResource:#style
containing:'arrowButton*'
in:Smalltalk allClasses
title:'methods with a #style resource'
"
"Modified: / 22.4.1998 / 10:29:20 / cg"
!
browseForResource:aResourceSymbol in:aCollectionOfClasses title:title
"launch a browser for all methods which have a particular (or any, ifNil)
resource in aCollectionOfClasses"
^ self
browseForResource:aResourceSymbol
containing:nil
in:aCollectionOfClasses
title:title
"
SystemBrowser
browseForResource:#style
in:Smalltalk allClasses
title:'methods accessing styleSheet values'
"
"
SystemBrowser
browseForResource:#keyboard
in:Smalltalk allClasses
title:'methods handling keyboard events'
"
"
SystemBrowser
browseForResource:nil
in:Smalltalk allClasses
title:'methods with a resource'
"
"Modified: 9.1.1997 / 12:44:38 / cg"
!
browseForString:aString
"launch a browser for all methods containing a string in their source.
This may be slow, since source-code has to be scanned."
^ self browseForString:aString in:(Smalltalk allClasses) ignoreCase:false
"Modified: / 18.6.1998 / 16:42:39 / cg"
!
browseForString:aString in:aCollectionOfClasses
"launch a browser for all methods in aCollectionOfClasses
containing a string in their source.
This may be slow, since source-code has to be scanned."
^ self
browseForString:aString
in:aCollectionOfClasses
ignoreCase:false
"
SystemBrowser browseForString:'all' in:(Array with:Object)
SystemBrowser browseForString:'should' in:(Array with:Object)
SystemBrowser browseForString:'[eE]rror' in:(Array with:Object)
"
"Created: / 9.12.1995 / 18:03:12 / cg"
"Modified: / 18.6.1998 / 16:43:27 / cg"
!
browseForString:aString in:aCollectionOfClasses ignoreCase:ignoreCase
"launch a browser for all methods in aCollectionOfClasses
containing a string in their source.
This may be slow, since source-code has to be scanned."
|browser searchBlock title s|
title := self classResources string:'methods containing: %1' with:aString displayString.
(aString includesMatchCharacters
or:[ignoreCase]) ifTrue:[
s := '*' , aString , '*'.
"a matchString"
searchBlock := [:c :m :sel |
|src|
src := m source.
src isNil ifTrue:[
('Browser [info]: no source for ' , m printString) infoPrintCR.
false
] ifFalse:[
s match:src ignoreCase:ignoreCase
]
]
] ifFalse:[
searchBlock := [:c :m :sel |
|src|
src := m source.
src isNil ifTrue:[
('Browser [info]: no source for ' , m printString) infoPrintCR.
false
] ifFalse:[
(src findString:aString) ~~ 0
]
]
].
browser := self browseMethodsIn:aCollectionOfClasses where:searchBlock title:title.
browser notNil ifTrue:[
browser autoSearch:aString ignoreCase:ignoreCase
].
^ browser
"
SystemBrowser browseForString:'all' in:(Array with:Object)
SystemBrowser browseForString:'should' in:(Array with:Object)
SystemBrowser browseForString:'[eE]rror' in:(Array with:Object)
"
"Created: / 18.6.1998 / 16:42:50 / cg"
"Modified: / 18.6.1998 / 16:51:25 / cg"
!
browseForSymbol:aSymbol
"launch a browser for all methods referencing aSymbol"
^ self
browseForSymbol:aSymbol
title:(self classResources string:'users of: %1' with:aSymbol)
warnIfNone:true
"Created: 9.12.1995 / 18:04:34 / cg"
"Modified: 10.7.1996 / 10:35:34 / cg"
!
browseForSymbol:aSymbol in:aSetOfClasses title:title warnIfNone:doWarn
"launch a browser for all methods referencing aSymbol"
|browser searchBlock sym|
(aSymbol includesMatchCharacters) ifTrue:[
"a matchString"
searchBlock := [:c :m :s |
(m literalsDetect:[:aLiteral|
(aLiteral isMemberOf:Symbol)
and:[aSymbol match:aLiteral]
] ifNone:nil) notNil
].
] ifFalse:[
"
can do a faster search
"
sym := aSymbol asSymbolIfInterned.
sym isNil ifTrue:[
self showNoneFound:title.
^ nil
].
searchBlock := [:c :m :s |
(m literalsDetect:[:aLiteral|
(sym == aLiteral)
] ifNone:nil) notNil
].
].
doWarn ifFalse:[
WarningSignal ignoreIn:[
browser := self browseMethodsIn:aSetOfClasses where:searchBlock title:title.
]
] ifTrue:[
browser := self browseMethodsIn:aSetOfClasses where:searchBlock title:title.
].
browser notNil ifTrue:[
browser autoSearch:aSymbol
].
^ browser
"Modified: 24.6.1996 / 14:39:07 / stefan"
"Modified: 30.6.1996 / 16:45:25 / cg"
"Created: 10.7.1996 / 10:36:36 / cg"
!
browseForSymbol:aSymbol in:aSetOfClasses title:title warnIfNone:doWarn searchFor:searchString
"launch a browser for all methods referencing aSymbol"
|browser searchBlock sym|
(aSymbol includesMatchCharacters) ifTrue:[
"a matchString"
searchBlock := [:c :m :s |
(m literalsDetect:[:aLiteral|
(aLiteral isMemberOf:Symbol)
and:[aSymbol match:aLiteral]
] ifNone:nil) notNil
].
] ifFalse:[
"
can do a faster search
"
sym := aSymbol asSymbolIfInterned.
sym isNil ifTrue:[
self showNoneFound:title.
^ nil
].
searchBlock := [:c :m :s |
(m literalsDetect:[:aLiteral|
(sym == aLiteral)
] ifNone:nil) notNil
].
].
doWarn ifFalse:[
WarningSignal ignoreIn:[
browser := self browseMethodsIn:aSetOfClasses where:searchBlock title:title.
]
] ifTrue:[
browser := self browseMethodsIn:aSetOfClasses where:searchBlock title:title.
].
(browser notNil
and:[searchString notNil]) ifTrue:[
browser autoSearch:searchString
].
^ browser
"Modified: 24.6.1996 / 14:39:07 / stefan"
"Modified: 30.6.1996 / 16:45:25 / cg"
"Created: 31.10.1996 / 14:57:30 / cg"
!
browseForSymbol:aSymbol title:title ifNone:actionIfNoneFound searchFor:searchString
"launch a browser for all methods referencing aSymbol"
|browser searchBlock sym|
(aSymbol includesMatchCharacters) ifTrue:[
"a matchString"
searchBlock := [:c :m :s |
m referencesGlobalMatching:aSymbol
"/ (m literalsDetect:[:aLiteral|
"/ (aLiteral isMemberOf:Symbol)
"/ and:[aSymbol match:aLiteral]
"/ ] ifNone:nil) notNil
].
] ifFalse:[
"
can do a faster search
"
sym := aSymbol asSymbolIfInterned.
sym isNil ifTrue:[
actionIfNoneFound value.
^ nil
].
searchBlock := [:c :m :s |
m referencesGlobal:sym
"/ (m literalsDetect:[:aLiteral|
"/ (sym == aLiteral)
"/ ] ifNone:nil) notNil
].
].
WarningSignal ignoreIn:[
InformationSignal ignoreIn:[
browser := self browseMethodsWhere:searchBlock title:title.
]
].
browser isNil ifTrue:[
actionIfNoneFound value
].
(browser notNil
and:[searchString notNil]) ifTrue:[
browser autoSearch:searchString
].
^ browser
"Modified: / 24.6.1996 / 14:39:07 / stefan"
"Created: / 31.10.1996 / 14:45:08 / cg"
"Modified: / 9.11.1999 / 17:04:30 / cg"
!
browseForSymbol:aSymbol title:title warnIfNone:doWarn
"launch a browser for all methods referencing aSymbol"
^ self
browseForSymbol:aSymbol
title:title
warnIfNone:doWarn
searchFor:aSymbol
"Modified: 31.10.1996 / 14:45:38 / cg"
!
browseForSymbol:aSymbol title:title warnIfNone:doWarn searchFor:searchString
"launch a browser for all methods referencing aSymbol"
|b|
doWarn ifTrue: [
b := [self showNoneFound:title]
].
^ self
browseForSymbol:aSymbol
title:title
ifNone:b
searchFor:searchString
!
browseImplementorsOf:aSelectorString
"launch a browser for all implementors of aSelector"
^ self
browseImplementorsOf:aSelectorString
in:(Smalltalk allClasses)
"
SystemBrowser browseImplementorsOf:#+
"
"Created: 9.12.1995 / 18:01:18 / cg"
"Modified: 10.7.1996 / 10:21:26 / cg"
!
browseImplementorsOf:aSelectorString in:aSetOfClasses
"launch a browser for all implementors of aSelector"
^ self
browseImplementorsOf:aSelectorString
in:aSetOfClasses
title:(self classResources string:'implementors of: %1' with:aSelectorString)
"
SystemBrowser browseImplementorsOf:#+ in:(Number withAllSubclasses)
"
"Created: 10.7.1996 / 10:20:59 / cg"
"Modified: 10.7.1996 / 10:21:49 / cg"
!
browseImplementorsOf:aSelectorString in:aSetOfClasses ignoreCase:ignoreCase
"launch a browser for all implementors of aSelector"
^ self
browseImplementorsOf:aSelectorString
in:aSetOfClasses
ignoreCase:ignoreCase
title:(self classResources string:'implementors of: %1' with:aSelectorString)
"
SystemBrowser browseImplementorsOf:#+ in:(Number withAllSubclasses)
"
"Created: 10.7.1996 / 10:20:59 / cg"
"Modified: 10.7.1996 / 10:21:49 / cg"
!
browseImplementorsOf:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase title:title
"launch a browser for all implementors of aSelector in
the classes contained in aCollectionOfClasses and its metaclasses"
|list|
list := self
findImplementorsOf:aSelectorString
in:aCollectionOfClasses
ignoreCase:ignoreCase.
list size == 0 ifTrue:[
self showNoneFound:title.
^ nil
].
^ self browseMethods:list asOrderedCollection title:title
"
SystemBrowser browseImplementorsOf:#+
in:(Array with:Number
with:Float
with:SmallInteger)
title:'some implementors of +'
"
"Modified: / 4.9.1995 / 17:33:39 / claus"
"Modified: / 19.6.1996 / 14:19:02 / stefan"
"Modified: / 16.10.1998 / 13:16:29 / cg"
!
browseImplementorsOf:aSelectorString in:aCollectionOfClasses title:title
"launch a browser for all implementors of aSelector in
the classes contained in aCollectionOfClasses and its metaclasses"
^ self
browseImplementorsOf:aSelectorString
in:aCollectionOfClasses
ignoreCase:false
title:title
!
browseImplementorsOf:aSelectorString under:aClass
"launch a browser for all implementors of aSelector in aClass
and its subclasses"
^ self
browseImplementorsOf:aSelectorString
in:(aClass withAllSubclasses)
title:(self classResources
string:'implementors of: %1 (in and below %2)'
with:aSelectorString
with:aClass name)
"
SystemBrowser browseImplementorsOf:#+ under:Integer
"
"Created: 9.12.1995 / 18:06:09 / cg"
"Modified: 9.12.1995 / 18:11:38 / cg"
!
browseInstRefsTo:aString in:aCollectionOfClasses modificationsOnly:modsOnly
"launch a browser for all methods in aClass where the instVar named
aString is referenced; if modsOnly is true, browse only methods where the
instvar is modified"
^ self browseRefsTo:aString classVars:false in:aCollectionOfClasses modificationsOnly:modsOnly
!
browseInstRefsTo:varName in:aCollectionOfClasses modificationsOnly:modsOnly title:title
"launch a browser for all methods in aClass where the instVar named
varName is referenced; if modsOnly is true, browse only methods where the
instvar is modified"
^ self browseRefsTo:varName classVars:false in:aCollectionOfClasses modificationsOnly:modsOnly title:title
!
browseInstRefsTo:aString under:aClass modificationsOnly:modsOnly
"launch a browser for all methods in aClass and subclasses
where the instVar named aString is referenced;
if modsOnly is true, browse only methods where the instvar is modified"
^ self browseInstRefsTo:aString in:(aClass withAllSubclasses) modificationsOnly:modsOnly
!
browseReferendsOf:aGlobalName
"launch a browser for all methods referencing a global
named aGlobalName. The argument may be a symbol, a string or
a matchPattern.
"
^ self browseReferendsOf:aGlobalName warnIfNone:true
"
Browser browseReferendsOf:#Transcript
Browser browseReferendsOf:'Tr*'
"
"Modified: / 30.10.1997 / 23:45:52 / cg"
!
browseReferendsOf:aGlobalName ifNone:actionIfNone
"launch a browser for all methods referencing a global
named aGlobalName.
"
^ self
browseReferendsOf:aGlobalName
title:(self classResources string:'users of: %1' with:aGlobalName)
ifNone:actionIfNone
"Modified: / 31.10.1997 / 15:42:05 / cg"
!
browseReferendsOf:aGlobalName in:aSetOfClasses
"launch a browser for all methods referencing a global
named aGlobalName.
"
^ self browseReferendsOf:aGlobalName in:aSetOfClasses warnIfNone:true
"
Browser browseReferendsOf:#Transcript
"
"Created: 10.7.1996 / 10:37:30 / cg"
!
browseReferendsOf:aGlobalName in:aSetOfClasses warnIfNone:doWarn
"launch a browser for all methods referencing a global
named aGlobalName.
"
|globalsPlainName idx|
globalsPlainName := aGlobalName.
(idx := globalsPlainName lastIndexOf:$:) ~~ 0 ifTrue:[
globalsPlainName := globalsPlainName copyFrom:idx+1
].
^ self browseForSymbol:aGlobalName
in:aSetOfClasses
title:(self classResources string:'users of: %1' with:aGlobalName)
warnIfNone:doWarn
searchFor:globalsPlainName
"Created: 10.7.1996 / 10:37:02 / cg"
"Modified: 31.10.1996 / 14:56:38 / cg"
!
browseReferendsOf:aGlobalName title:title ifNone:actionIfNone
"launch a browser for all methods referencing a global
named aGlobalName.
"
|globalsPlainName idx|
globalsPlainName := aGlobalName.
(idx := globalsPlainName lastIndexOf:$:) ~~ 0 ifTrue:[
globalsPlainName := globalsPlainName copyFrom:idx+1.
(globalsPlainName size == 0
or:[globalsPlainName = '*']) ifTrue:[
globalsPlainName := aGlobalName
]
].
^ self browseForSymbol:aGlobalName
title:title
ifNone:actionIfNone
searchFor:globalsPlainName
"Modified: / 31.10.1996 / 14:47:48 / cg"
"Created: / 31.10.1997 / 15:41:28 / cg"
!
browseReferendsOf:aGlobalName title:title warnIfNone:doWarn
"launch a browser for all methods referencing a global
named aGlobalName.
"
|b|
doWarn ifTrue: [
b := [self showNoneFound:title]
].
^ self
browseReferendsOf:aGlobalName
title:title
ifNone:b
!
browseReferendsOf:aGlobalName warnIfNone:doWarn
"launch a browser for all methods referencing a global
named aGlobalName.
"
^ self
browseReferendsOf:aGlobalName
title:(self classResources string:'users of: %1' with:aGlobalName)
warnIfNone:doWarn
"Modified: / 31.10.1997 / 15:42:05 / cg"
!
browseRefsTo:aString classVars:classVars in:aCollectionOfClasses modificationsOnly:modsOnly
"launch a browser for all methods in aClass where the instVar/classVar named
aString is referenced; if modsOnly is true, browse only methods where the
instvar is modified"
|title|
modsOnly ifTrue:[
title := 'modifications of: %1'
] ifFalse:[
title := 'references to: %1 '
].
^ self
browseRefsTo:aString
classVars:classVars
in:aCollectionOfClasses
modificationsOnly:modsOnly
title:(self classResources string:title with:aString)
"Created: 9.12.1995 / 18:07:05 / cg"
"Modified: 9.12.1995 / 18:11:49 / cg"
!
browseRefsTo:varName classVars:classVars in:aCollectionOfClasses modificationsOnly:modsOnly title:title
"launch a browser for all methods in aClass where the instVar/classVar named
varName is referenced; if modsOnly is true, browse only methods where the
instvar is modified"
|filter browser pattern|
filter := self filterToSearchRefsTo:varName classVars:classVars modificationsOnly:modsOnly.
browser := self browseMethodsIn:aCollectionOfClasses inst:true class:classVars where:filter title:title.
browser notNil ifTrue:[
modsOnly ifTrue:[
pattern := varName , ' :='
] ifFalse:[
pattern := varName
].
browser autoSearch:pattern
].
^ browser
!
browseSuperCallsIn:aCollectionOfClasses title:title
"launch a browser for all super sends in aCollectionOfClasses"
|browser searchBlock|
searchBlock := [:class :method :s |
|src parser|
src := method source.
(src notNil and:[src findString:'super']) ~~ 0 ifTrue:[
parser := Parser
parseMethod:src
in:class
ignoreErrors:true
ignoreWarnings:true.
parser notNil and:[parser usesSuper]
] ifFalse:[
false
]
].
browser := self browseMethodsIn:aCollectionOfClasses
where:searchBlock
title:title.
browser notNil ifTrue:[
browser autoSearch:'super'
].
^ browser
"
SystemBrowser
browseSuperCallsIn:(Array with:SortedCollection)
title:'superSends in SortedCollection'
"
"Created: 23.11.1995 / 14:08:55 / cg"
"Modified: 24.4.1996 / 13:25:31 / cg"
!
browseSuperCallsUnder:aClass
"launch a browser for all supersends in aClass and subclasses"
^ self browseSuperCallsIn:(aClass withAllSubclasses)
title:(self classResources string:'supersends (in and below %1)' with:aClass name)
"
SystemBrowser browseSuperCallsUnder:Number
"
"Created: 23.11.1995 / 12:06:06 / cg"
"Modified: 9.12.1995 / 18:11:59 / cg"
!
browseUsesOf:aClass
|dict owners offsets
sz "{ Class: SmallInteger }"
n "{ Class: SmallInteger }"
removeSet newDict|
owners := ObjectMemory whoReferencesInstancesOf:aClass.
"
collect set of offsets in dict; key is class
"
dict := IdentityDictionary new.
owners do:[:someObject |
|cls create|
someObject isContext ifFalse:[
"
someObject refers to an instance of aClass;
find out, which instVar(s)
"
cls := someObject class.
cls ~~ Array ifTrue:[
n := cls instSize.
create := [|s| s := Set new. dict at:cls put:s. s].
1 to:n do:[:i |
|ref|
ref := someObject instVarAt:i.
(ref isMemberOf:aClass) ifTrue:[
offsets := dict at:cls ifAbsent:create.
offsets add:i.
]
].
cls isVariable ifTrue:[
cls isPointers ifTrue:[
| idx "{ Class: SmallInteger }" |
sz := someObject basicSize.
idx := 1.
[idx <= sz] whileTrue:[
|ref|
ref := someObject basicAt:idx.
(ref isMemberOf:aClass) ifTrue:[
offsets := dict at:cls ifAbsent:create.
offsets add:0.
idx := sz
].
idx := idx + 1
]
]
]
]
]
].
"
merge with superclass refs
"
dict keysAndValuesDo:[:cls :set |
cls allSuperclasses do:[:aSuperclass |
|superSet|
superSet := dict at:aSuperclass ifAbsent:[].
superSet notNil ifTrue:[
|removeSet|
superSet := dict at:aSuperclass.
removeSet := Set new.
set do:[:offset |
(superSet includes:offset) ifTrue:[
removeSet add:offset
]
].
set removeAll:removeSet
]
]
].
"
remove empty ones
"
removeSet := Set new.
dict keysAndValuesDo:[:cls :set |
set isEmpty ifTrue:[
removeSet add:cls
]
].
removeSet do:[:cls |
dict removeKey:cls
].
"
replace the indices by real names
"
newDict := IdentityDictionary new.
dict keysAndValuesDo:[:cls :set |
|newSet names|
names := cls allInstVarNames.
newSet := set collect:[:index |
index == 0 ifTrue:['*indexed*'] ifFalse:[names at:index].
].
newDict at:cls put:newSet
].
newDict inspect
!
filterToSearchRefsTo:varName classVars:classVars access:accessType
"return a searchblock for variable references"
|searchBlock|
searchBlock := [:c :m :s |
|src result parser vars needMatch|
needMatch := varName includesMatchCharacters.
src := m source.
src isNil ifTrue:[
result := false
] ifFalse:[
needMatch ifFalse:[
"
before doing a slow parse, quickly scan the
methods source for the variables name ...
"
result := (src findString:varName) ~~ 0.
] ifTrue:[
result := true.
].
result ifTrue:[
result := false.
parser := Parser
parseMethod:src
in:c
ignoreErrors:true
ignoreWarnings:true.
(parser notNil and:[parser ~~ #Error]) ifTrue:[
classVars ifFalse:[
accessType == #read ifTrue:[
vars := parser readInstVars
] ifFalse:[
accessType == #write ifTrue:[
vars := parser modifiedInstVars
] ifFalse:[
vars := parser usedInstVars
]
].
] ifTrue:[
accessType == #read ifTrue:[
vars := parser readClassVars
] ifFalse:[
accessType == #write ifTrue:[
vars := parser modifiedClassVars
] ifFalse:[
vars := parser usedClassVars
]
].
].
vars size > 0 ifTrue:[
needMatch ifTrue:[
vars do:[:cv |
(varName match:cv) ifTrue:[result := true]
]
] ifFalse:[
result := vars includes:varName
]
]
].
].
].
Processor yield.
result
].
^ searchBlock
"Modified: 19.6.1997 / 18:27:57 / cg"
!
filterToSearchRefsTo:varName classVars:classVars modificationsOnly:modsOnly
"return a searchblock for variable references"
|searchBlock|
searchBlock := [:c :m :s |
|src result parser vars needMatch|
needMatch := varName includesMatchCharacters.
src := m source.
src isNil ifTrue:[
result := false
] ifFalse:[
needMatch ifFalse:[
"
before doing a slow parse, quickly scan the
methods source for the variables name ...
"
result := (src findString:varName) ~~ 0.
] ifTrue:[
result := true.
].
result ifTrue:[
result := false.
parser := Parser
parseMethod:src
in:c
ignoreErrors:true
ignoreWarnings:true.
(parser notNil and:[parser ~~ #Error]) ifTrue:[
classVars ifFalse:[
modsOnly ifTrue:[
vars := parser modifiedInstVars
] ifFalse:[
vars := parser usedInstVars
].
] ifTrue:[
modsOnly ifTrue:[
vars := parser modifiedClassVars
] ifFalse:[
vars := parser usedClassVars
].
].
vars size > 0 ifTrue:[
needMatch ifTrue:[
vars do:[:cv |
(varName match:cv) ifTrue:[result := true]
]
] ifFalse:[
result := vars includes:varName
]
]
].
].
].
Processor yield.
result
].
^ searchBlock
"Modified: 19.6.1997 / 18:27:57 / cg"
!
findAnyResourceIn:aCollectionOfClasses
"return a collection of all methods in aCollectionOfClasses containing any resource."
^ self findMethodsIn:aCollectionOfClasses where:[:c :m :sel | m hasResource ].
"
SystemBrowser findAnyResourceIn:(ApplicationModel withAllSubclasses)
"
!
findClassRefsTo:aString in:aCollectionOfClasses access:accessType
"return all methods in aCollectionOfClasses where the classVar named
aString is referenced;
if modsOnly is true, browse only methods where the classvar is modified"
^ self findRefsTo:aString classVars:true in:aCollectionOfClasses access:accessType
!
findClassRefsTo:aString in:aCollectionOfClasses modificationsOnly:modsOnly
"return all methods in aCollectionOfClasses where the classVar named
aString is referenced;
if modsOnly is true, browse only methods where the classvar is modified"
^ self findRefsTo:aString classVars:true in:aCollectionOfClasses modificationsOnly:modsOnly
!
findClassRefsTo:aString inClass:aClass access:accessType
"return all methods in aClass where the classVar named
aString is referenced;
if modsOnly is true, browse only methods where the classvar is modified"
^ self findRefsTo:aString classVars:true in:(Array with:aClass) access:accessType
!
findClassRefsTo:aString inClass:aClass modificationsOnly:modsOnly
"return all methods in aClass where the classVar named
aString is referenced;
if modsOnly is true, browse only methods where the classvar is modified"
^ self findRefsTo:aString classVars:true in:(Array with:aClass) modificationsOnly:modsOnly
!
findClassRefsTo:aString under:aClass access:accessType
"return all methods in aClass and subclasses
where the classVar named aString is referenced;
if modsOnly is true, browse only methods where the classvar is modified"
^ self findClassRefsTo:aString in:(aClass withAllSubclasses) access:accessType
!
findClassRefsTo:aString under:aClass modificationsOnly:modsOnly
"return all methods in aClass and subclasses
where the classVar named aString is referenced;
if modsOnly is true, browse only methods where the classvar is modified"
^ self findClassRefsTo:aString in:(aClass withAllSubclasses) modificationsOnly:modsOnly
!
findImplementorsOf:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase
"search for all implementors of aSelector in
the classes contained in aCollectionOfClasses and its metaclasses.
Return a collection of methods"
|list sel srchST srchJava lcSelector|
list := IdentitySet new.
((aSelectorString ~= '*') and:[aSelectorString includesMatchCharacters]) ifTrue:[
"a matchString"
ignoreCase == true ifTrue:[
lcSelector := aSelectorString asLowercase.
srchST := [:aSelector :aMethod |
(lcSelector match:aSelector asLowercase) ifTrue:[
list add:aMethod
]
].
srchJava := [:aSelector :aMethod |
(aSelector match:aMethod name asLowercase) ifTrue:[
list add:aMethod
]
].
] ifFalse:[
srchST := [:aSelector :aMethod |
(aSelectorString match:aSelector) ifTrue:[
list add:aMethod
]
].
srchJava := [:aSelector :aMethod |
(aSelectorString match:aMethod name) ifTrue:[
list add:aMethod
]
].
].
] ifFalse:[
"can do a faster search"
sel := aSelectorString asSymbolIfInterned.
sel isNil ifTrue:[
^ nil
].
ignoreCase == true ifTrue:[
lcSelector := sel asLowercase.
srchJava := [:aSelector :aMethod |
"/ allow search for signature AND
"/ search for plain name
((aMethod name asLowercase = lcSelector)
or:[aSelector asLowercase = lcSelector]) ifTrue:[
list add:aMethod
]
].
srchST := [:aSelector :aMethod |
(aSelector asLowercase = lcSelector) ifTrue:[
list add:aMethod
]
].
] ifFalse:[
srchJava := [:aSelector :aMethod |
"/ allow search for signature AND
"/ search for plain name
((aMethod name = sel)
or:[aSelector == sel]) ifTrue:[
list add:aMethod
]
].
srchST := [:aSelector :aMethod |
(aSelector == sel) ifTrue:[
list add:aMethod
]
].
].
].
aCollectionOfClasses do:[:aClass |
|srchBlock|
aClass isObsolete ifFalse:[
aClass isJavaClass ifTrue:[
srchBlock := srchJava
] ifFalse:[
srchBlock := srchST
].
aClass methodDictionary keysAndValuesDo:srchBlock.
aClass isMeta ifFalse:[
aClass class methodDictionary keysAndValuesDo:srchBlock
]
]
].
^ list
"
SystemBrowser findImplementorsOf:#+
in:(Array with:Number
with:Float
with:SmallInteger)
"
!
findInstRefsTo:aString in:aCollectionOfClasses access:accessType
"return all methods in aCollectionOfClasses where the instVar named
aString is referenced;
if modsOnly is true, browse only methods where the classvar is modified"
^ self findRefsTo:aString classVars:false in:aCollectionOfClasses access:accessType
!
findInstRefsTo:aString in:aCollectionOfClasses modificationsOnly:modsOnly
"return all methods in aCollectionOfClasses where the instVar named
aString is referenced; if modsOnly is true, browse only methods where the
instvar is modified"
^ self findRefsTo:aString classVars:false in:aCollectionOfClasses modificationsOnly:modsOnly
!
findInstRefsTo:aString inClass:aClass access:accessType
"return all methods in aClass where the instVar named
aString is referenced; if modsOnly is true, browse only methods where the
instvar is modified"
^ self findRefsTo:aString classVars:false in:(Array with:aClass) access:accessType
!
findInstRefsTo:aString inClass:aClass modificationsOnly:modsOnly
"return all methods in aClass where the instVar named
aString is referenced; if modsOnly is true, browse only methods where the
instvar is modified"
^ self findRefsTo:aString classVars:false in:(Array with:aClass) modificationsOnly:modsOnly
!
findInstRefsTo:aString under:aClass access:accessType
"return all methods in aClass and subclasses
where the classVar named aString is referenced;
if modsOnly is true, browse only methods where the classvar is modified"
^ self findInstRefsTo:aString in:(aClass withAllSubclasses) access:accessType
!
findInstRefsTo:aString under:aClass modificationsOnly:modsOnly
"return all methods in aClass and subclasses
where the instVar named aString is referenced;
if modsOnly is true, browse only methods where the instvar is modified"
^ self findInstRefsTo:aString in:(aClass withAllSubclasses) modificationsOnly:modsOnly
!
findRefsTo:varName classVars:classVars in:aCollectionOfClasses access:accessType
"return a list of all methods in aCollectionOfClasses where the instVar/classVar named
varName is referenced;
if modsOnly is true, browse only methods where the instvar is modified"
|filter|
filter := self filterToSearchRefsTo:varName classVars:classVars access:accessType.
^ self findMethodsIn:aCollectionOfClasses inst:true class:classVars where:filter.
"
self
findRefsTo:'x'
classVars:false
in:(Array with:Point)
modificationsOnly:true
"
!
findRefsTo:varName classVars:classVars in:aCollectionOfClasses modificationsOnly:modsOnly
"return a list of all methods in aCollectionOfClasses where the instVar/classVar named
varName is referenced;
if modsOnly is true, browse only methods where the instvar is modified"
|filter|
filter := self filterToSearchRefsTo:varName classVars:classVars modificationsOnly:modsOnly.
^ self findMethodsIn:aCollectionOfClasses inst:true class:classVars where:filter.
"
self
findRefsTo:'x'
classVars:false
in:(Array with:Point)
modificationsOnly:true
"
!
findResource:aResourceSymbolOrCollectionOfSymbols in:aCollectionOfClasses
"return a collection of all methods in aCollectionOfClasses
containing a resource."
|searchBlock|
aResourceSymbolOrCollectionOfSymbols isSymbol ifTrue:[
searchBlock := [:c :m :sel | |resources|
(resources := m resources) size > 0
and:[resources includesKey:aResourceSymbolOrCollectionOfSymbols]
].
] ifFalse:[
searchBlock := [:c :m :sel | |resources|
(resources := m resources) size > 0
and:[resources keys includesAny:aResourceSymbolOrCollectionOfSymbols]
].
].
^ self findMethodsIn:aCollectionOfClasses where:searchBlock.
"
SystemBrowser findResource:#image in:(ApplicationModel withAllSubclasses)
SystemBrowser findResource:#menu in:(ApplicationModel withAllSubclasses)
SystemBrowser findResource:#(menu programMenu) in:(ApplicationModel withAllSubclasses)
"
!
findSendersOf:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase
"search for all senders of aSelector in
the classes contained in aCollectionOfClasses and its metaclasses.
Return a collection of methods"
^ self allCallsOn:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase
"
SystemBrowser findSendersOf:#+
in:(Array with:Number
with:Float
with:SmallInteger)
ignoreCase:false
"
!
findString:aString in:aCollectionOfClasses ignoreCase:ignoreCase
"return a colelction of all methods in aCollectionOfClasses
containing a string in their source.
This may be slow, since source-code has to be scanned."
|browser searchBlock title s|
(aString includesMatchCharacters
or:[ignoreCase]) ifTrue:[
s := '*' , aString , '*'.
"a matchString"
searchBlock := [:c :m :sel |
|src|
src := m source.
src isNil ifTrue:[
('Browser [info]: no source for ' , m printString) infoPrintCR.
false
] ifFalse:[
s match:src ignoreCase:ignoreCase
]
]
] ifFalse:[
searchBlock := [:c :m :sel |
|src|
src := m source.
src isNil ifTrue:[
('Browser [info]: no source for ' , m printString) infoPrintCR.
false
] ifFalse:[
(src findString:aString) ~~ 0
]
]
].
^ self findMethodsIn:aCollectionOfClasses where:searchBlock.
"
SystemBrowser findString:'should' in:(Array with:Object) ignoreCase:false
"
! !
!SystemBrowser class methodsFor:'startup'!
browseAllSelect:aBlock
"launch a browser for all methods where aBlock returns true.
The block is called with 3 arguments, class, method and selector."
^ self
browseMethodsWhere:aBlock
title:'selected messages'
"
SystemBrowser browseAllSelect:[:aClass :aMethod :selector | selector numArgs == 3]
"
"Modified: 24.1.1997 / 19:45:05 / cg"
!
browseClass:aClass
"launch a browser for aClass"
^ self
newWithLabel:aClass name
setupSelector:#setupForClass:
arg:aClass
"
SystemBrowser browseClass:Object
"
"Modified: 24.1.1997 / 19:45:16 / cg"
!
browseClass:aClass methodCategory:aCategory
"launch a browser for all methods under aCategory in aClass"
^ self newWithLabel:(aClass name , ' ' , aCategory)
setupBlock:[:browser | browser setupForClass:aClass methodCategory:aCategory]
"
SystemBrowser browseClass:String methodCategory:'copying'
"
"Modified: 24.1.1997 / 19:45:23 / cg"
!
browseClass:aClass selector:selector
"launch a browser for the method at selector in aClass"
^ self
newWithLabel:(aClass name , ' ' , selector , ' ' , selector)
setupBlock:[:newBrowser | newBrowser setupForClass:aClass selector:selector]
"
SystemBrowser browseClass:Object selector:#printString
"
!
browseClassCategory:aClassCategory
"launch a browser for all classes under aCategory"
^ self
newWithLabel:aClassCategory
setupSelector:#setupForClassCategory:
arg:aClassCategory
"
SystemBrowser browseClassCategory:'Kernel-Objects'
"
"Modified: 24.1.1997 / 19:45:32 / cg"
!
browseClassHierarchy:aClass
"launch a browser for aClass and all its superclasses.
this is different from the fullProtocol browser."
^ self
newWithLabel:(aClass name , '-' , 'hierarchy')
setupSelector:#setupForClassHierarchy:
arg:aClass
"
SystemBrowser browseClassHierarchy:Number
"
!
browseClasses:aList title:title
"launch a browser for all classes in aList"
^ self
newWithLabel:title
setupBlock:[:b | b setupForClassList:aList sort:true]
"
SystemBrowser browseClasses:(Array with:Object
with:Float)
title:'two classes'
"
"Modified: 28.5.1996 / 13:52:25 / cg"
!
browseClasses:aList title:title sort:doSort
"launch a browser for all classes in aList"
^ self
newWithLabel:title
setupBlock:[:b | b setupForClassList:aList sort:doSort]
"
SystemBrowser browseClasses:(Array with:Object
with:Float)
title:'two classes'
"
"Created: 28.5.1996 / 13:52:09 / cg"
!
browseFullClassProtocol:aClass
"launch a browser for aClasses full protocol.
This is different from hierarchy browsing."
^ self
newWithLabel:(aClass name , '-' , 'full protocol')
setupSelector:#setupForFullClassProtocol:
arg:aClass
"
SystemBrowser browseFullClassProtocol:Number
"
!
browseFullClasses
"launch a browser showing all methods at once"
^ self
newWithLabel:'Full Class Browser'
setupBlock:[:newBrowser | newBrowser setupForFullClass]
"SystemBrowser browseFullClasses"
!
browseInstMethodsFrom:aClass where:aBlock title:title
"launch a browser for all instance methods in aClass and all subclasses
where aBlock evaluates to true"
^ self
browseMethodsIn:(aClass withAllSubclasses)
inst:true
class:false
where:aBlock
title:title
"Modified: 24.1.1997 / 19:44:45 / cg"
!
browseInstMethodsIn:aCollectionOfClasses where:aBlock title:title
"launch a browser for all instance methods of all classes in
aCollectionOfClasses where aBlock evaluates to true"
^ self
browseMethodsIn:aCollectionOfClasses
inst:true class:false
where:aBlock title:title
"Modified: 24.1.1997 / 19:43:41 / cg"
!
browseInstMethodsOf:aClass where:aBlock title:title
"launch a browser for all instance methods in aClass
where aBlock evaluates to true"
^ self
browseMethodsIn:(Array with:aClass)
inst:true
class:false
where:aBlock title:title
"Modified: 24.1.1997 / 19:43:50 / cg"
!
browseMethodCategory:aCategory
"launch a browser for all methods where category = aCategory"
|searchBlock|
aCategory includesMatchCharacters ifTrue:[
searchBlock := [:c :m :s | aCategory match:m category].
] ifFalse:[
searchBlock := [:c :m :s | m category = aCategory]
].
self browseMethodsWhere:searchBlock title:('all methods with category of ' , aCategory)
"
SystemBrowser browseMethodCategory:'printing & storing'
SystemBrowser browseMethodCategory:'print*'
"
!
browseMethods:aList title:aString
"launch a browser for an explicit list of class/selectors.
Each entry in the list can be either a method, or a string
consisting of the classes name and the selector, separated by spaces.
For class methods, the string ' class' must be appended to the classname."
^ self
browseMethods:aList
title:aString
sort:true
"
SystemBrowser
browseMethods:#('Object printOn:' 'Collection add:')
title:'some methods'
SystemBrowser
browseMethods:#('Behavior new:' 'Setclass new:')
title:'some new: methods'
SystemBrowser
browseMethods:(Array with:(Object compiledMethodAt:#printOn:)
with:(Collection compiledMethodAt:#add:)
with:(Object class compiledMethodAt:#initialize))
title:'some methods'
"
"Modified: 1.11.1996 / 16:30:17 / cg"
!
browseMethods:aList title:aString sort:doSort
"launch a browser for an explicit list of class/selectors.
Each entry in the list can be either a method, or a string
consisting of the classes name and the selector, separated by spaces.
For class methods, the string ' class' must be appended to the classname."
|l|
(aList size == 0) ifTrue:[
self showNoneFound:aString.
^ nil
].
l := aList asOrderedCollection.
l := l collect:[:entry |
|who cls clsName|
entry isString ifTrue:[
entry
] ifFalse:[
who := entry who.
who isNil ifTrue:[
'??? unbound'
] ifFalse:[
cls := who methodClass.
cls isNil ifTrue:[
'??? unbound'
] ifFalse:[
cls isJavaClass ifTrue:[
clsName := 'JAVA::' , cls fullName
] ifFalse:[
clsName := cls name
].
clsName
, ' '
, (entry printStringForBrowserWithSelector:(who methodSelector))
]
]
]
].
doSort ifTrue:[l sort].
^ self
newWithLabel:aString
setupSelector:#setupForList:
arg:l
"
SystemBrowser
browseMethods:#('Object printOn:' 'Collection add:')
title:'some methods'
SystemBrowser
browseMethods:#('Behavior new:' 'Setclass new:')
title:'some new: methods'
SystemBrowser
browseMethods:(Array with:(Object compiledMethodAt:#printOn:)
with:(Collection compiledMethodAt:#add:)
with:(Object class compiledMethodAt:#initialize))
title:'some methods'
"
"Modified: / 17.6.1996 / 17:07:46 / stefan"
"Modified: / 17.10.1998 / 11:25:53 / cg"
!
browseMethodsFrom:aClass where:aBlock title:title
"launch a browser for all instance- and classmethods in aClass
and all its subclasses where aBlock evaluates to true.
The block is called with 3 arguments, class, method and seelctor."
^ self
browseMethodsIn:(aClass withAllSubclasses)
where:aBlock
title:title
"Modified: 24.1.1997 / 19:44:00 / cg"
!
browseMethodsIn:aCollectionOfClasses inst:wantInst class:wantClass where:aBlock title:title
"launch a browser for all instance- (if wantInst is true) and/or
classmethods (if wantClass is true) from classes in aCollectionOfClasses,
where aBlock evaluates to true.
The block is called with 3 arguments, class, method and selector."
|list|
"
since this may take a long time, lower my priority ...
"
Processor activeProcess
withPriority:Processor activePriority-1 to:Processor activePriority
do:[
list := self findMethodsIn:aCollectionOfClasses inst:wantInst class:wantClass where:aBlock
].
^ self browseMethods:list title:title
!
browseMethodsIn:aCollectionOfClasses where:aBlock title:title
"launch a browser for all instance- and classmethods from
all classes in aCollectionOfClasses where aBlock evaluates to true.
The block is called with 3 arguments, class, method and seelctor."
^ self
browseMethodsIn:aCollectionOfClasses
inst:true
class:true
where:aBlock
title:title
"Modified: 24.1.1997 / 19:44:17 / cg"
!
browseMethodsOf:aClass where:aBlock title:title
"launch a browser for all instance- and classmethods in aClass
where aBlock evaluates to true.
The block is called with 3 arguments, class, method and seelctor."
^ self browseMethodsIn:(Array with:aClass) where:aBlock title:title
!
browseMethodsWhere:aBlock title:title
"launch a browser for all methods where aBlock returns true.
The block is called with 3 arguments, class, method and seelctor."
^ self
browseMethodsIn:(Smalltalk allClasses)
where:aBlock
title:title
"Modified: 24.1.1997 / 19:44:30 / cg"
!
findMethodsIn:aCollectionOfClasses inst:wantInst class:wantClass where:aBlock
"return all instance- (if wantInst is true) and/or classmethods (if wantClass is true)
from classes in aCollectionOfClasses, where aBlock evaluates to true."
|list checkedClasses checkBlock|
checkedClasses := IdentitySet new.
list := OrderedCollection new.
checkBlock := [:cls |
(checkedClasses includes:cls) ifFalse:[
cls isObsolete ifTrue:[
Transcript showCR:'skipping obsolete class: ' , cls displayString
] ifFalse:[
cls methodDictionary keysAndValuesDo:[:sel :method |
(aBlock value:cls value:method value:sel) ifTrue:[
list add:method "/ (cls name , ' ' , sel)
]
].
checkedClasses add:cls.
]
]
].
aCollectionOfClasses do:[:aClass |
aClass isObsolete ifFalse:[
"
output disabled - it slows down things too much (when searching for
implementors or senders)
"
wantInst ifTrue:[
"/ Transcript show:'searching '; show:aClass name; showCR:' ...'; endEntry.
checkBlock value:aClass
].
wantClass ifTrue:[
"/ Transcript show:'searching '; show:aClass class name; showCR:' ...'; endEntry.
checkBlock value:(aClass class)
].
Processor yield
]
].
^ list
!
findMethodsIn:aCollectionOfClasses where:aBlock
"return all instance- and classmethods
from classes in aCollectionOfClasses, where aBlock evaluates to true."
^ self
findMethodsIn:aCollectionOfClasses
inst:true
class:true
where:aBlock
! !
!SystemBrowser class methodsFor:'startup with query'!
askThenBrowseClass
self getClassThenPerform:#browseClass:
"
SystemBrowser askThenBrowseClass
"
!
askThenBrowseClassHierarchy
self getClassThenPerform:#browseClassHierarchy:
"
SystemBrowser askThenBrowseClassHierarchy
"
!
askThenBrowseFullClassProtocol
self getClassThenPerform:#browseFullClassProtocol:
"
SystemBrowser askThenBrowseFullClassProtocol
"
!
getClassThenPerform:aSelector
|enterBox resources|
resources := self classResources.
enterBox := EnterBox title:(self classResources at:'Browse which class:') withCRs.
enterBox okText:(resources at:'browse').
enterBox entryCompletionBlock:[:contents |
|s what m|
s := contents withoutSpaces.
what := Smalltalk classnameCompletion:s.
enterBox contents:what first.
].
enterBox action:[:className |
|cls|
cls := Smalltalk classNamed:className.
cls isNil ifTrue:[
self warn:(resources at:'no such class').
] ifFalse:[
self perform:aSelector with:cls
]
].
enterBox showAtPointer
"
SystemBrowser getClassThenPerform:#browseClass:
"
! !
!SystemBrowser class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.115 2000-09-10 11:36:25 cg Exp $'
! !
SystemBrowser initialize!