34 packageIcon greyPackageIcon folderIcon greyFolderIcon |
34 packageIcon greyPackageIcon folderIcon greyFolderIcon |
35 alreadyLoadedString applicationIcon greyApplicationIcon root |
35 alreadyLoadedString applicationIcon greyApplicationIcon root |
36 itemsByPath getItemByPath myHierarchicalItemWithLabelAndIcon |
36 itemsByPath getItemByPath myHierarchicalItemWithLabelAndIcon |
37 filterHolder masterRoot infoTextHolder loadButton |
37 filterHolder masterRoot infoTextHolder loadButton |
38 loadAndBrowseButton selectedPackageHolder monticelloRoot |
38 loadAndBrowseButton selectedPackageHolder monticelloRoot |
39 backgroundPackageFindProcess' |
39 backgroundPackageFindProcess itemsMatchingFilter' |
40 classVariableNames:'PreviousPackageDialogItems PreviousPackageDialogExtent' |
40 classVariableNames:'PreviousPackageDialogItems PreviousPackageDialogExtent' |
41 poolDictionaries:'' |
41 poolDictionaries:'' |
42 privateIn:AbstractLauncherApplication |
42 privateIn:AbstractLauncherApplication |
|
43 ! |
|
44 |
|
45 HierarchicalItemWithLabelAndIcon subclass:#MyHierarchicalItem |
|
46 instanceVariableNames:'type info' |
|
47 classVariableNames:'' |
|
48 poolDictionaries:'' |
|
49 privateIn:AbstractLauncherApplication::PackageLoadDialog |
43 ! |
50 ! |
44 |
51 |
45 !AbstractLauncherApplication class methodsFor:'documentation'! |
52 !AbstractLauncherApplication class methodsFor:'documentation'! |
46 |
53 |
47 copyright |
54 copyright |
419 ]. |
426 ]. |
420 OpenSettingsDialog := nil. |
427 OpenSettingsDialog := nil. |
421 ]. |
428 ]. |
422 |
429 |
423 settingsApp := SettingsDialog new. |
430 settingsApp := SettingsDialog new. |
|
431 settingsApp resources:(AbstractLauncherApplication resources). |
424 settingsApp requestor:requestor. |
432 settingsApp requestor:requestor. |
425 settingsApp installSettingsEntries:(self allSettingsList). |
433 settingsApp installSettingsEntries:(self allSettingsList). |
426 "/ settingsApp requestor:self. |
434 "/ settingsApp requestor:self. |
427 OpenSettingsDialog := settingsApp. |
435 OpenSettingsDialog := settingsApp. |
428 settingsApp allButOpen. |
436 settingsApp allButOpen. |
2624 "Modified: / 27-04-2012 / 13:24:23 / cg" |
2634 "Modified: / 27-04-2012 / 13:24:23 / cg" |
2625 ! |
2635 ! |
2626 |
2636 |
2627 viewInspect |
2637 viewInspect |
2628 "let user pick a view and inspect it. |
2638 "let user pick a view and inspect it. |
2629 Of course, only smalltalk views are allowed" |
2639 Of course, only Smalltalk views are allowed" |
2630 |
2640 |
2631 |v| |
2641 |v| |
2632 |
2642 |
2633 (v := self pickAView) notNil ifTrue:[ |
2643 (v := self pickAView) notNil ifTrue:[ |
2634 v inspect |
2644 v inspect |
2635 ] |
2645 ] |
2636 ! |
2646 ! |
2637 |
2647 |
2638 viewMigrate |
2648 viewMigrate |
2639 "let user pick a view and migrate it to some other display. |
2649 "let user pick a view and migrate it to some other display. |
2640 Only smalltalk views are allowed" |
2650 Only Smalltalk views are allowed" |
2641 |
2651 |
2642 |v| |
2652 |v| |
2643 |
2653 |
2644 (v := self pickAView) notNil ifTrue:[ |
2654 (v := self pickAView) notNil ifTrue:[ |
2645 self migrateWindow:v topView |
2655 self migrateWindow:v topView |
7240 filterHolder := ValueHolder with:nil. |
7250 filterHolder := ValueHolder with:nil. |
7241 itemsByPath := Dictionary new. |
7251 itemsByPath := Dictionary new. |
7242 packageIdByItem := IdentityDictionary new. |
7252 packageIdByItem := IdentityDictionary new. |
7243 pathByItem := IdentityDictionary new. |
7253 pathByItem := IdentityDictionary new. |
7244 |
7254 |
7245 Class withoutUpdatingChangesDo:[ |
|
7246 myHierarchicalItemWithLabelAndIcon := |
|
7247 HierarchicalItemWithLabelAndIcon |
|
7248 subclass:#myHierarchicalItemWithLabelAndIcon |
|
7249 instanceVariableNames:'type info' |
|
7250 classVariableNames:'' |
|
7251 poolDictionaries:'' |
|
7252 category:nil |
|
7253 inEnvironment:nil. |
|
7254 myHierarchicalItemWithLabelAndIcon compile:'type ^ type'. |
|
7255 myHierarchicalItemWithLabelAndIcon compile:'type:aSymbol type := aSymbol'. |
|
7256 myHierarchicalItemWithLabelAndIcon compile:'info ^ info'. |
|
7257 myHierarchicalItemWithLabelAndIcon compile:'info:anObject info := anObject'. |
|
7258 ]. |
|
7259 |
|
7260 list := HierarchicalList new. |
7255 list := HierarchicalList new. |
7261 |
7256 |
7262 masterRoot := myHierarchicalItemWithLabelAndIcon new. |
7257 masterRoot := MyHierarchicalItem new. |
7263 masterRoot icon:(ToolbarIconLibrary stxHomeIcon). |
7258 masterRoot icon:(ToolbarIconLibrary stxHomeIcon). |
7264 masterRoot label:(resources string:'local '). |
7259 masterRoot label:(resources string:'local '). |
7265 masterRoot type:#localRoot. |
7260 masterRoot type:#localRoot. |
7266 |
7261 |
7267 root := myHierarchicalItemWithLabelAndIcon new. |
7262 root := MyHierarchicalItem new. |
7268 root icon:folderIcon. |
7263 root icon:folderIcon. |
7269 root label:((resources string:'[Compiled Packages]') asText allItalic withColor:Color grey). |
7264 root label:((resources string:'[Compiled Packages]') asText allItalic withColor:Color grey). |
7270 root type:#compiledPackagesRoot. |
7265 root type:#compiledPackagesRoot. |
7271 masterRoot add:root. |
7266 masterRoot add:root. |
7272 |
7267 |
7273 monticelloRoot := myHierarchicalItemWithLabelAndIcon new. |
7268 monticelloRoot := MyHierarchicalItem new. |
7274 monticelloLabel := ((resources string:'[Monticello Packages]') asText allItalic withColor:Color grey). |
7269 monticelloLabel := ((resources string:'[Monticello Packages]') asText allItalic withColor:Color grey). |
7275 monticelloRoot type:#monticelloRoot. |
7270 monticelloRoot type:#monticelloRoot. |
7276 |
7271 |
7277 (MCRepositoryGroup isNil or:[MCRepositoryGroup isLoaded not]) ifTrue:[ |
7272 (MCRepositoryGroup isNil or:[MCRepositoryGroup isLoaded not]) ifTrue:[ |
7278 monticelloRoot icon:greyFolderIcon. |
7273 monticelloRoot icon:greyFolderIcon. |
7415 ] |
7410 ] |
7416 ]. |
7411 ]. |
7417 ! |
7412 ! |
7418 |
7413 |
7419 filterChangedAction |
7414 filterChangedAction |
7420 |matchingItems filterPattern isMatch firstMatchingItem| |
7415 |newMatchingItems filterPattern isMatch firstMatchingItem| |
7421 |
7416 |
7422 filterPattern := filterHolder value. |
7417 filterPattern := filterHolder value. |
7423 filterPattern isEmptyOrNil ifTrue:[ |
7418 filterPattern isEmptyOrNil ifTrue:[ |
7424 "/ nothing |
7419 itemsMatchingFilter notEmptyOrNil ifTrue:[ |
7425 root recursiveDo:[:item | |
7420 "/ nothing |
7426 item label:(item label copy asText allNonBold withoutAnyColorEmphasis). |
|
7427 ]. |
|
7428 ] ifFalse:[ |
|
7429 filterPattern := filterPattern asLowercase. |
|
7430 isMatch := filterPattern includesMatchCharacters. |
|
7431 |
|
7432 matchingItems := OrderedCollection new. |
|
7433 masterRoot recursiveDo:[:item | |
|
7434 |itemLabel itemPackage| |
|
7435 |
|
7436 itemLabel := item label. |
|
7437 itemPackage := packageIdByItem at:item ifAbsent:''. |
|
7438 |
|
7439 ((isMatch and:[itemLabel matches:filterPattern caseSensitive:false]) |
|
7440 or:[ (isMatch not and:[ itemLabel asLowercase includesString:filterPattern ]) |
|
7441 or:[ (isMatch and:[itemPackage matches:filterPattern caseSensitive:false]) |
|
7442 or:[ isMatch not and:[ itemPackage asLowercase includesString:filterPattern ]]]]) |
|
7443 ifTrue:[ |
|
7444 matchingItems add:item. |
|
7445 ] |
|
7446 ]. |
|
7447 matchingItems isEmpty ifTrue:[ |
|
7448 "/ nothing found |
|
7449 root recursiveDo:[:item | |
7421 root recursiveDo:[:item | |
7450 item label:(item label copy asText allNonBold withoutAnyColorEmphasis). |
7422 item label:(item label copy asText allNonBold withoutAnyColorEmphasis). |
7451 ]. |
7423 ]. |
7452 Screen current beep. |
7424 ]. |
7453 ] ifFalse:[ |
7425 itemsMatchingFilter := #(). |
7454 "/ collapse all and fully expand all matching items |
7426 ^ self. |
7455 masterRoot recursiveDo:[:item | |
7427 ]. |
7456 item collapse. |
7428 |
7457 item label:(item label copy asText allNonBold withColor:Color grey). |
7429 filterPattern := filterPattern asLowercase. |
7458 ]. |
7430 isMatch := filterPattern includesMatchCharacters. |
7459 firstMatchingItem := nil. |
7431 |
7460 matchingItems do:[:item | |
7432 newMatchingItems := OrderedCollection new. |
7461 item label:(item label copy asText allBold withoutAnyColorEmphasis). |
7433 masterRoot recursiveDo:[:item | |
7462 item makeVisible. |
7434 |itemLabel itemPackage| |
7463 firstMatchingItem := firstMatchingItem ? item. |
7435 |
7464 ]. |
7436 itemLabel := item label. |
7465 hierarchicalListView makeLineVisible:firstMatchingItem listIndex. |
7437 itemPackage := packageIdByItem at:item ifAbsent:''. |
7466 ]. |
7438 |
7467 ]. |
7439 ((isMatch and:[itemLabel matches:filterPattern caseSensitive:false]) |
|
7440 or:[ (isMatch not and:[ itemLabel asLowercase includesString:filterPattern ]) |
|
7441 or:[ (isMatch and:[itemPackage matches:filterPattern caseSensitive:false]) |
|
7442 or:[ isMatch not and:[ itemPackage asLowercase includesString:filterPattern ]]]]) |
|
7443 ifTrue:[ |
|
7444 newMatchingItems add:item. |
|
7445 ] |
|
7446 ]. |
|
7447 (newMatchingItems sameContentsAs:itemsMatchingFilter) ifTrue:[ |
|
7448 ^ self |
|
7449 ]. |
|
7450 |
|
7451 newMatchingItems isEmpty ifTrue:[ |
|
7452 "/ nothing found |
|
7453 root recursiveDo:[:item | |
|
7454 item label:(item label copy asText allNonBold withoutAnyColorEmphasis). |
|
7455 ]. |
|
7456 Screen current beep. |
|
7457 ] ifFalse:[ |
|
7458 "/ collapse all and fully expand all matching items |
|
7459 masterRoot recursiveDo:[:item | |
|
7460 item collapse. |
|
7461 item label:(item label copy asText allNonBold withColor:Color grey). |
|
7462 ]. |
|
7463 firstMatchingItem := nil. |
|
7464 newMatchingItems do:[:item | |
|
7465 item label:(item label copy asText allBold withoutAnyColorEmphasis). |
|
7466 item makeVisible. |
|
7467 firstMatchingItem := firstMatchingItem ? item. |
|
7468 ]. |
|
7469 hierarchicalListView makeLineVisible:firstMatchingItem listIndex. |
|
7470 ]. |
|
7471 itemsMatchingFilter := newMatchingItems. |
7468 ! |
7472 ! |
7469 |
7473 |
7470 getItemByPath:path packageID:packageID under:aRoot |
7474 getItemByPath:path packageID:packageID under:aRoot |
7471 "/ ensures an item for a path and returns it. |
7475 "/ ensures an item for a path and returns it. |
7472 "/ if not already present, the item is created as a folder |
7476 "/ if not already present, the item is created as a folder |
7496 (MCRepositoryGroup default repositories |
7500 (MCRepositoryGroup default repositories |
7497 asSortedCollection:[:a :b |a displayString < b displayString]) |
7501 asSortedCollection:[:a :b |a displayString < b displayString]) |
7498 do:[:each | |
7502 do:[:each | |
7499 |reposItem| |
7503 |reposItem| |
7500 |
7504 |
7501 reposItem := myHierarchicalItemWithLabelAndIcon new. |
7505 reposItem := MyHierarchicalItem new. |
7502 reposItem icon:folderIcon. |
7506 reposItem icon:folderIcon. |
7503 reposItem label:each displayString , ((resources string:' [MC Repository]') asText allItalic withColor:Color grey). |
7507 reposItem label:each displayString , ((resources string:' [MC Repository]') asText allItalic withColor:Color grey). |
7504 reposItem type:#monticelloRepository. |
7508 reposItem type:#monticelloRepository. |
7505 reposItem info:each. |
7509 reposItem info:each. |
7506 monticelloRoot add:reposItem. |
7510 monticelloRoot add:reposItem. |
7507 |
7511 |
7508 each allPackageNames asSortedCollection do:[:eachPackage | |
7512 each allPackageNames asSortedCollection do:[:eachPackage | |
7509 |packageItem| |
7513 |packageItem| |
7510 |
7514 |
7511 packageItem := myHierarchicalItemWithLabelAndIcon new. |
7515 packageItem := MyHierarchicalItem new. |
7512 packageItem icon:packageIcon. |
7516 packageItem icon:packageIcon. |
7513 packageItem label:eachPackage. |
7517 packageItem label:eachPackage. |
7514 packageItem type:#monticelloPackage. |
7518 packageItem type:#monticelloPackage. |
7515 reposItem add:packageItem. |
7519 reposItem add:packageItem. |
7516 ] |
7520 ] |
7726 |path| |
7730 |path| |
7727 |
7731 |
7728 path := subDir asFilename components. |
7732 path := subDir asFilename components. |
7729 (itemsByPath at:( {root label},path) ifAbsent:nil) isNil ifTrue:[ |
7733 (itemsByPath at:( {root label},path) ifAbsent:nil) isNil ifTrue:[ |
7730 folderRoot isNil ifTrue:[ |
7734 folderRoot isNil ifTrue:[ |
7731 folderRoot := myHierarchicalItemWithLabelAndIcon new. |
7735 folderRoot := MyHierarchicalItem new. |
7732 folderRoot icon:folderIcon. |
7736 folderRoot icon:folderIcon. |
7733 folderRoot label:((resources string:'[%1]' with:eachDirName) asText allItalic withColor:Color grey). |
7737 folderRoot label:((resources string:'[%1]' with:eachDirName) asText allItalic withColor:Color grey). |
7734 folderRoot type:#compiledPackagesRoot. |
7738 folderRoot type:#compiledPackagesRoot. |
7735 ]. |
7739 ]. |
7736 self |
7740 self |