673 ProjectBrowser new openInterface:#rightCanvasSpecForPatchesList |
673 ProjectBrowser new openInterface:#rightCanvasSpecForPatchesList |
674 " |
674 " |
675 |
675 |
676 <resource: #canvas> |
676 <resource: #canvas> |
677 |
677 |
678 ^ |
678 ^ |
679 |
679 #(#FullSpec |
680 #(#FullSpec |
680 #name: #rightCanvasSpecForPatchesList |
681 #window: |
681 #window: |
682 #(#WindowSpec |
682 #(#WindowSpec |
683 #name: 'NewApplication' |
683 #label: 'NewApplication' |
684 #layout: #(#LayoutFrame 216 0 173 0 515 0 472 0) |
684 #name: 'NewApplication' |
685 #level: 0 |
685 #min: #(#Point 10 10) |
686 #label: 'NewApplication' |
686 #max: #(#Point 1280 1024) |
687 #min: #(#Point 10 10) |
687 #bounds: #(#Rectangle 16 49 316 349) |
688 #max: #(#Point 1280 1024) |
688 ) |
689 #bounds: #(#Rectangle 216 173 516 473) |
689 #component: |
690 #usePreferredExtent: false |
690 #(#SpecCollection |
691 ) |
691 #collection: #( |
692 #component: |
692 #(#DataSetSpec |
693 #(#SpecCollection |
693 #name: 'patchesTable' |
694 #collection: |
694 #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
695 #( |
695 #model: #selectedPatch |
696 #(#DataSetSpec |
696 #menu: #menu |
697 #name: 'patchesTable' |
697 #hasHorizontalScrollBar: true |
698 #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
698 #hasVerticalScrollBar: true |
699 #hasHorizontalScrollBar: true |
699 #dataList: #patchesList |
700 #hasVerticalScrollBar: true |
700 #has3Dsepartors: false |
701 #dataList: #patchesList |
701 #columnHolder: #patchesTableColumns |
702 #has3Dsepartors: false |
702 #columnAdaptor: #classTableAdaptor |
703 #columnHolder: #patchesTableColumns |
703 ) |
704 #columnAdaptor: #classTableAdaptor |
704 ) |
705 ) |
705 |
706 ) |
706 ) |
707 ) |
|
708 ) |
707 ) |
709 ! |
708 ! |
710 |
709 |
711 rightCanvasSpecForPrerequisiteClasses |
710 rightCanvasSpecForPrerequisiteClasses |
712 "This resource specification was automatically generated |
711 "This resource specification was automatically generated |
1500 nil |
1499 nil |
1501 nil |
1500 nil |
1502 ) |
1501 ) |
1503 ) |
1502 ) |
1504 #(#MenuItem |
1503 #(#MenuItem |
|
1504 #label: 'View' |
|
1505 #translateLabel: true |
|
1506 #submenu: |
|
1507 #(#Menu |
|
1508 #( |
|
1509 #(#MenuItem |
|
1510 #label: 'Current Project' |
|
1511 #translateLabel: true |
|
1512 #choice: #showWhat |
|
1513 #choiceValue: #current |
|
1514 ) |
|
1515 #(#MenuItem |
|
1516 #label: 'Non BaseSystem Projects' |
|
1517 #translateLabel: true |
|
1518 #choice: #showWhat |
|
1519 #choiceValue: #userProjects |
|
1520 ) |
|
1521 #(#MenuItem |
|
1522 #label: 'All Projects' |
|
1523 #translateLabel: true |
|
1524 #choice: #showWhat |
|
1525 #choiceValue: #all |
|
1526 ) |
|
1527 #(#MenuItem |
|
1528 #label: '-' |
|
1529 ) |
|
1530 #(#MenuItem |
|
1531 #label: 'Update' |
|
1532 #translateLabel: true |
|
1533 #value: #updateListOfProjects |
|
1534 ) |
|
1535 ) |
|
1536 nil |
|
1537 nil |
|
1538 ) |
|
1539 ) |
|
1540 #(#MenuItem |
1505 #label: 'Project' |
1541 #label: 'Project' |
1506 #translateLabel: true |
1542 #translateLabel: true |
1507 #submenuChannel: #projectItemMenu |
1543 #submenuChannel: #projectItemMenu |
1508 ) |
1544 ) |
1509 #(#MenuItem |
1545 #(#MenuItem |
1577 |
1613 |
1578 ^ |
1614 ^ |
1579 #(#Menu |
1615 #(#Menu |
1580 #( |
1616 #( |
1581 #(#MenuItem |
1617 #(#MenuItem |
1582 #label: 'New...' |
1618 #label: 'Browse' |
1583 #translateLabel: true |
1619 #translateLabel: true |
1584 #isButton: true |
1620 #value: #browseMethod |
1585 #value: #newProject |
|
1586 #labelImage: #(#ResourceRetriever #Icon #newIcon) |
|
1587 ) |
1621 ) |
1588 #(#MenuItem |
1622 #(#MenuItem |
1589 #label: 'Open...' |
1623 #label: 'Browse Full' |
1590 #translateLabel: true |
1624 #translateLabel: true |
1591 #isButton: true |
1625 #value: #browseMethodFull |
1592 #value: #openProject |
|
1593 #labelImage: #(#ResourceRetriever #Icon #loadIcon) |
|
1594 ) |
|
1595 #(#MenuItem |
|
1596 #label: 'SaveAs...' |
|
1597 #translateLabel: true |
|
1598 #isButton: true |
|
1599 #value: #saveProject |
|
1600 #enabled: #hasProjectSelectedHolder |
|
1601 #labelImage: #(#ResourceRetriever #Icon #saveIcon) |
|
1602 ) |
1626 ) |
1603 ) |
1627 ) |
1604 nil |
1628 nil |
1605 nil |
1629 nil |
1606 ) |
1630 ) |
1607 |
|
1608 "Modified: / 26.4.1999 / 22:45:25 / cg" |
|
1609 ! |
1631 ! |
1610 |
1632 |
1611 noItemMenu |
1633 noItemMenu |
1612 "This resource specification was automatically generated |
1634 "This resource specification was automatically generated |
1613 by the MenuEditor of ST/X." |
1635 by the MenuEditor of ST/X." |
1827 DataSetBuilder new openOnClass:ProjectBrowser andSelector:#patchesTableColumns |
1849 DataSetBuilder new openOnClass:ProjectBrowser andSelector:#patchesTableColumns |
1828 " |
1850 " |
1829 |
1851 |
1830 <resource: #tableColumns> |
1852 <resource: #tableColumns> |
1831 |
1853 |
1832 |
1854 ^#( |
1833 ^ #( |
1855 #(#DataSetColumnSpec |
1834 #(#DataSetColumnSpec |
1856 #label: 'Class' |
1835 #label: 'Class' |
1857 #id: 'classColumn' |
1836 #id: 'classColumn' |
1858 #labelAlignment: #left |
1837 #labelAlignment: #left |
1859 #menu: #patchesMethodMenu |
1838 #model: #classNameFromPatchesInfo: |
1860 #model: #classNameFromPatchesInfo: |
|
1861 #doubleClickedSelector: #methodPatchDoubleClick: |
|
1862 #canSelect: false |
1839 ) |
1863 ) |
1840 #(#DataSetColumnSpec |
1864 #(#DataSetColumnSpec |
1841 #label: 'Selector' |
1865 #label: 'Selector' |
1842 #id: 'selectorColumn' |
1866 #id: 'selectorColumn' |
1843 #labelAlignment: #left |
1867 #labelAlignment: #left |
1844 #model: #selectorFromPatchesInfo: |
1868 #model: #selectorFromPatchesInfo: |
|
1869 #canSelect: false |
1845 ) |
1870 ) |
1846 ) |
1871 ) |
|
1872 |
1847 ! ! |
1873 ! ! |
1848 |
1874 |
1849 !ProjectBrowser methodsFor:'accessing'! |
1875 !ProjectBrowser methodsFor:'accessing'! |
1850 |
1876 |
1851 selectedTreeNode |
1877 selectedTreeNode |
1867 |
1893 |
1868 "Created: / 23.3.1999 / 14:18:05 / cg" |
1894 "Created: / 23.3.1999 / 14:18:05 / cg" |
1869 ! |
1895 ! |
1870 |
1896 |
1871 browseClass |
1897 browseClass |
1872 |node className cls| |
1898 |node classOrClassName cls| |
1873 |
1899 |
1874 self hasClassNodeSelected ifFalse:[^ self]. |
1900 self hasClassNodeSelected ifFalse:[^ self]. |
1875 |
1901 |
1876 node := self selectedTreeNode. |
1902 node := self selectedTreeNode. |
1877 className := node contents value. |
1903 classOrClassName := node contents value. |
1878 cls := Smalltalk at:className. |
1904 classOrClassName isBehavior ifTrue:[ |
|
1905 cls := classOrClassName. |
|
1906 ] ifFalse:[ |
|
1907 cls := Smalltalk at:classOrClassName. |
|
1908 ]. |
1879 cls isNil ifTrue:[ |
1909 cls isNil ifTrue:[ |
1880 self information:'The class is not (yet) loaded'. |
1910 self information:'The class is not (yet) loaded'. |
1881 ^ self. |
1911 ^ self. |
|
1912 ]. |
|
1913 cls isLoaded ifFalse:[ |
|
1914 self information:'The class is an autoloaded class.'. |
1882 ]. |
1915 ]. |
1883 SystemBrowser openInClass:cls selector:nil. |
1916 SystemBrowser openInClass:cls selector:nil. |
1884 |
1917 |
1885 ! |
1918 ! |
1886 |
1919 |
2500 |
2544 |
2501 (holder := builder bindingAt:#selectedTreeNodeHolder) isNil ifTrue:[ |
2545 (holder := builder bindingAt:#selectedTreeNodeHolder) isNil ifTrue:[ |
2502 builder aspectAt:#selectedTreeNodeHolder put:(holder := ValueHolder new). |
2546 builder aspectAt:#selectedTreeNodeHolder put:(holder := ValueHolder new). |
2503 ]. |
2547 ]. |
2504 ^ holder. |
2548 ^ holder. |
|
2549 ! |
|
2550 |
|
2551 showWhat |
|
2552 |holder| |
|
2553 |
|
2554 (holder := builder bindingAt:#showWhat) isNil ifTrue:[ |
|
2555 holder := ValueHolder with:#current. |
|
2556 builder aspectAt:#showWhat put:holder. |
|
2557 holder onChangeSend:#updateProjectTree to:self. |
|
2558 ]. |
|
2559 ^ holder. |
|
2560 |
|
2561 "Created: / 23.3.1999 / 14:18:05 / cg" |
2505 ! ! |
2562 ! ! |
2506 |
2563 |
2507 !ProjectBrowser methodsFor:'change & update'! |
2564 !ProjectBrowser methodsFor:'change & update'! |
2508 |
2565 |
2509 update:something with:aParameter from:changedObject |
2566 update:something with:aParameter from:changedObject |
2657 currentProjectsClassNames |
2714 currentProjectsClassNames |
2658 |p| |
2715 |p| |
2659 |
2716 |
2660 p := self currentProject. |
2717 p := self currentProject. |
2661 ^ (p classes ? #()) |
2718 ^ (p classes ? #()) |
2662 collect:[:classOrSymbol | |
2719 collect:[:classOrSymbol | |
2663 classOrSymbol isSymbol |
2720 classOrSymbol isBehavior ifTrue:[ |
2664 ifTrue:[classOrSymbol] |
2721 classOrSymbol name |
2665 ifFalse:[Smalltalk at:classOrSymbol asSymbol ifAbsent:[classOrSymbol]] |
2722 ] ifFalse:[ |
|
2723 classOrSymbol |
|
2724 ] |
2666 ] |
2725 ] |
2667 |
2726 |
2668 ! |
2727 ! |
2669 |
2728 |
2670 hasClassNodeSelected |
2729 hasClassNodeSelected |
2795 classesNode icon:(self class classesIcon). |
2854 classesNode icon:(self class classesIcon). |
2796 classesNode info:'Classes contained in the project'. |
2855 classesNode info:'Classes contained in the project'. |
2797 ((aProject classes ? #()) copy sort:[:a :b | |
2856 ((aProject classes ? #()) copy sort:[:a :b | |
2798 |nmA nmB| |
2857 |nmA nmB| |
2799 |
2858 |
2800 nmA := a isSymbol ifTrue:[a] ifFalse:[a name]. |
2859 nmA := a isBehavior ifTrue:[a name] ifFalse:[a]. |
2801 nmB := b isSymbol ifTrue:[b] ifFalse:[b name]. |
2860 nmB := b isBehavior ifTrue:[b name] ifFalse:[b]. |
2802 nmA < nmB |
2861 nmA < nmB |
2803 ]) |
2862 ]) |
2804 do:[:aClass | |
2863 do:[:aClass | |
2805 |cNode cName| |
2864 |cNode cName| |
2806 |
2865 |
2807 cName := aClass isSymbol ifTrue:[aClass] ifFalse:[aClass name]. |
2866 cName := aClass isBehavior ifTrue:[aClass name] ifFalse:[aClass]. |
2808 cNode := ProjectTreeItem name:cName. |
2867 cNode := ProjectTreeItem name:cName. |
2809 cNode contents:(#class -> aClass). |
2868 cNode contents:(#class -> aClass). |
2810 cNode icon:classIcon. |
2869 cNode icon:classIcon. |
2811 classesNode add:cNode. |
2870 classesNode add:cNode. |
2812 ]. |
2871 ]. |
2957 p addDependent:self. |
3008 p addDependent:self. |
2958 ]. |
3009 ]. |
2959 |
3010 |
2960 "Created: / 23.3.1999 / 14:16:12 / cg" |
3011 "Created: / 23.3.1999 / 14:16:12 / cg" |
2961 "Modified: / 23.3.1999 / 14:18:38 / cg" |
3012 "Modified: / 23.3.1999 / 14:18:38 / cg" |
|
3013 ! |
|
3014 |
|
3015 updateProjectTree |
|
3016 |tree root showWhat| |
|
3017 |
|
3018 showWhat := self showWhat value. |
|
3019 |
|
3020 tree := SelectionInTree new. |
|
3021 tree root:(root := TreeItem name:'invisibleRoot'). |
|
3022 root hide:false. |
|
3023 |
|
3024 (Project knownProjects asOrderedCollection |
|
3025 sort:[:a :b | a packageName < b packageName]) |
|
3026 do:[:aProject | |
|
3027 |doShow| |
|
3028 |
|
3029 (doShow := showWhat == #all) ifFalse:[ |
|
3030 doShow := (aProject package startsWith:'stx:') not |
|
3031 ]. |
|
3032 doShow ifTrue:[ |
|
3033 root add:(self nodeFor:aProject). |
|
3034 ] |
|
3035 ]. |
|
3036 projectTree := root. |
|
3037 |
|
3038 self projectTreeHolder root:projectTree. |
|
3039 ^ projectTree |
2962 ! |
3040 ! |
2963 |
3041 |
2964 updateRightCanvas |
3042 updateRightCanvas |
2965 |selectedNode nodeContents spec| |
3043 |selectedNode nodeContents spec| |
2966 |
3044 |
3166 project inspect. |
3244 project inspect. |
3167 ] |
3245 ] |
3168 ! |
3246 ! |
3169 |
3247 |
3170 itemDoubleClicked:index |
3248 itemDoubleClicked:index |
3171 |node className cls| |
3249 |node classOrClassName cls| |
3172 |
3250 |
3173 self hasClassNodeSelected ifTrue:[ |
3251 self hasClassNodeSelected ifTrue:[ |
3174 node := self selectedTreeNode. |
3252 node := self selectedTreeNode. |
3175 className := node contents value. |
3253 classOrClassName := node contents value. |
3176 cls := Smalltalk at:className. |
3254 classOrClassName isBehavior ifTrue:[ |
|
3255 cls := classOrClassName. |
|
3256 ] ifFalse:[ |
|
3257 cls := Smalltalk at:classOrClassName. |
|
3258 ]. |
3177 cls isNil ifTrue:[ |
3259 cls isNil ifTrue:[ |
3178 self information:'The class is not (yet) loaded'. |
3260 self information:'The class is not (yet) loaded'. |
3179 ^ self |
3261 ^ self |
3180 ]. |
3262 ]. |
3181 SystemBrowser browseClass:cls. |
3263 SystemBrowser browseClass:cls. |
3183 ! |
3265 ! |
3184 |
3266 |
3185 itemSelected:index |
3267 itemSelected:index |
3186 |item action| |
3268 |item action| |
3187 |
3269 |
3188 self updateRightCanvas. |
3270 self withWaitCursorDo:[ |
3189 |
3271 self updateRightCanvas. |
|
3272 ]. |
3190 self readAspectsFromProject. |
3273 self readAspectsFromProject. |
3191 |
3274 |
3192 item := self projectTreeHolder value at:index. |
3275 item := self projectTreeHolder value at:index. |
3193 action := item action. |
3276 action := item action. |
3194 action notNil ifTrue:[ |
3277 action notNil ifTrue:[ |
3376 ^ true |
3463 ^ true |
3377 |
3464 |
3378 ! |
3465 ! |
3379 |
3466 |
3380 showClassDefinitionOf:anItem |
3467 showClassDefinitionOf:anItem |
3381 |node className cls text| |
3468 |node classOrClassName cls text| |
3382 |
3469 |
3383 self hasClassNodeSelected ifFalse:[^ self]. |
3470 self hasClassNodeSelected ifFalse:[^ self]. |
3384 |
3471 |
3385 self currentCanvasHolder value:(self class rightCanvasSpecForEditableText). |
3472 self currentCanvasHolder value:(self class rightCanvasSpecForEditableText). |
3386 |
3473 |
3387 node := self selectedTreeNode. |
3474 node := self selectedTreeNode. |
3388 className := node contents value. |
3475 classOrClassName := node contents value. |
3389 cls := Smalltalk at:className. |
3476 classOrClassName isBehavior ifTrue:[ |
|
3477 cls := classOrClassName. |
|
3478 ] ifFalse:[ |
|
3479 cls := Smalltalk at:classOrClassName. |
|
3480 ]. |
3390 cls isNil ifTrue:[ |
3481 cls isNil ifTrue:[ |
3391 text := 'The class is not (yet) loaded'. |
3482 text := 'The class is not (yet) loaded'. |
3392 ] ifFalse:[ |
3483 ] ifFalse:[ |
3393 text := cls definition |
3484 text := cls definition |
3394 ]. |
3485 ]. |
3484 l addAll:classInfo. |
3575 l addAll:classInfo. |
3485 |
3576 |
3486 |
3577 |
3487 ! |
3578 ! |
3488 |
3579 |
|
3580 updateListOfProjects |
|
3581 "scan all classes/methods for new projects" |
|
3582 |
|
3583 self withWaitCursorDo:[ |
|
3584 Project initKnownProjects. |
|
3585 self updateProjectTree |
|
3586 ]. |
|
3587 ! |
|
3588 |
3489 updateListOfRequiredPrerequisiteClasses |
3589 updateListOfRequiredPrerequisiteClasses |
3490 "all autoloaded superclasses of my classes are definitely required" |
3590 "all autoloaded superclasses of my classes are definitely required" |
3491 |
3591 |
3492 |p anyChange allInPre requiredInPre nMissing| |
3592 |p anyChange allInPre requiredInPre nTotal nMissing msg| |
3493 |
3593 |
3494 p := self currentProject. |
3594 p := self currentProject. |
3495 p isNil ifTrue:[^ self]. |
3595 p isNil ifTrue:[^ self]. |
3496 anyChange := false. |
3596 anyChange := false. |
|
3597 nTotal := 0. |
3497 nMissing := 0. |
3598 nMissing := 0. |
3498 allInPre := self listOfAllClassesInPrerequisites value. |
3599 allInPre := self listOfAllClassesInPrerequisites value. |
3499 requiredInPre := self listOfRequiredClassesInPrerequisites value. |
3600 requiredInPre := self listOfRequiredClassesInPrerequisites value. |
3500 |
3601 |
3501 self currentProjectsClassNames do:[:aClassName | |
3602 self currentProjectsClassNames do:[:aClassName | |
3520 ] |
3621 ] |
3521 ] |
3622 ] |
3522 ] |
3623 ] |
3523 ] ifFalse:[ |
3624 ] ifFalse:[ |
3524 nMissing := nMissing + 1. |
3625 nMissing := nMissing + 1. |
3525 ] |
3626 ]. |
|
3627 nTotal := nTotal + 1. |
3526 ]. |
3628 ]. |
3527 |
3629 |
3528 anyChange ifTrue:[ |
3630 anyChange ifTrue:[ |
3529 self listOfRequiredClassesInPrerequisites changed. |
3631 self listOfRequiredClassesInPrerequisites changed. |
3530 self listOfAllClassesInPrerequisites changed. |
3632 self listOfAllClassesInPrerequisites changed. |
3531 ]. |
3633 ]. |
3532 nMissing ~~ 0 ifTrue:[ |
3634 nMissing ~~ 0 ifTrue:[ |
3533 self information:'Update not complete - ' , nMissing printString |
3635 nMissing == nTotal ifTrue:[ |
3534 , ' of the projects classes are not loaded'. |
3636 msg := 'Project is not loaded (' , nMissing printString |
3535 ]. |
3637 , ' unloaded classes)'. |
3536 self accept. |
3638 ] ifFalse:[ |
|
3639 msg := 'Project is not loaded completely - ' , nMissing printString |
|
3640 , ' of the projects ' , nTotal printString , ' classes are not loaded'. |
|
3641 ]. |
|
3642 self notify:msg. |
|
3643 ]. |
|
3644 modifiedChannel value:false. |
3537 ! ! |
3645 ! ! |
3538 |
3646 |
3539 !ProjectBrowser methodsFor:'user actions - canvas'! |
3647 !ProjectBrowser methodsFor:'user actions - canvas'! |
3540 |
3648 |
3541 accept |
3649 accept |
3591 self listOfAllProjectsInPrerequisites changed. |
3699 self listOfAllProjectsInPrerequisites changed. |
3592 self accept |
3700 self accept |
3593 |
3701 |
3594 ! |
3702 ! |
3595 |
3703 |
|
3704 browseMethod |
|
3705 "browse the selected table-rows method (from patches canvas)" |
|
3706 |
|
3707 |patchWho patchIndex| |
|
3708 |
|
3709 patchIndex := self selectedPatch value. |
|
3710 patchWho := self patchesList at:patchIndex. |
|
3711 SystemBrowser browseClass:patchWho methodClass selector:patchWho methodSelector. |
|
3712 |
|
3713 ! |
|
3714 |
|
3715 browseMethodFull |
|
3716 "browse the selected table-rows method (from patches canvas)" |
|
3717 |
|
3718 |patchWho patchIndex| |
|
3719 |
|
3720 patchIndex := self selectedPatch value. |
|
3721 patchWho := self patchesList at:patchIndex. |
|
3722 SystemBrowser openInClass:patchWho methodClass selector:patchWho methodSelector. |
|
3723 |
|
3724 ! |
|
3725 |
3596 cancel |
3726 cancel |
3597 "reload aspects from the project" |
3727 "reload aspects from the project" |
3598 |
3728 |
3599 self readAspectsFromProject |
3729 self readAspectsFromProject |
3600 ! |
3730 ! |