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