10009
|
1 |
"
|
10064
|
2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
|
|
3 |
All Rights Reserved
|
10009
|
4 |
|
10064
|
5 |
Permission is hereby granted, free of charge, to any person
|
|
6 |
obtaining a copy of this software and associated documentation
|
|
7 |
files (the 'Software'), to deal in the Software without
|
|
8 |
restriction, including without limitation the rights to use,
|
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10 |
copies of the Software, and to permit persons to whom the
|
|
11 |
Software is furnished to do so, subject to the following
|
|
12 |
conditions:
|
|
13 |
|
|
14 |
The above copyright notice and this permission notice shall be
|
|
15 |
included in all copies or substantial portions of the Software.
|
|
16 |
|
|
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
24 |
OTHER DEALINGS IN THE SOFTWARE.
|
10009
|
25 |
"
|
|
26 |
"{ Package: 'stx:libtool' }"
|
|
27 |
|
|
28 |
"{ NameSpace: Tools }"
|
|
29 |
|
|
30 |
BrowserList subclass:#ChangeList
|
10449
|
31 |
instanceVariableNames:'listHolder listView showRemovedHolder showSameHolder
|
|
32 |
acceptEnabledHolder'
|
10009
|
33 |
classVariableNames:'LastSelectionConditionString'
|
|
34 |
poolDictionaries:''
|
|
35 |
category:'Interface-Browsers-ChangeSet'
|
|
36 |
!
|
|
37 |
|
|
38 |
HierarchicalItem subclass:#ListEntry
|
|
39 |
instanceVariableNames:'change application x'
|
|
40 |
classVariableNames:''
|
|
41 |
poolDictionaries:''
|
|
42 |
privateIn:ChangeList
|
|
43 |
!
|
|
44 |
|
|
45 |
!ChangeList class methodsFor:'documentation'!
|
|
46 |
|
|
47 |
copyright
|
|
48 |
"
|
10064
|
49 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
|
|
50 |
All Rights Reserved
|
|
51 |
|
|
52 |
Permission is hereby granted, free of charge, to any person
|
|
53 |
obtaining a copy of this software and associated documentation
|
|
54 |
files (the 'Software'), to deal in the Software without
|
|
55 |
restriction, including without limitation the rights to use,
|
|
56 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
57 |
copies of the Software, and to permit persons to whom the
|
|
58 |
Software is furnished to do so, subject to the following
|
|
59 |
conditions:
|
10009
|
60 |
|
10064
|
61 |
The above copyright notice and this permission notice shall be
|
|
62 |
included in all copies or substantial portions of the Software.
|
|
63 |
|
|
64 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
65 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
66 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
67 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
68 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
69 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
70 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
71 |
OTHER DEALINGS IN THE SOFTWARE.
|
10009
|
72 |
"
|
|
73 |
! !
|
|
74 |
|
|
75 |
!ChangeList class methodsFor:'image specs'!
|
|
76 |
|
|
77 |
iconEqual
|
10657
|
78 |
^ ToolbarIconLibrary iconEqual12x12
|
10009
|
79 |
|
10657
|
80 |
"Modified: / 31-08-2011 / 10:52:34 / cg"
|
10009
|
81 |
!
|
|
82 |
|
|
83 |
iconEqualGrayed
|
10657
|
84 |
^ ToolbarIconLibrary iconEqualGray12x12
|
10009
|
85 |
|
10657
|
86 |
"Modified: / 31-08-2011 / 10:54:00 / cg"
|
10009
|
87 |
!
|
|
88 |
|
|
89 |
iconMinus
|
10657
|
90 |
^ ToolbarIconLibrary iconMinus12x12
|
10009
|
91 |
|
10657
|
92 |
"Modified: / 31-08-2011 / 10:51:26 / cg"
|
10009
|
93 |
!
|
|
94 |
|
|
95 |
iconMinusGrayed
|
10657
|
96 |
^ ToolbarIconLibrary iconMinusGray12x12
|
10009
|
97 |
|
10657
|
98 |
"Modified: / 31-08-2011 / 10:54:40 / cg"
|
10009
|
99 |
!
|
|
100 |
|
|
101 |
iconPlus
|
10657
|
102 |
^ ToolbarIconLibrary iconPlus12x12
|
10009
|
103 |
|
10657
|
104 |
"Modified: / 31-08-2011 / 10:51:39 / cg"
|
10009
|
105 |
!
|
|
106 |
|
|
107 |
iconPlusGrayed
|
10657
|
108 |
^ ToolbarIconLibrary iconPlusGray12x12
|
10009
|
109 |
|
10657
|
110 |
"Modified: / 31-08-2011 / 10:54:46 / cg"
|
10009
|
111 |
! !
|
|
112 |
|
|
113 |
!ChangeList class methodsFor:'interface specs'!
|
|
114 |
|
|
115 |
windowSpec
|
|
116 |
"This resource specification was automatically generated
|
|
117 |
by the UIPainter of ST/X."
|
|
118 |
|
|
119 |
"Do not manually edit this!! If it is corrupted,
|
|
120 |
the UIPainter may not be able to read the specification."
|
|
121 |
|
|
122 |
"
|
|
123 |
UIPainter new openOnClass:Tools::ChangeList andSelector:#windowSpec
|
|
124 |
Tools::ChangeList new openInterface:#windowSpec
|
|
125 |
Tools::ChangeList open
|
|
126 |
"
|
|
127 |
|
|
128 |
<resource: #canvas>
|
|
129 |
|
|
130 |
^
|
|
131 |
#(FullSpec
|
|
132 |
name: windowSpec
|
|
133 |
window:
|
|
134 |
(WindowSpec
|
|
135 |
label: 'Change List'
|
|
136 |
name: 'Change List'
|
|
137 |
min: (Point 10 10)
|
|
138 |
bounds: (Rectangle 0 0 300 300)
|
|
139 |
)
|
|
140 |
component:
|
|
141 |
(SpecCollection
|
|
142 |
collection: (
|
|
143 |
(SelectionInListModelViewSpec
|
10449
|
144 |
name: 'List'
|
10009
|
145 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
|
|
146 |
model: selectionHolder
|
|
147 |
menu: menuHolder
|
|
148 |
hasHorizontalScrollBar: true
|
|
149 |
hasVerticalScrollBar: true
|
|
150 |
listModel: listHolder
|
|
151 |
multipleSelectOk: true
|
|
152 |
useIndex: false
|
|
153 |
highlightMode: line
|
|
154 |
doubleClickSelector: selectionDoubleclicked
|
|
155 |
postBuildCallback: postBuildList:
|
|
156 |
)
|
|
157 |
)
|
|
158 |
|
|
159 |
)
|
|
160 |
)
|
|
161 |
! !
|
|
162 |
|
|
163 |
!ChangeList class methodsFor:'menu specs'!
|
|
164 |
|
|
165 |
listMenu
|
|
166 |
"This resource specification was automatically generated
|
|
167 |
by the MenuEditor of ST/X."
|
|
168 |
|
|
169 |
"Do not manually edit this!! If it is corrupted,
|
|
170 |
the MenuEditor may not be able to read the specification."
|
|
171 |
|
|
172 |
"
|
|
173 |
MenuEditor new openOnClass:Tools::ChangeList andSelector:#listMenu
|
|
174 |
(Menu new fromLiteralArrayEncoding:(Tools::ChangeList listMenu)) startUp
|
|
175 |
"
|
|
176 |
|
|
177 |
<resource: #menu>
|
|
178 |
|
|
179 |
^
|
|
180 |
#(Menu
|
|
181 |
(
|
|
182 |
(MenuItem
|
|
183 |
enabled: hasChangeSelectedAndNotRemoved
|
|
184 |
label: 'Apply'
|
|
185 |
itemValue: listMenuApply
|
|
186 |
translateLabel: true
|
|
187 |
isVisible: acceptEnabledHolder
|
|
188 |
shortcutKey: Accept
|
|
189 |
)
|
|
190 |
(MenuItem
|
|
191 |
label: 'Apply all'
|
|
192 |
itemValue: listMenuApplyAll
|
|
193 |
translateLabel: true
|
|
194 |
isVisible: acceptEnabledHolder
|
|
195 |
)
|
|
196 |
(MenuItem
|
|
197 |
enabled: hasSingleChangeSelectedAndCanBrowse
|
|
198 |
label: 'Browse'
|
|
199 |
itemValue: listMenuBrowse
|
|
200 |
translateLabel: true
|
|
201 |
)
|
|
202 |
(MenuItem
|
|
203 |
label: '-'
|
|
204 |
)
|
|
205 |
(MenuItem
|
|
206 |
label: 'Delete'
|
|
207 |
itemValue: listMenuDeleteSelection
|
|
208 |
nameKey: Delete
|
|
209 |
translateLabel: true
|
|
210 |
shortcutKey: Delete
|
|
211 |
)
|
|
212 |
(MenuItem
|
|
213 |
label: '-'
|
|
214 |
)
|
|
215 |
(MenuItem
|
|
216 |
label: 'Select...'
|
|
217 |
translateLabel: true
|
|
218 |
submenu:
|
|
219 |
(Menu
|
|
220 |
(
|
|
221 |
(MenuItem
|
|
222 |
label: 'Select same'
|
|
223 |
itemValue: listMenuSelectSame
|
|
224 |
translateLabel: true
|
|
225 |
)
|
|
226 |
(MenuItem
|
|
227 |
label: 'Select additions (new classes/methods)'
|
|
228 |
itemValue: listMenuSelectAdditions
|
|
229 |
translateLabel: true
|
|
230 |
)
|
|
231 |
(MenuItem
|
|
232 |
label: 'Select removals'
|
|
233 |
itemValue: listMenuSelectRemovals
|
|
234 |
translateLabel: true
|
|
235 |
)
|
|
236 |
(MenuItem
|
|
237 |
label: '-'
|
|
238 |
)
|
|
239 |
(MenuItem
|
|
240 |
label: 'Select all'
|
|
241 |
itemValue: listMenuSelectAll
|
|
242 |
translateLabel: true
|
|
243 |
)
|
|
244 |
(MenuItem
|
|
245 |
label: 'Select none'
|
|
246 |
itemValue: listMenuSelectNone
|
|
247 |
translateLabel: true
|
|
248 |
)
|
|
249 |
(MenuItem
|
|
250 |
label: '-'
|
|
251 |
)
|
|
252 |
(MenuItem
|
|
253 |
label: 'Select using block'
|
|
254 |
itemValue: listMenuSelectUsingBlock
|
|
255 |
translateLabel: true
|
|
256 |
)
|
|
257 |
)
|
|
258 |
nil
|
|
259 |
nil
|
|
260 |
)
|
|
261 |
)
|
|
262 |
(MenuItem
|
|
263 |
label: '-'
|
|
264 |
)
|
|
265 |
(MenuItem
|
|
266 |
label: 'Show Deleted'
|
|
267 |
translateLabel: true
|
|
268 |
indication: showRemovedHolder
|
|
269 |
)
|
|
270 |
(MenuItem
|
|
271 |
label: 'Inspect change'
|
|
272 |
itemValue: listMenuInspect
|
|
273 |
translateLabel: true
|
|
274 |
)
|
|
275 |
)
|
|
276 |
nil
|
|
277 |
nil
|
|
278 |
)
|
|
279 |
! !
|
|
280 |
|
|
281 |
!ChangeList class methodsFor:'plugIn spec'!
|
|
282 |
|
|
283 |
aspectSelectors
|
|
284 |
"This resource specification was automatically generated
|
|
285 |
by the UIPainter of ST/X."
|
|
286 |
|
|
287 |
"Do not manually edit this. If it is corrupted,
|
|
288 |
the UIPainter may not be able to read the specification."
|
|
289 |
|
|
290 |
"Return a description of exported aspects;
|
|
291 |
these can be connected to aspects of an embedding application
|
|
292 |
(if this app is embedded in a subCanvas)."
|
|
293 |
|
|
294 |
^ #(
|
|
295 |
#acceptEnabledHolder
|
|
296 |
#inGeneratorHolder
|
|
297 |
#menuHolder
|
|
298 |
#outGeneratorHolder
|
|
299 |
#selectionHolder
|
|
300 |
#showRemovedHolder
|
10449
|
301 |
#showSameHolder
|
10009
|
302 |
).
|
|
303 |
|
10449
|
304 |
"Modified: / 04-08-2011 / 18:42:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10009
|
305 |
! !
|
|
306 |
|
|
307 |
!ChangeList methodsFor:'accessing'!
|
|
308 |
|
|
309 |
acceptEnabled
|
|
310 |
"return the value in 'acceptEnabledHolder'"
|
|
311 |
|
|
312 |
^ self acceptEnabledHolder value
|
|
313 |
!
|
|
314 |
|
|
315 |
acceptEnabled: newValue
|
|
316 |
"set the value in 'acceptEnabledHolder'"
|
|
317 |
|
|
318 |
self acceptEnabledHolder value: newValue
|
|
319 |
!
|
|
320 |
|
|
321 |
selection
|
|
322 |
|
|
323 |
^self selectionHolder value
|
|
324 |
|
|
325 |
"Created: / 05-12-2009 / 14:48:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
326 |
!
|
|
327 |
|
|
328 |
showRemoved
|
|
329 |
|
|
330 |
^self showRemovedHolder value ? true
|
|
331 |
|
|
332 |
"Created: / 05-12-2009 / 14:28:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
333 |
! !
|
|
334 |
|
|
335 |
!ChangeList methodsFor:'actions'!
|
|
336 |
|
|
337 |
selectionDoubleclicked
|
|
338 |
|
|
339 |
| app |
|
|
340 |
|
|
341 |
self selection do:
|
|
342 |
[:e|e removed: e removed not].
|
|
343 |
((app := self masterApplication) respondsTo: #redrawChangeListViews)
|
|
344 |
ifTrue:[app redrawChangeListViews].
|
|
345 |
|
|
346 |
"Modified: / 16-03-2011 / 22:51:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
347 |
! !
|
|
348 |
|
|
349 |
!ChangeList methodsFor:'aspects'!
|
|
350 |
|
|
351 |
acceptEnabledHolder
|
|
352 |
"return/create the valueHolder 'acceptEnabledHolder'"
|
|
353 |
|
|
354 |
acceptEnabledHolder isNil ifTrue:[
|
|
355 |
acceptEnabledHolder := ValueHolder with:nil "defaultValue here".
|
|
356 |
].
|
|
357 |
^ acceptEnabledHolder
|
|
358 |
!
|
|
359 |
|
|
360 |
acceptEnabledHolder:aValueModel
|
|
361 |
acceptEnabledHolder := aValueModel.
|
|
362 |
!
|
|
363 |
|
|
364 |
listHolder
|
|
365 |
listHolder isNil ifTrue:[
|
|
366 |
listHolder := ValueHolder new.
|
|
367 |
].
|
|
368 |
^ listHolder
|
|
369 |
!
|
|
370 |
|
|
371 |
showRemovedHolder
|
|
372 |
"return/create the 'showRemovedHolder' value holder (automatically generated)"
|
|
373 |
|
|
374 |
showRemovedHolder isNil ifTrue:[
|
|
375 |
showRemovedHolder := ValueHolder with: true.
|
|
376 |
showRemovedHolder addDependent: self.
|
|
377 |
].
|
|
378 |
^ showRemovedHolder
|
|
379 |
!
|
|
380 |
|
10449
|
381 |
showRemovedHolder:something
|
10009
|
382 |
"set the 'showRemovedHolder' value holder (automatically generated)"
|
|
383 |
|
10449
|
384 |
|oldValue newValue|
|
|
385 |
|
|
386 |
showRemovedHolder notNil ifTrue:[
|
|
387 |
oldValue := showRemovedHolder value.
|
|
388 |
showRemovedHolder removeDependent:self.
|
|
389 |
].
|
|
390 |
showRemovedHolder := something.
|
|
391 |
showRemovedHolder notNil ifTrue:[
|
|
392 |
showRemovedHolder addDependent:self.
|
|
393 |
].
|
|
394 |
newValue := showRemovedHolder value.
|
|
395 |
oldValue ~~ newValue ifTrue:[
|
|
396 |
self update:#value with:newValue from:showRemovedHolder.
|
|
397 |
].
|
|
398 |
!
|
|
399 |
|
|
400 |
showSameHolder
|
|
401 |
"return/create the 'showSameHolder' value holder (automatically generated)"
|
|
402 |
|
|
403 |
showSameHolder isNil ifTrue:[
|
|
404 |
showSameHolder := ValueHolder with: true.
|
|
405 |
showSameHolder addDependent:self.
|
|
406 |
].
|
|
407 |
^ showSameHolder
|
|
408 |
|
|
409 |
"Modified: / 04-08-2011 / 18:39:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
410 |
!
|
|
411 |
|
|
412 |
showSameHolder:something
|
|
413 |
"set the 'showSameHolder' value holder (automatically generated)"
|
|
414 |
|
|
415 |
|oldValue newValue|
|
|
416 |
|
|
417 |
showSameHolder notNil ifTrue:[
|
|
418 |
oldValue := showSameHolder value.
|
|
419 |
showSameHolder removeDependent:self.
|
|
420 |
].
|
|
421 |
showSameHolder := something.
|
|
422 |
showSameHolder notNil ifTrue:[
|
|
423 |
showSameHolder addDependent:self.
|
|
424 |
].
|
|
425 |
newValue := showSameHolder value.
|
|
426 |
oldValue ~~ newValue ifTrue:[
|
|
427 |
self update:#value with:newValue from:showSameHolder.
|
|
428 |
].
|
10009
|
429 |
! !
|
|
430 |
|
|
431 |
!ChangeList methodsFor:'change & update'!
|
|
432 |
|
|
433 |
update: aspect with: param from: sender
|
|
434 |
|
10449
|
435 |
sender == selectionHolder ifTrue:[
|
|
436 |
self selectionChanged.
|
|
437 |
^self
|
|
438 |
].
|
|
439 |
sender == showSameHolder ifTrue:[
|
|
440 |
self updateList
|
|
441 |
].
|
|
442 |
sender == showRemovedHolder ifTrue:[
|
|
443 |
self updateList
|
|
444 |
].
|
|
445 |
|
10009
|
446 |
|
|
447 |
^super update: aspect with: param from: sender
|
|
448 |
|
|
449 |
"Created: / 24-10-2009 / 19:47:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
450 |
! !
|
|
451 |
|
|
452 |
!ChangeList methodsFor:'event processing'!
|
|
453 |
|
|
454 |
buttonPress:button x:x y:y view:aView
|
|
455 |
|
|
456 |
| itemIndex item |
|
|
457 |
|
|
458 |
button ~= 1 ifTrue:[^aView buttonPress:button x:x y:y].
|
|
459 |
|
|
460 |
itemIndex := aView yVisibleToLineNr:y.
|
|
461 |
itemIndex ifNil:[^self].
|
|
462 |
itemIndex == 0 ifTrue:[^self].
|
|
463 |
itemIndex > aView list size ifTrue:[^self].
|
|
464 |
item := aView list at: itemIndex.
|
|
465 |
|
|
466 |
((aView left + x) between: (item x) and: (item x + 16))
|
|
467 |
ifFalse:[^aView buttonPress:button x:x y:y].
|
|
468 |
|
|
469 |
item removed: item removed not.
|
|
470 |
aView invalidate
|
|
471 |
|
|
472 |
"Created: / 08-12-2009 / 14:12:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
473 |
!
|
|
474 |
|
|
475 |
handlesButtonPress:button inView:aView
|
|
476 |
|
|
477 |
^listView == aView
|
|
478 |
|
|
479 |
"Created: / 08-12-2009 / 14:08:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
480 |
! !
|
|
481 |
|
|
482 |
!ChangeList methodsFor:'generators'!
|
|
483 |
|
|
484 |
makeGenerator
|
|
485 |
"Superclass Tools::BrowserList says that I am responsible to implement this method"
|
|
486 |
|
|
487 |
^Iterator on:
|
|
488 |
[:whatToDo|
|
|
489 |
selectionHolder value do:
|
|
490 |
[:changeListItem| | change |
|
|
491 |
change := changeListItem change.
|
|
492 |
change isCompositeChange ifTrue:
|
|
493 |
[change changes do: whatToDo]]].
|
|
494 |
|
|
495 |
"Modified: / 24-07-2009 / 23:00:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
496 |
"Modified: / 24-10-2009 / 20:00:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
497 |
! !
|
|
498 |
|
|
499 |
!ChangeList methodsFor:'hooks'!
|
|
500 |
|
|
501 |
postBuildList: aView
|
|
502 |
|
|
503 |
listView := aView scrolledView.
|
|
504 |
listView delegate: self.
|
|
505 |
|
|
506 |
"Created: / 08-12-2009 / 14:10:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
507 |
! !
|
|
508 |
|
|
509 |
!ChangeList methodsFor:'initialization'!
|
|
510 |
|
|
511 |
initialize
|
|
512 |
|
|
513 |
super initialize.
|
|
514 |
menuHolder := [self menuFor: #listMenu].
|
|
515 |
|
|
516 |
"Created: / 29-10-2010 / 12:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
517 |
! !
|
|
518 |
|
|
519 |
!ChangeList methodsFor:'menu actions'!
|
|
520 |
|
|
521 |
listMenuApply
|
|
522 |
|
|
523 |
self acceptEnabled ifFalse:[^self].
|
|
524 |
|
|
525 |
self selectionHolder value do:[:e|e change apply].
|
|
526 |
|
|
527 |
"Modified: / 24-10-2009 / 22:02:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
528 |
!
|
|
529 |
|
|
530 |
listMenuApplyAll
|
|
531 |
|
|
532 |
self acceptEnabled ifFalse:[^self].
|
|
533 |
|
|
534 |
self selection value do:
|
|
535 |
[:e|e removed ifFalse:[e change apply]].
|
|
536 |
|
|
537 |
"Created: / 05-12-2009 / 14:53:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
538 |
!
|
|
539 |
|
|
540 |
listMenuBrowse
|
|
541 |
|
|
542 |
| classes methods methodsOnly |
|
|
543 |
classes := Set new.
|
|
544 |
methods := Set new.
|
|
545 |
methodsOnly := true.
|
|
546 |
self selectionHolder value do:
|
|
547 |
[:each|
|
|
548 |
each change isClassChange ifTrue:
|
|
549 |
[each change changeClass ifNotNil:
|
|
550 |
[classes add: each change changeClass.
|
|
551 |
each change isMethodCodeChange
|
|
552 |
ifTrue:
|
|
553 |
[each change changeMethod ifNotNil:
|
|
554 |
[methods add:each change changeMethod]]
|
|
555 |
ifFalse:
|
|
556 |
[methodsOnly := false]]]].
|
|
557 |
|
|
558 |
methodsOnly
|
|
559 |
ifTrue:
|
|
560 |
[methods size = 1
|
|
561 |
ifTrue:[Smalltalk browserClass openInMethod: methods anyOne]
|
|
562 |
ifFalse:[Smalltalk browserClass browseMethods: methods asArray title: 'Selected methods from changeset' sort: true]]
|
|
563 |
ifFalse:
|
|
564 |
[classes size = 1
|
|
565 |
ifTrue:[Smalltalk browserClass browseClass: classes anyOne]
|
|
566 |
ifFalse:[Smalltalk browserClass browseClasses: classes]]
|
|
567 |
|
|
568 |
|
|
569 |
|
|
570 |
|
|
571 |
"Modified: / 24-10-2009 / 22:02:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
572 |
!
|
|
573 |
|
|
574 |
listMenuDeleteSelection
|
|
575 |
|
|
576 |
self selectionHolder value do:
|
|
577 |
[:each|each removed: true].
|
|
578 |
self updateList
|
|
579 |
!
|
|
580 |
|
|
581 |
listMenuInspect
|
|
582 |
|
|
583 |
| selection |
|
|
584 |
|
|
585 |
selection := self selectionHolder value collect:[:e|e change].
|
|
586 |
selection size = 1
|
|
587 |
ifTrue:[selection anyOne inspect]
|
|
588 |
ifFalse:[selection inspect].
|
|
589 |
|
|
590 |
"Modified: / 24-10-2009 / 22:02:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
591 |
!
|
|
592 |
|
|
593 |
listMenuSelectAdditions
|
|
594 |
|
|
595 |
self listMenuSelectAllSuchThat:[:change|change delta = #+]
|
|
596 |
!
|
|
597 |
|
|
598 |
listMenuSelectAll
|
|
599 |
|
|
600 |
self listMenuSelectAllSuchThat:[:change|true]
|
|
601 |
!
|
|
602 |
|
|
603 |
listMenuSelectAllSuchThat:conditionBlock
|
|
604 |
|newSelection|
|
|
605 |
|
|
606 |
newSelection := self listHolder value
|
|
607 |
select:[:entry | conditionBlock value:entry change ].
|
|
608 |
self selectionHolder value:newSelection
|
|
609 |
!
|
|
610 |
|
|
611 |
listMenuSelectNone
|
|
612 |
|
|
613 |
self listMenuSelectAllSuchThat:[:change|false]
|
|
614 |
!
|
|
615 |
|
|
616 |
listMenuSelectRemovals
|
|
617 |
|
|
618 |
self listMenuSelectAllSuchThat:[:change|change delta = #-]
|
|
619 |
!
|
|
620 |
|
|
621 |
listMenuSelectSame
|
|
622 |
|
|
623 |
self listMenuSelectAllSuchThat:[:change|change delta = #=]
|
|
624 |
!
|
|
625 |
|
|
626 |
listMenuSelectUsingBlock
|
|
627 |
|
|
628 |
|conditionBlockString conditionBlock dialog textHolder template|
|
|
629 |
|
|
630 |
template :=
|
|
631 |
'[:change|
|
|
632 |
"/ Define condition for selection below:
|
|
633 |
"/ change is an instance of Change
|
|
634 |
"/ change will be selected if and only if block returns true
|
|
635 |
|
|
636 |
|
|
637 |
true"/always select the change
|
|
638 |
]
|
|
639 |
'.
|
|
640 |
|
|
641 |
LastSelectionConditionString isNil ifTrue:[
|
|
642 |
LastSelectionConditionString := template.
|
|
643 |
].
|
|
644 |
|
|
645 |
|
|
646 |
textHolder := ValueHolder new.
|
|
647 |
dialog := Dialog
|
|
648 |
forRequestText:(resources string:'Enter condition for selection')
|
|
649 |
lines:20
|
|
650 |
columns:70
|
|
651 |
initialAnswer:LastSelectionConditionString
|
|
652 |
model:textHolder.
|
|
653 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]).
|
|
654 |
dialog open.
|
|
655 |
dialog accepted ifFalse:[^ self].
|
|
656 |
|
|
657 |
conditionBlockString := textHolder value.
|
|
658 |
LastSelectionConditionString := conditionBlockString.
|
|
659 |
|
|
660 |
conditionBlock := Parser evaluate:conditionBlockString.
|
|
661 |
conditionBlock isBlock ifFalse:[
|
|
662 |
self error:'Bad selection block (syntax error?)'.
|
|
663 |
^ self
|
|
664 |
].
|
|
665 |
|
|
666 |
self listMenuSelectAllSuchThat: conditionBlock
|
|
667 |
!
|
|
668 |
|
|
669 |
listMenuUndeleteSelection
|
|
670 |
|
|
671 |
self selectionHolder value do:
|
|
672 |
[:each|each removed: false].
|
|
673 |
self updateList
|
|
674 |
! !
|
|
675 |
|
|
676 |
!ChangeList methodsFor:'private'!
|
|
677 |
|
|
678 |
application
|
|
679 |
|
|
680 |
^self
|
|
681 |
|
|
682 |
"Created: / 05-12-2009 / 14:10:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
683 |
!
|
|
684 |
|
|
685 |
browserNameList
|
|
686 |
|
|
687 |
^'Change list'
|
|
688 |
|
|
689 |
"Modified: / 24-07-2009 / 22:06:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
690 |
!
|
|
691 |
|
|
692 |
listEntryFor:chg
|
|
693 |
^ListEntry change:chg application: self
|
|
694 |
|
|
695 |
"Modified: / 05-12-2009 / 14:39:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
696 |
!
|
|
697 |
|
|
698 |
makeDependent
|
|
699 |
|
|
700 |
"Modified: / 24-07-2009 / 22:06:32 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
701 |
!
|
|
702 |
|
|
703 |
makeIndependent
|
|
704 |
|
|
705 |
"Modified: / 24-07-2009 / 22:06:37 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
706 |
!
|
|
707 |
|
|
708 |
parentOrModel
|
|
709 |
|
|
710 |
^self
|
|
711 |
|
|
712 |
"Created: / 05-12-2009 / 14:14:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
713 |
!
|
|
714 |
|
|
715 |
updateList
|
|
716 |
|inGenerator changeset|
|
|
717 |
|
|
718 |
inGenerator := self inGeneratorHolder value.
|
|
719 |
changeset := inGenerator ifNil:[ #() ] ifNotNil:[ inGenerator ].
|
|
720 |
self listHolder value:(changeset
|
10449
|
721 |
select:
|
|
722 |
[:chg |
|
|
723 |
(self showRemovedHolder value or:[ chg removed not ])
|
10451
|
724 |
and:[self showSameHolder value or:[chg delta ~~ #=]]
|
10449
|
725 |
]
|
10009
|
726 |
thenCollect:[:chg | self listEntryFor:chg ])
|
10449
|
727 |
|
10451
|
728 |
"Modified: / 04-08-2011 / 19:07:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10009
|
729 |
! !
|
|
730 |
|
|
731 |
!ChangeList methodsFor:'queries'!
|
|
732 |
|
|
733 |
hasChangeSelected
|
|
734 |
|
|
735 |
^self selectionHolder value size > 0
|
|
736 |
!
|
|
737 |
|
|
738 |
hasChangeSelectedAndNotRemoved
|
|
739 |
|
|
740 |
| selection |
|
|
741 |
selection := self selectionHolder value ? #().
|
|
742 |
^selection size > 0 and:
|
|
743 |
[selection allSatisfy:[:e|e removed not]].
|
|
744 |
!
|
|
745 |
|
|
746 |
hasSingleChangeSelected
|
|
747 |
|
|
748 |
^self selectionHolder value size = 1
|
|
749 |
!
|
|
750 |
|
|
751 |
hasSingleChangeSelectedAndCanBrowse
|
|
752 |
|
|
753 |
|
|
754 |
self selectionHolder value ? #() do:
|
|
755 |
[:each|
|
|
756 |
(each change isClassChange and:
|
|
757 |
[each change isMethodChange not
|
|
758 |
or:[each change isMethodCodeChange]]) ifFalse:[^false]].
|
|
759 |
^true
|
|
760 |
! !
|
|
761 |
|
|
762 |
!ChangeList::ListEntry class methodsFor:'instance creation'!
|
|
763 |
|
|
764 |
change: aChange
|
|
765 |
|
|
766 |
^self new change: aChange
|
|
767 |
|
|
768 |
"Created: / 24-07-2009 / 22:43:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
769 |
!
|
|
770 |
|
|
771 |
change: aChange application: anApplicationModel
|
|
772 |
|
|
773 |
^self new change: aChange; application: anApplicationModel
|
|
774 |
|
|
775 |
"Created: / 05-12-2009 / 14:16:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
776 |
!
|
|
777 |
|
|
778 |
change: aChange parent: aChangeList
|
|
779 |
|
|
780 |
^self new change: aChange; parent: aChangeList
|
|
781 |
|
|
782 |
"Created: / 25-07-2009 / 23:33:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
783 |
! !
|
|
784 |
|
|
785 |
!ChangeList::ListEntry methodsFor:'accessing'!
|
|
786 |
|
|
787 |
application
|
|
788 |
^ application ifNil:[super application]
|
|
789 |
|
|
790 |
"Modified: / 05-12-2009 / 14:16:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
791 |
!
|
|
792 |
|
|
793 |
application:anApplicationModel
|
|
794 |
application := anApplicationModel.
|
|
795 |
|
|
796 |
"Modified: / 05-12-2009 / 14:15:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
797 |
!
|
|
798 |
|
|
799 |
change
|
|
800 |
^ change
|
|
801 |
!
|
|
802 |
|
|
803 |
change:aChange
|
|
804 |
|
|
805 |
self assert: ((aChange isKindOf: Change) or:[aChange isKindOf: RefactoryChange]).
|
|
806 |
|
|
807 |
change := aChange.
|
|
808 |
|
|
809 |
"Modified: / 25-07-2009 / 23:40:38 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
810 |
!
|
|
811 |
|
|
812 |
changeClass
|
|
813 |
|
|
814 |
^change changeClass
|
|
815 |
!
|
|
816 |
|
10334
|
817 |
changeSource
|
|
818 |
|
|
819 |
^change changeSource
|
|
820 |
|
|
821 |
"Created: / 19-07-2011 / 12:03:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
822 |
!
|
|
823 |
|
10009
|
824 |
children
|
|
825 |
|
|
826 |
children ifNil:
|
|
827 |
[children :=
|
|
828 |
change isCompositeChange
|
10449
|
829 |
ifTrue:[change changes select:
|
|
830 |
[:chg|
|
|
831 |
(self application showRemovedHolder value or:[ chg removed not ])
|
|
832 |
and:[self application showSameHolder value or:[chg delta ~~ #=]]]
|
|
833 |
thenCollect:[:chg|(self application listEntryFor: chg) parent: self]]
|
|
834 |
ifFalse:[#()]
|
|
835 |
].
|
10009
|
836 |
^children
|
|
837 |
|
|
838 |
"Created: / 25-07-2009 / 23:32:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
10449
|
839 |
"Modified: / 04-08-2011 / 18:48:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10009
|
840 |
!
|
|
841 |
|
|
842 |
delta
|
10657
|
843 |
"/ obsolete: please use deltaDetail
|
10009
|
844 |
|
|
845 |
^change delta
|
|
846 |
|
|
847 |
"Created: / 29-10-2010 / 14:32:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
10657
|
848 |
"Modified (comment): / 31-08-2011 / 10:30:02 / cg"
|
|
849 |
!
|
|
850 |
|
|
851 |
deltaDetail
|
|
852 |
|
|
853 |
^change deltaDetail
|
|
854 |
|
|
855 |
"Created: / 29-10-2010 / 14:32:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
856 |
"Created: / 31-08-2011 / 10:29:21 / cg"
|
10009
|
857 |
!
|
|
858 |
|
|
859 |
iconDelta
|
|
860 |
|
|
861 |
| iconSelector |
|
|
862 |
iconSelector := self iconSelector.
|
|
863 |
iconSelector ifNil:[^nil].
|
|
864 |
self removed ifTrue:[iconSelector := iconSelector , #Grayed].
|
|
865 |
^self application class perform: iconSelector asSymbol.
|
|
866 |
|
|
867 |
"Created: / 05-12-2009 / 14:11:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
868 |
!
|
|
869 |
|
|
870 |
iconRemoved
|
|
871 |
|
|
872 |
^self removed
|
|
873 |
ifTrue: [self application class uncheckedIcon ]
|
|
874 |
ifFalse:[self application class checkedIcon ]
|
|
875 |
|
|
876 |
"Created: / 05-12-2009 / 14:11:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
877 |
!
|
|
878 |
|
10334
|
879 |
imageSource
|
|
880 |
|
|
881 |
^change imageSource
|
|
882 |
|
|
883 |
"Created: / 19-07-2011 / 12:03:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
884 |
!
|
|
885 |
|
10009
|
886 |
label
|
|
887 |
|
|
888 |
| label |
|
|
889 |
label := change displayString.
|
|
890 |
self removed ifTrue:[label := label asText colorizeAllWith: Color gray].
|
|
891 |
^label
|
|
892 |
|
|
893 |
"Created: / 05-11-2008 / 08:20:02 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
894 |
"Modified: / 25-07-2009 / 23:43:23 / Jan Vrany <vranyj1@fel.cvut.cz>"
|
|
895 |
"Modified: / 05-12-2009 / 14:46:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
896 |
!
|
|
897 |
|
|
898 |
removed
|
|
899 |
^ change removed
|
|
900 |
!
|
|
901 |
|
|
902 |
removed:aBoolean
|
|
903 |
change removed: aBoolean.
|
|
904 |
!
|
|
905 |
|
|
906 |
source
|
|
907 |
|
|
908 |
^change source
|
|
909 |
!
|
|
910 |
|
|
911 |
x
|
|
912 |
^ x
|
|
913 |
! !
|
|
914 |
|
|
915 |
!ChangeList::ListEntry methodsFor:'displaying'!
|
|
916 |
|
|
917 |
displayLabel:aLabel h:lH on:aGC x:newX y:y h:h
|
|
918 |
|
|
919 |
| cx icon |
|
|
920 |
cx := x := newX.
|
|
921 |
self application showRemoved ifTrue:
|
|
922 |
[(icon := self iconRemoved) ifNotNil:
|
|
923 |
[icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2) ].
|
|
924 |
cx := cx + 22."experimental value - this looks good"].
|
|
925 |
(icon := self iconDelta) ifNotNil:
|
|
926 |
[icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2) ].
|
|
927 |
cx := cx + 16."12 + 2px gap"
|
|
928 |
|
|
929 |
|
|
930 |
super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h
|
|
931 |
|
|
932 |
"Modified: / 05-12-2009 / 14:49:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
933 |
! !
|
|
934 |
|
|
935 |
!ChangeList::ListEntry methodsFor:'private'!
|
|
936 |
|
|
937 |
iconSelector
|
10657
|
938 |
| delta |
|
10009
|
939 |
|
10657
|
940 |
delta := change deltaDetail.
|
|
941 |
delta shortDeltaSymbol = #+ ifTrue:[^#iconPlus].
|
|
942 |
delta shortDeltaSymbol = #- ifTrue:[^#iconMinus].
|
|
943 |
delta shortDeltaSymbol = #= ifTrue:[^#iconEqual].
|
10009
|
944 |
|
10657
|
945 |
^ nil.
|
|
946 |
|
|
947 |
"Modified: / 31-08-2011 / 10:39:32 / cg"
|
10009
|
948 |
! !
|
|
949 |
|
|
950 |
!ChangeList class methodsFor:'documentation'!
|
|
951 |
|
10451
|
952 |
version
|
10657
|
953 |
^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeList.st,v 1.6 2011-08-31 10:05:00 cg Exp $'
|
10451
|
954 |
!
|
|
955 |
|
10009
|
956 |
version_CVS
|
10657
|
957 |
^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeList.st,v 1.6 2011-08-31 10:05:00 cg Exp $'
|
10009
|
958 |
!
|
|
959 |
|
|
960 |
version_SVN
|
|
961 |
^ '§Id: Tools__ChangeList.st 7486 2009-10-26 22:06:24Z vranyj1 §'
|
|
962 |
! !
|