# HG changeset patch # User Claus Gittinger # Date 1487006094 -3600 # Node ID f5ef58c6082ba6846b8fded89a7a23f129b3ed60 # Parent 9f2865200e2f8a9c2af1e8ce0a904a8b69254144 #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 diff -r 9f2865200e2f -r f5ef58c6082b 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 ,' + " + + + + ^ #( + +'. + ] 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'!