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