--- a/BrowserView.st Sat Oct 07 13:58:00 2000 +0200
+++ b/BrowserView.st Sat Oct 07 14:00:01 2000 +0200
@@ -622,98 +622,6 @@
"Modified: / 28.5.1998 / 12:22:58 / cg"
! !
-!BrowserView class methodsFor:'utilities'!
-
-extractClassAndSelectorFrom:aString into:aBlock
- "given a string which can be either 'class>>sel' or
- 'class sel', extract className and selector, and call aBlock with
- the result.
- Useful to open browser on a method as selected in some documentation."
-
- |sel clsName isMeta sep s|
-
- sel := aString.
- sel notNil ifTrue:[
- sel := sel asString withoutSeparators.
- ('*>>*' match:sel) ifTrue:[
- sep := $>
- ] ifFalse:[
- ('* *' match:sel) ifTrue:[
- sep := Character space
- ]
- ].
- sep notNil ifTrue:[
- "
- extract class/sel from selection
- "
- s := ReadStream on:sel.
- clsName := s upTo:sep.
- [s peek == sep] whileTrue:[s next].
- sel := s upToEnd.
-
- (clsName endsWith:' class') ifTrue:[
- isMeta := true.
- clsName := clsName copyWithoutLast:6 "copyTo:(clsName size - 5)"
- ] ifFalse:[
- isMeta := false
- ].
- ]
- ].
- aBlock value:clsName value:sel value:isMeta
-
- "Modified: / 17.6.1996 / 16:52:14 / stefan"
- "Created: / 6.2.2000 / 00:51:51 / cg"
- "Modified: / 6.2.2000 / 00:56:43 / cg"
-!
-
-extractSelectorFrom:aString
- "given an arbitrary string, try to extract a useful selector.
- Useful to open browser on a selected code fragment."
-
- |s sel t|
-
- aString isNil ifTrue:[^ nil].
-
- s := aString asString string.
- s := s withoutSeparators.
- sel := s.
- sel knownAsSymbol ifTrue:[
- "/ might be already correct ...
- ^ sel
- ].
- (sel startsWith:'#') ifTrue:[
- t := Symbol readFrom:sel.
- t knownAsSymbol ifTrue:[
- ^ t
- ]
- ].
-
- t := Parser selectorInExpression:sel.
- t notNil ifTrue:[
- sel := t
- ].
- (sel = s or:[sel isNil or:[t == #>>]]) ifTrue:[
- "oops - thats probably not what we want here ..."
- self extractClassAndSelectorFrom:s into:[:c :s :m |
- sel := s
- ]
- ].
- ^ sel
-
- "
- self extractSelectorFrom:'at:put:'
- self extractSelectorFrom:'#at:put:'
- self extractSelectorFrom:'at:something put:someValue'
- self extractSelectorFrom:'self at:something put:someValue'
- self extractSelectorFrom:'(self at:something put:someValue)'
- self extractSelectorFrom:'[self at:something put:someValue] value'
- self extractSelectorFrom:'Array>>at:put:'
- "
-
- "Created: / 6.2.2000 / 00:49:44 / cg"
- "Modified: / 6.2.2000 / 00:57:08 / cg"
-! !
-
!BrowserView methodsFor:'change & update'!
delayedUpdate:something with:someArgument from:changedObject
@@ -12155,7 +12063,7 @@
sel := codeView selection.
sel notNil ifTrue:[
- t := BrowserView extractSelectorFrom:sel.
+ t := SystemBrowser extractSelectorFrom:sel.
t notNil ifTrue:[
sel := t.
].
@@ -13794,6 +13702,6 @@
!BrowserView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.638 2000-09-27 14:06:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.639 2000-10-07 11:59:27 cg Exp $'
! !
BrowserView initialize!
--- a/SystemBrowser.st Sat Oct 07 13:58:00 2000 +0200
+++ b/SystemBrowser.st Sat Oct 07 14:00:01 2000 +0200
@@ -3071,9 +3071,101 @@
"
! !
+!SystemBrowser class methodsFor:'utilities'!
+
+extractClassAndSelectorFrom:aString into:aBlock
+ "given a string which can be either 'class>>sel' or
+ 'class sel', extract className and selector, and call aBlock with
+ the result.
+ Useful to open browser on a method as selected in some documentation."
+
+ |sel clsName isMeta sep s|
+
+ sel := aString.
+ sel notNil ifTrue:[
+ sel := sel asString withoutSeparators.
+ ('*>>*' match:sel) ifTrue:[
+ sep := $>
+ ] ifFalse:[
+ ('* *' match:sel) ifTrue:[
+ sep := Character space
+ ]
+ ].
+ sep notNil ifTrue:[
+ "
+ extract class/sel from selection
+ "
+ s := ReadStream on:sel.
+ clsName := s upTo:sep.
+ [s peek == sep] whileTrue:[s next].
+ sel := s upToEnd.
+
+ (clsName endsWith:' class') ifTrue:[
+ isMeta := true.
+ clsName := clsName copyWithoutLast:6 "copyTo:(clsName size - 5)"
+ ] ifFalse:[
+ isMeta := false
+ ].
+ ]
+ ].
+ aBlock value:clsName value:sel value:isMeta
+
+ "Modified: / 17.6.1996 / 16:52:14 / stefan"
+ "Created: / 6.2.2000 / 00:51:51 / cg"
+ "Modified: / 6.2.2000 / 00:56:43 / cg"
+!
+
+extractSelectorFrom:aString
+ "given an arbitrary string, try to extract a useful selector.
+ Useful to open browser on a selected code fragment."
+
+ |s sel t|
+
+ aString isNil ifTrue:[^ nil].
+
+ s := aString asString string.
+ s := s withoutSeparators.
+ sel := s.
+ sel knownAsSymbol ifTrue:[
+ "/ might be already correct ...
+ ^ sel
+ ].
+ (sel startsWith:'#') ifTrue:[
+ t := Symbol readFrom:sel.
+ t knownAsSymbol ifTrue:[
+ ^ t
+ ]
+ ].
+
+ t := Parser selectorInExpression:sel.
+ t notNil ifTrue:[
+ sel := t
+ ].
+ (sel = s or:[sel isNil or:[t == #>>]]) ifTrue:[
+ "oops - thats probably not what we want here ..."
+ self extractClassAndSelectorFrom:s into:[:c :s :m |
+ sel := s
+ ]
+ ].
+ ^ sel
+
+ "
+ self extractSelectorFrom:'at:put:'
+ self extractSelectorFrom:'#at:put:'
+ self extractSelectorFrom:'at:something put:someValue'
+ self extractSelectorFrom:'self at:something put:someValue'
+ self extractSelectorFrom:'(self at:something put:someValue)'
+ self extractSelectorFrom:'[self at:something put:someValue] value'
+ self extractSelectorFrom:'Array>>at:put:'
+ "
+
+ "Created: / 6.2.2000 / 00:49:44 / cg"
+ "Modified: / 6.2.2000 / 00:57:08 / cg"
+! !
+
!SystemBrowser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.116 2000-10-06 20:13:11 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.117 2000-10-07 12:00:01 cg Exp $'
! !
SystemBrowser initialize!