ProjectBrowser.st
changeset 1251 379bd54db35b
parent 1248 fc64935b7ff9
child 1253 9b66c237df0a
equal deleted inserted replaced
1250:644ed357b524 1251:379bd54db35b
    12 
    12 
    13 
    13 
    14 
    14 
    15 
    15 
    16 ToolApplicationModel subclass:#ProjectBrowser
    16 ToolApplicationModel subclass:#ProjectBrowser
    17 	instanceVariableNames:'projectTree modifiedChannel selectedTreeNodeHolder'
    17 	instanceVariableNames:'projectTree modifiedChannel selectedTreeNodeHolder
       
    18 		lastMoveToProject'
    18 	classVariableNames:'AlreadCheckedExistingModulesAndPackages'
    19 	classVariableNames:'AlreadCheckedExistingModulesAndPackages'
    19 	poolDictionaries:''
    20 	poolDictionaries:''
    20 	category:'Interface-Smalltalk'
    21 	category:'Interface-Smalltalk'
    21 !
    22 !
    22 
    23 
  1847        #(#WindowSpec
  1848        #(#WindowSpec
  1848           #label: 'ProjectBrowser'
  1849           #label: 'ProjectBrowser'
  1849           #name: 'ProjectBrowser'
  1850           #name: 'ProjectBrowser'
  1850           #min: #(#Point 10 10)
  1851           #min: #(#Point 10 10)
  1851           #max: #(#Point 1024 768)
  1852           #max: #(#Point 1024 768)
  1852           #bounds: #(#Rectangle 509 332 1112 883)
  1853           #bounds: #(#Rectangle 20 94 623 645)
  1853           #menu: #mainMenu
  1854           #menu: #mainMenu
  1854           #icon: #bigProjectBrowserIcon
  1855           #icon: #bigProjectBrowserIcon
  1855         )
  1856         )
  1856         #component: 
  1857         #component: 
  1857        #(#SpecCollection
  1858        #(#SpecCollection
  1901                      
  1902                      
  1902                     )
  1903                     )
  1903                     #handles: #(#Any 0.389718 1.0)
  1904                     #handles: #(#Any 0.389718 1.0)
  1904                   )
  1905                   )
  1905                  #(#ArbitraryComponentSpec
  1906                  #(#ArbitraryComponentSpec
  1906                     #name: 'ArbitraryComponent1'
  1907                     #name: 'commandOutputView'
       
  1908                     #hasHorizontalScrollBar: true
       
  1909                     #hasVerticalScrollBar: true
       
  1910                     #miniScrollerHorizontal: true
  1907                     #hasBorder: false
  1911                     #hasBorder: false
       
  1912                     #component: #TextCollector
  1908                   )
  1913                   )
  1909                  )
  1914                  )
  1910                
  1915                
  1911               )
  1916               )
  1912               #handles: #(#Any 0.987879 1.0)
  1917               #handles: #(#Any 0.987879 1.0)
  3739 
  3744 
  3740     ^ selectedNode contents == #subprojects
  3745     ^ selectedNode contents == #subprojects
  3741 
  3746 
  3742 !
  3747 !
  3743 
  3748 
       
  3749 makeTranscriptVisible
       
  3750     |transcript|
       
  3751 
       
  3752     transcript := self transcript.
       
  3753 
       
  3754     (transcript relativeCorner y - transcript relativeOrigin y) < 0.1 ifTrue:[
       
  3755         (self builder componentAt:#VariableVerticalPanel1)      
       
  3756             resizeSubViewsTo:#(0.7 0.3)
       
  3757     ].
       
  3758 
       
  3759 
       
  3760 
       
  3761 !
       
  3762 
  3744 nodeFor:aProject
  3763 nodeFor:aProject
  3745     "generate and return a treeNode for some project"
  3764     "generate and return a treeNode for some project"
  3746 
  3765 
  3747     |projectName pNode 
  3766     |projectName pNode 
  3748      propertiesNode docNode classesNode patchesNode subprojectsNode filesNode
  3767      propertiesNode docNode classesNode patchesNode subprojectsNode filesNode
  4122     mthd := methodInfo method.
  4141     mthd := methodInfo method.
  4123     mthd isNil ifTrue:[
  4142     mthd isNil ifTrue:[
  4124         self valueOfInfoLabel value:'The method is not (yet) loaded.'.
  4143         self valueOfInfoLabel value:'The method is not (yet) loaded.'.
  4125     ].
  4144     ].
  4126     ^ mthd
  4145     ^ mthd
       
  4146 !
       
  4147 
       
  4148 transcript
       
  4149     ^ self builder componentAt:#commandOutputView
  4127 !
  4150 !
  4128 
  4151 
  4129 updateProjectTree
  4152 updateProjectTree
  4130     |tree moduleRoots root showWhat|
  4153     |tree moduleRoots root showWhat|
  4131 
  4154 
  5196     p isNil ifTrue:[
  5219     p isNil ifTrue:[
  5197         self information:'No project selected'.
  5220         self information:'No project selected'.
  5198         ^ self
  5221         ^ self
  5199     ].
  5222     ].
  5200 
  5223 
       
  5224     self makeTranscriptVisible.
       
  5225 
  5201     self withCursor:Cursor wait do:[
  5226     self withCursor:Cursor wait do:[
  5202         "/ prepare the building ...
  5227         "/ prepare the building ...
  5203 
  5228 
  5204         (p propertyAt:#deliverLoadAllFile) == true ifTrue:[
  5229         TextCollector transcriptQuerySignal answer:self transcript
  5205             p createLoadAllFile
  5230         do:[
  5206         ].
  5231             (p propertyAt:#deliverLoadAllFile) == true ifTrue:[
  5207 
  5232                 p createLoadAllFile
  5208         (p propertyAt:#deliverSources) == true ifTrue:[
  5233             ].
  5209             p createSourceFiles
  5234 
  5210         ].
  5235             (p propertyAt:#deliverSources) == true ifTrue:[
  5211 
  5236                 p createSourceFiles
  5212         (p propertyAt:#deliverMakefiles) == true ifTrue:[
  5237             ].
  5213             self buildMakefiles
  5238 
  5214         ].
  5239             (p propertyAt:#deliverMakefiles) == true ifTrue:[
  5215 
  5240                 self buildMakefiles
  5216         (p propertyAt:#deliverCompiledBinary) == true ifTrue:[
  5241             ].
  5217             self buildCompiledClassLibrary
  5242 
  5218         ].
  5243             (p propertyAt:#deliverCompiledBinary) == true ifTrue:[
  5219 
  5244                 self buildCompiledClassLibrary
  5220         (p propertyAt:#deliverByteCode) == true ifTrue:[
  5245             ].
  5221             self buildByteCodeClassLibrary
  5246 
  5222         ].
  5247             (p propertyAt:#deliverByteCode) == true ifTrue:[
  5223 
  5248                 self buildByteCodeClassLibrary
  5224         "/ now, deploy ...
  5249             ].
  5225 
  5250 
  5226         (p propertyAt:#deliverZipArchive) == true ifTrue:[
  5251             "/ now, deploy ...
  5227             p buildZipArchive
  5252 
  5228         ].
  5253             (p propertyAt:#deliverZipArchive) == true ifTrue:[
  5229 
  5254                 p buildZipArchive
  5230         (p propertyAt:#deliverTarArchive) == true ifTrue:[
  5255             ].
  5231             p buildTarArchive
  5256 
  5232         ].
  5257             (p propertyAt:#deliverTarArchive) == true ifTrue:[
  5233 
  5258                 p buildTarArchive
  5234         (p propertyAt:#deliverGZipArchive) == true ifTrue:[
  5259             ].
  5235             p buildGZipArchive
  5260 
       
  5261             (p propertyAt:#deliverGZipArchive) == true ifTrue:[
       
  5262                 p buildGZipArchive
       
  5263             ].
  5236         ].
  5264         ].
  5237     ].
  5265     ].
  5238 
  5266 
  5239 
  5267 
  5240 !
  5268 !
  5241 
  5269 
  5242 buildCompiledClassLibrary
  5270 buildCompiledClassLibrary
  5243     "compile a binary class library in the projects directory"
  5271     "compile a binary class library in the projects directory"
  5244 
  5272 
  5245     |p diagnosticFile diagnostic error textBox|
  5273     |p diagnostic error textBox|
  5246 
  5274 
  5247     p := self currentProject.
  5275     p := self currentProject.
  5248     p isNil ifTrue:[
  5276     p isNil ifTrue:[
  5249         self information:'No project selected'.
  5277         self information:'No project selected'.
  5250         ^ self
  5278         ^ self
  5263     "/ check for Makefile ...
  5291     "/ check for Makefile ...
  5264     (self checkForMakefileFor:p) ifFalse:[
  5292     (self checkForMakefileFor:p) ifFalse:[
  5265         ^ self
  5293         ^ self
  5266     ].
  5294     ].
  5267 
  5295 
       
  5296     self makeTranscriptVisible.
       
  5297 
  5268     "/ now, execute the makefile found there ...
  5298     "/ now, execute the makefile found there ...
  5269     diagnosticFile := Filename newTemporary.
  5299     diagnostic := self transcript.
  5270     diagnostic := diagnosticFile writeStream.
  5300 
  5271     error := false.
  5301     error := false.
  5272 
  5302     diagnostic nextPutLine:('Building compiled class library...' asText emphasizeAllWith:#color->Color blue).
  5273     [
  5303 
  5274         self withCursor:Cursor wait do:[
  5304     self withCursor:Cursor wait do:[
  5275             OperatingSystem
  5305         OperatingSystem
  5276                 executeCommand:'make' 
  5306             executeCommand:'make' 
  5277                 inputFrom:nil 
  5307             inputFrom:nil 
  5278                 outputTo:diagnostic 
  5308             outputTo:diagnostic 
  5279                 errorTo:diagnostic 
  5309             errorTo:diagnostic 
  5280                 inDirectory:(p directory asFilename pathName) 
  5310             inDirectory:(p directory asFilename pathName) 
  5281                 onError:[error := true].
  5311             onError:[error := true].
  5282         ].
  5312     ].
  5283 
  5313 
  5284         diagnostic close.
       
  5285 
       
  5286         textBox := TextBox new.
       
  5287         textBox initialText:(diagnosticFile readStream contents).
       
  5288         textBox title:'Make Diagnostic output:'.
       
  5289         textBox readOnly:true.
       
  5290         textBox noCancel.
       
  5291         textBox label:'Make Diagnostic output'.
       
  5292         textBox extent:(600@250); sizeFixed:true.
       
  5293         textBox showAtPointer.
       
  5294 
       
  5295     ] valueNowOrOnUnwindDo:[
       
  5296         diagnosticFile delete
       
  5297     ].
       
  5298 
  5314 
  5299 
  5315 
  5300 !
  5316 !
  5301 
  5317 
  5302 buildLoadAllFile
  5318 buildLoadAllFile
  5309         self information:'No project selected'.
  5325         self information:'No project selected'.
  5310         ^ self
  5326         ^ self
  5311     ].
  5327     ].
  5312 
  5328 
  5313     self withCursor:Cursor wait do:[
  5329     self withCursor:Cursor wait do:[
  5314         p createLoadAllFile.
  5330         self makeTranscriptVisible.
       
  5331         TextCollector transcriptQuerySignal answer:self transcript
       
  5332         do:[
       
  5333             p createLoadAllFile.
       
  5334         ]
  5315     ]
  5335     ]
  5316 !
  5336 !
  5317 
  5337 
  5318 buildMakefiles
  5338 buildMakefiles
  5319     "generate a Make.proto and Makefile in the projects directory"
  5339     "generate a Make.proto and Makefile in the projects directory"
  5325         self information:'No project selected'.
  5345         self information:'No project selected'.
  5326         ^ self
  5346         ^ self
  5327     ].
  5347     ].
  5328 
  5348 
  5329     self withCursor:Cursor wait do:[
  5349     self withCursor:Cursor wait do:[
  5330         p createProtoMakefile.
  5350         self makeTranscriptVisible.
  5331         p createMakefile
  5351         TextCollector transcriptQuerySignal answer:self transcript
       
  5352         do:[
       
  5353             p createProtoMakefile.
       
  5354             p createMakefile
       
  5355         ]
  5332     ].
  5356     ].
  5333 !
  5357 !
  5334 
  5358 
  5335 checkInAllClasses
  5359 checkInAllClasses
  5336     "check in all classes"
  5360     "check in all classes"
  5462 
  5486 
  5463     p := self currentProject.
  5487     p := self currentProject.
  5464 
  5488 
  5465     mthd := self selectedMethod.
  5489     mthd := self selectedMethod.
  5466     mthd notNil ifTrue:[
  5490     mthd notNil ifTrue:[
  5467         newPackage := Dialog request:'Move to project:'.
  5491         newPackage := Dialog request:'Move to project:' initialAnswer:lastMoveToProject.
  5468         (newPackage size > 0 and:[newPackage ~= p package]) ifTrue:[
  5492         newPackage size > 0 ifTrue:[
  5469             mthd package:newPackage asSymbol.
  5493             lastMoveToProject := newPackage.
  5470             p removeMethod:mthd.
  5494             newPackage ~= p package ifTrue:[
  5471             self updatePatchesListForProject:p.
  5495                 mthd package:newPackage asSymbol.
  5472             self projectTree remove:self selectedTreeNode.
  5496                 p removeMethod:mthd.
       
  5497                 self updatePatchesListForProject:p.
       
  5498                 self projectTree remove:self selectedTreeNode.
       
  5499             ]
  5473         ]
  5500         ]
  5474     ].
  5501     ].
  5475 !
  5502 !
  5476 
  5503 
  5477 newProject
  5504 newProject