ProjectBrowser.st
changeset 1240 18fa01008a4f
parent 1239 a95243b3ab4a
child 1241 3bbc7d113387
equal deleted inserted replaced
1239:a95243b3ab4a 1240:18fa01008a4f
   420     ^Icon
   420     ^Icon
   421         constantNamed:#'ProjectBrowser projectsIcon'
   421         constantNamed:#'ProjectBrowser projectsIcon'
   422         ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@"H"H"@@@@@"H"H"@ @@@"H"H"@"@@@@@@@@@"H@@BH"H"HBH @@H"H"H H"@@@"H"H"@"H@@BH"H"HBH @@H"H"H H @@@"H"H"@ @@@BH"H"H@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 0 0 132 255 128 128]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@G? ?>G?8??''?>_?9??''?>_?9??G?8_?A?8@@@@@@b') ; yourself); yourself]! !
   422         ifAbsentPut:[(Depth4Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@"H"H"@@@@@"H"H"@ @@@"H"H"@"@@@@@@@@@"H@@BH"H"HBH @@H"H"H H"@@@"H"H"@"H@@BH"H"HBH @@H"H"H H @@@"H"H"@ @@@BH"H"H@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 0 0 132 255 128 128]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@G? ?>G?8??''?>_?9??''?>_?9??G?8_?A?8@@@@@@b') ; yourself); yourself]! !
   423 
   423 
   424 !ProjectBrowser class methodsFor:'interface specs'!
   424 !ProjectBrowser class methodsFor:'interface specs'!
       
   425 
       
   426 classValidationDialogSpec
       
   427     "This resource specification was automatically generated
       
   428      by the UIPainter of ST/X."
       
   429 
       
   430     "Do not manually edit this!! If it is corrupted,
       
   431      the UIPainter may not be able to read the specification."
       
   432 
       
   433     "
       
   434      UIPainter new openOnClass:ProjectBrowser andSelector:#classValidationDialogSpec
       
   435      ProjectBrowser new openInterface:#classValidationDialogSpec
       
   436     "
       
   437 
       
   438     <resource: #canvas>
       
   439 
       
   440     ^ 
       
   441      #(#FullSpec
       
   442         #name: #classValidationDialogSpec
       
   443         #window: 
       
   444        #(#WindowSpec
       
   445           #label: 'ProjectBrowser'
       
   446           #name: 'ProjectBrowser'
       
   447           #min: #(#Point 10 10)
       
   448           #max: #(#Point 1024 768)
       
   449           #bounds: #(#Rectangle 24 554 457 1003)
       
   450           #menu: #mainMenu
       
   451           #icon: #bigProjectBrowserIcon
       
   452         )
       
   453         #component: 
       
   454        #(#SpecCollection
       
   455           #collection: #(
       
   456            #(#VariableVerticalPanelSpec
       
   457               #name: 'VariableVerticalPanel1'
       
   458               #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -30 1.0)
       
   459               #handles: 
       
   460              #(#OrderedCollection
       
   461                 #Any 0.5
       
   462                 1.0
       
   463               )
       
   464               #component: 
       
   465              #(#SpecCollection
       
   466                 #collection: #(
       
   467                  #(#ViewSpec
       
   468                     #name: 'Box1'
       
   469                     #component: 
       
   470                    #(#SpecCollection
       
   471                       #collection: #(
       
   472                        #(#LabelSpec
       
   473                           #label: 'Classes only in Image'
       
   474                           #name: 'Label1'
       
   475                           #layout: #(#LayoutFrame 0 0 0 0 0 1 30 0)
       
   476                           #translateLabel: true
       
   477                           #adjust: #left
       
   478                         )
       
   479                        #(#SequenceViewSpec
       
   480                           #name: 'List2'
       
   481                           #layout: #(#LayoutFrame 0 0.0 30 0.0 0 1.0 0 1.0)
       
   482                           #hasHorizontalScrollBar: true
       
   483                           #hasVerticalScrollBar: true
       
   484                           #useIndex: false
       
   485                           #sequenceList: #classesInImageOnly
       
   486                         )
       
   487                        )
       
   488                      
       
   489                     )
       
   490                   )
       
   491                  #(#ViewSpec
       
   492                     #name: 'Box2'
       
   493                     #component: 
       
   494                    #(#SpecCollection
       
   495                       #collection: #(
       
   496                        #(#LabelSpec
       
   497                           #label: 'Classes only in Project'
       
   498                           #name: 'Label2'
       
   499                           #layout: #(#LayoutFrame 0 0 0 0 0 1 30 0)
       
   500                           #translateLabel: true
       
   501                           #adjust: #left
       
   502                         )
       
   503                        #(#SequenceViewSpec
       
   504                           #name: 'List1'
       
   505                           #layout: #(#LayoutFrame 0 0.0 30 0.0 0 1.0 0 1.0)
       
   506                           #hasHorizontalScrollBar: true
       
   507                           #hasVerticalScrollBar: true
       
   508                           #useIndex: false
       
   509                           #sequenceList: #classesInProjectOnly
       
   510                         )
       
   511                        )
       
   512                      
       
   513                     )
       
   514                   )
       
   515                  )
       
   516                
       
   517               )
       
   518             )
       
   519            #(#HorizontalPanelViewSpec
       
   520               #name: 'HorizontalPanel1'
       
   521               #layout: #(#LayoutFrame 0 0 -30 1 0 1 0 1)
       
   522               #horizontalLayout: #center
       
   523               #verticalLayout: #center
       
   524               #horizontalSpace: 3
       
   525               #verticalSpace: 3
       
   526               #component: 
       
   527              #(#SpecCollection
       
   528                 #collection: #(
       
   529                  #(#ActionButtonSpec
       
   530                     #label: 'OK'
       
   531                     #name: 'Button1'
       
   532                     #translateLabel: true
       
   533                     #model: #closeRequest
       
   534                     #extent: #(#Point 125 22)
       
   535                   )
       
   536                  )
       
   537                
       
   538               )
       
   539             )
       
   540            )
       
   541          
       
   542         )
       
   543       )
       
   544 !
   425 
   545 
   426 emptyRightCanvasSpec
   546 emptyRightCanvasSpec
   427     "This resource specification was automatically generated
   547     "This resource specification was automatically generated
   428      by the UIPainter of ST/X."
   548      by the UIPainter of ST/X."
   429 
   549 
  1892             )
  2012             )
  1893              #(#MenuItem
  2013              #(#MenuItem
  1894                 #label: '-'
  2014                 #label: '-'
  1895             )
  2015             )
  1896              #(#MenuItem
  2016              #(#MenuItem
       
  2017                 #label: 'Validate...'
       
  2018                 #translateLabel: true
       
  2019                 #value: #validateAgainstClassesInImage
       
  2020                 #enabled: #hasClassesSelectedHolder
       
  2021             )
       
  2022 
       
  2023              #(#MenuItem
       
  2024                 #label: '-'
       
  2025             )
       
  2026              #(#MenuItem
  1897                 #label: 'Browse...'
  2027                 #label: 'Browse...'
  1898                 #translateLabel: true
  2028                 #translateLabel: true
  1899                 #value: #browseClasses
  2029                 #value: #browseClasses
  1900                 #enabled: #hasClassesSelectedHolder
  2030                 #enabled: #hasClassesSelectedHolder
  1901             )
  2031             )
  4496         ] ifTrue:[
  4626         ] ifTrue:[
  4497             aClass isLoaded ifFalse:[
  4627             aClass isLoaded ifFalse:[
  4498                 Transcript showCR:('ProjectBrowser: cannot checkIn unloaded class: ' , aClass name).
  4628                 Transcript showCR:('ProjectBrowser: cannot checkIn unloaded class: ' , aClass name).
  4499             ] ifTrue:[
  4629             ] ifTrue:[
  4500                 aClass owningClass isNil ifTrue:[ "/ skip private classes
  4630                 aClass owningClass isNil ifTrue:[ "/ skip private classes
       
  4631                     Transcript showCR:('ProjectBrowser: checking in class: ' , aClass name).
  4501                     self checkInClass:aClass.
  4632                     self checkInClass:aClass.
  4502                 ]
  4633                 ]
  4503             ]
  4634             ]
  4504         ]
  4635         ]
  4505     ].
  4636     ].
  4516             ]
  4647             ]
  4517         ].
  4648         ].
  4518         anyMethodMissing ifTrue:[
  4649         anyMethodMissing ifTrue:[
  4519             Transcript showCR:'ProjectBrowser: cannot save method patches & extensions due to missing method(s)'.
  4650             Transcript showCR:'ProjectBrowser: cannot save method patches & extensions due to missing method(s)'.
  4520         ] ifFalse:[
  4651         ] ifFalse:[
       
  4652             Transcript showCR:('ProjectBrowser: checking in patches & extensions').
  4521             self checkInMethods:methods
  4653             self checkInMethods:methods
  4522         ].
  4654         ].
  4523     ].
  4655     ].
  4524 
  4656 
  4525     "/ check in the project file itself
  4657     "/ check in the project file itself
  5116     l := self patchesList.
  5248     l := self patchesList.
  5117     l removeAll.
  5249     l removeAll.
  5118     l addAll:methodInfo.
  5250     l addAll:methodInfo.
  5119 
  5251 
  5120 
  5252 
       
  5253 !
       
  5254 
       
  5255 validateAgainstClassesInImage
       
  5256     "validate classes in project against classes found in the image"
       
  5257 
       
  5258     |project classesInProjectOnly classesInImageOnly bindings|
       
  5259 
       
  5260     project := self currentProject.
       
  5261     classesInImageOnly := IdentitySet new.
       
  5262     classesInProjectOnly := IdentitySet new.
       
  5263 
       
  5264     Smalltalk allClassesDo:[:aClass |
       
  5265         aClass isMeta ifFalse:[
       
  5266             (aClass isNamespace not or:[aClass == Smalltalk]) ifTrue:[
       
  5267                 aClass package = project package ifTrue:[
       
  5268                     (project classInfoFor:aClass) isNil ifTrue:[
       
  5269                         classesInImageOnly add:aClass name.
       
  5270                     ]
       
  5271                  ]
       
  5272              ]
       
  5273         ]
       
  5274     ].
       
  5275     project classInfo do:[:clsInfo |
       
  5276         |clsName cls|
       
  5277 
       
  5278         clsName := clsInfo className.
       
  5279         cls := Smalltalk at:clsName asSymbol.
       
  5280         (cls isBehavior not) ifTrue:[
       
  5281             classesInProjectOnly add:clsName
       
  5282         ].
       
  5283     ].
       
  5284 
       
  5285     (classesInImageOnly isEmpty and:[classesInProjectOnly isEmpty]) ifTrue:[
       
  5286         self information:'Set of classes in project and image are equesl.'.
       
  5287         ^ self.
       
  5288     ].
       
  5289 
       
  5290     classesInImageOnly := classesInImageOnly asOrderedCollection sort.
       
  5291     classesInProjectOnly := classesInProjectOnly asOrderedCollection sort.
       
  5292 
       
  5293     bindings := IdentityDictionary new.
       
  5294     bindings at:#classesInImageOnly put:classesInImageOnly.
       
  5295     bindings at:#classesInProjectOnly put:classesInProjectOnly.
       
  5296 
       
  5297     SimpleDialog
       
  5298         openDialogInterfaceSpec:(self class classValidationDialogSpec)
       
  5299         withBindings:bindings
       
  5300 
  5121 ! !
  5301 ! !
  5122 
  5302 
  5123 !ProjectBrowser methodsFor:'user actions - canvas'!
  5303 !ProjectBrowser methodsFor:'user actions - canvas'!
  5124 
  5304 
  5125 accept
  5305 accept