#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Mon, 13 Feb 2017 18:14:54 +0100
changeset 3402 f5ef58c6082b
parent 3401 9f2865200e2f
child 3403 5725611d7f35
#BUGFIX by cg class: UIHelpTool changed: #loadFromClass: care for helpPairs being present: do not clobber helpSpec/flyByHelpSpec. Only treat them as valid, if they have the #help resource
UIHelpTool.st
--- a/UIHelpTool.st	Mon Feb 13 15:30:41 2017 +0100
+++ b/UIHelpTool.st	Mon Feb 13 18:14:54 2017 +0100
@@ -730,8 +730,14 @@
     specClass := self getHelpSpecClassFromClass:aClass.
 
     aClass notNil ifTrue:[
-        (aClass theMetaclass implements:helpSpecSelector) ifFalse:[
-            alternativeSelector := (self alternativeSpecSelectors ? #()) detect:[:sel | aClass theMetaclass implements:sel] ifNone:nil.
+        ((aClass theMetaclass implements:helpSpecSelector)
+        and:[(aClass theMetaclass compiledMethodAt:helpSpecSelector) hasResource:#help]) ifFalse:[
+            alternativeSelector := (self alternativeSpecSelectors ? #()) 
+                                        detect:[:sel | 
+                                            (aClass theMetaclass implements:sel)
+                                            and:[(aClass theMetaclass compiledMethodAt:sel) hasResource:#help]
+                                        ] 
+                                        ifNone:nil.
             alternativeSelector notNil ifTrue:[
                 helpSpecSelector := specSelector := alternativeSelector.
                 specClass := aClass.
@@ -791,6 +797,8 @@
         self updateIcons.
         classItemModel value:(list last)
     ].
+
+    "Modified: / 13-02-2017 / 17:47:02 / cg"
 !
 
 loadFromClass:aClass andSelector:aSelector
@@ -1201,6 +1209,9 @@
 !UIHelpTool::ClassItem methodsFor:'code generation'!
 
 createHelpMethodNamed:aMethodName
+    "cg: special case for helpPairs.
+     this returns a plain array, not invoking super"
+     
     |stream|
 
     modified ifFalse:[
@@ -1214,9 +1225,24 @@
     ].
     stream := '' writeStream.
 
-    stream nextPutAll:
-        aMethodName, '\' withCRs,
-        (ResourceSpecEditor codeGenerationCommentForClass:UIHelpTool) withCRs,
+    aMethodName = 'helpPairs' ifTrue:[
+        stream nextPutAll:
+            aMethodName, '\' withCRs,
+            (ResourceSpecEditor codeGenerationCommentForClass:UIHelpTool) withCRs,
+    '\\' withCRs,
+    '    "\' withCRs,
+    '     UIHelpTool openOnClass:', theClass name asString ,'
+    "
+
+    <resource: #help>
+
+    ^ #(
+
+'.
+    ] ifFalse:[    
+        stream nextPutAll:
+            aMethodName, '\' withCRs,
+            (ResourceSpecEditor codeGenerationCommentForClass:UIHelpTool) withCRs,
     '\\' withCRs,
     '    "\' withCRs,
     '     UIHelpTool openOnClass:', theClass name asString ,'
@@ -1227,7 +1253,8 @@
     ^ super ', aMethodName, ' addPairsFrom:#(
 
 '.
-
+    ].
+    
     self do:[:aKeyItem| |helpText|
         helpText := aKeyItem helpText.
         helpText isNil ifTrue:[ helpText := '' ].
@@ -1243,6 +1270,8 @@
         inCategory:'help specs'.
 
     self modified:false.
+
+    "Modified: / 13-02-2017 / 17:51:53 / cg"
 ! !
 
 !UIHelpTool::ClassItem methodsFor:'displaying'!