1444
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2003 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
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 |
"
|
|
12 |
|
1267
|
13 |
"{ Package: 'stx:libbasic3' }"
|
|
14 |
|
|
15 |
"{ NameSpace: Packages }"
|
|
16 |
|
|
17 |
Object subclass:#ChangeFaker
|
|
18 |
instanceVariableNames:''
|
|
19 |
classVariableNames:''
|
|
20 |
poolDictionaries:''
|
|
21 |
category:'Package-helpers'
|
|
22 |
!
|
|
23 |
|
|
24 |
ClassChange subclass:#ClassPackageChange
|
|
25 |
instanceVariableNames:'oldPackageName'
|
|
26 |
classVariableNames:''
|
|
27 |
poolDictionaries:''
|
|
28 |
privateIn:ChangeFaker
|
|
29 |
!
|
|
30 |
|
|
31 |
MethodChange subclass:#MethodPackageChange
|
|
32 |
instanceVariableNames:'oldPackageName'
|
|
33 |
classVariableNames:''
|
|
34 |
poolDictionaries:''
|
|
35 |
privateIn:ChangeFaker
|
|
36 |
!
|
|
37 |
|
1444
|
38 |
!ChangeFaker class methodsFor:'documentation'!
|
|
39 |
|
|
40 |
copyright
|
|
41 |
"
|
|
42 |
COPYRIGHT (c) 2003 by eXept Software AG
|
|
43 |
All Rights Reserved
|
|
44 |
|
|
45 |
This software is furnished under a license and may be used
|
|
46 |
only in accordance with the terms of that license and with the
|
|
47 |
inclusion of the above copyright notice. This software may not
|
|
48 |
be provided or otherwise made available to, or used by, any
|
|
49 |
other person. No title to or ownership of the software is
|
|
50 |
hereby transferred.
|
|
51 |
"
|
|
52 |
! !
|
1267
|
53 |
|
|
54 |
!ChangeFaker class methodsFor:'initialization'!
|
|
55 |
|
|
56 |
initialize
|
1268
|
57 |
"/ Smalltalk addDependent:self.
|
1267
|
58 |
!
|
|
59 |
|
|
60 |
update:something with:aParameter from:changedObject
|
|
61 |
| oldPackageName movedClass methodOwnedClass oldMethod|
|
|
62 |
(something == #projectOrganization) ifTrue:[
|
|
63 |
aParameter ifNil:[
|
|
64 |
"no need to know about this. It has probably already been past here already!!"
|
|
65 |
^ self
|
|
66 |
].
|
|
67 |
|
|
68 |
aParameter size == 1 ifTrue:[
|
|
69 |
Transcript
|
|
70 |
nextPutAll:'From PackageManager>>update:with:from:' ;
|
|
71 |
cr;
|
|
72 |
nextPutAll:'When does this happen' ;
|
|
73 |
cr.
|
|
74 |
"checking out changedObject = Smalltalk"
|
|
75 |
|
|
76 |
^ self.
|
|
77 |
].
|
|
78 |
|
|
79 |
aParameter size == 2 ifTrue:[
|
|
80 |
oldPackageName := aParameter second.
|
|
81 |
movedClass := aParameter first.
|
|
82 |
(oldPackageName isSymbol) ifTrue:[
|
|
83 |
|
|
84 |
self classMovePackageChangeWithClass:movedClass
|
|
85 |
oldPackageName:oldPackageName.
|
|
86 |
|
|
87 |
^ self.
|
|
88 |
] ifFalse:[
|
|
89 |
"it is a method move but the change will be called again as 3 parameters
|
|
90 |
it is implemented in two ways. One by NewSystemBrowser>>moveMethods:toProject:
|
|
91 |
and Method>>package i only care for the one implemented in method as it gives
|
|
92 |
me the previous package information"
|
|
93 |
^ self
|
|
94 |
].
|
|
95 |
].
|
|
96 |
|
|
97 |
aParameter size == 3 ifTrue:[
|
|
98 |
oldMethod := (aParameter second).
|
|
99 |
methodOwnedClass := (aParameter first).
|
|
100 |
oldPackageName := (aParameter third).
|
|
101 |
self
|
|
102 |
methodMovePackageChangeWithMethod:oldMethod
|
|
103 |
class:methodOwnedClass
|
|
104 |
oldPackageName:oldPackageName.
|
|
105 |
^ self.
|
|
106 |
].
|
|
107 |
self breakPoint:''.
|
|
108 |
].
|
|
109 |
! !
|
|
110 |
|
|
111 |
!ChangeFaker class methodsFor:'accessing'!
|
|
112 |
|
|
113 |
changeSet
|
|
114 |
^ ChangeSet current
|
|
115 |
! !
|
|
116 |
|
|
117 |
!ChangeFaker class methodsFor:'faked - changes'!
|
|
118 |
|
|
119 |
classMovePackageChangeWithClass:class oldPackageName:oldPackageName
|
|
120 |
| fakedChange |
|
|
121 |
fakedChange := ClassPackageChange className:class name oldPackageName:oldPackageName.
|
|
122 |
self changeSet changed:#addChange: with:fakedChange.
|
|
123 |
!
|
|
124 |
|
|
125 |
methodMovePackageChangeWithMethod:movedMethod class:methodOwnedClass oldPackageName:oldPackageName
|
|
126 |
| fakedChange |
|
|
127 |
fakedChange := (MethodPackageChange new)
|
|
128 |
previousVersion:movedMethod;
|
|
129 |
className:methodOwnedClass name;
|
|
130 |
oldPackageName:oldPackageName.
|
|
131 |
|
|
132 |
self changeSet changed:#addChange: with:fakedChange.
|
|
133 |
! !
|
|
134 |
|
|
135 |
!ChangeFaker::ClassPackageChange class methodsFor:'instance creation'!
|
|
136 |
|
|
137 |
className:className oldPackageName:oldPackageName
|
|
138 |
^ (self basicNew)
|
|
139 |
className:className;
|
|
140 |
oldPackageName:oldPackageName;
|
|
141 |
package:(Smalltalk classNamed:className) package
|
|
142 |
! !
|
|
143 |
|
|
144 |
!ChangeFaker::ClassPackageChange methodsFor:'accessing'!
|
|
145 |
|
|
146 |
oldPackageName
|
|
147 |
"return the value of the instance variable 'oldPackageName' (automatically generated)"
|
|
148 |
|
|
149 |
^ oldPackageName
|
|
150 |
!
|
|
151 |
|
|
152 |
oldPackageName:something
|
|
153 |
"set the value of the instance variable 'oldPackageName' (automatically generated)"
|
|
154 |
|
|
155 |
oldPackageName := something.
|
|
156 |
! !
|
|
157 |
|
|
158 |
!ChangeFaker::MethodPackageChange methodsFor:'accessing'!
|
|
159 |
|
|
160 |
oldPackageName
|
|
161 |
"return the value of the instance variable 'oldPackageName' (automatically generated)"
|
|
162 |
|
|
163 |
^ oldPackageName
|
|
164 |
!
|
|
165 |
|
|
166 |
oldPackageName:something
|
|
167 |
"set the value of the instance variable 'oldPackageName' (automatically generated)"
|
|
168 |
|
|
169 |
oldPackageName := something.
|
|
170 |
! !
|
|
171 |
|
|
172 |
!ChangeFaker class methodsFor:'documentation'!
|
|
173 |
|
|
174 |
version
|
1444
|
175 |
^ '$Header: /cvs/stx/stx/libbasic3/packages/ChangeFaker.st,v 1.3 2006-01-10 09:29:32 cg Exp $'
|
1267
|
176 |
! !
|
|
177 |
|
|
178 |
ChangeFaker initialize!
|