7629 !AbstractLauncherApplication::PackageLoadDialog methodsFor:'private'! |
7627 !AbstractLauncherApplication::PackageLoadDialog methodsFor:'private'! |
7630 |
7628 |
7631 addItemWithPackagePath:path target:target asApplication:isApplication toRoot:aRoot |
7629 addItemWithPackagePath:path target:target asApplication:isApplication toRoot:aRoot |
7632 "add a package item to the tree" |
7630 "add a package item to the tree" |
7633 |
7631 |
7634 |item isAlreadyLoaded defClass packageID| |
7632 |item isAlreadyLoaded defClass packageID targetPath isBroken| |
7635 |
7633 |
7636 "/ see if already loaded |
7634 "/ see if already loaded |
7637 |
7635 |
7638 packageID := (path size > 1) |
7636 packageID := (path size > 1) |
7639 ifTrue:[ path first , ':' , ((path copyFrom:2) asStringWith:$/) ] |
7637 ifTrue:[ path first , ':' , ((path copyFrom:2) asStringWith:$/) ] |
7640 ifFalse:[ path first ]. |
7638 ifFalse:[ path first ]. |
7641 |
7639 |
7642 item := self getItemByPath:path packageID:packageID under:aRoot. |
7640 item := self getItemByPath:path packageID:packageID under:aRoot. |
7643 |
7641 |
7644 isAlreadyLoaded := false. |
7642 isAlreadyLoaded := isBroken := false. |
7645 Error handle:[:ex | |
7643 Error handle:[:ex | |
7646 item label:(item label , (' ERROR - please rebuild!!' withColor:Color red)). |
7644 item label:(item label , (' ERROR - please rebuild!!' withColor:Color red)). |
7647 ] do:[ |
7645 ] do:[ |
7648 isAlreadyLoaded := |
7646 isAlreadyLoaded := |
7649 (defClass := ProjectDefinition definitionClassForPackage:packageID) notNil |
7647 (defClass := ProjectDefinition definitionClassForPackage:packageID) notNil |
7651 and:[ defClass isFullyLoaded ]]. |
7649 and:[ defClass isFullyLoaded ]]. |
7652 ]. |
7650 ]. |
7653 |
7651 |
7654 target notNil ifTrue:[ |
7652 target notNil ifTrue:[ |
7655 ((target startsWith:'lib ') or:[(target startsWith:'app ')]) ifTrue:[ |
7653 ((target startsWith:'lib ') or:[(target startsWith:'app ')]) ifTrue:[ |
7656 pathByItem at:item put:(target copyFrom:(target indexOfSeparator + 1)) withoutSeparators. |
7654 targetPath := (target copyFrom:(target indexOfSeparator + 1)) withoutSeparators. |
|
7655 pathByItem at:item put:targetPath. |
|
7656 isBroken := ('packages' asFilename / targetPath) directory exists not. |
7657 ]. |
7657 ]. |
7658 ]. |
7658 ]. |
7659 |
7659 |
7660 "/ do not overwrite an app by a lib with the same name (happens in expecco/application) |
7660 "/ do not overwrite an app by a lib with the same name (happens in expecco/application) |
7661 (isApplication or:[ item icon isNil or:[item icon == folderIcon or:[item icon == greyFolderIcon]]]) ifTrue:[ |
7661 (isApplication or:[ item icon isNil or:[item icon == folderIcon or:[item icon == greyFolderIcon]]]) ifTrue:[ |
7662 isAlreadyLoaded ifTrue:[ |
7662 isBroken ifTrue:[ |
7663 item icon:(isApplication ifTrue:[greyApplicationIcon] ifFalse:[greyPackageIcon]). |
7663 item icon:(ToolbarIconLibrary packageDefectOpen24x24Icon2). |
7664 item label:(item label , alreadyLoadedString) |
7664 item label:(item label , (' (broken: folder no longer present)' withColor:Color red)) |
7665 ] ifFalse:[ |
7665 ] ifFalse:[ |
7666 item icon:(isApplication ifTrue:[applicationIcon] ifFalse:[packageIcon]). |
7666 isAlreadyLoaded ifTrue:[ |
|
7667 item icon:(isApplication ifTrue:[greyApplicationIcon] ifFalse:[greyPackageIcon]). |
|
7668 item label:(item label , alreadyLoadedString) |
|
7669 ] ifFalse:[ |
|
7670 item icon:(isApplication ifTrue:[applicationIcon] ifFalse:[packageIcon]). |
|
7671 ]. |
7667 ]. |
7672 ]. |
7668 ]. |
7673 ]. |
7669 |
7674 |
7670 "/ if it is not already loaded, make all parents non-grey |
7675 "/ if it is not already loaded, make all parents non-grey |
7671 isAlreadyLoaded ifFalse:[ |
7676 isAlreadyLoaded ifFalse:[ |
8127 ]. |
8134 ]. |
8128 ] forkAt:(Processor userBackgroundPriority). |
8135 ] forkAt:(Processor userBackgroundPriority). |
8129 ! |
8136 ! |
8130 |
8137 |
8131 readPackageTree |
8138 readPackageTree |
|
8139 "looks for the packages folder, which contains symbolic-link-like entries |
|
8140 for packages which were generated during the build process" |
|
8141 |
8132 packageDirPath := Smalltalk getSystemFileName:'packages'. |
8142 packageDirPath := Smalltalk getSystemFileName:'packages'. |
8133 packageDirPath isNil ifTrue:[ |
8143 packageDirPath isNil ifTrue:[ |
8134 root label:root label,((resources string:' (no "packages" folder found)') withColor:Color red). |
8144 root label:root label,((resources string:' (no "packages" folder found)') withColor:Color red). |
8135 ] ifFalse:[ |
8145 ] ifFalse:[ |
8136 packageDirPath asFilename directoryContentsAsFilenames sort do:[:fn | |
8146 packageDirPath asFilename directoryContentsAsFilenames sort do:[:fn | |