author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 09 May 2013 13:50:49 +0100 | |
branch | jv |
changeset 3284 | cc387d176667 |
parent 3237 | d24781ec9edc |
child 3285 | 90f2f3083f51 |
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 |
3284
cc387d176667
Fixes for mamespace handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
15 |
instanceVariableNames:'className classIsJava package nameSpaceOverride' |
cc387d176667
Fixes for mamespace handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
16 |
classVariableNames:'' |
cc387d176667
Fixes for mamespace handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
17 |
poolDictionaries:'' |
cc387d176667
Fixes for mamespace handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
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 |
|
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
82 |
|className class owner altName nsName ns meta| |
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. |
2245 | 85 |
className isNil ifTrue:[^ nil]. |
86 |
||
2555
86df1e00019f
comment/format in: #classNameWithoutNamespace
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
87 |
"/ ok, try some heuristics (for example Root.something -> Smalltalk::something) |
2094 | 88 |
(className includes:$.) ifTrue:[ |
89 |
"/ VW - namespace prefix - convert to colon-notation |
|
90 |
className := className copyReplaceAll:$. withAll:'::'. |
|
2520 | 91 |
]. |
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
92 |
nsName := self nameSpaceOverride ? 'Smalltalk'. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
93 |
nsName notNil ifTrue:[ |
2525 | 94 |
ns := Smalltalk at:nsName asSymbol. |
95 |
ns isNil ifTrue:[ |
|
96 |
ns := NameSpace name:nsName |
|
97 |
] |
|
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
98 |
]. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
99 |
(meta := (className endsWith:' class')) ifTrue:[ |
3228
ccab656238ac
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3221
diff
changeset
|
100 |
className := className copyButLast:6. |
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
101 |
]. |
2094 | 102 |
|
2520 | 103 |
ns := (ns ? Smalltalk). |
104 |
class := ns isNameSpace |
|
105 |
ifTrue:[ ns loadedClassNamed:className ] |
|
106 |
ifFalse:[ Smalltalk loadedClassNamed:className ]. |
|
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
107 |
class isNil ifTrue:[ |
1905
51e766803c45
avoid endless recursion, if change is for a namespace definition.
boris
parents:
1903
diff
changeset
|
108 |
self isPrivateClassDefinitionChange ifTrue:[ |
2612 | 109 |
ns isNameSpace ifTrue:[ |
110 |
owner := ns loadedClassNamed:(self owningClassName). |
|
111 |
] ifFalse:[ |
|
112 |
owner := Smalltalk loadedClassNamed:(self owningClassName). |
|
113 |
]. |
|
1905
51e766803c45
avoid endless recursion, if change is for a namespace definition.
boris
parents:
1903
diff
changeset
|
114 |
owner notNil ifTrue:[ |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
115 |
class := owner privateClassesAt:className. |
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
116 |
^ meta ifTrue:[class theMetaclass] ifFalse:[class]. |
1905
51e766803c45
avoid endless recursion, if change is for a namespace definition.
boris
parents:
1903
diff
changeset
|
117 |
]. |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
118 |
] ifFalse:[ |
2520 | 119 |
class := ns isNameSpace |
120 |
ifTrue:[ ns classNamed:className ] |
|
121 |
ifFalse:[ Smalltalk loadedClassNamed:className ]. |
|
122 |
||
2057 | 123 |
"/ 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
|
124 |
class isNil ifTrue:[ |
2314
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
125 |
(altName := self classNameForWellKnownVisualWorksNamespaceClass:className) notNil |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
126 |
ifTrue:[ |
2520 | 127 |
class := ns isNameSpace |
128 |
ifTrue:[ ns classNamed:altName ] |
|
129 |
ifFalse:[ Smalltalk loadedClassNamed:altName ]. |
|
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
130 |
class isNil ifTrue:[ |
2314
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
131 |
class := Parser evaluate:altName ifFail:[nil] |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
132 |
] |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
133 |
]. |
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
134 |
]. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
135 |
]. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
136 |
class isNil ifTrue:[ |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
137 |
ns ~= Smalltalk ifTrue:[ |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
138 |
self isPrivateClassDefinitionChange ifTrue:[ |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
139 |
owner := Smalltalk loadedClassNamed:(self owningClassName). |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
140 |
owner notNil ifTrue:[ |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
141 |
class := owner privateClassesAt:className. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
142 |
^ meta ifTrue:[class theMetaclass] ifFalse:[class]. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
143 |
]. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
144 |
] ifFalse:[ |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
145 |
class := Smalltalk classNamed:className. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
146 |
"/ class := Parser evaluate:className ifFail:[nil]. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
147 |
class isNil ifTrue:[ |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
148 |
^ nil. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
149 |
]. |
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
150 |
]. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
151 |
]. |
2521 | 152 |
class isNil ifTrue:[^ nil]. |
1870
55f67b913779
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
153 |
]. |
55f67b913779
+owner access and other support for private classes
Claus Gittinger <cg@exept.de>
parents:
1855
diff
changeset
|
154 |
]. |
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
155 |
|
1855
0c365a83ffc2
care for class name aliases when getting an existing
Claus Gittinger <cg@exept.de>
parents:
1513
diff
changeset
|
156 |
"/ care for aliases... |
2521 | 157 |
"/ (class nameWithoutPrefix ~= className) ifTrue:[ ^ nil ]. |
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
158 |
^ meta ifTrue:[class theMetaclass] ifFalse:[class]. |
2314
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
159 |
|
2901
6b85ec626617
fixed namespaceoverride (for changeSetBrowser)
Claus Gittinger <cg@exept.de>
parents:
2815
diff
changeset
|
160 |
"Modified: / 10-08-2012 / 12:07:26 / cg" |
850 | 161 |
! |
162 |
||
1040 | 163 |
changeClass:aClass |
164 |
"set the class of the change" |
|
165 |
||
166 |
className := aClass name. |
|
167 |
! |
|
168 |
||
100 | 169 |
class:aClass |
378 | 170 |
"set the class of the change" |
171 |
||
1903 | 172 |
self className:aClass name. |
100 | 173 |
|
1903 | 174 |
"Created: / 03-12-1995 / 14:01:45 / cg" |
175 |
"Modified: / 12-11-2006 / 20:10:28 / cg" |
|
100 | 176 |
! |
177 |
||
1096 | 178 |
class:aClass source:newSource |
179 |
"set both class and source of the change" |
|
180 |
||
1286
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
181 |
self className:(aClass name) source:newSource |
1096 | 182 |
! |
183 |
||
1305 | 184 |
classBaseName |
378 | 185 |
"return the className of the change" |
186 |
||
1196 | 187 |
^ self cutNameSpaceOf:className |
378 | 188 |
|
189 |
"Modified: 15.7.1996 / 09:28:35 / cg" |
|
654 | 190 |
! |
191 |
||
3151 | 192 |
className |
3221
7fa1821ca907
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
193 |
^ className |
3151 | 194 |
! |
195 |
||
654 | 196 |
className:aString |
197 |
"set the className of the change" |
|
198 |
||
3183 | 199 |
self assert:aString notNil. |
654 | 200 |
className := aString |
201 |
||
202 |
"Modified: / 15.7.1996 / 09:28:35 / cg" |
|
203 |
"Created: / 16.2.1998 / 13:05:36 / cg" |
|
1233 | 204 |
! |
205 |
||
1286
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
206 |
className:newClassName source:newSource |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
207 |
"set both className and source of the change" |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
208 |
|
1469 | 209 |
self assert:(newSource isString). |
210 |
self assert:(newClassName isString). |
|
211 |
||
1286
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
212 |
className := newClassName. |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
213 |
source := newSource. |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
214 |
|
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
215 |
"Created: 3.12.1995 / 14:01:45 / cg" |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
216 |
"Modified: 15.7.1996 / 09:28:26 / cg" |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
217 |
! |
621aac0264a7
catch non-string source args
Claus Gittinger <cg@exept.de>
parents:
1233
diff
changeset
|
218 |
|
2314
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
219 |
classNameForWellKnownVisualWorksNamespaceClass:className |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
220 |
(className startsWith:'Root::') ifTrue:[ |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
221 |
^ className copyFrom:7. |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
222 |
]. |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
223 |
(className startsWith:'Core.') ifTrue:[ |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
224 |
^ className copyFrom:6. |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
225 |
]. |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
226 |
(className startsWith:'Smalltalk.') ifTrue:[ |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
227 |
^ className copyFrom:11. |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
228 |
]. |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
229 |
^ nil |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
230 |
|
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
231 |
"Created: / 29-01-2011 / 11:29:59 / cg" |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
232 |
! |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
233 |
|
1305 | 234 |
classNameWithoutNamespace |
235 |
"return the className of the change" |
|
236 |
||
3221
7fa1821ca907
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
237 |
^ self cutMyNameSpaceOf: "cutNameSpaceOf:"className |
1305 | 238 |
|
2555
86df1e00019f
comment/format in: #classNameWithoutNamespace
Claus Gittinger <cg@exept.de>
parents:
2525
diff
changeset
|
239 |
"Modified: / 06-10-2011 / 16:58:34 / cg" |
1305 | 240 |
! |
241 |
||
3151 | 242 |
fullClassName |
243 |
|ns| |
|
244 |
||
245 |
"/ used to be ^ className; |
|
246 |
"/ |
|
247 |
"/ now include a translation from vw namespace to stx nameSpace |
|
248 |
||
249 |
ns := self nameSpaceName. |
|
250 |
(ns isNil or:[ns = 'Smalltalk']) ifTrue:[^ self className]. |
|
251 |
||
252 |
^ ns , '::' , self className |
|
253 |
! |
|
254 |
||
255 |
localClassName |
|
256 |
"for private classes, this returns the name relative to its owner; |
|
257 |
for non-private ones, this is the regular name. |
|
258 |
Notice that className always returns the full name (incl. any owner prefix)" |
|
259 |
||
260 |
^self className |
|
261 |
! |
|
262 |
||
263 |
nameSpace |
|
264 |
|nsName nameSpace| |
|
265 |
||
266 |
(nsName := self nameSpaceName) notNil ifTrue:[ |
|
267 |
^ NameSpace name:nsName. |
|
268 |
]. |
|
269 |
^ Smalltalk |
|
270 |
! |
|
271 |
||
272 |
nameSpaceName |
|
273 |
|ns cnm idx| |
|
274 |
||
275 |
className isNil ifTrue:[^ nil]. |
|
276 |
||
3284
cc387d176667
Fixes for mamespace handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
277 |
ns := self nameSpaceOverride. |
cc387d176667
Fixes for mamespace handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
278 |
ns notNil ifTrue:[ ^ ns ]. |
cc387d176667
Fixes for mamespace handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
279 |
|
3151 | 280 |
(idx := className indexOf:$:) ~~ 0 ifTrue:[ |
281 |
"/ in a namespace |
|
282 |
^ className copyTo:(idx - 1). |
|
283 |
]. |
|
284 |
(idx := className indexOf:$.) ~~ 0 ifTrue:[ |
|
285 |
"/ in a namespace |
|
286 |
ns := className copyTo:(idx - 1). |
|
287 |
cnm := className copyFrom:(idx + 1). |
|
288 |
"cheat: VW namespaces" |
|
289 |
^ self nameSpaceForVWNamespace:ns class:cnm ifAbsent:ns |
|
290 |
]. |
|
291 |
^ nil |
|
292 |
||
293 |
"Modified: / 03-08-2006 / 02:04:03 / cg" |
|
3284
cc387d176667
Fixes for mamespace handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
294 |
"Modified: / 09-05-2013 / 13:33:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3151 | 295 |
! |
296 |
||
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
297 |
nameSpaceOverride |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
298 |
|ns| |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
299 |
|
3110 | 300 |
ns := nameSpaceOverride. |
3221
7fa1821ca907
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
301 |
Class nameSpaceQuerySignal isHandled ifTrue:[ |
3110 | 302 |
ns := Class nameSpaceQuerySignal query. |
3221
7fa1821ca907
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
303 |
] ifFalse:[ |
7fa1821ca907
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
304 |
"/ self halt |
3110 | 305 |
]. |
3221
7fa1821ca907
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
306 |
ns isNil ifTrue:[^ nil]. |
7fa1821ca907
namespace handling fixed (I hope)
Claus Gittinger <cg@exept.de>
parents:
3216
diff
changeset
|
307 |
"/ ns == Smalltalk ifTrue:[^ nil]. |
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
308 |
^ ns name |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
309 |
|
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
310 |
"Created: / 07-09-2011 / 20:45:43 / cg" |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
311 |
! |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
312 |
|
3135 | 313 |
nameSpaceOverride:aNamespaceOrString |
314 |
aNamespaceOrString isString ifTrue:[ |
|
315 |
nameSpaceOverride := NameSpace name:aNamespaceOrString |
|
316 |
] ifFalse:[ |
|
317 |
nameSpaceOverride := aNamespaceOrString |
|
318 |
] |
|
2815 | 319 |
|
320 |
"Created: / 20-03-2012 / 17:12:08 / cg" |
|
321 |
! |
|
322 |
||
2169 | 323 |
nonMetaClassName |
324 |
^ self isForMeta |
|
325 |
ifTrue:[ self className copyTo:(self className size - 6) ] |
|
326 |
ifFalse:[ self className ] |
|
327 |
||
328 |
"Created: / 06-11-2008 / 17:26:03 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
329 |
! |
|
330 |
||
1233 | 331 |
package |
332 |
"return the value of the instance variable 'package' (automatically generated)" |
|
333 |
||
334 |
^ package |
|
335 |
! |
|
336 |
||
337 |
package:something |
|
338 |
"set the value of the instance variable 'package' (automatically generated)" |
|
339 |
||
340 |
package := something. |
|
0 | 341 |
! ! |
342 |
||
859 | 343 |
!ClassChange methodsFor:'applying'! |
344 |
||
345 |
apply |
|
346 |
"apply the change" |
|
347 |
||
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
348 |
|class| |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
349 |
|
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
350 |
class := self changeClass. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
351 |
class isNil ifTrue:[ |
2078 | 352 |
self error:('Cannot apply change for missing class: ' , className) mayProceed:true. |
353 |
^ self |
|
2019
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
354 |
]. |
685031a55645
changed #apply: load class before applying a change
Stefan Vogel <sv@exept.de>
parents:
1905
diff
changeset
|
355 |
class autoload. "Most changes cannot be applied to unloaded classes" |
2315 | 356 |
Class nameSpaceQuerySignal answer:self nameSpace do:[ |
357 |
Parser evaluate:(self source) |
|
358 |
]. |
|
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
359 |
"/ |ns| |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
360 |
"/ |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
361 |
"/ ns := Class nameSpaceQuerySignal isHandled |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
362 |
"/ ifTrue:[ Class nameSpaceQuerySignal query ] |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
363 |
"/ ifFalse:[ self nameSpace ]. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
364 |
"/ |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
365 |
"/ Class nameSpaceQuerySignal answer:ns do:[ |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
366 |
"/ Parser evaluate:(self source) |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
367 |
"/ ]. |
2315 | 368 |
|
369 |
"Modified: / 29-01-2011 / 12:28:03 / cg" |
|
859 | 370 |
! ! |
371 |
||
962 | 372 |
!ClassChange methodsFor:'printing & storing'! |
101 | 373 |
|
374 |
printOn:aStream |
|
801 | 375 |
"append a user printed representation of the receiver to aStream. |
376 |
The format is suitable for a human - not meant to be read back." |
|
377 |
||
911 | 378 |
source isNil ifTrue:[ |
3183 | 379 |
aStream nextPutAll:self class nameWithArticle,'-change (no source)'. |
911 | 380 |
^ self |
381 |
]. |
|
1469 | 382 |
aStream nextPutAll:(self class name , ' - ' , source string firstLine , '...'). |
101 | 383 |
! ! |
384 |
||
932 | 385 |
!ClassChange methodsFor:'queries'! |
386 |
||
2315 | 387 |
cutMyNameSpaceOf:aString |
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
388 |
|ns| |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
389 |
|
3216 | 390 |
aString isNil ifTrue:[ ^ nil ]. |
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
391 |
(ns := self nameSpaceOverride) isNil ifTrue:[ ^ aString ]. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
392 |
(aString startsWith:(ns , '.')) ifTrue:[ ^ self cutNameSpaceOf:aString ]. |
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
393 |
(aString startsWith:(ns , '::')) ifTrue:[ ^ self cutNameSpaceOf:aString ]. |
2315 | 394 |
|
395 |
^ aString |
|
396 |
||
2514
36e11e387006
handle namespace overrides (for mc browser)
Claus Gittinger <cg@exept.de>
parents:
2315
diff
changeset
|
397 |
"Modified: / 07-09-2011 / 20:49:33 / cg" |
2315 | 398 |
! |
399 |
||
1196 | 400 |
cutNameSpaceOf:aString |
1304 | 401 |
|dotIndex colonIndex| |
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
402 |
|
2314
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
403 |
aString isNil ifTrue:[ ^ nil]. |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
404 |
|
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
405 |
dotIndex := aString indexOf:$.. |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
406 |
dotIndex ~~ 0 ifTrue:[ |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
407 |
^ aString copyFrom:dotIndex+1 |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
408 |
]. |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
409 |
colonIndex := aString indexOf:$:. |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
410 |
colonIndex ~~ 0 ifTrue:[ |
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
411 |
^ aString copyFrom:colonIndex+2 |
1196 | 412 |
]. |
413 |
^ aString |
|
2314
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
414 |
|
ba70ddd96c9e
added: #classNameForWellKnownVisualWorksNamespaceClass:
Claus Gittinger <cg@exept.de>
parents:
2245
diff
changeset
|
415 |
"Modified: / 29-01-2011 / 11:32:01 / cg" |
1196 | 416 |
! |
417 |
||
932 | 418 |
isClassChange |
419 |
^ true |
|
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
420 |
! |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
421 |
|
2169 | 422 |
isForMeta |
423 |
^ (self className endsWith:' class') |
|
424 |
! |
|
425 |
||
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
426 |
nameSpaceForVWNamespace:ns class:className ifAbsent:default |
2094 | 427 |
"map the namespace for a given class - hack; only works for some" |
1303 | 428 |
|
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
429 |
ns = 'Core' ifTrue:[^ 'Smalltalk']. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
430 |
ns = 'Kernel' ifTrue:[^ 'Smalltalk']. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
431 |
ns = 'Graphics' ifTrue:[^ 'Smalltalk']. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
432 |
ns = 'OS' ifTrue:[^ 'Smalltalk']. |
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
433 |
ns = 'Smalltalk' ifTrue:[^ 'Smalltalk']. |
1303 | 434 |
ns = 'UI' ifTrue:[^ 'Smalltalk']. |
1300
3847c8f8a4f5
handle NS.Classname (vw files)
Claus Gittinger <cg@exept.de>
parents:
1286
diff
changeset
|
435 |
^ default value |
2057 | 436 |
! |
437 |
||
438 |
owningClassName |
|
439 |
self shouldImplement |
|
932 | 440 |
! ! |
441 |
||
634 | 442 |
!ClassChange class methodsFor:'documentation'! |
100 | 443 |
|
444 |
version |
|
3284
cc387d176667
Fixes for mamespace handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
445 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassChange.st,v 1.74 2013-05-09 13:49:14 +0100 vrany Exp $' |
2245 | 446 |
! |
447 |
||
448 |
version_CVS |
|
3284
cc387d176667
Fixes for mamespace handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3237
diff
changeset
|
449 |
^ '$Header: /cvs/stx/stx/libbasic3/ClassChange.st,v 1.74 2013-05-09 13:49:14 +0100 vrany Exp $' |
3012 | 450 |
! |
451 |
||
3121
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
452 |
version_HG |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
453 |
|
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
454 |
^ '$Changeset: <not expanded> $' |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
455 |
! |
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
456 |
|
3012 | 457 |
version_SVN |
3121
19723298dd2c
Bugfix: reading of Java class extensions methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3078
diff
changeset
|
458 |
^ '§Id: ClassChange.st 1957 2012-09-05 11:45:38Z vranyj1 §' |
100 | 459 |
! ! |
3110 | 460 |