#UI_ENHANCEMENT by cg
authorClaus Gittinger <cg@exept.de>
Thu, 08 Dec 2016 12:19:08 +0100
changeset 17154 228a38eb12b7
parent 17153 52b99321786d
child 17155 7f4e22f945d2
#UI_ENHANCEMENT by cg class: AbstractLauncherApplication show README file if present in package load dialog
AbstractLauncherApplication.st
--- a/AbstractLauncherApplication.st	Thu Dec 08 11:01:44 2016 +0100
+++ b/AbstractLauncherApplication.st	Thu Dec 08 12:19:08 2016 +0100
@@ -8074,7 +8074,7 @@
 !
 
 showPackageInfoAction:package
-    |projectDef comment info dir className fileName docChange|
+    |projectDef comment info projectDir className projectDefinitionFile readMeFile|
 
     info := resources string:'Sorry, could not find any package documentation'.
     projectDef := package asPackageId projectDefinitionClass.
@@ -8086,13 +8086,15 @@
         ].
     ] ifFalse:[
         "/ try to find the package's source
-        dir := Smalltalk packageDirectoryForPackageId:package.
-        dir notNil ifTrue:[
+        projectDir := Smalltalk packageDirectoryForPackageId:package.
+        projectDir notNil ifTrue:[
+            |docChange|
+            
             "/ is there a project definition class's source?
             className := ProjectDefinition projectDefinitionClassNameForDefinitionOf:package.
-            fileName := dir / ((Smalltalk fileNameForClass:className),'.st').
-            fileName exists ifTrue:[
-                fileName readingFileDo:[:s |
+            projectDefinitionFile := projectDir / ((Smalltalk fileNameForClass:className),'.st').
+            projectDefinitionFile exists ifTrue:[
+                projectDefinitionFile readingFileDo:[:s |
                     ChangeSet 
                         fromStream:s 
                         while:[:change |
@@ -8112,12 +8114,12 @@
                     info := info ,
                             (resources stringWithCRs:'\\The project''s definition class (%1) is present,\but has no documentation method.\\In file: %2'
                                     with:className
-                                    with:fileName pathName).
+                                    with:projectDefinitionFile pathName).
                 ].
             ] ifFalse:[
                 info := info , 
                         (resources stringWithCRs:'\\No definition class was found in the project.\In folder: %1'
-                                with:dir pathName).
+                                with:projectDir pathName).
             ].
         ].
     ].
@@ -8135,6 +8137,9 @@
         info := comment asString.
     ] ifFalse:[ 
         info := info withColor:Color red.
+        (projectDir notNil and:[ (readMeFile := projectDir / 'README') exists]) ifTrue:[
+            info := info , '\\The README file there says:\\' withCRs , (readMeFile contents asString).
+        ].            
     ].
     infoTextHolder value:info.
 !