The Trunk: System-ul.400.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: System-ul.400.mcz

commits-2
Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.400.mcz

==================== Summary ====================

Name: System-ul.400
Author: ul
Time: 12 December 2010, 11:28:14.925 pm
UUID: 8d3e4370-de51-3f4f-b259-19b9f5184e52
Ancestors: System-mtf.399

- Utilities class >> #classFromPattern:withCaption: was moved to ToolBuilder-Kernel

=============== Diff against System-mtf.399 ===============

Item was removed:
- ----- 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 :=  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]].
- 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]
- ifNotNil: [classNames addFirst: exactMatch.
- UIManager default chooseFrom: classNames lines: lines 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: ''
- "
- !