author | Claus Gittinger <cg@exept.de> |
Tue, 22 Sep 2009 16:08:55 +0200 | |
changeset 8764 | e79f1730c32e |
parent 8757 | 43e349ffe3ef |
child 9030 | 9f4eec2a3c83 |
permissions | -rw-r--r-- |
5591 | 1 |
" |
2 |
COPYRIGHT (c) 2000 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 |
" |
|
5592 | 12 |
"{ Package: 'stx:libtool' }" |
5591 | 13 |
|
14 |
"{ NameSpace: Tools }" |
|
15 |
||
16 |
BrowserList subclass:#NamespaceList |
|
17 |
instanceVariableNames:'namespaceNameList namespaceList' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-Browsers-New' |
|
21 |
! |
|
22 |
||
23 |
!NamespaceList class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 2000 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! ! |
|
38 |
||
39 |
!NamespaceList class methodsFor:'interface specs'! |
|
40 |
||
41 |
singleNameSpaceWindowSpec |
|
42 |
"This resource specification was automatically generated |
|
43 |
by the UIPainter of ST/X." |
|
44 |
||
45 |
"Do not manually edit this!! If it is corrupted, |
|
46 |
the UIPainter may not be able to read the specification." |
|
47 |
||
48 |
" |
|
49 |
UIPainter new openOnClass:ClassCategoryList andSelector:#singleCategoryWindowSpec |
|
50 |
ClassCategoryList new openInterface:#singleCategoryWindowSpec |
|
51 |
" |
|
52 |
||
53 |
<resource: #canvas> |
|
54 |
||
55 |
^ |
|
56 |
#(#FullSpec |
|
5592 | 57 |
#name: #singleNameSpaceWindowSpec |
58 |
#window: |
|
5591 | 59 |
#(#WindowSpec |
5592 | 60 |
#label: 'NameSpaceList' |
61 |
#name: 'NameSpaceList' |
|
62 |
#min: #(#Point 0 0) |
|
63 |
#max: #(#Point 1024 721) |
|
64 |
#bounds: #(#Rectangle 218 175 518 475) |
|
65 |
) |
|
66 |
#component: |
|
5591 | 67 |
#(#SpecCollection |
5592 | 68 |
#collection: #( |
69 |
#(#LabelSpec |
|
70 |
#label: 'NameSpaceName' |
|
71 |
#name: 'NameSpaceLabel' |
|
72 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 25 0) |
|
73 |
#translateLabel: true |
|
74 |
#labelChannel: #nameSpaceLabelHolder |
|
75 |
#menu: #menuHolder |
|
76 |
) |
|
77 |
) |
|
5591 | 78 |
|
5592 | 79 |
) |
5591 | 80 |
) |
81 |
! |
|
82 |
||
83 |
windowSpec |
|
84 |
"This resource specification was automatically generated |
|
85 |
by the UIPainter of ST/X." |
|
86 |
||
87 |
"Do not manually edit this!! If it is corrupted, |
|
88 |
the UIPainter may not be able to read the specification." |
|
89 |
||
90 |
" |
|
91 |
UIPainter new openOnClass:ProjectList andSelector:#windowSpec |
|
92 |
ProjectList new openInterface:#windowSpec |
|
93 |
ProjectList open |
|
94 |
" |
|
95 |
||
96 |
<resource: #canvas> |
|
97 |
||
98 |
^ |
|
99 |
#(#FullSpec |
|
8631
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
100 |
#name: #windowSpec |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
101 |
#window: |
5591 | 102 |
#(#WindowSpec |
8631
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
103 |
#label: 'NamespaceList' |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
104 |
#name: 'NamespaceList' |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
105 |
#min: #(#Point 0 0) |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
106 |
#max: #(#Point 1024 721) |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
107 |
#bounds: #(#Rectangle 13 23 313 323) |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
108 |
) |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
109 |
#component: |
5591 | 110 |
#(#SpecCollection |
8631
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
111 |
#collection: #( |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
112 |
#(#SequenceViewSpec |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
113 |
#name: 'List' |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
114 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
115 |
#tabable: true |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
116 |
#model: #selectedNamespaces |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
117 |
#menu: #menuHolder |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
118 |
#hasHorizontalScrollBar: true |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
119 |
#hasVerticalScrollBar: true |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
120 |
#miniScrollerHorizontal: true |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
121 |
#isMultiSelect: true |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
122 |
#valueChangeSelector: #selectionChangedByClick |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
123 |
#useIndex: false |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
124 |
#sequenceList: #nameSpaceList |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
125 |
#doubleClickChannel: #doubleClickChannel |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
126 |
#properties: |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
127 |
#(#PropertyListDictionary |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
128 |
#dragArgument: nil |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
129 |
#dropArgument: nil |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
130 |
#canDropSelector: #canDropContext: |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
131 |
#dropSelector: #doDropContext: |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
132 |
) |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
133 |
) |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
134 |
) |
5591 | 135 |
|
8631
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
136 |
) |
5591 | 137 |
) |
138 |
||
139 |
"Created: / 18.2.2000 / 01:06:05 / cg" |
|
140 |
"Modified: / 18.2.2000 / 01:24:50 / cg" |
|
141 |
! ! |
|
142 |
||
143 |
!NamespaceList class methodsFor:'queries-plugin'! |
|
144 |
||
145 |
aspectSelectors |
|
146 |
^ #( |
|
7706 | 147 |
#(#doubleClickChannel #action ) |
148 |
immediateUpdate |
|
149 |
selectedNamespaces |
|
150 |
menuHolder |
|
151 |
inGeneratorHolder |
|
152 |
outGeneratorHolder |
|
153 |
selectionChangeCondition |
|
154 |
updateTrigger |
|
155 |
forceGeneratorTrigger |
|
156 |
hideUnloadedClasses |
|
157 |
showAllClassesInNameSpaceOrganisation |
|
158 |
organizerMode |
|
159 |
slaveMode |
|
5591 | 160 |
) |
161 |
||
7706 | 162 |
"Created: / 18-02-2000 / 01:06:27 / cg" |
163 |
"Modified: / 05-03-2007 / 16:47:45 / cg" |
|
5591 | 164 |
! ! |
165 |
||
166 |
!NamespaceList methodsFor:'aspects'! |
|
167 |
||
8631
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
168 |
itemList |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
169 |
^ self nameSpaceList value |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
170 |
! |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
171 |
|
5591 | 172 |
nameSpaceLabelHolder |
173 |
^ self pseudoListLabelHolder |
|
174 |
! |
|
175 |
||
176 |
nameSpaceList |
|
177 |
namespaceList isNil ifTrue:[ |
|
178 |
namespaceList := ValueHolder new |
|
179 |
]. |
|
180 |
^ namespaceList |
|
181 |
||
182 |
"Created: / 18.2.2000 / 00:59:01 / cg" |
|
183 |
! |
|
184 |
||
185 |
selectedNamespaces |
|
186 |
^ self selectionHolder |
|
187 |
||
188 |
! |
|
189 |
||
190 |
selectedNamespaces:aValueHolder |
|
191 |
^ self selectionHolder:aValueHolder |
|
192 |
||
193 |
! ! |
|
194 |
||
195 |
!NamespaceList methodsFor:'change & update'! |
|
196 |
||
197 |
delayedUpdate:something with:aParameter from:changedObject |
|
198 |
||
199 |
self inSlaveModeOrInvisible |
|
200 |
ifTrue:[ |
|
201 |
changedObject == Smalltalk ifTrue:[ |
|
202 |
something == #classComment ifTrue:[^ self]. |
|
203 |
]. |
|
204 |
self invalidateList. |
|
205 |
^ self |
|
206 |
]. |
|
207 |
||
208 |
changedObject == slaveMode ifTrue:[ |
|
209 |
listValid ~~ true ifTrue:[ |
|
210 |
self enqueueDelayedUpdateList |
|
211 |
]. |
|
212 |
"/ self invalidateList. |
|
213 |
^ self |
|
214 |
]. |
|
215 |
||
216 |
changedObject == Smalltalk ifTrue:[ |
|
217 |
something == #newClass ifTrue:[ |
|
218 |
listValid == true ifTrue:[ |
|
219 |
aParameter isNameSpace ifTrue:[ |
|
220 |
(namespaceList value includes:aParameter name) ifFalse:[ |
|
221 |
self invalidateList. |
|
222 |
] |
|
223 |
]. |
|
224 |
]. |
|
225 |
^ self |
|
226 |
]. |
|
227 |
something == #classRemove ifTrue:[ |
|
228 |
listValid == true ifTrue:[ |
|
229 |
aParameter isNameSpace ifTrue:[ |
|
230 |
self invalidateList. |
|
231 |
]. |
|
232 |
]. |
|
233 |
^ self |
|
234 |
]. |
|
235 |
^ self |
|
236 |
]. |
|
237 |
||
238 |
super delayedUpdate:something with:aParameter from:changedObject |
|
239 |
||
240 |
"Created: / 18.2.2000 / 01:00:07 / cg" |
|
241 |
"Modified: / 26.2.2000 / 01:10:46 / cg" |
|
242 |
! |
|
243 |
||
244 |
selectionChangedByClick |
|
245 |
"we are not interested in that - get another notification |
|
246 |
via the changed valueHolder" |
|
247 |
||
248 |
"Created: / 18.2.2000 / 01:00:14 / cg" |
|
249 |
! |
|
250 |
||
251 |
update:something with:aParameter from:changedObject |
|
252 |
changedObject == Smalltalk ifTrue:[ |
|
253 |
something == #methodDictionary ifTrue:[ |
|
254 |
^ self |
|
255 |
]. |
|
256 |
something == #methodTrap ifTrue:[ |
|
257 |
^ self |
|
258 |
]. |
|
259 |
something == #methodInClass ifTrue:[ |
|
260 |
^ self |
|
261 |
]. |
|
262 |
something == #classVariables ifTrue:[ |
|
263 |
^ self |
|
264 |
]. |
|
265 |
something == #classComment ifTrue:[ |
|
266 |
^ self. |
|
267 |
]. |
|
268 |
something == #methodInClassRemoved ifTrue:[ |
|
269 |
^ self. |
|
270 |
]. |
|
271 |
]. |
|
272 |
super update:something with:aParameter from:changedObject |
|
273 |
! ! |
|
274 |
||
8631
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
275 |
!NamespaceList methodsFor:'drag & drop'! |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
276 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
277 |
canDropContext:aDropContext |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
278 |
|objects nameSpace| |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
279 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
280 |
objects := aDropContext dropObjects collect:[:obj | obj theObject]. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
281 |
(objects conform:[:aMethodOrClass | aMethodOrClass isClass ]) ifFalse:[^ false]. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
282 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
283 |
nameSpace := self nameSpaceAtTargetPointOf:aDropContext. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
284 |
nameSpace isNil ifTrue:[^ false]. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
285 |
nameSpace = self class nameListEntryForALL ifTrue:[^ false]. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
286 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
287 |
^ (objects contains:[:aClass | aClass nameSpace name ~= nameSpace]) |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
288 |
! |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
289 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
290 |
doDropContext:aDropContext |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
291 |
|nameSpaceName nameSpace objects| |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
292 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
293 |
objects := aDropContext dropObjects collect:[:aDropObject | aDropObject theObject]. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
294 |
(objects conform:[:something | something isClass]) ifTrue:[ |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
295 |
nameSpaceName := self nameSpaceAtTargetPointOf:aDropContext. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
296 |
(nameSpaceName notNil |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
297 |
and:[ nameSpaceName ~= self class nameListEntryForALL]) ifTrue:[ |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
298 |
nameSpace := NameSpace name:nameSpaceName. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
299 |
objects do:[:eachClassToMove | |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
300 |
|className| |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
301 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
302 |
className := eachClassToMove nameWithoutPrefix. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
303 |
nameSpace == Smalltalk ifTrue:[ |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
304 |
Smalltalk renameClass:eachClassToMove to:className asSymbol. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
305 |
] ifFalse:[ |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
306 |
Smalltalk renameClass:eachClassToMove to:(nameSpace name , '::' , className) asSymbol. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
307 |
nameSpace changed. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
308 |
]. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
309 |
]. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
310 |
Smalltalk changed. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
311 |
]. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
312 |
^ self |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
313 |
]. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
314 |
! |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
315 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
316 |
nameSpaceAtTargetPointOf:aDropContext |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
317 |
|p targetView lineNr item| |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
318 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
319 |
p := aDropContext targetPoint. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
320 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
321 |
targetView := aDropContext targetWidget. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
322 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
323 |
lineNr := targetView yVisibleToLineNr:p y. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
324 |
lineNr isNil ifTrue:[^ nil]. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
325 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
326 |
item := self itemList at:lineNr. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
327 |
item isNil ifTrue:[^ nil]. |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
328 |
|
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
329 |
^ item |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
330 |
! ! |
0178be4a8c65
can now drag a class insto another nameSpace
Claus Gittinger <cg@exept.de>
parents:
7706
diff
changeset
|
331 |
|
5591 | 332 |
!NamespaceList methodsFor:'generators'! |
333 |
||
334 |
makeGenerator |
|
335 |
"return a generator which enumerates the classes from the selected namespace(s)." |
|
336 |
||
8757 | 337 |
|spaceNames hideUnloadedClasses showAllClasses showChangedClasses| |
5591 | 338 |
|
339 |
spaceNames := self selectedNamespaces value. |
|
340 |
spaceNames size == 0 ifTrue:[ |
|
7706 | 341 |
^ #() |
5591 | 342 |
]. |
343 |
||
344 |
hideUnloadedClasses := self hideUnloadedClasses value. |
|
7706 | 345 |
showAllClasses := self showAllClassesInNameSpaceOrganisation value. |
8757 | 346 |
showChangedClasses := spaceNames includes:(self class nameListEntryForChanged). |
5591 | 347 |
|
7706 | 348 |
(showAllClasses or:[spaceNames includes:(self class nameListEntryForALL)]) ifTrue:[ |
349 |
hideUnloadedClasses ifTrue:[ |
|
350 |
^ Iterator on:[:whatToDo | |
|
351 |
Smalltalk allClassesDo:[:cls | |
|
352 |
cls isLoaded ifTrue:[ |
|
8757 | 353 |
cls isRealNameSpace ifFalse:[ |
7706 | 354 |
whatToDo value:cls |
355 |
] |
|
356 |
] |
|
357 |
] |
|
358 |
] |
|
359 |
]. |
|
360 |
^ Iterator on:[:whatToDo | |
|
361 |
Smalltalk allClassesDo:whatToDo |
|
362 |
] |
|
5591 | 363 |
]. |
364 |
||
365 |
(spaceNames size == 1 |
|
366 |
and:[spaceNames first = 'Smalltalk']) ifTrue:[ |
|
8757 | 367 |
"/ somewhat tuned - quick look if classes name includes colons ... |
7706 | 368 |
^ Iterator on:[:whatToDo | |
369 |
Smalltalk allClassesDo:[:cls | |
|
370 |
|includeIt| |
|
371 |
||
372 |
includeIt := (cls name includes:$:) not. |
|
373 |
includeIt := includeIt |
|
374 |
or:[(cls isPrivate not |
|
375 |
and:[(cls nameSpace == Smalltalk)])]. |
|
376 |
includeIt := includeIt |
|
377 |
or:[(cls isPrivate |
|
378 |
and:[(cls topOwningClass nameSpace == Smalltalk)])]. |
|
379 |
||
380 |
includeIt := includeIt |
|
381 |
and:[hideUnloadedClasses not or:[cls isLoaded]]. |
|
5591 | 382 |
|
7706 | 383 |
includeIt := includeIt |
384 |
or:[ cls extensions |
|
385 |
contains:[:mthd | |
|
386 |
|sel parts| |
|
387 |
sel := mthd selector. |
|
388 |
(sel isNameSpaceSelector |
|
389 |
and:[ parts := sel nameSpaceSelectorParts. |
|
390 |
spaceNames includes:parts first]) |
|
391 |
] |
|
392 |
]. |
|
5591 | 393 |
|
7706 | 394 |
includeIt ifTrue:[ |
8757 | 395 |
cls isRealNameSpace ifFalse:[ |
7706 | 396 |
whatToDo value:cls |
397 |
] |
|
398 |
] |
|
399 |
] |
|
400 |
] |
|
5591 | 401 |
]. |
402 |
||
403 |
^ Iterator on:[:whatToDo | |
|
8757 | 404 |
|changedClasses| |
405 |
||
406 |
showChangedClasses ifTrue:[ changedClasses := ChangeSet current changedClasses collect:[:cls | cls theNonMetaclass]]. |
|
5591 | 407 |
|
8757 | 408 |
Smalltalk allClassesDo:[:cls | |
409 |
|spaceOfClass spaceNameOfClass includeIt| |
|
5591 | 410 |
|
8757 | 411 |
spaceOfClass := cls isPrivate ifTrue:[cls topOwningClass nameSpace] ifFalse:[cls nameSpace]. |
412 |
spaceNameOfClass := spaceOfClass name. |
|
5591 | 413 |
|
8757 | 414 |
includeIt := spaceNames contains:[:nm | nm = spaceNameOfClass |
415 |
or:[spaceNameOfClass startsWith:(nm , '::')]]. |
|
416 |
includeIt ifFalse:[ |
|
417 |
(showChangedClasses and:[ (changedClasses includes:cls theNonMetaclass) ]) ifTrue:[ |
|
418 |
includeIt := true |
|
419 |
]. |
|
420 |
]. |
|
421 |
hideUnloadedClasses ifTrue:[ |
|
422 |
includeIt := includeIt and:[cls isLoaded]. |
|
423 |
]. |
|
424 |
includeIt ifTrue:[ |
|
425 |
cls isRealNameSpace ifFalse:[ |
|
426 |
whatToDo value:cls |
|
427 |
] |
|
428 |
] |
|
429 |
] |
|
7706 | 430 |
] |
5591 | 431 |
|
7706 | 432 |
"Created: / 18-02-2000 / 01:01:58 / cg" |
433 |
"Modified: / 05-03-2007 / 23:01:21 / cg" |
|
5591 | 434 |
! ! |
435 |
||
436 |
!NamespaceList methodsFor:'private'! |
|
437 |
||
438 |
defaultSlaveModeValue |
|
6710 | 439 |
|mode| |
440 |
||
441 |
mode := self topApplication perform:#initialOrganizerMode ifNotUnderstood:nil. |
|
6735
72cb810a8786
magic constants (organizerMode) removed
Claus Gittinger <cg@exept.de>
parents:
6710
diff
changeset
|
442 |
mode == OrganizerCanvas organizerModeNamespace ifTrue:[^ false]. |
72cb810a8786
magic constants (organizerMode) removed
Claus Gittinger <cg@exept.de>
parents:
6710
diff
changeset
|
443 |
"/ self organizerMode value == OrganizerCanvas organizerModeCategory ifTrue:[^ true]. |
5591 | 444 |
"/ ^ false |
6745 | 445 |
mode isNil ifTrue:[^ false]. |
5591 | 446 |
^ true |
447 |
! |
|
448 |
||
449 |
initialOrganizerMode |
|
6735
72cb810a8786
magic constants (organizerMode) removed
Claus Gittinger <cg@exept.de>
parents:
6710
diff
changeset
|
450 |
^ OrganizerCanvas organizerModeNamespace |
5591 | 451 |
! |
452 |
||
453 |
listOfNamespaces |
|
8757 | 454 |
|allNamespaces showAllNamespaces generator numClassesInChangeSet| |
5591 | 455 |
|
8757 | 456 |
showAllNamespaces := false. "/ only topLevel namespaces are shown |
457 |
"/ showAllNamespaces := true. |
|
458 |
||
5591 | 459 |
allNamespaces := IdentitySet new. |
460 |
||
461 |
inGeneratorHolder isNil ifTrue:[ |
|
6675 | 462 |
(self hideUnloadedClasses value) ifTrue:[ |
463 |
Smalltalk allClassesDo:[:eachClass | |
|
464 |
eachClass isLoaded ifTrue:[ |
|
465 |
allNamespaces add:(eachClass theNonMetaclass topNameSpace) |
|
466 |
]. |
|
467 |
] |
|
468 |
] ifFalse:[ |
|
6794 | 469 |
allNamespaces := NameSpace allNameSpaces. |
6675 | 470 |
]. |
5591 | 471 |
|
6675 | 472 |
showAllNamespaces ifFalse:[ |
473 |
"/ only topLevel namespaces are shown |
|
474 |
"/ i.e. ignore subspaces |
|
5591 | 475 |
|
6675 | 476 |
allNamespaces := allNamespaces select:[:ns | ns isTopLevelNameSpace]. |
477 |
]. |
|
478 |
allNamespaces := allNamespaces collect:[:ns | ns name]. |
|
5591 | 479 |
] ifFalse:[ |
6675 | 480 |
generator := inGeneratorHolder value. |
481 |
generator isNil ifTrue:[^ #() ]. |
|
482 |
generator do:[:ns | allNamespaces add:ns]. |
|
5591 | 483 |
]. |
484 |
||
485 |
allNamespaces := allNamespaces asOrderedCollection. |
|
486 |
allNamespaces sort. |
|
487 |
allNamespaces size == 1 ifTrue:[ |
|
6675 | 488 |
self nameSpaceLabelHolder value:(LabelAndIcon icon:(self class nameSpaceIcon) string:allNamespaces first). |
5591 | 489 |
]. |
8757 | 490 |
|
8764 | 491 |
"/ for now: disabled, because it gets replicated into the nameSpace filter, which |
492 |
"/ does not (yet) handle it correctly |
|
493 |
"/ numClassesInChangeSet := ChangeSet current changedClasses size. |
|
494 |
"/ numClassesInChangeSet > 0 ifTrue:[ |
|
495 |
"/ "/ dont include count - makeGenerator compares against the un-expanded nameListEntry (sigh - need two lists) |
|
496 |
"/ allNamespaces addFirst:((self class nameListEntryForChanged "bindWith:numClassesInChangeSet") allItalic). |
|
497 |
"/ ]. |
|
8757 | 498 |
|
8696 | 499 |
allNamespaces addFirst:(self class nameListEntryForALL asText allItalic). |
5591 | 500 |
^ allNamespaces |
501 |
||
502 |
"Created: / 18.2.2000 / 01:04:27 / cg" |
|
503 |
"Modified: / 25.2.2000 / 22:11:29 / cg" |
|
504 |
! |
|
505 |
||
506 |
makeDependent |
|
507 |
Smalltalk addDependent:self |
|
508 |
||
509 |
"Created: / 18.2.2000 / 01:04:36 / cg" |
|
510 |
! |
|
511 |
||
512 |
makeIndependent |
|
513 |
Smalltalk removeDependent:self. |
|
514 |
||
515 |
"Created: / 18.2.2000 / 01:04:42 / cg" |
|
516 |
! |
|
517 |
||
518 |
updateList |
|
519 |
|newList oldSelection newSelection selectedNamespacesHolder| |
|
520 |
||
521 |
selectedNamespacesHolder := self selectedNamespaces. |
|
522 |
oldSelection := selectedNamespacesHolder value. |
|
523 |
newList := self listOfNamespaces. |
|
524 |
newList ~= namespaceList value ifTrue:[ |
|
525 |
"/ oldSelection size > 0 ifTrue:[ |
|
526 |
"/ selectedNamespacesHolder removeDependent:self. |
|
527 |
"/ selectedNamespacesHolder value:#(). |
|
528 |
"/ selectedNamespacesHolder addDependent:self. |
|
529 |
"/ ]. |
|
530 |
self nameSpaceList value:newList. |
|
531 |
||
532 |
oldSelection size > 0 ifTrue:[ |
|
533 |
newSelection := oldSelection select:[:nm | |
|
534 |
(nm = self class nameListEntryForALL) |
|
535 |
or:[ (Smalltalk at:nm asSymbol) isNameSpace] |
|
536 |
]. |
|
537 |
newSelection ~= oldSelection ifTrue:[ |
|
538 |
selectedNamespacesHolder value:newSelection. |
|
539 |
] |
|
540 |
] |
|
541 |
]. |
|
542 |
listValid := true. |
|
543 |
! ! |
|
544 |
||
545 |
!NamespaceList class methodsFor:'documentation'! |
|
546 |
||
547 |
version |
|
8764 | 548 |
^ '$Header: /cvs/stx/stx/libtool/Tools_NamespaceList.st,v 1.14 2009-09-22 14:08:55 cg Exp $' |
5591 | 549 |
! ! |