AbstractLauncherApplication.st
changeset 18819 af9f6140c93b
parent 18804 5e06abe51151
child 18854 10a887eba554
--- a/AbstractLauncherApplication.st	Fri Jun 07 22:54:29 2019 +0200
+++ b/AbstractLauncherApplication.st	Sat Jun 08 01:55:59 2019 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1997 by eXept Software AG
               All Rights Reserved
@@ -43,7 +45,7 @@
 !
 
 HierarchicalItemWithLabelAndIcon subclass:#MyHierarchicalItem
-	instanceVariableNames:'type info'
+	instanceVariableNames:'type info isBroken'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:AbstractLauncherApplication::PackageLoadDialog
@@ -7657,17 +7659,22 @@
         ].
     ].
 
+    isBroken ifTrue:[
+        item isBroken:true.
+    ].
+    
     "/ do not overwrite an app by a lib with the same name (happens in expecco/application)
     (isApplication or:[ item icon isNil or:[item icon == folderIcon or:[item icon == greyFolderIcon]]]) ifTrue:[
         isBroken ifTrue:[
             item icon:(ToolbarIconLibrary packageDefectOpen24x24Icon2).
-            item label:(item label , (' (broken: folder no longer present)' withColor:Color red))
+            item label:(item label , (' (broken: folder no longer present)' withColor:Color red)).
         ] ifFalse:[    
             isAlreadyLoaded ifTrue:[
                 item icon:(isApplication ifTrue:[greyApplicationIcon] ifFalse:[greyPackageIcon]). 
                 item label:(item label , alreadyLoadedString)
             ] ifFalse:[
                 item icon:(isApplication ifTrue:[applicationIcon] ifFalse:[packageIcon]). 
+                item type:(isApplication ifTrue:[#application] ifFalse:[#package]). 
             ].
         ].
     ].
@@ -7689,7 +7696,7 @@
         ]
     ].
 
-    "Modified: / 05-06-2019 / 14:15:02 / Claus Gittinger"
+    "Modified: / 08-06-2019 / 01:54:12 / Claus Gittinger"
 !
 
 filterChangedAction
@@ -7700,7 +7707,12 @@
         itemsMatchingFilter notEmptyOrNil ifTrue:[ 
             "/ nothing
             root recursiveDo:[:item |
-                item label:(item label copy allNonBold withoutAnyColorEmphasis).
+                |lbl|
+                lbl := (item label copy allNonBold withoutAnyColorEmphasis).
+                item isBroken ifTrue:[
+                    lbl := lbl withColor:Color red.
+                ].
+                item label:lbl.
             ].
         ].
         itemsMatchingFilter := #().
@@ -7722,7 +7734,9 @@
             or:[ (isMatch and:[itemPackage matches:filterPattern caseSensitive:false])
             or:[ isMatch not and:[ itemPackage asLowercase includesString:filterPattern ]]]])
         ifTrue:[ 
-            newMatchingItems add:item.
+            item isBroken ifFalse:[
+                newMatchingItems add:item.
+            ]
         ]
     ].
     (newMatchingItems sameContentsAs:itemsMatchingFilter) ifTrue:[
@@ -7732,29 +7746,55 @@
     newMatchingItems isEmpty ifTrue:[
         "/ nothing found
         root recursiveDo:[:item |
-            item label:(item label copy allNonBold withoutAnyColorEmphasis).
+            |lbl|
+            
+            lbl := item label copy allNonBold withoutAnyColorEmphasis.
+            item isBroken ifTrue:[
+                lbl := lbl withColor:Color red.
+            ].
+            item label:lbl.
         ].
         Screen current beep.
     ] ifFalse:[
         "/ collapse all and fully expand all matching items
         masterRoot recursiveDo:[:item |
+            |lbl|
+            
             (newMatchingItems includes:item) ifFalse:[
                 item collapse.
-                item label:(item label copy asText allNonBold withColor:Color grey).
+                lbl := (item label copy asText allNonBold withColor:Color grey).
+                item isBroken ifTrue:[
+                    lbl := lbl withColor:Color red.
+                ].
+                item label:lbl.
             ]
         ].
         firstMatchingItem := nil.
         newMatchingItems do:[:item |
-            item label:(item label copy allBold withoutAnyColorEmphasis).
+            |lbl|
+            lbl := (item label copy allBold withoutAnyColorEmphasis).
+            item isBroken ifTrue:[
+                lbl := lbl withColor:Color red.
+            ].
+            item label:lbl.
             item makeVisible.
-            firstMatchingItem := firstMatchingItem ? item.
+            item isBroken ifFalse:[
+                "/ don't select items which have no non-broken app or package
+                (item type notNil
+                  or:[ item recursiveDetect:
+                            [:child | child isBroken not
+                                      and:[child type notNil]]]
+                ) notNil ifTrue:[
+                    firstMatchingItem := firstMatchingItem ? item.
+                ].
+            ].
         ].
         hierarchicalListView makeLineVisible:firstMatchingItem listIndex.
     ].
     itemsMatchingFilter := newMatchingItems.
 
     "Modified (format): / 16-10-2017 / 13:58:08 / cg"
-    "Modified: / 13-03-2019 / 21:05:56 / Claus Gittinger"
+    "Modified: / 08-06-2019 / 01:52:38 / Claus Gittinger"
 !
 
 getItemByPath:path packageID:packageID under:aRoot
@@ -8369,6 +8409,42 @@
     ].
 ! !
 
+!AbstractLauncherApplication::PackageLoadDialog::MyHierarchicalItem class methodsFor:'documentation'!
+
+documentation
+"
+    documentation to be added.
+
+    class:
+        <a short class summary here, describing what instances represent>
+
+    responsibilities:    
+        <describing what my main role is>
+
+    collaborators:    
+        <describing with whom and how I talk to>
+
+    API:
+        <public api and main messages>
+        
+    example:
+        <a one-line examples on how to use - can also be in a separate example method>
+
+    implementation:
+        <implementation points>
+
+    [author:]
+        Claus Gittinger
+
+    [instance variables:]
+
+    [class variables:]
+
+    [see also:]
+
+"
+! !
+
 !AbstractLauncherApplication::PackageLoadDialog::MyHierarchicalItem methodsFor:'accessing'!
 
 info
@@ -8379,6 +8455,16 @@
     info := something.
 !
 
+isBroken
+    ^ isBroken ? false
+
+    "Modified: / 08-06-2019 / 01:03:59 / Claus Gittinger"
+!
+
+isBroken:aBoolean
+    isBroken := aBoolean.
+!
+
 type
     ^ type
 !