ProjectBrowser.st
changeset 1255 d5616023622e
parent 1254 ca6590dae738
child 1267 db910ada83f7
equal deleted inserted replaced
1254:ca6590dae738 1255:d5616023622e
   579               #model: #rightCanvasTextHolder
   579               #model: #rightCanvasTextHolder
   580               #hasHorizontalScrollBar: true
   580               #hasHorizontalScrollBar: true
   581               #hasVerticalScrollBar: true
   581               #hasVerticalScrollBar: true
   582               #miniScrollerHorizontal: true
   582               #miniScrollerHorizontal: true
   583               #isReadOnly: true
   583               #isReadOnly: true
       
   584             )
       
   585            )
       
   586          
       
   587         )
       
   588       )
       
   589 !
       
   590 
       
   591 methodValidationDialogSpec
       
   592     "This resource specification was automatically generated
       
   593      by the UIPainter of ST/X."
       
   594 
       
   595     "Do not manually edit this!! If it is corrupted,
       
   596      the UIPainter may not be able to read the specification."
       
   597 
       
   598     "
       
   599      UIPainter new openOnClass:ProjectBrowser andSelector:#classValidationDialogSpec
       
   600      ProjectBrowser new openInterface:#classValidationDialogSpec
       
   601     "
       
   602 
       
   603     <resource: #canvas>
       
   604 
       
   605     ^ 
       
   606      #(#FullSpec
       
   607         #name: #classValidationDialogSpec
       
   608         #window: 
       
   609        #(#WindowSpec
       
   610           #label: 'ProjectBrowser'
       
   611           #name: 'ProjectBrowser'
       
   612           #min: #(#Point 10 10)
       
   613           #max: #(#Point 1024 768)
       
   614           #bounds: #(#Rectangle 24 554 457 1003)
       
   615           #menu: #mainMenu
       
   616           #icon: #bigProjectBrowserIcon
       
   617         )
       
   618         #component: 
       
   619        #(#SpecCollection
       
   620           #collection: #(
       
   621            #(#VariableVerticalPanelSpec
       
   622               #name: 'VariableVerticalPanel1'
       
   623               #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -30 1.0)
       
   624               #handles: 
       
   625              #(#OrderedCollection
       
   626                 #Any 0.5
       
   627                 1.0
       
   628               )
       
   629               #component: 
       
   630              #(#SpecCollection
       
   631                 #collection: #(
       
   632                  #(#ViewSpec
       
   633                     #name: 'Box1'
       
   634                     #component: 
       
   635                    #(#SpecCollection
       
   636                       #collection: #(
       
   637                        #(#LabelSpec
       
   638                           #label: 'Methods only in Image'
       
   639                           #name: 'Label1'
       
   640                           #layout: #(#LayoutFrame 0 0 0 0 0 1 30 0)
       
   641                           #translateLabel: true
       
   642                           #adjust: #left
       
   643                         )
       
   644                        #(#SequenceViewSpec
       
   645                           #name: 'List2'
       
   646                           #layout: #(#LayoutFrame 0 0.0 30 0.0 0 1.0 0 1.0)
       
   647                           #hasHorizontalScrollBar: true
       
   648                           #hasVerticalScrollBar: true
       
   649                           #useIndex: false
       
   650                           #sequenceList: #methodsInImageOnly
       
   651                         )
       
   652                        )
       
   653                      
       
   654                     )
       
   655                   )
       
   656                  #(#ViewSpec
       
   657                     #name: 'Box2'
       
   658                     #component: 
       
   659                    #(#SpecCollection
       
   660                       #collection: #(
       
   661                        #(#LabelSpec
       
   662                           #label: 'Methods only in Project'
       
   663                           #name: 'Label2'
       
   664                           #layout: #(#LayoutFrame 0 0 0 0 0 1 30 0)
       
   665                           #translateLabel: true
       
   666                           #adjust: #left
       
   667                         )
       
   668                        #(#SequenceViewSpec
       
   669                           #name: 'List1'
       
   670                           #layout: #(#LayoutFrame 0 0.0 30 0.0 0 1.0 0 1.0)
       
   671                           #hasHorizontalScrollBar: true
       
   672                           #hasVerticalScrollBar: true
       
   673                           #useIndex: false
       
   674                           #sequenceList: #methodsInProjectOnly
       
   675                         )
       
   676                        )
       
   677                      
       
   678                     )
       
   679                   )
       
   680                  )
       
   681                
       
   682               )
       
   683             )
       
   684            #(#HorizontalPanelViewSpec
       
   685               #name: 'HorizontalPanel1'
       
   686               #layout: #(#LayoutFrame 0 0 -30 1 0 1 0 1)
       
   687               #horizontalLayout: #center
       
   688               #verticalLayout: #center
       
   689               #horizontalSpace: 3
       
   690               #verticalSpace: 3
       
   691               #component: 
       
   692              #(#SpecCollection
       
   693                 #collection: #(
       
   694                  #(#ActionButtonSpec
       
   695                     #label: 'OK'
       
   696                     #name: 'Button1'
       
   697                     #translateLabel: true
       
   698                     #model: #closeRequest
       
   699                     #extent: #(#Point 125 22)
       
   700                   )
       
   701                  )
       
   702                
       
   703               )
   584             )
   704             )
   585            )
   705            )
   586          
   706          
   587         )
   707         )
   588       )
   708       )
  2343         nil
  2463         nil
  2344         nil
  2464         nil
  2345       )
  2465       )
  2346 !
  2466 !
  2347 
  2467 
       
  2468 methodsItemMenu
       
  2469     "This resource specification was automatically generated
       
  2470      by the MenuEditor of ST/X."
       
  2471 
       
  2472     "Do not manually edit this!! If it is corrupted,
       
  2473      the MenuEditor may not be able to read the specification."
       
  2474 
       
  2475     "
       
  2476      MenuEditor new openOnClass:ProjectBrowser andSelector:#menu
       
  2477      (Menu new fromLiteralArrayEncoding:(ProjectBrowser menu)) startUp
       
  2478     "
       
  2479 
       
  2480     <resource: #menu>
       
  2481 
       
  2482     ^ 
       
  2483      #(#Menu
       
  2484         #(
       
  2485              #(#MenuItem
       
  2486                 #label: '-'
       
  2487             )
       
  2488              #(#MenuItem
       
  2489                 #label: 'Validate...'
       
  2490                 #translateLabel: true
       
  2491                 #value: #validateAgainstMethodsInImage
       
  2492                 #enabled: #hasMethodsSelectedHolder
       
  2493             )
       
  2494          )
       
  2495         nil
       
  2496         nil
       
  2497       )
       
  2498 !
       
  2499 
  2348 noItemMenu
  2500 noItemMenu
  2349     "This resource specification was automatically generated
  2501     "This resource specification was automatically generated
  2350      by the MenuEditor of ST/X."
  2502      by the MenuEditor of ST/X."
  2351 
  2503 
  2352     "Do not manually edit this!! If it is corrupted,
  2504     "Do not manually edit this!! If it is corrupted,
  3550         ^ self class classItemMenu
  3702         ^ self class classItemMenu
  3551     ].      
  3703     ].      
  3552     self hasMethodNodeSelected ifTrue:[
  3704     self hasMethodNodeSelected ifTrue:[
  3553         ^ self class methodItemMenu
  3705         ^ self class methodItemMenu
  3554     ].      
  3706     ].      
       
  3707     self hasPatchesNodeSelected ifTrue:[
       
  3708         ^ self class methodsItemMenu
       
  3709     ].      
  3555     self hasPrerequisiteClassesNodeSelected ifTrue:[
  3710     self hasPrerequisiteClassesNodeSelected ifTrue:[
  3556         ^ self class prerequisiteClassesItemMenu
  3711         ^ self class prerequisiteClassesItemMenu
  3557     ].      
  3712     ].      
  3558     ^ nil
  3713     ^ nil
  3559 !
  3714 !
  3715       and:[selectedNode contents key == #class]
  3870       and:[selectedNode contents key == #class]
  3716 
  3871 
  3717 !
  3872 !
  3718 
  3873 
  3719 hasClassesNodeSelected
  3874 hasClassesNodeSelected
       
  3875     ^ self hasNodeSelected:#classes.
       
  3876 
       
  3877 !
       
  3878 
       
  3879 hasMethodNodeSelected
  3720     |selectedNode|
  3880     |selectedNode|
  3721 
  3881 
  3722     selectedNode := self selectedTreeNode.
  3882     selectedNode := self selectedTreeNode.
  3723     selectedNode isNil ifTrue:[^ false].
  3883     selectedNode isNil ifTrue:[^ false].
  3724 
  3884 
  3725     ^ selectedNode contents == #classes
  3885     ^ selectedNode contents isAssociation
  3726 
  3886       and:[selectedNode contents key == #method]
  3727 !
  3887 
  3728 
  3888 !
  3729 hasMethodNodeSelected
  3889 
       
  3890 hasNodeSelected
       
  3891     ^ self selectedTreeNode notNil
       
  3892 
       
  3893 !
       
  3894 
       
  3895 hasNodeSelected:type
  3730     |selectedNode|
  3896     |selectedNode|
  3731 
  3897 
  3732     selectedNode := self selectedTreeNode.
  3898     selectedNode := self selectedTreeNode.
  3733     selectedNode isNil ifTrue:[^ false].
  3899     selectedNode isNil ifTrue:[^ false].
  3734 
  3900 
  3735     ^ selectedNode contents isAssociation
  3901     ^ selectedNode contents == type
  3736       and:[selectedNode contents key == #method]
  3902 
  3737 
  3903 !
  3738 !
  3904 
  3739 
  3905 hasPatchesNodeSelected
  3740 hasMethodsNodeSelected
  3906     ^ self hasNodeSelected:#patches.
  3741     |selectedNode|
       
  3742 
       
  3743     selectedNode := self selectedTreeNode.
       
  3744     selectedNode isNil ifTrue:[^ false].
       
  3745 
       
  3746     ^ selectedNode contents key == #patches
       
  3747 
       
  3748 !
       
  3749 
       
  3750 hasNodeSelected
       
  3751     ^ self selectedTreeNode notNil
       
  3752 
  3907 
  3753 !
  3908 !
  3754 
  3909 
  3755 hasPrerequisiteClassesNodeSelected
  3910 hasPrerequisiteClassesNodeSelected
  3756     |selectedNode|
  3911     ^ self hasNodeSelected:#prerequisiteClasses.
  3757 
       
  3758     selectedNode := self selectedTreeNode.
       
  3759     selectedNode isNil ifTrue:[^ false].
       
  3760 
       
  3761     ^ selectedNode contents == #prerequisiteClasses
       
  3762 
       
  3763 !
  3912 !
  3764 
  3913 
  3765 hasProjectNodeSelected
  3914 hasProjectNodeSelected
  3766     |selectedNode|
  3915     |selectedNode|
  3767 
  3916 
  3785     ].
  3934     ].
  3786     ^ false.
  3935     ^ false.
  3787 !
  3936 !
  3788 
  3937 
  3789 hasSubProjectsNodeSelected
  3938 hasSubProjectsNodeSelected
  3790     |selectedNode|
  3939     ^ self hasNodeSelected:#subprojects.
  3791 
       
  3792     selectedNode := self selectedTreeNode.
       
  3793     selectedNode isNil ifTrue:[^ false].
       
  3794 
       
  3795     ^ selectedNode contents == #subprojects
       
  3796 
  3940 
  3797 !
  3941 !
  3798 
  3942 
  3799 makeTranscriptVisible
  3943 makeTranscriptVisible
  3800     |transcript|
  3944     |transcript|
  3913     methodIcon := self class methodIcon.
  4057     methodIcon := self class methodIcon.
  3914 
  4058 
  3915     patchesNode contents:#patches.
  4059     patchesNode contents:#patches.
  3916     patchesNode icon:(self class methodsIcon).
  4060     patchesNode icon:(self class methodsIcon).
  3917     patchesNode info:'Patches & Extensions (system-changes) contained in the project'.
  4061     patchesNode info:'Patches & Extensions (system-changes) contained in the project'.
  3918     ((aProject methodInfo ? #()) copy 
  4062     (aProject methodInfo copy 
  3919         sort:[:a :b | 
  4063         sort:[:a :b | 
  3920                     a displayString < b displayString.
  4064                     a displayString < b displayString.
  3921             ]
  4065             ]
  3922     ) do:[:aMethodInfo |
  4066     ) do:[:aMethodInfo |
  3923         |cNode cName|
  4067         |cNode cName|
  5756     SimpleDialog
  5900     SimpleDialog
  5757         openDialogInterfaceSpec:(self class classValidationDialogSpec)
  5901         openDialogInterfaceSpec:(self class classValidationDialogSpec)
  5758         withBindings:bindings
  5902         withBindings:bindings
  5759 
  5903 
  5760     "Modified: / 26.9.1999 / 16:03:50 / cg"
  5904     "Modified: / 26.9.1999 / 16:03:50 / cg"
       
  5905 !
       
  5906 
       
  5907 validateAgainstMethodsInImage
       
  5908     "validate methods in project against methods found in the image"
       
  5909 
       
  5910     |project package methodsInProjectOnly methodsInImageOnly bindings who|
       
  5911 
       
  5912     project := self currentProject.
       
  5913     package := project package.
       
  5914 
       
  5915     methodsInImageOnly := IdentitySet new.
       
  5916     methodsInProjectOnly := IdentitySet new.
       
  5917 
       
  5918     Method allSubInstancesDo:[:aMethod |
       
  5919         aMethod package = package ifTrue:[
       
  5920             who := aMethod who.
       
  5921             who notNil ifTrue:[
       
  5922                 (project classInfoFor:who methodClass) isNil ifTrue:[
       
  5923                     "/ is it in the projects methodList ?
       
  5924                     (project includesMethod:aMethod) ifFalse:[
       
  5925                         methodsInImageOnly add:(who methodClass name , ' ' , who methodSelector).
       
  5926                     ]
       
  5927                 ]
       
  5928             ]
       
  5929          ]
       
  5930     ].
       
  5931 
       
  5932     project methodInfo do:[:mthdInfo |
       
  5933         |clsName sel cls m|
       
  5934 
       
  5935         clsName := mthdInfo className.
       
  5936         sel := mthdInfo methodName.
       
  5937         cls := Smalltalk at:clsName asSymbol.
       
  5938         (project includesClass:clsName) ifFalse:[
       
  5939             (cls isBehavior not 
       
  5940             or:[(m := cls compiledMethodAt:sel) isNil
       
  5941             or:[m package ~= package]]) ifTrue:[
       
  5942                 methodsInProjectOnly add:(clsName , ' ' , sel)
       
  5943             ].
       
  5944         ].
       
  5945     ].
       
  5946 
       
  5947     (methodsInImageOnly isEmpty and:[methodsInProjectOnly isEmpty]) ifTrue:[
       
  5948         self information:'Set of methods in project and image are equal.'.
       
  5949         ^ self.
       
  5950     ].
       
  5951 
       
  5952     methodsInImageOnly := methodsInImageOnly asOrderedCollection sort:[:a :b | a printString < b printString].
       
  5953     methodsInProjectOnly := methodsInProjectOnly asOrderedCollection sort:[:a :b | a printString < b printString].
       
  5954 
       
  5955     bindings := IdentityDictionary new.
       
  5956     bindings at:#methodsInImageOnly put:methodsInImageOnly.
       
  5957     bindings at:#methodsInProjectOnly put:methodsInProjectOnly.
       
  5958 
       
  5959     SimpleDialog
       
  5960         openDialogInterfaceSpec:(self class methodValidationDialogSpec)
       
  5961         withBindings:bindings
       
  5962 
       
  5963     "Modified: / 26.9.1999 / 16:03:50 / cg"
  5761 ! !
  5964 ! !
  5762 
  5965 
  5763 !ProjectBrowser::ProjectTreeItem methodsFor:'accessing'!
  5966 !ProjectBrowser::ProjectTreeItem methodsFor:'accessing'!
  5764 
  5967 
  5765 action
  5968 action