--- a/Tools__ObjectModuleInformation.st Tue Oct 13 10:46:57 2009 +0200
+++ b/Tools__ObjectModuleInformation.st Wed Oct 14 08:13:10 2009 +0200
@@ -469,6 +469,16 @@
#(Menu
(
(MenuItem
+ label: 'Update'
+ itemValue: menuUpdateModuleList
+ translateLabel: true
+ isButton: true
+ labelImage: (ResourceRetriever ToolbarIconLibrary reloadIcon)
+ )
+ (MenuItem
+ label: '-'
+ )
+ (MenuItem
enabled: canBrowseSelectedModule
label: 'Browse the Selected Module''s Classes'
itemValue: browseModule
@@ -799,10 +809,9 @@
!
selectedModuleIndexChanged
- |module info |
+ | info |
info := self selectedModuleInfo.
- module := self selectedModule.
self canBrowseSelectedModule value:false.
self canBrowseSelectedModulesExtensions value:false.
@@ -815,7 +824,7 @@
vmInfoShown := nil.
info isNil ifTrue:[
- "/ selected a method, cObject or unknown
+ "/ selected a cObject or unknown
self showInfoForNonClassLib:(self selectedModuleIndex).
^ self.
].
@@ -832,15 +841,23 @@
!
selectedModuleInfo
- |sel info|
+ |sel|
sel := self selectedModuleIndex.
sel notNil ifTrue:[
(self showClassLibs value or:[self showBuiltIn value]) ifTrue:[
- info := allModules at:sel ifAbsent:nil.
+ ^ allModules at:sel ifAbsent:nil.
].
].
- ^ info
+ ^ nil
+!
+
+selectedObjectHandle
+ |sel|
+
+ sel := self selectedModuleIndex.
+ sel isNil ifTrue:[^ nil].
+ ^ objectHandles at:sel.
!
showInfoForClassLib:info
@@ -878,7 +895,7 @@
(libraryName notNil and:[ libraryName startsWith:'lib' ]) ifTrue:[
defClassName := libraryName copyFrom:4
] ifFalse:[
- self halt.
+ "/ self halt.
].
].
defClassName notNil ifTrue:[
@@ -1120,9 +1137,8 @@
!ObjectModuleInformation methodsFor:'menu actions'!
browseClass
- |module info classNames selectedClassName selectedClass|
+ |info classNames selectedClassName selectedClass|
- module := self selectedModule.
info := self selectedModuleInfo.
classNames := (self shownClassNamesFor:info) asSortedCollection.
selectedClassName := classNames at:(self selectedInfoIndex).
@@ -1143,31 +1159,34 @@
!
browseModule
- |module classes method|
+ |moduleInfoOrHandle classes method|
- module := self selectedModule.
- module isMethodHandle ifTrue:[
- method := module method.
- (method notNil and:[method mclass notNil]) ifFalse:[
- Dialog information:'The method has been redefined/removed'.
- ^ self.
- ].
- UserPreferences systemBrowserClass
- openInMethod:method
- ] ifFalse:[
- classes := module classNames collect:[:nm | Smalltalk classNamed:nm].
+ moduleInfoOrHandle := self selectedObjectHandle.
+ "/ what a hack
+ (moduleInfoOrHandle isKindOf: ObjectMemory::BinaryModuleDescriptor) ifTrue:[
+ classes := moduleInfoOrHandle classNames collect:[:nm | Smalltalk classNamed:nm].
UserPreferences systemBrowserClass
browseClasses:classes
- label:(resources string:'Classes in %1' with:module libraryName)
- ]
+ label:(resources string:'Classes in %1' with:moduleInfoOrHandle libraryName)
+ ] ifFalse:[
+ moduleInfoOrHandle isMethodHandle ifTrue:[
+ method := moduleInfoOrHandle method.
+ (method notNil and:[method mclass notNil]) ifFalse:[
+ Dialog information:'The method has been redefined/removed'.
+ ^ self.
+ ].
+ UserPreferences systemBrowserClass
+ openInMethod:method
+ ]
+ ].
!
browseModuleExtensions
- |module name packageID methods|
+ |info name packageID methods|
- module := self selectedModule.
+ info := self selectedModuleInfo.
- name := module classNames detect:[:nm | self isExtensionName:nm].
+ name := info classNames detect:[:nm | self isExtensionName:nm].
packageID := (name copyWithoutLast:('_extensions' size)) asSymbol.
methods := Smalltalk allExtensionsForPackage:packageID.
(UserPreferences browserClass) browseMethods:methods title:('Extensions for ',packageID).
@@ -1207,9 +1226,8 @@
!
selectedModulesProjectDefinitionClass
- |module info classNames classes definitionClasses|
+ | info classNames classes definitionClasses|
- module := self selectedModule.
info := self selectedModuleInfo.
classNames := (self shownClassNamesFor:info) asSortedCollection.
classes := classNames collect:[:nm | Smalltalk classNamed:nm].
@@ -1289,7 +1307,7 @@
updateModuleList
|showClassLibs showBuiltIn showMethods showCObjects showOthers
- listOfModuleNames allObjects handles|
+ listOfModuleNames allObjects handles methodObjects |
showClassLibs := self showClassLibs value.
showBuiltIn := self showBuiltIn value.
@@ -1301,23 +1319,30 @@
handles := OrderedCollection new.
allObjects := ObjectFileLoader loadedObjectHandles.
+ methodObjects := (allObjects select:[:h | h isMethodHandle]) asArray.
(showClassLibs or:[showBuiltIn]) ifTrue:[
|moduleNames|
allModules := ObjectMemory binaryModuleInfo asOrderedCollection.
- (showBuiltIn and:[showClassLibs]) ifFalse:[
- allModules := allModules select:
- [:i |
- |wantToSee|
+ allModules := allModules select:
+ [:i |
+ |wantToSee|
- wantToSee := i dynamic.
- showBuiltIn ifTrue:[
- wantToSee := wantToSee not
+ wantToSee := false.
+ i dynamic ifTrue:[
+ showClassLibs ifTrue:[
+ i isSingleMethod ifFalse:[
+ wantToSee := true
+ ].
].
- wantToSee
- ]
- ].
+ ] ifFalse:[
+ showBuiltIn ifTrue:[
+ wantToSee := true
+ ].
+ ].
+ wantToSee
+ ].
"/ sorting by reverse id brings newest ones to the top (a side effect)
allModules sort:[:a :b | (a id) > (b id)].
@@ -1327,9 +1352,8 @@
].
showMethods ifTrue:[
- |methodObjects methodNames|
+ |methodNames|
- methodObjects := (allObjects select:[:h | h isMethodHandle]) asArray.
methodNames := methodObjects collect:[:mH | mH method isNil ifTrue:[
'compiled method - removed' " , ' (in ' , mH pathName , ')' "
] ifFalse:[