#REFACTORING by cg
class: Tools::NewSystemBrowser
comment/format in: #selectorMenuNewMethod:
changed:
#messagesMenuFor:withCurrentSelector:withSenderChain:withImplementorChain:withLocalSenders:withLocalImplementors:withCallersOfThisMethod:withMethodsCalledByThisMethod:selfSendsOnly:
#methodTemplate
#selectorMenuNewMethod
#setAcceptActionForMethodUsingLanguage:
--- a/Tools__NewSystemBrowser.st Fri Apr 29 11:45:00 2016 +0200
+++ b/Tools__NewSystemBrowser.st Fri Apr 29 11:45:24 2016 +0200
@@ -45898,7 +45898,7 @@
methodTemplate
"return a method definition template string or nil"
- |classes cls|
+ |classes cls templateProvider|
cls := self theSingleSelectedClass.
cls isNil ifTrue:[
@@ -45908,9 +45908,17 @@
]
].
cls notNil ifTrue:[
- ^ cls programmingLanguage methodTemplate
- ].
- ^ SystemBrowser methodTemplate
+ templateProvider := cls programmingLanguage
+ ] ifFalse:[
+ templateProvider := SmalltalkLanguage instance
+ ].
+
+ (cls notNil and:[ cls isMeta and:[(cls implements:#documentation) not]]) ifTrue:[
+ self theSingleSelectedProtocol = 'documentation' ifTrue:[
+ ^ templateProvider methodTemplateForDocumentation
+ ].
+ ].
+ ^ templateProvider methodTemplate
"Modified: / 28-02-2012 / 16:59:30 / cg"
!
@@ -47806,16 +47814,13 @@
!
selectorMenuNewMethod
- "show a template for a new method"
-
- self setAcceptActionForMethod.
- ^ self showCode:(self showMethodTemplate value ifTrue:[self methodTemplate] ifFalse:[''])
-
- "Modified: / 17.2.2000 / 23:14:14 / cg"
+ "show a template for a new method for an unknown language"
+
+ ^ self selectorMenuNewMethod: nil "no language"
!
selectorMenuNewMethod: language
- "show a template for a new method"
+ "show a template for a new method for a given language"
self setAcceptActionForMethodUsingLanguage: language.
^ self showCode:(self showMethodTemplate value ifTrue:[self methodTemplate] ifFalse:[''])
@@ -51739,10 +51744,10 @@
l := l , (mthd messagesSentToSuper asArray collect:[:each | { each . mthd mclass superclass }]).
l := l , ((mthd messagesPossiblySent
select:[:sel | mthd mclass canUnderstand:sel])
- asArray collect:[:each | each colorizeAllWith:Color darkGray]).
+ asArray collect:[:each | each allItalic "colorizeAllWith:Color darkGray"]).
] ifFalse:[
l := mthd messagesSent asArray.
- l := l , (mthd messagesPossiblySent asArray collect:[:each | each colorizeAllWith:Color darkGray]).
+ l := l , (mthd messagesPossiblySent asArray collect:[:each | each allItalic "colorizeAllWith:Color darkGray"]).
].
l size > 0 ifTrue:[
l := l asOrderedCollection sort:[:a :b |
@@ -61587,12 +61592,10 @@
self explain:theSelection inCode:theCode
].
codeView isCodeView2 ifTrue:[
- languageOrNil ifNotNil:[
+ languageOrNil notNil ifTrue:[
codeView languageHolder value: languageOrNil.
]
-
- ]
-
+ ]
]
"Created: / 30-12-2009 / 20:03:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"