#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Tue, 23 Jul 2019 10:23:19 +0200
changeset 4317 f0048471e0cf
parent 4316 a0550c30453e
child 4318 ca938bab6a5d
#FEATURE by cg class: ApplicationModel added: #showMeHowItWorks:inAny: #showMeHowItWorksDefaultMajorKeys comment/format in: #showMeHowItWorks changed: #showMeHowItWorks: (send #showMeHowItWorksDefaultMajorKeys instead of #className, send #showMeHowItWorks:inAny: instead of #showMeHowItWorks:in:) #showMeHowItWorks:in:
ApplicationModel.st
--- a/ApplicationModel.st	Mon Jul 22 17:35:55 2019 +0200
+++ b/ApplicationModel.st	Tue Jul 23 10:23:19 2019 +0200
@@ -2848,110 +2848,147 @@
 !ApplicationModel methodsFor:'help - presentations'!
 
 showMeHowItWorks
+    "present the default show, from a file named <majorKey>_<lang>.show.
+     The major key defaults to the classes name."
+     
     self showMeHowItWorks:nil
-"/    ShowMeHowItWorks do: #(
-"/        show: 'this little presentation shows, how to find a method when the desired result is known'
-"/
-"/        intro
-"/        
-"/        (unless: ( isEmpty: ReceiverEditor ) do:(
-"/            (showing: 'you can clear the fields - by pressing the "Clear" button' do:(
-"/                    fastMoveTo: ClearButton
-"/                    click
-"/            ))
-"/        ))
-"/        
-"/        ( showing: 'start by choosing the number of arguments,' do:(
-"/            moveTo: AllowedArguments
-"/            select: '1 argument' 
-"/        ))  
-"/        (showing: 'Click into the "receiver" field' do:(
-"/            moveTo: ReceiverEditor
-"/            click 
-"/        ))
-"/        wait: 0.5
-"/        (showing: 'Enter a value (or expression) into "receiver" field' do:(
-"/            type: '10'
-"/        ))
-"/        wait: 0.5
-"/        (showing: 'Click into the "first argument" field' do:(
-"/            moveTo: Arg1Editor
-"/            click
-"/        ))
-"/        wait: 0.5
-"/        (showing: 'and enter a value for the argument' do:(
-"/            type: '1'
-"/        ))
-"/        wait: 0.5
-"/        (showing: 'Click into the "answer" field' do:(
-"/            fastMoveTo: AnswerEditor
-"/            click
-"/        ))
-"/        (showing: 'Enter the expected result value into the "answer" field' do:(
-"/            type: '11'
-"/        ))
-"/        wait: 0.5
-"/        (showing: 'and finally, Click on the "search" button' do:(
-"/            fastMoveTo: SearchButton
-"/            click
-"/        ))
-"/        show: 'now, the finder searches for combinations that produce the desired result' 
-"/        fastMoveTo: ResultList
-"/        show: 'and present code which would produce it in the answer list below' 
-"/        show: 'if you select any item there,' 
-"/        wait: 0.5
-"/        selectIndex: 2 
-"/        wait: 0.5
-"/        fastMoveTo: ImplementorsList
-"/        show: 'the implementations will be shown in the top right implementor list' 
-"/        show: 'if you select any item there,' 
-"/        selectIndex: 1 
-"/        wait: 0.5
-"/        show: 'the implementation is shown in the bottom code editor' 
-"/        fastMoveTo: CodeView
-"/        wait: 0.5
-"/        show: 'Thank you for watching, indeed' 
-"/    )
+
+"<<END
+    ShowMeHowItWorks do: #(
+        show: 'this little show demonstrates how to open a class browser'
+
+        intro
+
+        (unless: ( isEmpty: ReceiverEditor ) do:(
+            (showing: 'you can clear the fields - by pressing the "Clear" button' do:(
+                    fastMoveTo: ClearButton
+                    click
+            ))
+        ))
+
+        ( showing: 'start by choosing the number of arguments,' do:(
+            moveTo: AllowedArguments
+            select: '1 argument' 
+        ))  
+        (showing: 'Click into the "receiver" field' do:(
+            moveTo: ReceiverEditor
+            click 
+        ))
+        wait: 0.5
+        (showing: 'Enter a value (or expression) into "receiver" field' do:(
+            type: '10'
+        ))
+        wait: 0.5
+        (showing: 'Click into the "first argument" field' do:(
+            moveTo: Arg1Editor
+            click
+        ))
+        wait: 0.5
+        (showing: 'and enter a value for the argument' do:(
+            type: '1'
+        ))
+        wait: 0.5
+        (showing: 'Click into the "answer" field' do:(
+            fastMoveTo: AnswerEditor
+            click
+        ))
+        (showing: 'Enter the expected result value into the "answer" field' do:(
+            type: '11'
+        ))
+        wait: 0.5
+        (showing: 'and finally, Click on the "search" button' do:(
+            fastMoveTo: SearchButton
+            click
+        ))
+        show: 'now, the finder searches for combinations that produce the desired result' 
+        fastMoveTo: ResultList
+        show: 'and present code which would produce it in the answer list below' 
+        show: 'if you select any item there,' 
+        wait: 0.5
+        selectIndex: 2 
+        wait: 0.5
+        fastMoveTo: ImplementorsList
+        show: 'the implementations will be shown in the top right implementor list' 
+        show: 'if you select any item there,' 
+        selectIndex: 1 
+        wait: 0.5
+        show: 'the implementation is shown in the bottom code editor' 
+        fastMoveTo: CodeView
+        wait: 0.5
+        show: 'Thank you for watching, indeed' 
+    )
+END"
 
     "Created: / 18-07-2019 / 21:59:06 / Claus Gittinger"
-    "Modified: / 19-07-2019 / 16:52:01 / Claus Gittinger"
+    "Modified: / 23-07-2019 / 09:04:36 / Claus Gittinger"
 !
 
 showMeHowItWorks:minorKey
-    self showMeHowItWorks:minorKey in:self className
-
+    "present the default show, from a file named <majorKey>_<minorKey>_<lang>.show.
+     Usually, the major key defaults to the classes name,
+     and the minor key is often emptyOrNil, if there is only one show."
+
+     self showMeHowItWorks:minorKey inAny:(self showMeHowItWorksDefaultMajorKeys)
+
+    "Modified: / 23-07-2019 / 09:08:00 / Claus Gittinger"
 !
 
 showMeHowItWorks:minorKey in:majorKey
+    self showMeHowItWorks:minorKey inAny:{ majorKey }
+
+    "Modified: / 23-07-2019 / 09:09:59 / Claus Gittinger"
+!
+
+showMeHowItWorks:minorKey inAny:setOfMajorKeys
     |fn rsrcDir spec|
 
-    fn := majorKey.
-    minorKey notEmptyOrNil ifTrue:[
-        fn := fn,'_',minorKey
-    ].
-
     rsrcDir := self class packageDirectory asFilename / 'resources' / 'shows'.
     (rsrcDir exists) ifFalse:[
-        Dialog warn:'No presentations available for %1' with:fn.
+        Dialog warn:'No presentations available for %1' with:(self className).
         ^ self
     ].
-    {
-        ('_',Smalltalk language,'.show') .
-        ('_en','.show') .
-        '.show' .
-    } do:[:rest |
-        |triedFn|
-
-        triedFn := fn,rest.
-        (rsrcDir / triedFn) exists ifTrue:[
-            (rsrcDir / triedFn) readingFileWithEncoding:#utf8 do:[:s |
-                spec := Array readFrom:s.
-            ].
-            ShowMeHowItWorks do:spec.
-            ^ self
-        ]
-    ].
-    Dialog warn:'No presentations available for %1' with:fn.
+
+    setOfMajorKeys do:[:eachTriedMajorKey |
+        fn := eachTriedMajorKey.
+        minorKey notEmptyOrNil ifTrue:[
+            fn := fn,'_',minorKey
+        ].
+
+        {
+            ('_',Smalltalk language,'.show') .
+            ('_en','.show') .
+            '.show' .
+        } do:[:rest |
+            |triedFn|
+
+            triedFn := fn,rest.
+            (rsrcDir / triedFn) exists ifTrue:[
+                (rsrcDir / triedFn) readingFileWithEncoding:#utf8 do:[:s |
+                    spec := Array readFrom:s.
+                ].
+                ShowMeHowItWorks do:spec.
+                ^ self
+            ]
+        ].
+    ].    
+    Dialog warn:'No presentations available for %1' with:(self className).
+
+    "Created: / 23-07-2019 / 09:09:37 / Claus Gittinger"
+!
+
+showMeHowItWorksDefaultMajorKeys
+    "Usually, the major key defaults to the classes name"
+
+    ^ { self class name  copyReplaceAll:$: with:$_.
+        self class nameWithoutPrefix copyReplaceAll:$: with:$_ 
+      } asSet
+
+    "
+     Expecco::ProjectDifferenceBrowser basicNew showMeHowItWorksDefaultMajorKeys
+     Expecco::ProjectDifferenceBrowser basicNew showMeHowItWorks
+    "
+
+    "Created: / 23-07-2019 / 09:07:37 / Claus Gittinger"
 ! !
 
 !ApplicationModel methodsFor:'help texts'!