changed:
authorClaus Gittinger <cg@exept.de>
Sat, 24 Oct 2009 14:47:46 +0200
changeset 9066 5a3e22e2c61c
parent 9065 efb483eb10a8
child 9067 3d6f7b88f4da
changed: #setUndoCount #switchToClassNameOrSelectorMatching:
NewSystemBrowser.st
Tools__NewSystemBrowser.st
--- a/NewSystemBrowser.st	Sat Oct 24 14:43:04 2009 +0200
+++ b/NewSystemBrowser.st	Sat Oct 24 14:47:46 2009 +0200
@@ -12561,11 +12561,8 @@
     classListApp := self classListApp.
     DefaultEmphasizeUnloadedClasses := e := self emphasizeUnloadedClasses value.
     e ifTrue:[
-        classListApp window font boldness < 0.6 ifTrue:[
-            clr := (Color red:20)
-        ] ifFalse:[
-            clr := (Color red:10)
-        ].
+        clr := Color red:(classListApp window font boldness < 0.6 
+                                ifTrue:[20] ifFalse:[10]).
     ] ifFalse:[
         clr := nil
     ].
@@ -25526,23 +25523,17 @@
 !
 
 setUndoCount
-    | undoString undoTree |
+    | undoString undoSize |
 
     (self canUseRefactoringSupport) ifFalse:[^ self].
 
     undoString := Dialog request: 'Enter undo stack size:\(i.e.: Number of remembered operations)' withCRs
                          initialAnswer:(RefactoryChangeManager undoSize printString).
-    undoString isEmpty ifTrue: [^self].
-    undoTree := RBParser parseExpression: undoString onError: [:str :pos | ^self].
-
-    "Don't like the isKindOf:, but don't have a portable way to determine if something is a number."
-    "/ cg: who asked this question ?
-    "/ why not simply use 'asInteger' or 'Number readFrom:string' ?
-
-    (undoTree isLiteral and: [undoTree value isKindOf: Integer])
-            ifFalse: [^self].
-
-    RefactoryChangeManager undoSize: undoTree value
+
+    undoSize := Integer readFrom:undoString onError:nil.
+    undoSize isNil ifTrue: [^self].
+
+    RefactoryChangeManager undoSize: undoSize
 !
 
 synchronousUpdate
@@ -35745,7 +35736,7 @@
 !
 
 switchToClassNameOrSelectorMatching:aMatchString
-    |className class impl|
+    |className class implementors answer|
 
     aMatchString knownAsSymbol ifTrue:[
         class := Smalltalk classNamed:aMatchString.
@@ -35756,6 +35747,38 @@
 "/        impl := Smalltalk allImplementorsOf:aMatchString asSymbol.
 "/        impl notEmptyOrNil ifTrue:[
 "/        ].
+        (aMatchString first isLetter not
+        or:[ aMatchString first isLowercase]) ifTrue:[
+            implementors := SystemBrowser findImplementorsMatching:aMatchString in:(Smalltalk allClasses) ignoreCase:true.
+            implementors size > 0 ifTrue:[
+                implementors size == 1 ifTrue:[
+                    answer := Dialog 
+                        confirm:(resources 
+                                        stringWithCRs:'No class named "%1".\But "%2" implements it. Go there ?' 
+                                        with:aMatchString allBold
+                                        with:implementors first mclass name).
+                    answer ifTrue:[
+                        self switchToClass:implementors first mclass selector:implementors first selector.
+                    ].
+                    ^ self.
+                ].
+                implementors := implementors asOrderedCollection sort:[:a :b | a mclass name < b mclass name].
+                answer := Dialog 
+                    choose:(resources 
+                                    stringWithCRs:'No class named "%1.\But there are %2 implementors of it. Goto one of them ?' 
+                                    with:aMatchString allBold
+                                    with:implementors size)
+                    fromList:(implementors collect:[:m | m mclass name])
+                    values:implementors 
+                    buttons:#('No, Search for a Class') values:#(searchClass) 
+                    lines:10 cancel:nil.
+
+                answer isNil ifTrue:[^ self].
+                answer ~~ #searchClass ifTrue:[
+self halt.
+                ].
+            ].
+        ].
     ].
 
     className := self askForClassNameMatching:aMatchString.
@@ -43215,11 +43238,11 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.1379 2009-10-23 14:27:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.1380 2009-10-24 12:47:46 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.1379 2009-10-23 14:27:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Attic/NewSystemBrowser.st,v 1.1380 2009-10-24 12:47:46 cg Exp $'
 ! !
 
 NewSystemBrowser initialize!
--- a/Tools__NewSystemBrowser.st	Sat Oct 24 14:43:04 2009 +0200
+++ b/Tools__NewSystemBrowser.st	Sat Oct 24 14:47:46 2009 +0200
@@ -12561,11 +12561,8 @@
     classListApp := self classListApp.
     DefaultEmphasizeUnloadedClasses := e := self emphasizeUnloadedClasses value.
     e ifTrue:[
-        classListApp window font boldness < 0.6 ifTrue:[
-            clr := (Color red:20)
-        ] ifFalse:[
-            clr := (Color red:10)
-        ].
+        clr := Color red:(classListApp window font boldness < 0.6 
+                                ifTrue:[20] ifFalse:[10]).
     ] ifFalse:[
         clr := nil
     ].
@@ -25526,23 +25523,17 @@
 !
 
 setUndoCount
-    | undoString undoTree |
+    | undoString undoSize |
 
     (self canUseRefactoringSupport) ifFalse:[^ self].
 
     undoString := Dialog request: 'Enter undo stack size:\(i.e.: Number of remembered operations)' withCRs
                          initialAnswer:(RefactoryChangeManager undoSize printString).
-    undoString isEmpty ifTrue: [^self].
-    undoTree := RBParser parseExpression: undoString onError: [:str :pos | ^self].
-
-    "Don't like the isKindOf:, but don't have a portable way to determine if something is a number."
-    "/ cg: who asked this question ?
-    "/ why not simply use 'asInteger' or 'Number readFrom:string' ?
-
-    (undoTree isLiteral and: [undoTree value isKindOf: Integer])
-            ifFalse: [^self].
-
-    RefactoryChangeManager undoSize: undoTree value
+
+    undoSize := Integer readFrom:undoString onError:nil.
+    undoSize isNil ifTrue: [^self].
+
+    RefactoryChangeManager undoSize: undoSize
 !
 
 synchronousUpdate
@@ -35745,7 +35736,7 @@
 !
 
 switchToClassNameOrSelectorMatching:aMatchString
-    |className class impl|
+    |className class implementors answer|
 
     aMatchString knownAsSymbol ifTrue:[
         class := Smalltalk classNamed:aMatchString.
@@ -35756,6 +35747,38 @@
 "/        impl := Smalltalk allImplementorsOf:aMatchString asSymbol.
 "/        impl notEmptyOrNil ifTrue:[
 "/        ].
+        (aMatchString first isLetter not
+        or:[ aMatchString first isLowercase]) ifTrue:[
+            implementors := SystemBrowser findImplementorsMatching:aMatchString in:(Smalltalk allClasses) ignoreCase:true.
+            implementors size > 0 ifTrue:[
+                implementors size == 1 ifTrue:[
+                    answer := Dialog 
+                        confirm:(resources 
+                                        stringWithCRs:'No class named "%1".\But "%2" implements it. Go there ?' 
+                                        with:aMatchString allBold
+                                        with:implementors first mclass name).
+                    answer ifTrue:[
+                        self switchToClass:implementors first mclass selector:implementors first selector.
+                    ].
+                    ^ self.
+                ].
+                implementors := implementors asOrderedCollection sort:[:a :b | a mclass name < b mclass name].
+                answer := Dialog 
+                    choose:(resources 
+                                    stringWithCRs:'No class named "%1.\But there are %2 implementors of it. Goto one of them ?' 
+                                    with:aMatchString allBold
+                                    with:implementors size)
+                    fromList:(implementors collect:[:m | m mclass name])
+                    values:implementors 
+                    buttons:#('No, Search for a Class') values:#(searchClass) 
+                    lines:10 cancel:nil.
+
+                answer isNil ifTrue:[^ self].
+                answer ~~ #searchClass ifTrue:[
+self halt.
+                ].
+            ].
+        ].
     ].
 
     className := self askForClassNameMatching:aMatchString.
@@ -43215,11 +43238,11 @@
 !NewSystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1379 2009-10-23 14:27:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1380 2009-10-24 12:47:46 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1379 2009-10-23 14:27:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__NewSystemBrowser.st,v 1.1380 2009-10-24 12:47:46 cg Exp $'
 ! !
 
 NewSystemBrowser initialize!