4338 |
4373 |
4339 self updateClassListForProject:p |
4374 self updateClassListForProject:p |
4340 |
4375 |
4341 ! |
4376 ! |
4342 |
4377 |
4343 addClassesFromFilesInDirectory |
|
4344 self addClassesFromFilesInDirectoryWithFilter:nil |
|
4345 ! |
|
4346 |
|
4347 addClassesFromFilesInDirectoryIfPresentInImage |
|
4348 self addClassesFromFilesInDirectoryWithFilter:[:classOrName | classOrName isBehavior] |
|
4349 |
|
4350 ! |
|
4351 |
|
4352 addClassesFromFilesInDirectoryWithFilter:aFilterBlockOrNil |
|
4353 |project existingClasses prjDirectory anyChange numSTFilesFound| |
|
4354 |
|
4355 project := self currentProject. |
|
4356 |
|
4357 existingClasses := project classInfo. |
|
4358 anyChange := false. |
|
4359 numSTFilesFound := 0. |
|
4360 |
|
4361 prjDirectory := project directory asFilename. |
|
4362 (prjDirectory exists and:[prjDirectory isDirectory]) ifFalse:[ |
|
4363 self warn:'Invalid project directory: ' , prjDirectory pathName. |
|
4364 ^ self |
|
4365 ]. |
|
4366 |
|
4367 prjDirectory directoryContents do:[:fn | |
|
4368 |f oldInfo cls| |
|
4369 |
|
4370 f := prjDirectory construct:fn. |
|
4371 (f hasSuffix:'st') ifTrue:[ |
|
4372 numSTFilesFound := numSTFilesFound + 1. |
|
4373 |
|
4374 oldInfo := existingClasses |
|
4375 detect:[:clsInfo | |
|
4376 clsInfo classFileName = fn |
|
4377 ] |
|
4378 ifNone:nil. |
|
4379 oldInfo isNil ifTrue:[ |
|
4380 "/ extract className from fileName ... |
|
4381 cls := Smalltalk filenameAbbreviations keyAtValue:(f withoutSuffix baseName ). |
|
4382 cls isNil ifTrue:[ |
|
4383 cls := f withoutSuffix baseName asSymbol. |
|
4384 project defaultNameSpace notNil ifTrue:[ |
|
4385 cls := (project defaultNameSpace name , '::' , cls) asSymbol |
|
4386 ] |
|
4387 ]. |
|
4388 (aFilterBlockOrNil isNil |
|
4389 or:[aFilterBlockOrNil value:cls]) ifTrue:[ |
|
4390 project addClass:cls classFileName:fn. |
|
4391 anyChange := true. |
|
4392 Transcript showCR:'added ' , fn , ' as class: ' , cls printString. |
|
4393 ] ifFalse:[ |
|
4394 Transcript showCR:'skipped ' , fn , ' as class: ' , cls printString. |
|
4395 ] |
|
4396 |
|
4397 ] |
|
4398 ] |
|
4399 ]. |
|
4400 |
|
4401 anyChange ifTrue:[ |
|
4402 self updateClassListForProject:project |
|
4403 ] ifFalse:[ |
|
4404 numSTFilesFound == 0 ifTrue:[ |
|
4405 self information:'No st-sourcefiles found in ' , prjDirectory pathName. |
|
4406 ] |
|
4407 ] |
|
4408 ! |
|
4409 |
|
4410 addClassesFromImage |
|
4411 "add classes with this packageId found in the image" |
|
4412 |
|
4413 |project| |
|
4414 |
|
4415 project := self currentProject. |
|
4416 Smalltalk allClassesDo:[:aClass | |
|
4417 aClass isMeta ifFalse:[ |
|
4418 (aClass isNamespace not or:[aClass == Smalltalk]) ifTrue:[ |
|
4419 aClass package = project package ifTrue:[ |
|
4420 (project classInfoFor:aClass) isNil ifTrue:[ |
|
4421 project |
|
4422 addClass:aClass name |
|
4423 classFileName:(aClass classFilename |
|
4424 ? ((Smalltalk fileNameForClass:aClass) , '.st')). |
|
4425 ] |
|
4426 ] |
|
4427 ] |
|
4428 ] |
|
4429 ]. |
|
4430 |
|
4431 self updateClassListForProject:project |
|
4432 |
|
4433 ! |
|
4434 |
|
4435 browseClasses |
|
4436 |ns p classes nBad uniqueClasses| |
|
4437 |
|
4438 p := self currentProject. |
|
4439 classes := p classes |
|
4440 collect:[:clsOrName | |
|
4441 |cls realName| |
|
4442 |
|
4443 clsOrName isSymbol ifTrue:[ |
|
4444 realName := clsOrName. |
|
4445 (realName includes:$:) ifTrue:[ |
|
4446 (realName startsWith:'Smalltalk::') ifTrue:[ |
|
4447 realName := (realName copyFrom:'Smalltalk::' size + 1) asSymbol |
|
4448 ] |
|
4449 ]. |
|
4450 cls := Smalltalk at:realName |
|
4451 ] ifFalse:[ |
|
4452 cls := clsOrName |
|
4453 ]. |
|
4454 cls |
|
4455 ]. |
|
4456 |
|
4457 "/ remove duplicates - but want to preserve order |
|
4458 "/ thats why we do not use asIdentitySet asOrderedCollection |
|
4459 uniqueClasses := OrderedCollection new. |
|
4460 classes do:[:cls | (uniqueClasses includesIdentical:cls) ifFalse:[uniqueClasses add:cls]]. |
|
4461 |
|
4462 nBad := classes inject:0 into:[:sum :el | el isNil ifTrue:[sum+1] ifFalse:[sum]]. |
|
4463 nBad ~~ 0 ifTrue:[ |
|
4464 classes := classes select:[:cls | cls notNil]. |
|
4465 self warn:('Oops - %1 classes could not be found.\\You should probably load them first.' bindWith:nBad) withCRs. |
|
4466 ]. |
|
4467 |
|
4468 |
|
4469 SystemBrowser |
|
4470 browseClasses:classes title:('Classes in ' , p name) sort:true. |
|
4471 |
|
4472 |
|
4473 |
|
4474 ! |
|
4475 |
|
4476 buildAll |
|
4477 |p| |
|
4478 |
|
4479 p := self currentProject. |
|
4480 p isNil ifTrue:[ |
|
4481 self information:'No project selected'. |
|
4482 ^ self |
|
4483 ]. |
|
4484 |
|
4485 self withCursor:Cursor wait do:[ |
|
4486 "/ prepare the building ... |
|
4487 |
|
4488 (p propertyAt:#deliverLoadAllFile) == true ifTrue:[ |
|
4489 p createLoadAllFile |
|
4490 ]. |
|
4491 |
|
4492 (p propertyAt:#deliverSources) == true ifTrue:[ |
|
4493 p createSourceFiles |
|
4494 ]. |
|
4495 |
|
4496 (p propertyAt:#deliverMakefiles) == true ifTrue:[ |
|
4497 self buildMakefiles |
|
4498 ]. |
|
4499 |
|
4500 (p propertyAt:#deliverCompiledBinary) == true ifTrue:[ |
|
4501 self buildCompiledClassLibrary |
|
4502 ]. |
|
4503 |
|
4504 (p propertyAt:#deliverByteCode) == true ifTrue:[ |
|
4505 self buildByteCodeClassLibrary |
|
4506 ]. |
|
4507 |
|
4508 "/ now, deploy ... |
|
4509 |
|
4510 (p propertyAt:#deliverZipArchive) == true ifTrue:[ |
|
4511 p buildZipArchive |
|
4512 ]. |
|
4513 |
|
4514 (p propertyAt:#deliverTarArchive) == true ifTrue:[ |
|
4515 p buildTarArchive |
|
4516 ]. |
|
4517 |
|
4518 (p propertyAt:#deliverGZipArchive) == true ifTrue:[ |
|
4519 p buildGZipArchive |
|
4520 ]. |
|
4521 ]. |
|
4522 |
|
4523 |
|
4524 ! |
|
4525 |
|
4526 buildCompiledClassLibrary |
|
4527 "compile a binary class library in the projects directory" |
|
4528 |p diagnosticFile diagnostic error textBox| |
|
4529 |
|
4530 p := self currentProject. |
|
4531 p isNil ifTrue:[ |
|
4532 self information:'No project selected'. |
|
4533 ^ self |
|
4534 ]. |
|
4535 |
|
4536 "/ check for directory ... |
|
4537 (self checkForProjectDirectoryFor:p) ifFalse:[ |
|
4538 ^ self |
|
4539 ]. |
|
4540 |
|
4541 "/ check for Make.proto ... |
|
4542 (self checkForMakeProtoFor:p) ifFalse:[ |
|
4543 ^ self |
|
4544 ]. |
|
4545 |
|
4546 "/ check for Makefile ... |
|
4547 (self checkForMakefileFor:p) ifFalse:[ |
|
4548 ^ self |
|
4549 ]. |
|
4550 |
|
4551 "/ now, execute the makefile found there ... |
|
4552 diagnosticFile := Filename newTemporary. |
|
4553 diagnostic := diagnosticFile writeStream. |
|
4554 error := false. |
|
4555 |
|
4556 [ |
|
4557 self withCursor:Cursor wait do:[ |
|
4558 OperatingSystem |
|
4559 executeCommand:'make' |
|
4560 inputFrom:nil |
|
4561 outputTo:diagnostic |
|
4562 errorTo:diagnostic |
|
4563 inDirectory:(p directory asFilename pathName) |
|
4564 onError:[error := true]. |
|
4565 ]. |
|
4566 |
|
4567 diagnostic close. |
|
4568 |
|
4569 textBox := TextBox new. |
|
4570 textBox initialText:(diagnosticFile readStream contents). |
|
4571 textBox title:'Make Diagnostic output:'. |
|
4572 textBox readOnly:true. |
|
4573 textBox noCancel. |
|
4574 textBox label:'Make Diagnostic output'. |
|
4575 textBox extent:(600@250); sizeFixed:true. |
|
4576 textBox showAtPointer. |
|
4577 |
|
4578 ] valueNowOrOnUnwindDo:[ |
|
4579 diagnosticFile delete |
|
4580 ]. |
|
4581 |
|
4582 |
|
4583 ! |
|
4584 |
|
4585 buildLoadAllFile |
|
4586 |p | |
|
4587 |
|
4588 p := self currentProject. |
|
4589 p isNil ifTrue:[ |
|
4590 self information:'No project selected'. |
|
4591 ^ self |
|
4592 ]. |
|
4593 |
|
4594 self withCursor:Cursor wait do:[ |
|
4595 p createLoadAllFile. |
|
4596 ] |
|
4597 ! |
|
4598 |
|
4599 buildMakefiles |
|
4600 |p | |
|
4601 |
|
4602 p := self currentProject. |
|
4603 p isNil ifTrue:[ |
|
4604 self information:'No project selected'. |
|
4605 ^ self |
|
4606 ]. |
|
4607 |
|
4608 self withCursor:Cursor wait do:[ |
|
4609 p createProtoMakefile. |
|
4610 p createMakefile |
|
4611 ]. |
|
4612 ! |
|
4613 |
|
4614 checkInProject |
|
4615 |p classes methods anyMethodMissing| |
|
4616 |
|
4617 p := self currentProject. |
|
4618 p isNil ifTrue:[ |
|
4619 self information:'No project selected'. |
|
4620 ^ self |
|
4621 ]. |
|
4622 |
|
4623 "/ check in classes ... |
|
4624 |
|
4625 classes := p classes. |
|
4626 classes do:[:aClass | |
|
4627 |clsName| |
|
4628 |
|
4629 aClass isBehavior ifFalse:[ |
|
4630 aClass isSymbol ifTrue:[ |
|
4631 clsName := aClass |
|
4632 ] ifFalse:[ |
|
4633 clsName := aClass className |
|
4634 ]. |
|
4635 Transcript showCR:('ProjectBrowser: cannot checkIn unloaded class: ' , clsName). |
|
4636 ] ifTrue:[ |
|
4637 aClass isLoaded ifFalse:[ |
|
4638 Transcript showCR:('ProjectBrowser: cannot checkIn unloaded class: ' , aClass name). |
|
4639 ] ifTrue:[ |
|
4640 aClass owningClass isNil ifTrue:[ "/ skip private classes |
|
4641 Transcript showCR:('ProjectBrowser: checking in class: ' , aClass name). |
|
4642 self checkInClass:aClass. |
|
4643 ] |
|
4644 ] |
|
4645 ] |
|
4646 ]. |
|
4647 |
|
4648 "/ check methods ... |
|
4649 |
|
4650 anyMethodMissing := false. |
|
4651 methods := p methods. |
|
4652 methods size > 0 ifTrue:[ |
|
4653 methods do:[:aMethod | |
|
4654 aMethod isMethod ifFalse:[ |
|
4655 Transcript showCR:('ProjectBrowser: cannot checkIn unloaded method: ' , aMethod className , ' ' , aMethod methodName). |
|
4656 anyMethodMissing := true. |
|
4657 ] |
|
4658 ]. |
|
4659 anyMethodMissing ifTrue:[ |
|
4660 Transcript showCR:'ProjectBrowser: cannot save method patches & extensions due to missing method(s)'. |
|
4661 ] ifFalse:[ |
|
4662 Transcript showCR:('ProjectBrowser: checking in patches & extensions'). |
|
4663 self checkInMethods:methods |
|
4664 ]. |
|
4665 ]. |
|
4666 |
|
4667 "/ check in the project file itself |
|
4668 self checkInProjectFile. |
|
4669 |
|
4670 ! |
|
4671 |
|
4672 inspectCurrentProject |
|
4673 "inspect the current project" |
|
4674 |
|
4675 self hasProjectSelected ifTrue:[ |
|
4676 self currentProject inspect. |
|
4677 ] |
|
4678 ! |
|
4679 |
|
4680 itemDoubleClicked:index |
4378 itemDoubleClicked:index |
4681 |node classOrClassName cls| |
4379 |node classOrClassName cls| |
4682 |
4380 |
4683 self hasClassNodeSelected ifTrue:[ |
4381 self hasClassNodeSelected ifTrue:[ |
4684 node := self selectedTreeNode. |
4382 node := self selectedTreeNode. |
5504 ]. |
5005 ]. |
5505 ]. |
5006 ]. |
5506 self valueOfInfoLabel value:nil |
5007 self valueOfInfoLabel value:nil |
5507 ! ! |
5008 ! ! |
5508 |
5009 |
|
5010 !ProjectBrowser methodsFor:'user actions - menu'! |
|
5011 |
|
5012 addClass |
|
5013 "ask for, and add a single class" |
|
5014 |
|
5015 |p className cls| |
|
5016 |
|
5017 p := self currentProject. |
|
5018 |
|
5019 className := Dialog request:'Class to add:'. |
|
5020 className size == 0 ifTrue:[^ self]. |
|
5021 cls := Smalltalk classNamed:className. |
|
5022 cls isNil ifTrue:[ |
|
5023 "/ a new one |
|
5024 (self confirm:'This is a new class. Add ?') ifFalse:[ |
|
5025 ^ self |
|
5026 ]. |
|
5027 p |
|
5028 addClass:className |
|
5029 classFileName:((Smalltalk fileNameForClass:className) , '.st'). |
|
5030 ] ifFalse:[ |
|
5031 cls package ~= p package ifTrue:[ |
|
5032 "/ a new one |
|
5033 (self confirm:'Change the classes package from ' , cls package , ' to ' , p package , ' ?') ifFalse:[ |
|
5034 ^ self |
|
5035 ]. |
|
5036 cls package:p package. |
|
5037 ]. |
|
5038 p |
|
5039 addClass:cls name |
|
5040 classFileName:(cls classFilename |
|
5041 ? ((Smalltalk fileNameForClass:cls) , '.st')). |
|
5042 ]. |
|
5043 |
|
5044 self updateClassListForProject:p |
|
5045 |
|
5046 ! |
|
5047 |
|
5048 addClassesFromFilesInDirectory |
|
5049 "add all classes found from files in the project directory" |
|
5050 |
|
5051 self addClassesFromFilesInDirectoryWithFilter:nil |
|
5052 ! |
|
5053 |
|
5054 addClassesFromFilesInDirectoryIfPresentInImage |
|
5055 "add all classes found from files in the project directory, |
|
5056 but only if class is currently present in the image." |
|
5057 |
|
5058 self addClassesFromFilesInDirectoryWithFilter:[:classOrName | classOrName isBehavior] |
|
5059 |
|
5060 ! |
|
5061 |
|
5062 addClassesFromFilesInDirectoryWithFilter:aFilterBlockOrNil |
|
5063 "helper to add all classes found from files in the project directory" |
|
5064 |
|
5065 |project existingClasses prjDirectory anyChange numSTFilesFound| |
|
5066 |
|
5067 project := self currentProject. |
|
5068 |
|
5069 existingClasses := project classInfo. |
|
5070 anyChange := false. |
|
5071 numSTFilesFound := 0. |
|
5072 |
|
5073 prjDirectory := project directory asFilename. |
|
5074 (prjDirectory exists and:[prjDirectory isDirectory]) ifFalse:[ |
|
5075 self warn:'Invalid project directory: ' , prjDirectory pathName. |
|
5076 ^ self |
|
5077 ]. |
|
5078 |
|
5079 prjDirectory directoryContents do:[:fn | |
|
5080 |f oldInfo cls| |
|
5081 |
|
5082 f := prjDirectory construct:fn. |
|
5083 (f hasSuffix:'st') ifTrue:[ |
|
5084 numSTFilesFound := numSTFilesFound + 1. |
|
5085 |
|
5086 oldInfo := existingClasses |
|
5087 detect:[:clsInfo | |
|
5088 clsInfo classFileName = fn |
|
5089 ] |
|
5090 ifNone:nil. |
|
5091 oldInfo isNil ifTrue:[ |
|
5092 "/ extract className from fileName ... |
|
5093 cls := Smalltalk filenameAbbreviations keyAtValue:(f withoutSuffix baseName ). |
|
5094 cls isNil ifTrue:[ |
|
5095 cls := f withoutSuffix baseName asSymbol. |
|
5096 project defaultNameSpace notNil ifTrue:[ |
|
5097 cls := (project defaultNameSpace name , '::' , cls) asSymbol |
|
5098 ] |
|
5099 ]. |
|
5100 (aFilterBlockOrNil isNil |
|
5101 or:[aFilterBlockOrNil value:cls]) ifTrue:[ |
|
5102 project addClass:cls classFileName:fn. |
|
5103 anyChange := true. |
|
5104 Transcript showCR:'added ' , fn , ' as class: ' , cls printString. |
|
5105 ] ifFalse:[ |
|
5106 Transcript showCR:'skipped ' , fn , ' as class: ' , cls printString. |
|
5107 ] |
|
5108 |
|
5109 ] |
|
5110 ] |
|
5111 ]. |
|
5112 |
|
5113 anyChange ifTrue:[ |
|
5114 self updateClassListForProject:project |
|
5115 ] ifFalse:[ |
|
5116 numSTFilesFound == 0 ifTrue:[ |
|
5117 self information:'No st-sourcefiles found in ' , prjDirectory pathName. |
|
5118 ] |
|
5119 ] |
|
5120 ! |
|
5121 |
|
5122 addClassesFromImage |
|
5123 "add classes with this packageId found in the image" |
|
5124 |
|
5125 |project| |
|
5126 |
|
5127 project := self currentProject. |
|
5128 Smalltalk allClassesDo:[:aClass | |
|
5129 aClass isMeta ifFalse:[ |
|
5130 (aClass isNamespace not or:[aClass == Smalltalk]) ifTrue:[ |
|
5131 aClass package = project package ifTrue:[ |
|
5132 (project classInfoFor:aClass) isNil ifTrue:[ |
|
5133 project |
|
5134 addClass:aClass name |
|
5135 classFileName:(aClass classFilename |
|
5136 ? ((Smalltalk fileNameForClass:aClass) , '.st')). |
|
5137 ] |
|
5138 ] |
|
5139 ] |
|
5140 ] |
|
5141 ]. |
|
5142 |
|
5143 self updateClassListForProject:project |
|
5144 |
|
5145 ! |
|
5146 |
|
5147 browseClasses |
|
5148 "browse the projects classes" |
|
5149 |
|
5150 |ns p classes nBad uniqueClasses| |
|
5151 |
|
5152 p := self currentProject. |
|
5153 classes := p classes |
|
5154 collect:[:clsOrName | |
|
5155 |cls realName| |
|
5156 |
|
5157 clsOrName isSymbol ifTrue:[ |
|
5158 realName := clsOrName. |
|
5159 (realName includes:$:) ifTrue:[ |
|
5160 (realName startsWith:'Smalltalk::') ifTrue:[ |
|
5161 realName := (realName copyFrom:'Smalltalk::' size + 1) asSymbol |
|
5162 ] |
|
5163 ]. |
|
5164 cls := Smalltalk at:realName |
|
5165 ] ifFalse:[ |
|
5166 cls := clsOrName |
|
5167 ]. |
|
5168 cls |
|
5169 ]. |
|
5170 |
|
5171 "/ remove duplicates - but want to preserve order |
|
5172 "/ thats why we do not use asIdentitySet asOrderedCollection |
|
5173 uniqueClasses := OrderedCollection new. |
|
5174 classes do:[:cls | (uniqueClasses includesIdentical:cls) ifFalse:[uniqueClasses add:cls]]. |
|
5175 |
|
5176 nBad := classes inject:0 into:[:sum :el | el isNil ifTrue:[sum+1] ifFalse:[sum]]. |
|
5177 nBad ~~ 0 ifTrue:[ |
|
5178 classes := classes select:[:cls | cls notNil]. |
|
5179 self warn:('Oops - %1 classes could not be found.\\You should probably load them first.' bindWith:nBad) withCRs. |
|
5180 ]. |
|
5181 |
|
5182 |
|
5183 SystemBrowser |
|
5184 browseClasses:classes title:('Classes in ' , p name) sort:true. |
|
5185 |
|
5186 |
|
5187 |
|
5188 ! |
|
5189 |
|
5190 buildAll |
|
5191 "build all as specified in the deployment section" |
|
5192 |
|
5193 |p| |
|
5194 |
|
5195 p := self currentProject. |
|
5196 p isNil ifTrue:[ |
|
5197 self information:'No project selected'. |
|
5198 ^ self |
|
5199 ]. |
|
5200 |
|
5201 self withCursor:Cursor wait do:[ |
|
5202 "/ prepare the building ... |
|
5203 |
|
5204 (p propertyAt:#deliverLoadAllFile) == true ifTrue:[ |
|
5205 p createLoadAllFile |
|
5206 ]. |
|
5207 |
|
5208 (p propertyAt:#deliverSources) == true ifTrue:[ |
|
5209 p createSourceFiles |
|
5210 ]. |
|
5211 |
|
5212 (p propertyAt:#deliverMakefiles) == true ifTrue:[ |
|
5213 self buildMakefiles |
|
5214 ]. |
|
5215 |
|
5216 (p propertyAt:#deliverCompiledBinary) == true ifTrue:[ |
|
5217 self buildCompiledClassLibrary |
|
5218 ]. |
|
5219 |
|
5220 (p propertyAt:#deliverByteCode) == true ifTrue:[ |
|
5221 self buildByteCodeClassLibrary |
|
5222 ]. |
|
5223 |
|
5224 "/ now, deploy ... |
|
5225 |
|
5226 (p propertyAt:#deliverZipArchive) == true ifTrue:[ |
|
5227 p buildZipArchive |
|
5228 ]. |
|
5229 |
|
5230 (p propertyAt:#deliverTarArchive) == true ifTrue:[ |
|
5231 p buildTarArchive |
|
5232 ]. |
|
5233 |
|
5234 (p propertyAt:#deliverGZipArchive) == true ifTrue:[ |
|
5235 p buildGZipArchive |
|
5236 ]. |
|
5237 ]. |
|
5238 |
|
5239 |
|
5240 ! |
|
5241 |
|
5242 buildCompiledClassLibrary |
|
5243 "compile a binary class library in the projects directory" |
|
5244 |
|
5245 |p diagnosticFile diagnostic error textBox| |
|
5246 |
|
5247 p := self currentProject. |
|
5248 p isNil ifTrue:[ |
|
5249 self information:'No project selected'. |
|
5250 ^ self |
|
5251 ]. |
|
5252 |
|
5253 "/ check for directory ... |
|
5254 (self checkForProjectDirectoryFor:p) ifFalse:[ |
|
5255 ^ self |
|
5256 ]. |
|
5257 |
|
5258 "/ check for Make.proto ... |
|
5259 (self checkForMakeProtoFor:p) ifFalse:[ |
|
5260 ^ self |
|
5261 ]. |
|
5262 |
|
5263 "/ check for Makefile ... |
|
5264 (self checkForMakefileFor:p) ifFalse:[ |
|
5265 ^ self |
|
5266 ]. |
|
5267 |
|
5268 "/ now, execute the makefile found there ... |
|
5269 diagnosticFile := Filename newTemporary. |
|
5270 diagnostic := diagnosticFile writeStream. |
|
5271 error := false. |
|
5272 |
|
5273 [ |
|
5274 self withCursor:Cursor wait do:[ |
|
5275 OperatingSystem |
|
5276 executeCommand:'make' |
|
5277 inputFrom:nil |
|
5278 outputTo:diagnostic |
|
5279 errorTo:diagnostic |
|
5280 inDirectory:(p directory asFilename pathName) |
|
5281 onError:[error := true]. |
|
5282 ]. |
|
5283 |
|
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 |
|
5299 |
|
5300 ! |
|
5301 |
|
5302 buildLoadAllFile |
|
5303 "generate a loadAll file in the projects directory" |
|
5304 |
|
5305 |p | |
|
5306 |
|
5307 p := self currentProject. |
|
5308 p isNil ifTrue:[ |
|
5309 self information:'No project selected'. |
|
5310 ^ self |
|
5311 ]. |
|
5312 |
|
5313 self withCursor:Cursor wait do:[ |
|
5314 p createLoadAllFile. |
|
5315 ] |
|
5316 ! |
|
5317 |
|
5318 buildMakefiles |
|
5319 "generate a Make.proto and Makefile in the projects directory" |
|
5320 |
|
5321 |p | |
|
5322 |
|
5323 p := self currentProject. |
|
5324 p isNil ifTrue:[ |
|
5325 self information:'No project selected'. |
|
5326 ^ self |
|
5327 ]. |
|
5328 |
|
5329 self withCursor:Cursor wait do:[ |
|
5330 p createProtoMakefile. |
|
5331 p createMakefile |
|
5332 ]. |
|
5333 ! |
|
5334 |
|
5335 checkInAllClasses |
|
5336 "check in all classes" |
|
5337 |
|
5338 |p classes methods anyMethodMissing| |
|
5339 |
|
5340 p := self currentProject. |
|
5341 p isNil ifTrue:[ |
|
5342 self information:'No project selected'. |
|
5343 ^ self |
|
5344 ]. |
|
5345 |
|
5346 "/ check in classes ... |
|
5347 |
|
5348 classes := p classes. |
|
5349 classes do:[:aClass | |
|
5350 |clsName| |
|
5351 |
|
5352 aClass isBehavior ifFalse:[ |
|
5353 aClass isSymbol ifTrue:[ |
|
5354 clsName := aClass |
|
5355 ] ifFalse:[ |
|
5356 clsName := aClass className |
|
5357 ]. |
|
5358 Transcript showCR:('ProjectBrowser: cannot checkIn unloaded class: ' , clsName). |
|
5359 ] ifTrue:[ |
|
5360 aClass isLoaded ifFalse:[ |
|
5361 Transcript showCR:('ProjectBrowser: cannot checkIn unloaded class: ' , aClass name). |
|
5362 ] ifTrue:[ |
|
5363 aClass owningClass isNil ifTrue:[ "/ skip private classes |
|
5364 Transcript showCR:('ProjectBrowser: checking in class: ' , aClass name). |
|
5365 self checkInClass:aClass. |
|
5366 ] |
|
5367 ] |
|
5368 ] |
|
5369 ]. |
|
5370 |
|
5371 |
|
5372 ! |
|
5373 |
|
5374 checkInMethods |
|
5375 "check in all extensions (patches)" |
|
5376 |
|
5377 |p methods anyMethodMissing| |
|
5378 |
|
5379 p := self currentProject. |
|
5380 p isNil ifTrue:[ |
|
5381 self information:'No project selected'. |
|
5382 ^ self |
|
5383 ]. |
|
5384 |
|
5385 "/ check methods ... |
|
5386 |
|
5387 anyMethodMissing := false. |
|
5388 methods := p methods. |
|
5389 methods size > 0 ifTrue:[ |
|
5390 methods do:[:aMethod | |
|
5391 aMethod isMethod ifFalse:[ |
|
5392 Transcript showCR:('ProjectBrowser: cannot checkIn unloaded method: ' , aMethod className , ' ' , aMethod methodName). |
|
5393 anyMethodMissing := true. |
|
5394 ] |
|
5395 ]. |
|
5396 anyMethodMissing ifTrue:[ |
|
5397 Transcript showCR:'ProjectBrowser: cannot save method patches & extensions due to missing method(s)'. |
|
5398 ] ifFalse:[ |
|
5399 Transcript showCR:('ProjectBrowser: checking in patches & extensions'). |
|
5400 self checkInMethods:methods |
|
5401 ]. |
|
5402 ]. |
|
5403 |
|
5404 ! |
|
5405 |
|
5406 checkInProject |
|
5407 "check in all classes and extensions" |
|
5408 |
|
5409 |p| |
|
5410 |
|
5411 p := self currentProject. |
|
5412 p isNil ifTrue:[ |
|
5413 self information:'No project selected'. |
|
5414 ^ self |
|
5415 ]. |
|
5416 |
|
5417 "/ check in classes ... |
|
5418 self checkInAllClasses. |
|
5419 |
|
5420 "/ check methods ... |
|
5421 self checkInMethods. |
|
5422 |
|
5423 "/ check in the project file itself |
|
5424 self checkInProjectFile. |
|
5425 |
|
5426 ! |
|
5427 |
|
5428 inspectCurrentProject |
|
5429 "inspect the current project" |
|
5430 |
|
5431 self hasProjectSelected ifTrue:[ |
|
5432 self currentProject inspect. |
|
5433 ] |
|
5434 ! |
|
5435 |
|
5436 loadClassesFromDirectory |
|
5437 "load all classes as contained in the project into the system" |
|
5438 |
|
5439 self withReadCursorDo:[ |
|
5440 self currentProject loadClassesFromProjectDirectory. |
|
5441 ]. |
|
5442 |
|
5443 ! |
|
5444 |
|
5445 makeCurrentProject |
|
5446 "make the selected Project the current project" |
|
5447 |
|
5448 |project| |
|
5449 |
|
5450 self hasProjectSelected ifTrue:[ |
|
5451 project := self currentProject. |
|
5452 |
|
5453 Project current:project. |
|
5454 self showWhat value == #current ifTrue:[ |
|
5455 self updateProjectTree |
|
5456 ] |
|
5457 ] |
|
5458 ! |
|
5459 |
|
5460 moveMethodToProject |
|
5461 |p mthd newPackage| |
|
5462 |
|
5463 p := self currentProject. |
|
5464 |
|
5465 mthd := self selectedMethod. |
|
5466 mthd notNil ifTrue:[ |
|
5467 newPackage := Dialog request:'Move to project:'. |
|
5468 (newPackage size > 0 and:[newPackage ~= p package]) ifTrue:[ |
|
5469 mthd package:newPackage asSymbol. |
|
5470 p removeMethod:mthd. |
|
5471 self updatePatchesListForProject:p. |
|
5472 self projectTree remove:self selectedTreeNode. |
|
5473 ] |
|
5474 ]. |
|
5475 ! |
|
5476 |
|
5477 newProject |
|
5478 self newProject:Project new. |
|
5479 |
|
5480 ! |
|
5481 |
|
5482 newProject:newProject |
|
5483 |newNode| |
|
5484 |
|
5485 newNode := self nodeFor:newProject. |
|
5486 self addProjectNodeToTree:newNode. |
|
5487 self projectTreeHolder root:projectTree. |
|
5488 "/ self projectTreeHolder selectNode:newNode. |
|
5489 "/ self projectTreeHolder expand:newNode. |
|
5490 |
|
5491 self readAspectsFromProject. |
|
5492 newProject wasLoadedFromFile ifFalse:[ |
|
5493 self updateListOfRequiredPrerequisiteClasses. |
|
5494 ] |
|
5495 ! |
|
5496 |
|
5497 newSubProject |
|
5498 |projectNode subProjectsNode newNode parentProject newProject| |
|
5499 |
|
5500 projectNode := self currentProjectNode. |
|
5501 |
|
5502 projectNode notNil ifTrue:[ |
|
5503 parentProject := projectNode contents. |
|
5504 subProjectsNode := projectNode children detect:[:child | child contents == #subprojects]. |
|
5505 self halt. |
|
5506 parentProject notNil ifTrue:[ |
|
5507 newProject := Project new. |
|
5508 newNode := self nodeFor:newProject. |
|
5509 |
|
5510 parentProject addSubProject:newProject. |
|
5511 subProjectsNode add:newNode. |
|
5512 self projectTreeHolder root:projectTree. |
|
5513 self projectTreeHolder selectNode:newNode. |
|
5514 ] |
|
5515 ] |
|
5516 |
|
5517 ! |
|
5518 |
|
5519 openDocumentation |
|
5520 self openHTMLDocument: 'tools/pbrowser/TOP.html' |
|
5521 |
|
5522 ! |
|
5523 |
|
5524 openProject |
|
5525 |fn| |
|
5526 |
|
5527 fn := Dialog |
|
5528 requestFileName:'filename:' |
|
5529 default:nil |
|
5530 ifFail:nil |
|
5531 pattern:'*.prj' |
|
5532 fromDirectory:(FileSelectionBox lastFileSelectionDirectory). |
|
5533 |
|
5534 fn notNil ifTrue:[ |
|
5535 self loadFromProjectFile:fn. |
|
5536 ] |
|
5537 ! |
|
5538 |
|
5539 removeMethod |
|
5540 |p mthd| |
|
5541 |
|
5542 p := self currentProject. |
|
5543 |
|
5544 mthd := self selectedMethod. |
|
5545 mthd notNil ifTrue:[ |
|
5546 (self confirm:'Really remove the method (from both project and image) ?') ifTrue:[ |
|
5547 p removeMethod:mthd. |
|
5548 mthd who methodClass removeSelector:mthd who methodSelector. |
|
5549 self updatePatchesListForProject:p. |
|
5550 self projectTree remove:self selectedTreeNode. |
|
5551 ] |
|
5552 ]. |
|
5553 ! |
|
5554 |
|
5555 removeMethodFromProject |
|
5556 |p mthd| |
|
5557 |
|
5558 p := self currentProject. |
|
5559 |
|
5560 mthd := self selectedMethod. |
|
5561 mthd notNil ifTrue:[ |
|
5562 (self confirm:'Really remove the method (from the project) ?') ifTrue:[ |
|
5563 mthd package:#unknown. |
|
5564 p removeMethod:mthd. |
|
5565 self updatePatchesListForProject:p. |
|
5566 self projectTree remove:self selectedTreeNode. |
|
5567 ] |
|
5568 ]. |
|
5569 ! |
|
5570 |
|
5571 removeProject |
|
5572 |projectToRemove selectedNode subNode newNode parentNode parentProject newProject| |
|
5573 |
|
5574 self hasProjectNodeSelected ifTrue:[ |
|
5575 selectedNode := self selectedTreeNode. |
|
5576 projectToRemove := selectedNode contents. |
|
5577 |
|
5578 (self confirm:'Really remove the project ?') ifTrue:[ |
|
5579 self withExecuteCursorDo:[ |
|
5580 self projectTreeHolder removeSelection. |
|
5581 projectToRemove removeFromSystem. |
|
5582 ] |
|
5583 ] |
|
5584 ] |
|
5585 ! |
|
5586 |
|
5587 renameProject |
|
5588 |nm projectNode selectedProject| |
|
5589 |
|
5590 projectNode := self currentProjectNode. |
|
5591 projectNode notNil ifTrue:[ |
|
5592 selectedProject := projectNode contents. |
|
5593 |
|
5594 nm := Dialog |
|
5595 request:'Rename to:' |
|
5596 initialAnswer:selectedProject name. |
|
5597 |
|
5598 nm size > 0 ifTrue:[ |
|
5599 selectedProject name:nm. |
|
5600 "/ selectedNode name:nm. |
|
5601 "/ selectedNode changed. |
|
5602 ] |
|
5603 ] |
|
5604 ! |
|
5605 |
|
5606 saveProjectFile |
|
5607 "save the project file in the project directory" |
|
5608 |
|
5609 |d p| |
|
5610 |
|
5611 self modifiedChannel value ifTrue:[ |
|
5612 (self confirm:'Changes not confirmed; save anyway ?') ifFalse:[^ self] |
|
5613 ]. |
|
5614 |
|
5615 p := self currentProject. |
|
5616 p isNil ifTrue:[ |
|
5617 self information:'Select a project first.'. |
|
5618 ^self |
|
5619 ]. |
|
5620 p directory isNil ifTrue:[ |
|
5621 d := (Dialog request:'Project Directory:'). |
|
5622 d size == 0 ifTrue:[ |
|
5623 ^ self |
|
5624 ]. |
|
5625 p directory:d |
|
5626 ]. |
|
5627 |
|
5628 self withCursor:Cursor write do:[ |
|
5629 p saveAsProjectFile. |
|
5630 ] |
|
5631 |
|
5632 "Modified: / 26.4.1999 / 22:43:57 / cg" |
|
5633 ! |
|
5634 |
|
5635 validateAgainstClassesInImage |
|
5636 "validate classes in project against classes found in the image" |
|
5637 |
|
5638 |project classesInProjectOnly classesInImageOnly bindings| |
|
5639 |
|
5640 project := self currentProject. |
|
5641 classesInImageOnly := IdentitySet new. |
|
5642 classesInProjectOnly := IdentitySet new. |
|
5643 |
|
5644 Smalltalk allClassesDo:[:aClass | |
|
5645 aClass isMeta ifFalse:[ |
|
5646 (aClass isNamespace not or:[aClass == Smalltalk]) ifTrue:[ |
|
5647 aClass package = project package ifTrue:[ |
|
5648 (project classInfoFor:aClass) isNil ifTrue:[ |
|
5649 classesInImageOnly add:aClass name. |
|
5650 ] |
|
5651 ] |
|
5652 ] |
|
5653 ] |
|
5654 ]. |
|
5655 project classInfo do:[:clsInfo | |
|
5656 |clsName cls| |
|
5657 |
|
5658 clsName := clsInfo className. |
|
5659 cls := Smalltalk at:clsName asSymbol. |
|
5660 (cls isBehavior not) ifTrue:[ |
|
5661 classesInProjectOnly add:clsName |
|
5662 ]. |
|
5663 ]. |
|
5664 |
|
5665 (classesInImageOnly isEmpty and:[classesInProjectOnly isEmpty]) ifTrue:[ |
|
5666 self information:'Set of classes in project and image are equal.'. |
|
5667 ^ self. |
|
5668 ]. |
|
5669 |
|
5670 classesInImageOnly := classesInImageOnly asOrderedCollection sort. |
|
5671 classesInProjectOnly := classesInProjectOnly asOrderedCollection sort. |
|
5672 |
|
5673 bindings := IdentityDictionary new. |
|
5674 bindings at:#classesInImageOnly put:classesInImageOnly. |
|
5675 bindings at:#classesInProjectOnly put:classesInProjectOnly. |
|
5676 |
|
5677 SimpleDialog |
|
5678 openDialogInterfaceSpec:(self class classValidationDialogSpec) |
|
5679 withBindings:bindings |
|
5680 |
|
5681 "Modified: / 26.9.1999 / 16:03:50 / cg" |
|
5682 ! ! |
|
5683 |
5509 !ProjectBrowser::ProjectTreeItem methodsFor:'accessing'! |
5684 !ProjectBrowser::ProjectTreeItem methodsFor:'accessing'! |
5510 |
5685 |
5511 action |
5686 action |
5512 "return the value of the instance variable 'action' (automatically generated)" |
5687 "return the value of the instance variable 'action' (automatically generated)" |
5513 |
5688 |