author | Claus Gittinger <cg@exept.de> |
Mon, 01 Jun 2009 12:59:09 +0200 | |
changeset 2094 | 09ded92b1604 |
parent 2083 | 42a1c4642916 |
child 2169 | cf70a05669ef |
permissions | -rw-r--r-- |
3 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
85 | 3 |
All Rights Reserved |
3 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
932 | 12 |
"{ Package: 'stx:libbasic3' }" |
13 |
||
0 | 14 |
Change subclass:#ClassChange |
1233 | 15 |
instanceVariableNames:'className package' |
235 | 16 |
classVariableNames:'' |
17 |
poolDictionaries:'' |
|
18 |
category:'System-Changes' |
|
0 | 19 |
! |
20 |
||
634 | 21 |
!ClassChange class methodsFor:'documentation'! |
9 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
38 | 26 |
All Rights Reserved |
9 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
45 | 39 |
Abstract superclass for class related changes |
1162 | 40 |
They are typically held in a ChangeSet. |
235 | 41 |
|
42 |
[author:] |
|
43 |
Claus Gittinger |
|
9 | 44 |
" |
100 | 45 |
! ! |
46 |
||
634 | 47 |
!ClassChange class methodsFor:'instance creation'! |
85 | 48 |
|
100 | 49 |
class:aClass |
50 |
^ self new class:aClass |
|
51 |
||
52 |
"Created: 3.12.1995 / 14:01:32 / cg" |
|
1096 | 53 |
! |
54 |
||
55 |
class:aClass source:source |
|
56 |
^ self new class:aClass source:source |
|
57 |
||
58 |
"Created: 3.12.1995 / 14:01:32 / cg" |
|
1903 | 59 |
! |
60 |
||
61 |
className:aClassName |
|
62 |
^ self new className:aClassName |
|
63 |
||
64 |
"Created: / 13-11-2006 / 10:37:39 / cg" |
|
65 |
! |
|
66 |
||
67 |
className:aClassName source:source |
|
68 |
^ self new className:aClassName source:source |
|
69 |
||
70 |
"Created: / 12-11-2006 / 20:11:26 / cg" |
|
9 | 71 |
! ! |
72 |
||
0 | 73 |
!ClassChange methodsFor:'accessing'! |
74 |
||
850 | 75 |
changeClass |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
76 |
"the class of the change (nil if not present). |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
77 |
Take care for changes from foreign Smalltalks having |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
78 |
a different Namespace definition syntax" |
850 | 79 |
|
1897 | 80 |
"do not autoload an owning class of a private class!!" |
1196 | 81 |
|
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
82 |
|className class owner| |
1855
0c365a83ffc2
care for class name aliases when getting an existing
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
83 |
|
0c365a83ffc2
care for class name aliases when getting an existing
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
84 |
className := self className. |
2094 | 85 |
(className includes:$.) ifTrue:[ |
86 |
"/ VW - namespace prefix - convert to colon-notation |
|
87 |
className := className copyReplaceAll:$. withAll:'::'. |
|
88 |
]. |
|
89 |
||
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
90 |
class := Smalltalk loadedClassNamed:className. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
91 |
class isNil ifTrue:[ |
1905
51e766803c45
avoid endless recursion, if change is for a namespace definition.
boris
parents:
1903
diff
changeset
|
92 |
self isPrivateClassDefinitionChange ifTrue:[ |
51e766803c45
avoid endless recursion, if change is for a namespace definition.
boris
parents:
1903
diff
changeset
|
93 |
owner := Smalltalk loadedClassNamed:(self owningClassName). |
51e766803c45
avoid endless recursion, if change is for a namespace definition.
boris
parents:
1903
diff
changeset
|
94 |
owner notNil ifTrue:[ |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
95 |
class := owner privateClassesAt:className. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
96 |
^ class. |
1905
51e766803c45
avoid endless recursion, if change is for a namespace definition.
boris
parents:
1903
diff
changeset
|
97 |
]. |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
98 |
] ifFalse:[ |
2057 | 99 |
(className endsWith:' class') ifTrue:[ |
100 |
class := Smalltalk classNamed:(className copyWithoutLast:6). |
|
101 |
class notNil ifTrue:[ class := class theMetaclass ]. |
|
102 |
] ifFalse:[ |
|
103 |
class := Smalltalk classNamed:className. |
|
104 |
]. |
|
2094 | 105 |
|
2057 | 106 |
"/ class := Parser evaluate:className ifFail:[nil]. |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
107 |
class isNil ifTrue:[ |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
108 |
(className startsWith:'Root::') ifTrue:[ |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
109 |
className := className copyFrom:7. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
110 |
class := Smalltalk classNamed:className. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
111 |
class isNil ifTrue:[ |
2024 | 112 |
class := Parser evaluate:className ifFail:[nil] |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
113 |
] |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
114 |
] ifFalse:[ |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
115 |
(className startsWith:'Core.') ifTrue:[ |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
116 |
className := className copyFrom:6. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
117 |
class := Smalltalk classNamed:className. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
118 |
class isNil ifTrue:[ |
2024 | 119 |
class := Parser evaluate:className ifFail:[nil] |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
120 |
] |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
121 |
]. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
122 |
]. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
123 |
class isNil ifTrue:[ |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
124 |
(className startsWith:'Smalltalk.') ifTrue:[ |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
125 |
className := className copyFrom:11. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
126 |
class := Smalltalk classNamed:className. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
127 |
class isNil ifTrue:[ |
2024 | 128 |
class := Parser evaluate:className ifFail:[nil] |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
129 |
] |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
130 |
]. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
131 |
]. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
132 |
class isNil ifTrue:[ |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
133 |
^ nil. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
134 |
]. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
135 |
]. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
136 |
|
1870
55f67b913779
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
137 |
]. |
55f67b913779
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
138 |
]. |
1855
0c365a83ffc2
care for class name aliases when getting an existing
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
139 |
"/ care for aliases... |
2083 | 140 |
(class notNil and:[class name ~= className]) ifTrue:[ ^ nil ]. |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
141 |
^ class. |
850 | 142 |
! |
143 |
||
1040 | 144 |
changeClass:aClass |
145 |
"set the class of the change" |
|
146 |
||
147 |
className := aClass name. |
|
148 |
! |
|
149 |
||
100 | 150 |
class:aClass |
378 | 151 |
"set the class of the change" |
152 |
||
1903 | 153 |
self className:aClass name. |
100 | 154 |
|
1903 | 155 |
"Created: / 03-12-1995 / 14:01:45 / cg" |
156 |
"Modified: / 12-11-2006 / 20:10:28 / cg" |
|
100 | 157 |
! |
158 |
||
1096 | 159 |
class:aClass source:newSource |
160 |
"set both class and source of the change" |
|
161 |
||
1286
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
162 |
self className:(aClass name) source:newSource |
1096 | 163 |
! |
164 |
||
1305 | 165 |
classBaseName |
378 | 166 |
"return the className of the change" |
167 |
||
1196 | 168 |
^ self cutNameSpaceOf:className |
378 | 169 |
|
170 |
"Modified: 15.7.1996 / 09:28:35 / cg" |
|
654 | 171 |
! |
172 |
||
173 |
className:aString |
|
174 |
"set the className of the change" |
|
175 |
||
176 |
className := aString |
|
177 |
||
178 |
"Modified: / 15.7.1996 / 09:28:35 / cg" |
|
179 |
"Created: / 16.2.1998 / 13:05:36 / cg" |
|
1233 | 180 |
! |
181 |
||
1286
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
182 |
className:newClassName source:newSource |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
183 |
"set both className and source of the change" |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
184 |
|
1469 | 185 |
self assert:(newSource isString). |
186 |
self assert:(newClassName isString). |
|
187 |
||
1286
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
188 |
className := newClassName. |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
189 |
source := newSource. |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
190 |
|
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
191 |
"Created: 3.12.1995 / 14:01:45 / cg" |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
192 |
"Modified: 15.7.1996 / 09:28:26 / cg" |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
193 |
! |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
194 |
|
1305 | 195 |
classNameWithoutNamespace |
196 |
"return the className of the change" |
|
197 |
||
198 |
^ self cutNameSpaceOf:className |
|
199 |
||
200 |
"Modified: 15.7.1996 / 09:28:35 / cg" |
|
201 |
! |
|
202 |
||
1233 | 203 |
package |
204 |
"return the value of the instance variable 'package' (automatically generated)" |
|
205 |
||
206 |
^ package |
|
207 |
! |
|
208 |
||
209 |
package:something |
|
210 |
"set the value of the instance variable 'package' (automatically generated)" |
|
211 |
||
212 |
package := something. |
|
0 | 213 |
! ! |
214 |
||
859 | 215 |
!ClassChange methodsFor:'applying'! |
216 |
||
217 |
apply |
|
218 |
"apply the change" |
|
219 |
||
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
220 |
|class| |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
221 |
|
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
222 |
class := self changeClass. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
223 |
class isNil ifTrue:[ |
2078 | 224 |
self error:('Cannot apply change for missing class: ' , className) mayProceed:true. |
225 |
^ self |
|
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
226 |
]. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
227 |
class autoload. "Most changes cannot be applied to unloaded classes" |
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
228 |
Parser evaluate:(self source) |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
229 |
"/ |ns| |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
230 |
"/ |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
231 |
"/ ns := Class nameSpaceQuerySignal isHandled |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
232 |
"/ ifTrue:[ Class nameSpaceQuerySignal query ] |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
233 |
"/ ifFalse:[ self nameSpace ]. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
234 |
"/ |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
235 |
"/ Class nameSpaceQuerySignal answer:ns do:[ |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
236 |
"/ Parser evaluate:(self source) |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
237 |
"/ ]. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
238 |
! |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
239 |
|
1305 | 240 |
className |
241 |
|ns| |
|
242 |
||
243 |
"/ used to be ^ className; |
|
244 |
"/ |
|
245 |
"/ now include a translation from vw namespace to stx nameSpace |
|
246 |
||
247 |
ns := self nameSpaceName. |
|
248 |
(ns isNil or:[ns = 'Smalltalk']) ifTrue:[^ className]. |
|
249 |
||
250 |
^ ns , '::' , (self classNameWithoutNamespace) |
|
251 |
! |
|
252 |
||
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
253 |
fullClassName |
1196 | 254 |
|ns| |
255 |
||
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
256 |
"/ used to be ^ className; |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
257 |
"/ |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
258 |
"/ now include a translation from vw namespace to stx nameSpace |
1196 | 259 |
|
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
260 |
ns := self nameSpaceName. |
1304 | 261 |
(ns isNil or:[ns = 'Smalltalk']) ifTrue:[^ self className]. |
262 |
||
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
263 |
^ ns , '::' , self className |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
264 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
265 |
|
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
266 |
nameSpace |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
267 |
|nsName nameSpace| |
859 | 268 |
|
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
269 |
(nsName := self nameSpaceName) notNil ifTrue:[ |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
270 |
^ NameSpace name:nsName. |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
271 |
]. |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
272 |
^ Smalltalk |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
273 |
! |
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
274 |
|
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
275 |
nameSpaceName |
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
276 |
|ns cnm idx| |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
277 |
|
1513 | 278 |
className isNil ifTrue:[^ nil]. |
279 |
||
2094 | 280 |
(idx := className indexOf:$:) ~~ 0 ifTrue:[ |
859 | 281 |
"/ in a namespace |
2094 | 282 |
^ className copyTo:(idx - 1). |
859 | 283 |
]. |
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
284 |
(idx := className indexOf:$.) ~~ 0 ifTrue:[ |
1196 | 285 |
"/ in a namespace |
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
286 |
ns := className copyTo:(idx - 1). |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
287 |
cnm := className copyFrom:(idx + 1). |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
288 |
"cheat: VW namespaces" |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
289 |
^ self nameSpaceForVWNamespace:ns class:cnm ifAbsent:ns |
1196 | 290 |
]. |
1046
450ef3136cc3
care for the nameSpace in a class-definition
Claus Gittinger <cg@exept.de>
parents:
1043
diff
changeset
|
291 |
^ nil |
1513 | 292 |
|
293 |
"Modified: / 03-08-2006 / 02:04:03 / cg" |
|
859 | 294 |
! ! |
295 |
||
962 | 296 |
!ClassChange methodsFor:'printing & storing'! |
101 | 297 |
|
298 |
printOn:aStream |
|
801 | 299 |
"append a user printed representation of the receiver to aStream. |
300 |
The format is suitable for a human - not meant to be read back." |
|
301 |
||
911 | 302 |
source isNil ifTrue:[ |
303 |
aStream nextPutAll:'an empty change'. |
|
304 |
^ self |
|
305 |
]. |
|
1469 | 306 |
aStream nextPutAll:(self class name , ' - ' , source string firstLine , '...'). |
101 | 307 |
! ! |
308 |
||
932 | 309 |
!ClassChange methodsFor:'queries'! |
310 |
||
1196 | 311 |
cutNameSpaceOf:aString |
1304 | 312 |
|dotIndex colonIndex| |
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
313 |
|
1197 | 314 |
aString notNil ifTrue:[ |
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
315 |
dotIndex := aString indexOf:$.. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
316 |
dotIndex ~~ 0 ifTrue:[ |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
317 |
^ aString copyFrom:dotIndex+1 |
1197 | 318 |
]. |
1304 | 319 |
colonIndex := aString indexOf:$:. |
320 |
colonIndex ~~ 0 ifTrue:[ |
|
321 |
^ aString copyFrom:colonIndex+2 |
|
322 |
]. |
|
1196 | 323 |
]. |
324 |
^ aString |
|
325 |
! |
|
326 |
||
932 | 327 |
isClassChange |
328 |
^ true |
|
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
329 |
! |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
330 |
|
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
331 |
nameSpaceForVWNamespace:ns class:className ifAbsent:default |
2094 | 332 |
"map the namespace for a given class - hack; only works for some" |
1303 | 333 |
|
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
334 |
ns = 'Core' ifTrue:[^ 'Smalltalk']. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
335 |
ns = 'Kernel' ifTrue:[^ 'Smalltalk']. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
336 |
ns = 'Graphics' ifTrue:[^ 'Smalltalk']. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
337 |
ns = 'OS' ifTrue:[^ 'Smalltalk']. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
338 |
ns = 'Smalltalk' ifTrue:[^ 'Smalltalk']. |
1303 | 339 |
ns = 'UI' ifTrue:[^ 'Smalltalk']. |
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
340 |
^ default value |
2057 | 341 |
! |
342 |
||
343 |
owningClassName |
|
344 |
self shouldImplement |
|
932 | 345 |
! ! |
346 |
||
634 | 347 |
!ClassChange class methodsFor:'documentation'! |
100 | 348 |
|
349 |
version |
|
2094 | 350 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassChange.st,v 1.54 2009-06-01 10:59:09 cg Exp $' |
100 | 351 |
! ! |