# HG changeset patch # User ca # Date 950789778 -3600 # Node ID c0116e25a2aceab31514041ea51be65455008110 # Parent ba372586f8996d42062f90f735d11df4a2709277 generateAspectSelectorsMethod diff -r ba372586f899 -r c0116e25a2ac UIPainterView.st --- a/UIPainterView.st Thu Feb 17 13:15:58 2000 +0100 +++ b/UIPainterView.st Thu Feb 17 13:16:18 2000 +0100 @@ -868,6 +868,53 @@ "Modified: / 29.7.1998 / 12:21:19 / cg" ! +generateAspectSelectorsMethod + "generate aspectSelectors method. + Return a string ready to compile into the application class." + + |cls code spec| + + className isNil ifTrue:[ + self warn:'Set first the class!!'. + ^ nil + ]. + + (cls := self resolveName:className) isNil ifTrue:[ + self warn:'Class ', className asString, ' does not exist!!'. + ^ nil + ]. + spec := treeView exportedAspects. + spec size == 0 ifTrue:[^ nil]. + + "/ make it an array ... + spec := spec collect:[:entry | + entry type isNil ifTrue:[ + entry subAspect + ] ifFalse:[ + Array with:entry subAspect with:entry type + ]. + ]. + spec := spec asArray. + + code := '!!' , cls name , ' class methodsFor:''plugIn spec''!!\\' . + + code := code , 'aspectSelectors + "This resource specification was automatically generated + by the UIPainter of ST/X." + + "Do not manually edit this. If it is corrupted, + the UIPainter may not be able to read the specification." + + "Return a description of exported aspects; + these can be connected to aspects of an embedding application + (if this app is embedded in a subCanvas)." + + ^ ' , spec storeString , '\!!\'. + code := code withCRs. + ^ code + +! + generateCodeFrom:aListOfSelectors in:aClass do:aBlock self class redefineAspectMethods ifTrue:[