author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 29 Jan 2012 12:53:39 +0000 | |
branch | jv |
changeset 12123 | 4bde08cebd48 |
parent 10938 | 2afa554b0227 |
child 12125 | 0c49a3b13e43 |
permissions | -rw-r--r-- |
10192 | 1 |
" |
2 |
Copyright (c) 2007-2010 Jan Vrany |
|
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
4 |
||
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. |
|
25 |
" |
|
10217 | 26 |
"{ Package: 'stx:libtool' }" |
10192 | 27 |
|
28 |
"{ NameSpace: Tools }" |
|
29 |
||
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
30 |
BrowserList subclass:#ChangeSetDiffList |
10192 | 31 |
instanceVariableNames:'listHolder listEntryLabelGenerator listEntryIconGenerator' |
32 |
classVariableNames:'' |
|
33 |
poolDictionaries:'' |
|
34 |
category:'Interface-Diff' |
|
35 |
! |
|
36 |
||
37 |
Object subclass:#ListEntry |
|
38 |
instanceVariableNames:'model application' |
|
39 |
classVariableNames:'' |
|
40 |
poolDictionaries:'' |
|
41 |
privateIn:ChangeSetDiffList |
|
42 |
! |
|
43 |
||
44 |
!ChangeSetDiffList class methodsFor:'documentation'! |
|
45 |
||
46 |
copyright |
|
47 |
" |
|
48 |
Copyright (c) 2007-2010 Jan Vrany |
|
49 |
Copyright (c) 2009-2010 eXept Software AG |
|
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: |
|
59 |
||
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. |
|
71 |
||
72 |
" |
|
73 |
! ! |
|
74 |
||
75 |
!ChangeSetDiffList class methodsFor:'interface specs'! |
|
76 |
||
77 |
windowSpec |
|
78 |
"This resource specification was automatically generated |
|
79 |
by the UIPainter of ST/X." |
|
80 |
||
81 |
"Do not manually edit this!! If it is corrupted, |
|
82 |
the UIPainter may not be able to read the specification." |
|
83 |
||
84 |
" |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
85 |
UIPainter new openOnClass:SVN::DiffList andSelector:#windowSpec |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
86 |
SVN::DiffList new openInterface:#windowSpec |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
87 |
SVN::DiffList open |
10192 | 88 |
" |
89 |
||
90 |
<resource: #canvas> |
|
91 |
||
92 |
^ |
|
93 |
#(FullSpec |
|
94 |
name: windowSpec |
|
95 |
window: |
|
96 |
(WindowSpec |
|
97 |
label: 'Diff List' |
|
98 |
name: 'Diff List' |
|
99 |
min: (Point 10 10) |
|
100 |
bounds: (Rectangle 0 0 300 300) |
|
101 |
) |
|
102 |
component: |
|
103 |
(SpecCollection |
|
104 |
collection: ( |
|
105 |
(SelectionInListModelViewSpec |
|
106 |
name: 'List' |
|
107 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
108 |
model: selectionHolder |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
109 |
menu: menuHolder |
10192 | 110 |
hasHorizontalScrollBar: true |
111 |
hasVerticalScrollBar: true |
|
112 |
listModel: listHolder |
|
113 |
multipleSelectOk: true |
|
114 |
useIndex: false |
|
115 |
highlightMode: line |
|
116 |
) |
|
117 |
) |
|
118 |
||
119 |
) |
|
120 |
) |
|
121 |
! ! |
|
122 |
||
123 |
!ChangeSetDiffList class methodsFor:'plugIn spec'! |
|
124 |
||
125 |
aspectSelectors |
|
126 |
"This resource specification was automatically generated |
|
127 |
by the UIPainter of ST/X." |
|
128 |
||
129 |
"Do not manually edit this. If it is corrupted, |
|
130 |
the UIPainter may not be able to read the specification." |
|
131 |
||
132 |
"Return a description of exported aspects; |
|
133 |
these can be connected to aspects of an embedding application |
|
134 |
(if this app is embedded in a subCanvas)." |
|
135 |
||
136 |
^ #( |
|
137 |
#inGeneratorHolder |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
138 |
#outGeneratorHolder |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
139 |
#menuHolder |
10938 | 140 |
#listEntryLabelGenerator |
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
141 |
#listEntryIconGenerator |
10192 | 142 |
). |
143 |
||
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
144 |
"Modified: / 24-11-2009 / 09:59:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10192 | 145 |
! ! |
146 |
||
147 |
!ChangeSetDiffList methodsFor:'accessing'! |
|
148 |
||
149 |
listEntryIconGenerator |
|
150 |
^ listEntryIconGenerator |
|
151 |
! |
|
152 |
||
153 |
listEntryIconGenerator:aBlock |
|
154 |
listEntryIconGenerator := aBlock. |
|
155 |
! |
|
156 |
||
157 |
listEntryLabelGenerator |
|
158 |
^ listEntryLabelGenerator |
|
159 |
! |
|
160 |
||
161 |
listEntryLabelGenerator:aBlock |
|
162 |
listEntryLabelGenerator := aBlock. |
|
163 |
! ! |
|
164 |
||
165 |
!ChangeSetDiffList methodsFor:'aspects'! |
|
166 |
||
167 |
listHolder |
|
168 |
"return/create the 'difflistHolder' value holder (automatically generated)" |
|
169 |
||
170 |
listHolder isNil ifTrue:[ |
|
171 |
listHolder := ValueHolder new. |
|
172 |
]. |
|
173 |
^ listHolder |
|
174 |
! ! |
|
175 |
||
176 |
!ChangeSetDiffList methodsFor:'change & update'! |
|
177 |
||
178 |
update: aspect with: param from: sender |
|
179 |
||
180 |
aspect == #resolution ifTrue:[^(self componentAt: #List) invalidateRepairNow: true]. |
|
181 |
||
182 |
sender == selectionHolder ifTrue:[^self selectionChanged]. |
|
183 |
super update: aspect with: param from: sender. |
|
184 |
||
185 |
"Modified: / 24-11-2009 / 18:34:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
186 |
! ! |
|
187 |
||
188 |
!ChangeSetDiffList methodsFor:'generators'! |
|
189 |
||
190 |
makeGenerator |
|
191 |
||
192 |
^Iterator on: |
|
193 |
[:whatToDo| |
|
194 |
self selectionHolder value do: |
|
195 |
[:each|each model do: whatToDo]] |
|
196 |
||
197 |
"Modified: / 26-11-2009 / 17:23:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
198 |
! ! |
|
199 |
||
200 |
!ChangeSetDiffList methodsFor:'private'! |
|
201 |
||
202 |
listEntryIconFor:aDiffComponent |
|
203 |
|a hasA b hasB hasBase| |
|
204 |
||
205 |
aDiffComponent isDiffSet ifTrue:[ |
|
206 |
^ nil |
|
207 |
]. |
|
208 |
hasA := (a := aDiffComponent versionA) notNil and:[a isMethodRemoveChange not]. |
|
209 |
hasB := (b := aDiffComponent versionB) notNil and:[b isMethodRemoveChange not]. |
|
210 |
hasBase := aDiffComponent versionBase notNil. |
|
211 |
(hasA & hasB & hasBase) ifTrue:[ |
|
10217 | 212 |
^ ToolbarIconLibrary versionABBase12x12 |
10192 | 213 |
]. |
214 |
(hasA & hasB) ifTrue:[ |
|
10217 | 215 |
^ ToolbarIconLibrary versionAB12x12 |
10192 | 216 |
]. |
217 |
(hasA & hasBase) ifTrue:[ |
|
10217 | 218 |
^ ToolbarIconLibrary versionABase12x12 |
10192 | 219 |
]. |
220 |
(hasA) ifTrue:[ |
|
10217 | 221 |
^ ToolbarIconLibrary versionA12x12 |
10192 | 222 |
]. |
223 |
(hasB & hasBase) ifTrue:[ |
|
10217 | 224 |
^ ToolbarIconLibrary versionBBase12x12 |
10192 | 225 |
]. |
226 |
(hasB) ifTrue:[ |
|
10217 | 227 |
^ ToolbarIconLibrary versionB12x12 |
10192 | 228 |
]. |
229 |
^ nil |
|
230 |
||
231 |
"Created: / 21-11-2009 / 21:58:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
232 |
"Modified: / 09-06-2011 / 08:19:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10217 | 233 |
"Modified: / 06-07-2011 / 16:38:33 / jv" |
10192 | 234 |
! |
235 |
||
236 |
listEntryLabelFor:diff |
|
237 |
||
238 |
^listEntryLabelGenerator |
|
239 |
ifNotNil: [listEntryLabelGenerator value: diff] |
|
240 |
ifNil:[diff name] |
|
241 |
||
242 |
"Modified: / 24-11-2009 / 10:00:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
243 |
! |
|
244 |
||
245 |
makeDependent |
|
246 |
||
247 |
"Nothing to do" |
|
248 |
! |
|
249 |
||
250 |
makeIndependent |
|
251 |
||
252 |
"Nothing to do" |
|
253 |
! |
|
254 |
||
255 |
updateList |
|
256 |
"Superclass Tools::BrowserList says that I am responsible to implement this method" |
|
257 |
||
258 |
| newDiffs newList | |
|
259 |
self listHolder value ? #() do: [:entry|entry model removeDependent: self]. |
|
260 |
||
261 |
newDiffs := self inGeneratorHolder value ? #(). |
|
10246 | 262 |
(newDiffs isKindOf: ChangeSetDiffComponent) ifTrue: |
10192 | 263 |
[newDiffs := newDiffs diffs]. |
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
264 |
newList := OrderedCollection new:16. |
10192 | 265 |
newDiffs do: |
266 |
[:item| |
|
267 |
newList add:(ListEntry model: item application: self). |
|
268 |
item addDependent: self]. |
|
10251 | 269 |
|
270 |
newList sort:[:a :b|a label < b label]. |
|
10192 | 271 |
self listHolder value:newList |
272 |
||
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
273 |
"Modified: / 06-07-2011 / 12:58:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10251 | 274 |
"Modified: / 07-07-2011 / 14:17:26 / jv" |
10192 | 275 |
! ! |
276 |
||
277 |
!ChangeSetDiffList::ListEntry class methodsFor:'instance creation'! |
|
278 |
||
279 |
model: model application: application |
|
280 |
||
281 |
^self new |
|
282 |
model: model; |
|
283 |
application: application |
|
284 |
||
285 |
"Created: / 24-11-2009 / 18:29:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
286 |
! ! |
|
287 |
||
288 |
!ChangeSetDiffList::ListEntry methodsFor:'accessing'! |
|
289 |
||
290 |
application |
|
291 |
^ application |
|
292 |
! |
|
293 |
||
294 |
application:aDiffList |
|
295 |
application := aDiffList. |
|
296 |
! |
|
297 |
||
298 |
icon |
|
299 |
||
300 |
^application |
|
301 |
ifNotNil:[application listEntryIconFor: model] |
|
302 |
ifNil:[nil] |
|
303 |
||
304 |
"Created: / 24-11-2009 / 18:26:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
305 |
! |
|
306 |
||
307 |
label |
|
308 |
||
309 |
^application |
|
310 |
ifNotNil:[application listEntryLabelFor: model] |
|
311 |
ifNil:[model displayString] |
|
312 |
||
313 |
"Created: / 24-11-2009 / 18:26:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
314 |
"Modified: / 26-11-2009 / 17:33:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
315 |
! |
|
316 |
||
317 |
model |
|
318 |
^ model |
|
319 |
! |
|
320 |
||
321 |
model:aDiffComponent |
|
322 |
model := aDiffComponent. |
|
323 |
! ! |
|
324 |
||
325 |
!ChangeSetDiffList::ListEntry methodsFor:'displaying'! |
|
326 |
||
327 |
displayOn: aGC x: x y: y opaque: opaque |
|
328 |
||
329 |
| icon | |
|
330 |
(icon := self icon) ifNotNil:[icon displayOn: aGC x: x y: y - icon height opaque: opaque]. |
|
331 |
self label displayOn: aGC x: x + 16 y:y opaque: opaque |
|
332 |
||
333 |
"Created: / 24-11-2009 / 18:21:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
334 |
! ! |
|
335 |
||
336 |
!ChangeSetDiffList class methodsFor:'documentation'! |
|
337 |
||
338 |
version_CVS |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
339 |
^ '§Header: /cvs/stx/stx/libtool/Tools__ChangeSetDiffList.st,v 1.4 2011/07/07 14:12:15 vrany Exp §' |
10192 | 340 |
! |
341 |
||
342 |
version_SVN |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
343 |
^ '$Id: Tools__ChangeSetDiffList.st 7810 2011-08-12 14:54:02Z vranyj1 $' |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10938
diff
changeset
|
344 |
! ! |