#FEATURE
class: UIPainter
added:
#openSubSpecBrowser
#withSpecClassAndSelectorDo:
changed: #openSubSpecGUIPainter
--- a/UIPainter.st Wed Nov 18 11:34:57 2015 +0100
+++ b/UIPainter.st Wed Nov 18 11:36:07 2015 +0100
@@ -3780,35 +3780,22 @@
"Modified: / 16.7.1998 / 18:15:46 / cg"
!
+openSubSpecBrowser
+ "opens a browser on the current subspecification"
+
+ self withSpecClassAndSelectorDo:[:cls :sel |
+ cls theMetaclass browse:sel.
+ ].
+!
+
openSubSpecGUIPainter
"opens a GUI Painter on the current subspecification"
- |spec cls meta sel|
-
- (self resolveName:specClassName) isNil ifTrue:[
- self askForSaving ifFalse: [^self]
- ].
-
- spec := self specTool specification.
- cls := spec majorKey.
- cls isNil ifTrue:[
- cls := specClassName.
- ].
- (cls := self resolveName:cls inClass:(Smalltalk at: specClassName asSymbol)) isNil ifTrue:[
- spec majorKey isNil ifTrue:[
- ^ self warn:'Cannot find class (no majorKey specified).'.
- ].
- ^ self warn:('Cannot find class ', spec majorKey asBoldText, '.').
- ].
- sel := spec minorKey.
- meta := cls class whichClassIncludesSelector:sel.
- meta isNil ifTrue:[
- ^ self warn:'Cannot find selector #', (sel ? '') asBoldText, ' in class ', cls name asBoldText, '!!'
- ].
-
- self class
- openOnClass:meta soleInstance
- andSelector:spec minorKey.
+ self withSpecClassAndSelectorDo:[:cls :sel |
+ self class
+ openOnClass:cls theMetaclass soleInstance
+ andSelector:sel.
+ ].
"Modified: / 5.11.2001 / 16:51:46 / cg"
!
@@ -3843,6 +3830,35 @@
].
"Modified: / 12-01-2008 / 10:31:34 / cg"
+!
+
+withSpecClassAndSelectorDo:aTwoArgBlock
+ "helper for open GUI Painter/open Browser on the current subspecification"
+
+ |spec cls meta sel|
+
+ (self resolveName:specClassName) isNil ifTrue:[
+ self askForSaving ifFalse: [^self]
+ ].
+
+ spec := self specTool specification.
+ cls := spec majorKey.
+ cls isNil ifTrue:[
+ cls := specClassName.
+ ].
+ (cls := self resolveName:cls inClass:(Smalltalk at: specClassName asSymbol)) isNil ifTrue:[
+ spec majorKey isNil ifTrue:[
+ ^ self warn:'Cannot find class (no majorKey specified).'.
+ ].
+ ^ self warn:('Cannot find class ', spec majorKey asBoldText, '.').
+ ].
+ sel := spec minorKey.
+ meta := cls class whichClassIncludesSelector:sel.
+ meta isNil ifTrue:[
+ ^ self warn:'Cannot find selector #', (sel ? '') asBoldText, ' in class ', cls name asBoldText, '!!'
+ ].
+
+ aTwoArgBlock value:meta value:spec minorKey.
! !
!UIPainter methodsFor:'change & update'!