NewLauncher.st
changeset 15351 a6745c3d13da
parent 15312 f750bc9768f6
child 15357 3ab46b52387d
--- a/NewLauncher.st	Sat Feb 21 12:49:46 2015 +0100
+++ b/NewLauncher.st	Sat Feb 21 13:50:28 2015 +0100
@@ -3410,9 +3410,11 @@
      loadAction updateAction filterChangedAction selectionChangeAction showPackageInfoAction
      hierarchicalListView itemMenuGenerator
      resources selectedPackageLabel selectedPackageHolder infoView infoTextHolder
-     monticelloRoot monticelloLabel myHierarchicalItemWithLabelAndIcon|
+     monticelloRoot monticelloLabel myHierarchicalItemWithLabelAndIcon
+     alreadyLoadedString|
 
     resources := self resources.
+    alreadyLoadedString := (resources string:' (already loaded)') allItalic.
 
     folderIcon := ToolbarIconLibrary directoryOpen18x18Icon.
     packageIcon := ToolbarIconLibrary packageOpen24x24Icon.
@@ -3470,6 +3472,7 @@
     masterRoot := myHierarchicalItemWithLabelAndIcon new.
     masterRoot icon:(ToolbarIconLibrary stxHomeIcon).
     masterRoot label:(resources string:'local ').
+    masterRoot type:#localRoot.
 
     root := myHierarchicalItemWithLabelAndIcon new.
     root icon:folderIcon.
@@ -3550,7 +3553,7 @@
                 (isApplication or:[ item icon isNil or:[item icon == folderIcon or:[item icon == greyFolderIcon]]]) ifTrue:[
                     isAlreadyLoaded ifTrue:[
                         item icon:(isApplication ifTrue:[greyApplicationIcon] ifFalse:[greyPackageIcon]). 
-                        item label:(item label , (resources string:' (already loaded)') asText allItalic)
+                        item label:(item label , alreadyLoadedString)
                     ] ifFalse:[
                         item icon:(isApplication ifTrue:[applicationIcon] ifFalse:[packageIcon]). 
                     ].
@@ -3604,7 +3607,7 @@
                     isLoaded ifTrue:[
                         (item icon == applicationIcon or:[item icon == packageIcon]) ifTrue:[
                             item icon:((item icon == applicationIcon) ifTrue:[greyApplicationIcon] ifFalse:[greyPackageIcon]). 
-                            item label:(item label , (resources string:' (already loaded)') asText allItalic)
+                            item label:(item label , alreadyLoadedString)
                         ].
                     ].
                 ].
@@ -3690,22 +3693,22 @@
                                 and:[ defClass isLoaded
                                 and:[ defClass isFullyLoaded ]])
                             ifFalse:[
-                                defClass isNil ifTrue:[
-                                    Dialog warn:'Load failed: definition class not present after package load.'
-                                ] ifFalse:[
-                                    Dialog warn:'Load failed: definition class not fully loaded after package load.'
-                                ]            
+                                Dialog warn:(resources 
+                                                string:
+                                                    (defClass isNil 
+                                                        ifTrue:['Load failed: definition class not present after package load.']
+                                                        ifFalse:['Load failed: definition class not fully loaded after package load.']))
                             ] ifTrue:[
                                 doBrowse ifTrue:[
                                     Tools::NewSystemBrowser openOnPackage:package
                                 ].
                                 eachSelectedItem icon == packageIcon ifTrue:[
                                     eachSelectedItem icon:greyPackageIcon.
-                                    eachSelectedItem label:(eachSelectedItem label , ' (already loaded)' asText allItalic).
+                                    eachSelectedItem label:(eachSelectedItem label , alreadyLoadedString).
                                 ] ifFalse:[
                                     eachSelectedItem icon == applicationIcon ifTrue:[
                                         eachSelectedItem icon:greyApplicationIcon.
-                                        eachSelectedItem label:(eachSelectedItem label , (resources string:' (already loaded)') asText allItalic).
+                                        eachSelectedItem label:(eachSelectedItem label , alreadyLoadedString).
                                     ].
                                 ].
                             ].
@@ -3753,7 +3756,7 @@
                             comment := Parser methodCommentFromSource:docChange source.
                         ] ifFalse:[
                             info := info ,
-                                    (resources stringWithCRs:'\\The project''s definition class (%1)\has no documentation method.\In file: %2'
+                                    (resources stringWithCRs:'\\The project''s definition class (%1) is present,\but has no documentation method.\\In file: %2'
                                             with:className
                                             with:fileName pathName).
                         ].
@@ -3784,15 +3787,17 @@
 
     selectionChangeAction :=
         [:selectionIndices |
-            |selectedItem p|
+            |selectedItem p itemType info|
 
             selectionIndices size == 1 ifTrue:[
                 selectedItem := hierarchicalListView selectionValue first.
-                selectedItem type == #monticelloRepository ifTrue:[
-                    infoTextHolder value:'Monticello repository. Double click to browse its contents.'.
+                itemType := selectedItem type.
+
+                itemType == #monticelloRepository ifTrue:[
+                    info := 'Monticello repository. Double click to browse its contents.'.
                 ] ifFalse:[
-                    selectedItem type == #monticelloPackage ifTrue:[
-                        infoTextHolder value:'Monticello package. Double click to browse its contents.'.
+                    itemType == #monticelloPackage ifTrue:[
+                        info := 'Monticello package. Double click to browse its contents.'.
                     ] ifFalse:[
                         p := packageIdByItem at:selectedItem ifAbsent:nil.
                         p notNil ifTrue:[
@@ -3800,13 +3805,19 @@
                             showPackageInfoAction value:p.
                         ] ifFalse:[
                             selectedItem == masterRoot ifTrue:[
-                                infoTextHolder value:'Packages found on the local machine.'
-                            ].
-                            selectedItem == root ifTrue:[
-                                infoTextHolder value:'Local packages as found in the "packages" folder.'
+                                info := 'Packages found on the local machine.'
+                            ] ifFalse:[
+                                selectedItem == monticelloRoot ifTrue:[
+                                    info := 'Monticello packages found on the local machine.'
+                                ] ifFalse:[
+                                    selectedItem == root ifTrue:[
+                                        info := 'Local class library packages as found in the "packages" folder.'
+                                    ].
+                                ].
                             ].
                         ].
                     ].
+                    info notNil ifTrue:[ infoTextHolder value:(resources string:info)].
                 ].
             ] ifFalse:[
                 selectedPackageHolder value:(resources string:'Selected %1 packages.' with:selectionIndices size).
@@ -3815,47 +3826,58 @@
 
     itemMenuGenerator :=
         [
-            |item m|
+            |item m itemType package defClass|
 
             hierarchicalListView selectionValue notEmptyOrNil ifTrue:[
                 item := hierarchicalListView selectionValue first.
-                m := Menu new.
-                m addItem:(MenuItem 
-                            label: (resources string:'Open File Browser on Project''s Folder')
-                            itemValue: [
-                                |package dir|
-
-                                package := packageIdByItem at:item ifAbsent:nil.
-                                package notNil ifTrue:[
-                                    dir := Smalltalk packageDirectoryForPackageId:package.
-                                    dir notNil ifTrue:[
-                                        UserPreferences current fileBrowserClass openOn:dir.
+
+                itemType := item type.
+                ( 
+                    #( #localRoot #monticelloRoot #compiledPackagesRoot ) includes:itemType
+                ) ifFalse:[
+
+                    package := packageIdByItem at:item ifAbsent:nil.
+                    package notNil ifTrue:[
+                        defClass := package asPackageId projectDefinitionClass.
+                    ].
+
+                    m := Menu new.
+                    m addItem:(MenuItem 
+                                label: (resources string:'Open File Browser on Project''s Folder')
+                                itemValue: 
+                                    [
+                                        |dir|
+
+                                        package notNil ifTrue:[
+                                            dir := Smalltalk packageDirectoryForPackageId:package.
+                                            dir notNil ifTrue:[
+                                                UserPreferences current fileBrowserClass openOn:dir.
+                                            ] ifFalse:[
+                                                Dialog warn:(resources string:'Directory not present/readable: "%1"' with:dir)
+                                            ]
+                                        ].
                                     ]
-                                ].
-                            ]).
-                m addItem:(MenuItem 
-                            label: (resources string:'Browse Project Definition')
-                            itemValue: [
-                                |package defClass|
-
-                                package := packageIdByItem at:item ifAbsent:nil.
-                                package notNil ifTrue:[
-                                    defClass := package asPackageId projectDefinitionClass.
-                                    defClass notNil ifTrue:[
-                                        UserPreferences current systemBrowserClass openInClass:defClass class
+                                enabled:package notNil).
+                    m addItem:(MenuItem 
+                                label: (resources string:'Browse Project Definition')
+                                itemValue: 
+                                    [
+                                        defClass notNil ifTrue:[
+                                            UserPreferences current systemBrowserClass openInClass:defClass class
+                                        ].
                                     ]
-                                ].
-                            ]).
-
-                item type == #monticelloPackage ifTrue:[
-                    m addItem:(MenuItem 
-                                label: (resources string:'Browse Monticello Package')
-                                itemValue: [
-                                    |repos|
-
-                                    repos := item parent info.                    
-                                    MCRepositoryBrowser openOnRepository:repos forPackage:item label.
-                                ]).
+                                enabled:defClass notNil).
+
+                    item type == #monticelloPackage ifTrue:[
+                        m addItem:(MenuItem 
+                                    label: (resources string:'Browse Monticello Package')
+                                    itemValue: [
+                                        |repos|
+
+                                        repos := item parent info.                    
+                                        MCRepositoryBrowser openOnRepository:repos forPackage:item label.
+                                    ]).
+                    ].
                 ].
             ].
             m
@@ -5704,14 +5726,14 @@
 !NewLauncher class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.536 2015-02-17 15:56:38 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.537 2015-02-21 12:50:28 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.536 2015-02-17 15:56:38 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/NewLauncher.st,v 1.537 2015-02-21 12:50:28 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: NewLauncher.st,v 1.536 2015-02-17 15:56:38 stefan Exp $'
+    ^ '$Id: NewLauncher.st,v 1.537 2015-02-21 12:50:28 cg Exp $'
 ! !