Tools__ObjectModuleInformation.st
changeset 2616 01e597429c47
parent 2403 11c5c82a852c
child 2617 060a35c37056
equal deleted inserted replaced
2615:347a0b26e210 2616:01e597429c47
     6 	instanceVariableNames:'readOnly listOfModuleNames selectedModuleIndexHolder allModules
     6 	instanceVariableNames:'readOnly listOfModuleNames selectedModuleIndexHolder allModules
     7 		objectHandles showOthers showCObjects showBuiltIn showMethods
     7 		objectHandles showOthers showCObjects showBuiltIn showMethods
     8 		showClassLibs table1VisibleHolder table2VisibleHolder
     8 		showClassLibs table1VisibleHolder table2VisibleHolder
     9 		selectedInfoIndexHolder canBrowseSelectedModule
     9 		selectedInfoIndexHolder canBrowseSelectedModule
    10 		canUnloadSelectedModule classNamesShown classInfoShown
    10 		canUnloadSelectedModule classNamesShown classInfoShown
    11 		vmInfoShown'
    11 		vmInfoShown canUnloadSelectedModulesPackage'
    12 	classVariableNames:''
    12 	classVariableNames:''
    13 	poolDictionaries:''
    13 	poolDictionaries:''
    14 	category:'Monitors-ST/X'
    14 	category:'Monitors-ST/X'
    15 !
    15 !
    16 
    16 
    82         component: 
    82         component: 
    83        (SpecCollection
    83        (SpecCollection
    84           collection: (
    84           collection: (
    85            (MenuPanelSpec
    85            (MenuPanelSpec
    86               name: 'ToolBar1'
    86               name: 'ToolBar1'
    87               layout: (LayoutFrame 0 0 0 0 0 1 30 0)
    87               layout: (LayoutFrame 0 0 0 0 0 1 40 0)
    88               menu: toolbarMenu
    88               menu: toolbarMenu
    89               textDefault: true
    89               textDefault: true
    90             )
    90             )
    91            (VariableVerticalPanelSpec
    91            (VariableVerticalPanelSpec
    92               name: 'VariableVerticalPanel1'
    92               name: 'VariableVerticalPanel1'
    93               layout: (LayoutFrame 0 0 30 0 0 1 0 1)
    93               layout: (LayoutFrame 0 0 40 0 0 1 0 1)
    94               component: 
    94               component: 
    95              (SpecCollection
    95              (SpecCollection
    96                 collection: (
    96                 collection: (
    97                  (SequenceViewSpec
    97                  (SequenceViewSpec
    98                     name: 'List1'
    98                     name: 'List1'
   258                 )
   258                 )
   259                (MenuItem
   259                (MenuItem
   260                   label: '-'
   260                   label: '-'
   261                 )
   261                 )
   262                (MenuItem
   262                (MenuItem
       
   263                   enabled: canUnloadSelectedModulesPackage
       
   264                   label: 'Unload Package'
       
   265                   itemValue: unloadSelectedModulesPackage
       
   266                   translateLabel: true
       
   267                 )
       
   268                (MenuItem
   263                   enabled: canUnloadSelectedModule
   269                   enabled: canUnloadSelectedModule
   264                   label: 'Unload'
   270                   label: 'Remove Classes && Unload DLL'
       
   271                   itemValue: unloadSelectedModuleAndRemoveClasses
       
   272                   translateLabel: true
       
   273                 )
       
   274                (MenuItem
       
   275                   enabled: canUnloadSelectedModule
       
   276                   label: 'Unload DLL'
   265                   itemValue: unloadSelectedModule
   277                   itemValue: unloadSelectedModule
   266                   translateLabel: true
       
   267                 )
       
   268                (MenuItem
       
   269                   enabled: canUnloadSelectedModule
       
   270                   label: 'Remove Classes && Unload'
       
   271                   itemValue: unloadSelectedModuleAndRemoveClasses
       
   272                   translateLabel: true
   278                   translateLabel: true
   273                 )
   279                 )
   274                )
   280                )
   275               nil
   281               nil
   276               nil
   282               nil
   376           )
   382           )
   377          (MenuItem
   383          (MenuItem
   378             label: '-'
   384             label: '-'
   379           )
   385           )
   380          (MenuItem
   386          (MenuItem
       
   387             enabled: canUnloadSelectedModulesPackage
       
   388             label: 'Unload Package'
       
   389             itemValue: unloadSelectedModulesPackage
       
   390             translateLabel: true
       
   391           )
       
   392          (MenuItem
   381             enabled: canUnloadSelectedModule
   393             enabled: canUnloadSelectedModule
   382             label: 'Remove Classes && Unload'
   394             label: 'Remove Classes && Unload DLL'
   383             itemValue: unloadSelectedModuleAndRemoveClasses
   395             itemValue: unloadSelectedModuleAndRemoveClasses
   384             translateLabel: true
   396             translateLabel: true
   385           )
   397           )
   386          (MenuItem
   398          (MenuItem
   387             enabled: canUnloadSelectedModule
   399             enabled: canUnloadSelectedModule
   388             label: 'Unload'
   400             label: 'Unload DLL'
   389             itemValue: unloadSelectedModule
   401             itemValue: unloadSelectedModule
   390             translateLabel: true
   402             translateLabel: true
       
   403           )
       
   404          )
       
   405         nil
       
   406         nil
       
   407       )
       
   408 !
       
   409 
       
   410 toolbarMenu
       
   411     "This resource specification was automatically generated
       
   412      by the MenuEditor of ST/X."
       
   413 
       
   414     "Do not manually edit this!! If it is corrupted,
       
   415      the MenuEditor may not be able to read the specification."
       
   416 
       
   417     "
       
   418      MenuEditor new openOnClass:Tools::ObjectModuleInformation andSelector:#toolbarMenu
       
   419      (Menu new fromLiteralArrayEncoding:(Tools::ObjectModuleInformation toolbarMenu)) startUp
       
   420     "
       
   421 
       
   422     <resource: #menu>
       
   423 
       
   424     ^ 
       
   425      #(Menu
       
   426         (
       
   427          (MenuItem
       
   428             enabled: canBrowseSelectedModule
       
   429             label: 'Action'
       
   430             itemValue: browseModule
       
   431             translateLabel: true
       
   432             isButton: true
       
   433             labelImage: (ResourceRetriever ToolbarIconLibrary systemBrowser24x24Icon2)
   391           )
   434           )
   392          )
   435          )
   393         nil
   436         nil
   394         nil
   437         nil
   395       )
   438       )
   503     ^ canUnloadSelectedModule.
   546     ^ canUnloadSelectedModule.
   504 
   547 
   505     "Modified: / 05-10-2007 / 10:51:39 / cg"
   548     "Modified: / 05-10-2007 / 10:51:39 / cg"
   506 !
   549 !
   507 
   550 
       
   551 canUnloadSelectedModulesPackage
       
   552     canUnloadSelectedModulesPackage isNil ifTrue:[
       
   553         canUnloadSelectedModulesPackage := false asValue
       
   554     ].
       
   555     ^ canUnloadSelectedModulesPackage.
       
   556 !
       
   557 
   508 infoTable1ListHolder
   558 infoTable1ListHolder
   509     ^ builder valueAspectFor:#'infoTable1ListHolder' initialValue:#()
   559     ^ builder valueAspectFor:#'infoTable1ListHolder' initialValue:#()
   510 
   560 
   511     "Created: / 05-10-2007 / 12:48:06 / cg"
   561     "Created: / 05-10-2007 / 12:48:06 / cg"
   512 !
   562 !
   705     ].
   755     ].
   706     ^ info
   756     ^ info
   707 !
   757 !
   708 
   758 
   709 showInfoForClassLib:info
   759 showInfoForClassLib:info
   710     "/ selected a package; fill bottom list with class-info
   760     " selected a lib-package; fill bottom list with class-info "
   711 
   761 
   712     |rows|
   762     |rows libraryName defClassName libraryDefinition mgr defClassNames|
   713 
   763 
   714     self middleLabelHolder value:'Contains Modules:'.
   764     self middleLabelHolder value:'Contains Components:'.
       
   765 
       
   766     "/ try to figure out, what the definitionClass is inside that module.
       
   767     "/ in the future, we should always find one there, however, old libs or
       
   768     "/ special libraries (hand built) might be without a projectDefinition.
       
   769     defClassNames := (info classNames ? #()) 
       
   770                         select:[:nm |                
       
   771                             |cls| 
       
   772                             cls := Smalltalk classNamed:nm.
       
   773                             cls isBehavior and:[ cls isProjectDefinition ]].
       
   774 
       
   775     defClassNames size == 1 ifTrue:[
       
   776         libraryName := defClassNames first
       
   777     ] ifFalse:[
       
   778         "/ fallback - some heuristics...
       
   779         libraryName := info libraryName.
       
   780         (libraryName notNil and:[ libraryName startsWith:'lib' ]) ifTrue:[
       
   781             defClassName := libraryName copyFrom:4
       
   782         ] ifFalse:[
       
   783             self halt.
       
   784         ].
       
   785     ].
       
   786     defClassName notNil ifTrue:[
       
   787         libraryDefinition := Smalltalk classNamed:defClassName.
       
   788     ].
   715 
   789 
   716     classNamesShown := self shownClassNamesFor:info.
   790     classNamesShown := self shownClassNamesFor:info.
   717 
   791 
   718     rows := classNamesShown collect:[:cName |
   792     rows := classNamesShown collect:[:cName |
   719                     |cls entry rev listEntry revisionInfo|
   793                     |cls entry rev listEntry revisionInfo versionString dateString|
   720 
   794 
   721                     listEntry := InfoRow new.
   795                     listEntry := InfoRow new.
   722                     listEntry name:cName.
   796                     listEntry name:cName.
   723 
   797 
   724                     cls := Smalltalk classNamed:cName.
   798                     cls := Smalltalk classNamed:cName.
   725                     cls isNil ifTrue:[
   799                     cls isNil ifTrue:[
   726                         (cName endsWith:'_extensions') ifFalse:[
   800                         (cName endsWith:'_extensions') ifFalse:[
   727                             listEntry version:'(class removed)'.
   801                             versionString := '(class removed)'.
   728                         ]
   802                         ] ifTrue:[
       
   803                             libraryDefinition notNil ifTrue:[
       
   804                                 mgr := libraryDefinition sourceCodeManager.
       
   805                                 versionString := libraryDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil.
       
   806                                 versionString notNil ifTrue:[
       
   807                                     versionString := '(bin: ',(mgr revisionInfoFromString:versionString) revision,')'.
       
   808                                 ]
       
   809                             ].
       
   810                         ].
   729                     ] ifFalse:[
   811                     ] ifFalse:[
   730                         rev := cls binaryRevision.
   812                         rev := cls binaryRevision.
   731                         rev notNil ifTrue:[
   813                         rev notNil ifTrue:[
   732                             cls isLoaded ifFalse:[
   814                             cls isLoaded ifFalse:[
   733                                 entry := '(stub for: ' , rev.
   815                                 entry := '(stub for: ' , rev.
   736                             ].    
   818                             ].    
   737                             cls revision ~= rev ifTrue:[
   819                             cls revision ~= rev ifTrue:[
   738                                 entry := entry , ' / src: ' , (cls revision printString)
   820                                 entry := entry , ' / src: ' , (cls revision printString)
   739                             ].
   821                             ].
   740                             entry := entry , ')'.
   822                             entry := entry , ')'.
   741                             listEntry version:entry
   823                             versionString := entry
   742                         ] ifFalse:[
   824                         ] ifFalse:[
   743                            cls revision notNil ifTrue:[
   825                             cls revision notNil ifTrue:[
   744                                 listEntry version:'(overloaded by: ' , cls revision , ')' 
   826                                 versionString := '(overloaded by: ' , cls revision , ')' 
   745                            ]
   827                             ]
   746                         ].
   828                         ].
   747                         revisionInfo := cls revisionInfo.
   829                         revisionInfo := cls revisionInfo.
   748                         revisionInfo notNil ifTrue:[
   830                         revisionInfo notNil ifTrue:[
   749                             listEntry date:(revisionInfo at:#date)
   831                             dateString := (revisionInfo at:#date)
   750                         ].
   832                         ].
   751                     ].
   833                     ].
   752                     listEntry
   834                     listEntry version:versionString.
       
   835                     listEntry date:dateString
   753                   ].
   836                   ].
   754 
   837 
   755     classInfoShown := rows.
   838     classInfoShown := rows.
   756 
   839 
   757     self infoTable1ListHolder value:rows.
   840     self infoTable1ListHolder value:rows.
   760 
   843 
   761     "Modified: / 05-10-2007 / 13:03:56 / cg"
   844     "Modified: / 05-10-2007 / 13:03:56 / cg"
   762 !
   845 !
   763 
   846 
   764 showInfoForNonClassLib:sel
   847 showInfoForNonClassLib:sel
   765     "/ selected a method, cObject or unknown
   848     " selected a method, cObject or unknown "
   766 
   849 
   767     |module fileName list entry|
   850     |module fileName list entry|
   768 
   851 
   769     sel isNil ifTrue:[
   852     sel isNil ifTrue:[
   770         self table1VisibleHolder value:false.
   853         self table1VisibleHolder value:false.
   843 
   926 
   844     "Modified: / 05-10-2007 / 13:01:33 / cg"
   927     "Modified: / 05-10-2007 / 13:01:33 / cg"
   845 !
   928 !
   846 
   929 
   847 showInfoForVM
   930 showInfoForVM
   848     "/ show file versions in lower view.
   931     " show file versions of vm info in lower view. "
   849 
   932 
   850     |l|
   933     |l|
   851 
   934 
   852     self middleLabelHolder value:'Contains Modules:'.
   935     self middleLabelHolder value:'Contains Components:'.
   853 
   936 
   854     l := (ObjectMemory getVMIdentificationStrings).
   937     l := (ObjectMemory getVMIdentificationStrings).
   855     l := l select:[:entry | entry includesString:'$Header'].
   938     l := l select:[:entry | entry includesString:'$Header'].
   856     l := l select:[:entry | entry includesString:',v'].
   939     l := l select:[:entry | entry includesString:',v'].
   857     l := l collect:[:entry |
   940     l := l collect:[:entry |
   950     "/ clicked on an extensions-module ?
  1033     "/ clicked on an extensions-module ?
   951     (selectedClassName endsWith:'_extensions') ifTrue:[
  1034     (selectedClassName endsWith:'_extensions') ifTrue:[
   952         packageID := (selectedClassName copyWithoutLast:('_extensions' size)) asSymbol.
  1035         packageID := (selectedClassName copyWithoutLast:('_extensions' size)) asSymbol.
   953         methods := Smalltalk allExtensionsForPackage:packageID.
  1036         methods := Smalltalk allExtensionsForPackage:packageID.
   954         (UserPreferences browserClass) browseMethods:methods title:('Extensions for ',packageID).
  1037         (UserPreferences browserClass) browseMethods:methods title:('Extensions for ',packageID).
       
  1038         ^ self.
   955     ].
  1039     ].
   956 self halt.
  1040 self halt.
   957 !
  1041 !
   958 
  1042 
   959 browseModule
  1043 browseModule
   992 unloadSelectedModuleAndRemoveClasses
  1076 unloadSelectedModuleAndRemoveClasses
   993     self unloadSelectedModuleRemoveClasses:true
  1077     self unloadSelectedModuleRemoveClasses:true
   994 !
  1078 !
   995 
  1079 
   996 unloadSelectedModuleRemoveClasses:doRemoveClasses
  1080 unloadSelectedModuleRemoveClasses:doRemoveClasses
       
  1081     (Dialog 
       
  1082         confirm:'This is a possibly dangerous operation, as the DLL is unloaded without caring for 
       
  1083 proper package-deinstallation procedures. Please only use this in repair situations and when the 
       
  1084 regular unloadPackage operation fails.
       
  1085 
       
  1086 Continue ?')
       
  1087     ifFalse:[
       
  1088         ^ self  
       
  1089     ].
       
  1090 
   997     self withWaitCursorDo:[
  1091     self withWaitCursorDo:[
   998         |info idx handle pathName|
  1092         |info idx handle pathName|
   999 
  1093 
  1000         info := self selectedModuleInfo.
  1094         info := self selectedModuleInfo.
  1001         handle := objectHandles at:(self selectedModuleIndex).
  1095         handle := objectHandles at:(self selectedModuleIndex).
  1161 
  1255 
  1162 !ObjectModuleInformation class methodsFor:'documentation'!
  1256 !ObjectModuleInformation class methodsFor:'documentation'!
  1163 
  1257 
  1164 version
  1258 version
  1165     ^ '$Header$'
  1259     ^ '$Header$'
       
  1260 !
       
  1261 
       
  1262 version_CVS
       
  1263     ^ '$Header$'
  1166 ! !
  1264 ! !