3 "{ NameSpace: Tools }" |
3 "{ NameSpace: Tools }" |
4 |
4 |
5 ToolApplicationModel subclass:#ObjectModuleInformation |
5 ToolApplicationModel subclass:#ObjectModuleInformation |
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 |
|
10 canUnloadSelectedModule classNamesShown classInfoShown |
|
11 vmInfoShown' |
9 classVariableNames:'' |
12 classVariableNames:'' |
10 poolDictionaries:'' |
13 poolDictionaries:'' |
11 category:'Monitors-ST/X' |
14 category:'Monitors-ST/X' |
12 ! |
15 ! |
13 |
16 |
114 (DataSetSpec |
118 (DataSetSpec |
115 name: 'Table1' |
119 name: 'Table1' |
116 layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
120 layout: (LayoutFrame 0 0 30 0 0 1 0 1) |
117 visibilityChannel: table1VisibleHolder |
121 visibilityChannel: table1VisibleHolder |
118 model: selectedInfoIndexHolder |
122 model: selectedInfoIndexHolder |
|
123 menu: moduleItemMenu |
119 hasHorizontalScrollBar: true |
124 hasHorizontalScrollBar: true |
120 hasVerticalScrollBar: true |
125 hasVerticalScrollBar: true |
121 dataList: infoTable1ListHolder |
126 dataList: infoTable1ListHolder |
122 columnHolder: tableColumns |
127 columnHolder: tableColumns |
123 separatorOneDColor: (Color 66.999313344015 66.999313344015 66.999313344015) |
128 separatorOneDColor: (Color 66.999313344015 66.999313344015 66.999313344015) |
268 ) |
295 ) |
269 ) |
296 ) |
270 nil |
297 nil |
271 nil |
298 nil |
272 ) |
299 ) |
|
300 ! |
|
301 |
|
302 moduleItemMenu |
|
303 "This resource specification was automatically generated |
|
304 by the MenuEditor of ST/X." |
|
305 |
|
306 "Do not manually edit this!! If it is corrupted, |
|
307 the MenuEditor may not be able to read the specification." |
|
308 |
|
309 " |
|
310 MenuEditor new openOnClass:Tools::ObjectModuleInformation andSelector:#moduleItemMenu |
|
311 (Menu new fromLiteralArrayEncoding:(Tools::ObjectModuleInformation moduleItemMenu)) startUp |
|
312 " |
|
313 |
|
314 <resource: #menu> |
|
315 |
|
316 ^ |
|
317 #(Menu |
|
318 ( |
|
319 (MenuItem |
|
320 enabled: canBrowseSelectedClass |
|
321 label: 'Browse' |
|
322 itemValue: browseClass |
|
323 translateLabel: true |
|
324 ) |
|
325 (MenuItem |
|
326 label: '-' |
|
327 ) |
|
328 (MenuItem |
|
329 enabled: canCopyClassNameList |
|
330 label: 'Copy Version Info to Clipboard' |
|
331 itemValue: copyClassOrVMNameList |
|
332 translateLabel: true |
|
333 ) |
|
334 ) |
|
335 nil |
|
336 nil |
|
337 ) |
|
338 ! |
|
339 |
|
340 moduleMenu |
|
341 "This resource specification was automatically generated |
|
342 by the MenuEditor of ST/X." |
|
343 |
|
344 "Do not manually edit this!! If it is corrupted, |
|
345 the MenuEditor may not be able to read the specification." |
|
346 |
|
347 " |
|
348 MenuEditor new openOnClass:Tools::ObjectModuleInformation andSelector:#moduleMenu |
|
349 (Menu new fromLiteralArrayEncoding:(Tools::ObjectModuleInformation moduleMenu)) startUp |
|
350 " |
|
351 |
|
352 <resource: #menu> |
|
353 |
|
354 ^ |
|
355 #(Menu |
|
356 ( |
|
357 (MenuItem |
|
358 enabled: canBrowseSelectedModule |
|
359 label: 'Browse' |
|
360 itemValue: browseModule |
|
361 translateLabel: true |
|
362 ) |
|
363 (MenuItem |
|
364 enabled: canCopyClassNameList |
|
365 label: 'Copy Version Info to Clipboard' |
|
366 itemValue: copyClassOrVMNameList |
|
367 translateLabel: true |
|
368 ) |
|
369 (MenuItem |
|
370 label: '-' |
|
371 ) |
|
372 (MenuItem |
|
373 enabled: canUnloadSelectedModule |
|
374 label: 'Remove Classes && Unload' |
|
375 itemValue: unloadSelectedModuleAndRemoveClasses |
|
376 translateLabel: true |
|
377 ) |
|
378 (MenuItem |
|
379 enabled: canUnloadSelectedModule |
|
380 label: 'Unload' |
|
381 itemValue: unloadSelectedModule |
|
382 translateLabel: true |
|
383 ) |
|
384 ) |
|
385 nil |
|
386 nil |
|
387 ) |
273 ! ! |
388 ! ! |
274 |
389 |
275 !ObjectModuleInformation class methodsFor:'tableColumns specs'! |
390 !ObjectModuleInformation class methodsFor:'tableColumns specs'! |
276 |
391 |
277 tableColumns |
392 tableColumns |
347 |
462 |
348 ! ! |
463 ! ! |
349 |
464 |
350 !ObjectModuleInformation methodsFor:'aspects'! |
465 !ObjectModuleInformation methodsFor:'aspects'! |
351 |
466 |
|
467 canBrowseSelectedClass |
|
468 ^ [classNamesShown notEmptyOrNil |
|
469 and:[ self selectedInfoIndex notNil |
|
470 and:[ self selectedInfoIndex ~~ 0 ]]] |
|
471 |
|
472 "Modified: / 05-10-2007 / 10:51:39 / cg" |
|
473 ! |
|
474 |
|
475 canBrowseSelectedModule |
|
476 canBrowseSelectedModule isNil ifTrue:[ |
|
477 canBrowseSelectedModule := false asValue |
|
478 ]. |
|
479 ^ canBrowseSelectedModule. |
|
480 |
|
481 "Modified: / 05-10-2007 / 10:51:39 / cg" |
|
482 ! |
|
483 |
|
484 canCopyClassNameList |
|
485 ^ [table1VisibleHolder value |
|
486 and:[classInfoShown notEmptyOrNil or:[vmInfoShown notEmptyOrNil] ]] |
|
487 |
|
488 "Modified: / 05-10-2007 / 10:51:39 / cg" |
|
489 ! |
|
490 |
|
491 canUnloadSelectedModule |
|
492 canUnloadSelectedModule isNil ifTrue:[ |
|
493 canUnloadSelectedModule := false asValue |
|
494 ]. |
|
495 ^ canUnloadSelectedModule. |
|
496 |
|
497 "Modified: / 05-10-2007 / 10:51:39 / cg" |
|
498 ! |
|
499 |
352 infoTable1ListHolder |
500 infoTable1ListHolder |
353 ^ builder valueAspectFor:#'infoTable1ListHolder' initialValue:#() |
501 ^ builder valueAspectFor:#'infoTable1ListHolder' initialValue:#() |
354 |
502 |
355 "Created: / 05-10-2007 / 12:48:06 / cg" |
503 "Created: / 05-10-2007 / 12:48:06 / cg" |
356 ! |
504 ! |
384 |
532 |
385 readOnly |
533 readOnly |
386 ^ readOnly ? false |
534 ^ readOnly ? false |
387 |
535 |
388 "Created: / 05-10-2007 / 13:05:51 / cg" |
536 "Created: / 05-10-2007 / 13:05:51 / cg" |
|
537 ! |
|
538 |
|
539 readOnly:aBoolean |
|
540 readOnly := aBoolean |
|
541 |
|
542 "Created: / 05-10-2007 / 13:05:51 / cg" |
|
543 ! |
|
544 |
|
545 selectedInfoIndex |
|
546 |sel| |
|
547 |
|
548 sel := self selectedInfoIndexHolder value. |
|
549 ^ sel |
|
550 ! |
|
551 |
|
552 selectedInfoIndexHolder |
|
553 selectedInfoIndexHolder isNil ifTrue:[ |
|
554 selectedInfoIndexHolder := ValueHolder new. |
|
555 selectedInfoIndexHolder onChangeSend:#selectedInfoIndexChanged to:self. |
|
556 ]. |
|
557 ^ selectedInfoIndexHolder. |
|
558 |
|
559 "Modified: / 05-10-2007 / 10:51:39 / cg" |
|
560 ! |
|
561 |
|
562 selectedModuleIndex |
|
563 |sel| |
|
564 |
|
565 sel := self selectedModuleIndexHolder value. |
|
566 ^ sel |
389 ! |
567 ! |
390 |
568 |
391 selectedModuleIndexHolder |
569 selectedModuleIndexHolder |
392 selectedModuleIndexHolder isNil ifTrue:[ |
570 selectedModuleIndexHolder isNil ifTrue:[ |
393 selectedModuleIndexHolder := ValueHolder new. |
571 selectedModuleIndexHolder := ValueHolder new. |
466 "Modified: / 05-10-2007 / 12:53:14 / cg" |
644 "Modified: / 05-10-2007 / 12:53:14 / cg" |
467 ! ! |
645 ! ! |
468 |
646 |
469 !ObjectModuleInformation methodsFor:'change & update'! |
647 !ObjectModuleInformation methodsFor:'change & update'! |
470 |
648 |
|
649 selectedInfoIndexChanged |
|
650 ! |
|
651 |
|
652 selectedModule |
|
653 |sel| |
|
654 |
|
655 sel := self selectedModuleIndex. |
|
656 sel isNil ifTrue:[^ nil]. |
|
657 ^ objectHandles at:sel. |
|
658 ! |
|
659 |
471 selectedModuleIndexChanged |
660 selectedModuleIndexChanged |
|
661 |module info| |
|
662 |
|
663 info := self selectedModuleInfo. |
|
664 module := self selectedModule. |
|
665 |
|
666 self canBrowseSelectedModule value:(info notNil and:[info ~~ #VM and:[module notNil]]). |
|
667 self canUnloadSelectedModule value:(self readOnly not and:[info ~~ #VM and:[module notNil and:[module dynamic]]]). |
|
668 |
|
669 classNamesShown := nil. |
|
670 classInfoShown := nil. |
|
671 vmInfoShown := nil. |
|
672 |
|
673 info isNil ifTrue:[ |
|
674 "/ selected a method, cObject or unknown |
|
675 self showInfoForNonClassLib:(self selectedModuleIndex). |
|
676 ^ self. |
|
677 ]. |
|
678 info == #VM ifTrue:[ |
|
679 "/ selected the pseudo entry for the VM itself |
|
680 self showInfoForVM. |
|
681 ^ self. |
|
682 ]. |
|
683 "/ selected a class-library package |
|
684 self showInfoForClassLib:info. |
|
685 |
|
686 "Modified: / 05-10-2007 / 12:56:13 / cg" |
|
687 ! |
|
688 |
|
689 selectedModuleInfo |
472 |sel info| |
690 |sel info| |
473 |
691 |
474 sel := self selectedModuleIndexHolder value. |
692 sel := self selectedModuleIndex. |
475 sel notNil ifTrue:[ |
693 sel notNil ifTrue:[ |
476 (self showClassLibs value or:[self showBuiltIn value]) ifTrue:[ |
694 (self showClassLibs value or:[self showBuiltIn value]) ifTrue:[ |
477 info := allModules at:sel ifAbsent:nil. |
695 info := allModules at:sel ifAbsent:nil. |
478 ]. |
696 ]. |
479 ]. |
697 ]. |
480 |
698 ^ info |
481 info isNil ifTrue:[ |
|
482 "/ selected a method, cObject or unknown |
|
483 self showInfoForNonClassLib:sel. |
|
484 ^ self. |
|
485 ]. |
|
486 info == #VM ifTrue:[ |
|
487 "/ selected the pseudo entry for the VM itself |
|
488 self showInfoForVM. |
|
489 ^ self. |
|
490 ]. |
|
491 "/ selected a class-library package |
|
492 self showInfoForClassLib:info. |
|
493 |
|
494 "Modified: / 05-10-2007 / 12:56:13 / cg" |
|
495 ! |
699 ! |
496 |
700 |
497 showInfoForClassLib:info |
701 showInfoForClassLib:info |
498 "/ selected a package; fill bottom list with class-info |
702 "/ selected a package; fill bottom list with class-info |
499 |
703 |
559 |
767 |
560 showInfoForNonClassLib:sel |
768 showInfoForNonClassLib:sel |
561 "/ selected a method, cObject or unknown |
769 "/ selected a method, cObject or unknown |
562 |
770 |
563 |module fileName list entry| |
771 |module fileName list entry| |
|
772 |
|
773 sel isNil ifTrue:[ |
|
774 self table1VisibleHolder value:false. |
|
775 self table2VisibleHolder value:false. |
|
776 ^ self. |
|
777 ]. |
564 |
778 |
565 module := objectHandles at:sel. |
779 module := objectHandles at:sel. |
566 fileName := module pathName. |
780 fileName := module pathName. |
567 |
781 |
568 module isMethodHandle ifTrue:[ |
782 module isMethodHandle ifTrue:[ |
700 "Created: / 05-10-2007 / 10:50:27 / cg" |
916 "Created: / 05-10-2007 / 10:50:27 / cg" |
701 ! ! |
917 ! ! |
702 |
918 |
703 !ObjectModuleInformation methodsFor:'menu actions'! |
919 !ObjectModuleInformation methodsFor:'menu actions'! |
704 |
920 |
|
921 browseClass |
|
922 |module info classNames selectedClassName selectedClass| |
|
923 |
|
924 module := self selectedModule. |
|
925 info := self selectedModuleInfo. |
|
926 classNames := info classNames asSortedCollection. |
|
927 selectedClassName := classNames at:(self selectedInfoIndex). |
|
928 selectedClass := Smalltalk classNamed:selectedClassName. |
|
929 |
|
930 UserPreferences systemBrowserClass |
|
931 openInClass:selectedClass |
|
932 ! |
|
933 |
|
934 browseModule |
|
935 |module classes| |
|
936 |
|
937 module := self selectedModule. |
|
938 classes := module classNames collect:[:nm | Smalltalk classNamed:nm]. |
|
939 UserPreferences systemBrowserClass |
|
940 browseClasses:classes |
|
941 label:(resources string:'Classes in %1' with:module libraryName) |
|
942 ! |
|
943 |
|
944 copyClassOrVMNameList |
|
945 |text| |
|
946 |
|
947 text := ((classInfoShown ? vmInfoShown)collect:[:eachRow | eachRow infoString]) asStringCollection asString. |
|
948 self window setClipboardText:text. |
|
949 ! |
|
950 |
705 openDocumentation |
951 openDocumentation |
706 self openHTMLDocument: 'tools/misc/TOP.html#MODULEINFO' |
952 self openHTMLDocument: 'tools/misc/TOP.html#MODULEINFO' |
707 |
953 |
708 "Modified: / 05-10-2007 / 13:11:45 / cg" |
954 "Modified: / 05-10-2007 / 13:11:45 / cg" |
|
955 ! |
|
956 |
|
957 unloadModule |
|
958 self unloadModuleRemoveClasses:false |
|
959 ! |
|
960 |
|
961 unloadModuleAndRemoveClasses |
|
962 self unloadModuleRemoveClasses:true |
|
963 ! |
|
964 |
|
965 unloadModuleRemoveClasses:doRemoveClasses |
|
966 self withWaitCursorDo:[ |
|
967 |info idx handle pathName| |
|
968 |
|
969 info := self selectedModuleInfo. |
|
970 self selectedModuleIndexHolder value:nil. |
|
971 handle := objectHandles at:(self selectedModuleIndex). |
|
972 |
|
973 info isNil ifTrue:[ |
|
974 "/ selected a method |
|
975 "/ idx := idx - allModules size. |
|
976 pathName := handle pathName. |
|
977 ] ifFalse:[ |
|
978 "/ selected a package |
|
979 pathName := info pathName. |
|
980 ]. |
|
981 pathName notNil ifTrue:[ |
|
982 doRemoveClasses ifTrue:[ |
|
983 ObjectFileLoader unloadObjectFileAndRemoveClasses:pathName. |
|
984 ] ifFalse:[ |
|
985 ObjectFileLoader unloadObjectFile:pathName. |
|
986 ] |
|
987 ]. |
|
988 self updateModuleList. |
|
989 ] |
709 ! ! |
990 ! ! |
710 |
991 |
711 !ObjectModuleInformation methodsFor:'private'! |
992 !ObjectModuleInformation methodsFor:'private'! |
712 |
993 |
713 filterChanged |
994 filterChanged |