[squeak-dev] The Trunk: System-cmm.251.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Feb 13 21:59:45 UTC 2010
Chris Muller uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-cmm.251.mcz
==================== Summary ====================
Name: System-cmm.251
Author: cmm
Time: 13 February 2010, 3:56:48.909 pm
UUID: 957fecec-e199-4629-842e-fdc1a7dc8f61
Ancestors: System-dtl.250
- Enhanced browser invocation from a text-editor via Cmd+B. The system is now aware that Type-Suggesting Parameter Names, a long-recognized Smalltalk best-practice, will frequently be used to spawn a browser. Therefore, gross-motor skills (vs. fine) can be now used to spawn browsers on type-suggesting method-arguments, conserving developer time and energy.
=============== Diff against System-dtl.250 ===============
Item was changed:
----- Method: Utilities class>>classFromPattern:withCaption: (in category 'summer97 additions') -----
classFromPattern: pattern withCaption: aCaption
"If there is a class whose name exactly given by pattern, return it.
If there is only one class in the system whose name matches pattern, return it.
Otherwise, put up a menu offering the names of all classes that match pattern, and return the class chosen, else nil if nothing chosen.
This method ignores tab, space, & cr characters in the pattern"
+ | toMatch potentialClassNames classNames exactMatch index lines reducedIdentifiers |
- | toMatch potentialClassNames classNames exactMatch index |
(toMatch := pattern copyWithoutAll:
{Character space. Character cr. Character tab})
isEmpty ifTrue: [^ nil].
Symbol hasInterned: toMatch ifTrue:
[:patternSymbol | Smalltalk at: patternSymbol ifPresent:
[:maybeClass | (maybeClass isKindOf: Class) ifTrue: [^ maybeClass]]].
toMatch := (toMatch copyWithout: $.) asLowercase.
potentialClassNames := (Smalltalk classNames , Smalltalk traitNames) asOrderedCollection.
classNames := pattern last = $.
ifTrue: [potentialClassNames select:
[:nm | nm asLowercase = toMatch]]
ifFalse: [potentialClassNames select:
[:n | n includesSubstring: toMatch caseSensitive: false]].
- classNames isEmpty ifTrue: [^ nil].
exactMatch := classNames detect: [:each | each asLowercase = toMatch] ifNone: [nil].
+ lines := OrderedCollection new.
+ exactMatch ifNotNil: [ lines add: 1 ].
+ (reducedIdentifiers := pattern suggestedTypeNames select: [ :each | potentialClassNames includes: each ]) notEmpty
+ ifTrue:
+ [ classNames addAll: reducedIdentifiers.
+ lines add: 1 + classNames size + reducedIdentifiers size ].
-
index := classNames size = 1
ifTrue: [1]
ifFalse: [exactMatch
+ ifNil: [UIManager default chooseFrom: classNames lines: lines title: aCaption]
- ifNil: [UIManager default chooseFrom: classNames lines: #() title: aCaption]
ifNotNil: [classNames addFirst: exactMatch.
+ UIManager default chooseFrom: classNames lines: lines title: aCaption]].
- UIManager default chooseFrom: classNames lines: #(1) title: aCaption]].
index = 0 ifTrue: [^ nil].
^ Smalltalk at: (classNames at: index) asSymbol
-
"
self classFromPattern: 'CharRecog' withCaption: ''
self classFromPattern: 'rRecog' withCaption: ''
self classFromPattern: 'znak' withCaption: ''
self classFromPattern: 'orph' withCaption: ''
self classFromPattern: 'TCompil' withCaption: ''
"
!
Item was added:
+ ----- Method: String>>suggestedTypeNames (in category '*system') -----
+ suggestedTypeNames
+ ^ Array streamContents:
+ [ : stream |
+ self withIndexDo:
+ [ : eachChar : index |
+ eachChar isUppercase ifTrue:
+ [ stream nextPut:
+ (self
+ copyFrom: index
+ to: self size) trimBlanks.
+ "Often, argument names that refer to Collections end in the letter s, which can cause the suggested type-name to not be found. Account for this."
+ self last = $s
+ ifTrue:
+ [ stream nextPut:
+ (self
+ copyFrom: index
+ to: self size-1) trimBlanks ] ] ] ]!
More information about the Squeak-dev
mailing list
|