[squeak-dev] The Trunk: Tools-yo.406.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri May 11 18:53:39 UTC 2012
Yoshiki Ohshima uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-yo.406.mcz
==================== Summary ====================
Name: Tools-yo.406
Author: yo
Time: 11 May 2012, 11:52:55.047 am
UUID: 73d5f657-0395-4324-96ad-3fbfbffb43ae
Ancestors: Tools-yo.405, Tools-bf.405
Allows to accept method definitions in the DependencyBrowser. Works with class-side methods as well.
=============== Diff against Tools-bf.405 ===============
Item was added:
+ ----- Method: DependencyBrowser>>contents:notifying: (in category 'contents') -----
+ contents: input notifying: aController
+ "The retrieved information has changed and its source must now be
+ updated. The information can be a variety of things, depending on
+ the list selections (such as templates for class or message definition,
+ methods) or the user menu commands (such as definition, comment,
+ hierarchy). Answer the result of updating the source."
+
+ | aString aText theClass theMethodName |
+ self changed: #annotation.
+ aString := input asString.
+ aText := input asText.
+
+ theClass := self selectedClassOrMetaClass.
+ theMethodName := self selectedMessageName.
+ (theClass notNil and: [theMethodName notNil]) ifTrue: [
+ ^ self okayToAccept
+ ifFalse:
+ [false]
+ ifTrue:
+ [self defineMessageFrom: aText notifying: aController]].
+ self error: 'unacceptable accept'
+ !
Item was added:
+ ----- Method: DependencyBrowser>>defineMessageFrom:notifying: (in category 'contents') -----
+ defineMessageFrom: aString notifying: aController
+ "Compile the expressions in aString. Notify aController if a syntax error occurs. Install the compiled method in the selected class classified under the currently selected message category name. Answer the selector obtained if compilation succeeds, nil otherwise."
+ | selectedMessageName selector category oldMessageList |
+ selectedMessageName := self selectedMessageName.
+ oldMessageList := self messageList.
+ contents := nil.
+ selector := (self selectedClassOrMetaClass newParser parseSelector: aString).
+ selector := self selectedClassOrMetaClass
+ compile: aString
+ classified: (category := self selectedMessageCategoryName)
+ notifying: aController.
+ selector == nil ifTrue: [^ false].
+ contents := aString copy.
+ ^ true
+ !
Item was changed:
----- Method: DependencyBrowser>>selectedClass (in category 'class list') -----
selectedClass
"Answer the class that is currently selected. Answer nil if no selection
exists."
+ | name envt nonMetaClass nonMetaName |
- | name envt |
(name := self selectedClassName) ifNil: [^ nil].
(envt := self selectedEnvironment) ifNil: [^ nil].
+ nonMetaName := (name endsWith: ' class') ifTrue: [name allButLast: 6] ifFalse: [name].
+ nonMetaClass := envt at: nonMetaName asSymbol ifAbsent: [^ nil].
+ ^ nonMetaName = name ifTrue: [nonMetaClass] ifFalse: [nonMetaClass class].
+ !
- ^ envt at: name ifAbsent: [nil]!
More information about the Squeak-dev
mailing list
|