author | Claus Gittinger <cg@exept.de> |
Wed, 05 Feb 2014 19:55:59 +0100 | |
changeset 13797 | 21182b668964 |
parent 13264 | 4a0cdaf356ec |
child 13289 | cc75e3cd0362 |
child 13863 | 481f2981e611 |
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 |
||
10926 | 30 |
BrowserListWithFilter 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 |
" |
|
10938 | 85 |
UIPainter new openOnClass:Tools::ChangeSetDiffList andSelector:#windowSpec |
86 |
Tools::ChangeSetDiffList new openInterface:#windowSpec |
|
87 |
Tools::ChangeSetDiffList 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: ( |
|
10938 | 105 |
(InputFieldSpec |
106 |
name: 'Filter' |
|
107 |
layout: (LayoutFrame 0 0 0 0 0 1 25 0) |
|
108 |
initiallyInvisible: true |
|
109 |
model: filterPatternHolder |
|
110 |
immediateAccept: true |
|
111 |
acceptOnLeave: false |
|
112 |
acceptOnReturn: false |
|
113 |
acceptOnTab: false |
|
114 |
acceptOnPointerLeave: false |
|
115 |
emptyFieldReplacementText: 'Search Filter...' |
|
116 |
usePreferredHeight: true |
|
117 |
useDynamicPreferredHeight: true |
|
118 |
postBuildCallback: postBuildFilterView: |
|
119 |
) |
|
10192 | 120 |
(SelectionInListModelViewSpec |
121 |
name: 'List' |
|
122 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
123 |
model: selectionHolder |
|
10926 | 124 |
menu: menuHolderWithShowFilter |
10192 | 125 |
hasHorizontalScrollBar: true |
126 |
hasVerticalScrollBar: true |
|
127 |
listModel: listHolder |
|
128 |
multipleSelectOk: true |
|
129 |
useIndex: false |
|
130 |
highlightMode: line |
|
131 |
) |
|
132 |
) |
|
133 |
||
134 |
) |
|
135 |
) |
|
136 |
! ! |
|
137 |
||
138 |
!ChangeSetDiffList class methodsFor:'plugIn spec'! |
|
139 |
||
140 |
aspectSelectors |
|
141 |
"This resource specification was automatically generated |
|
142 |
by the UIPainter of ST/X." |
|
143 |
||
144 |
"Do not manually edit this. If it is corrupted, |
|
145 |
the UIPainter may not be able to read the specification." |
|
146 |
||
147 |
"Return a description of exported aspects; |
|
148 |
these can be connected to aspects of an embedding application |
|
149 |
(if this app is embedded in a subCanvas)." |
|
150 |
||
151 |
^ #( |
|
152 |
#inGeneratorHolder |
|
10938 | 153 |
#listEntryIconGenerator |
154 |
#listEntryLabelGenerator |
|
10192 | 155 |
#menuHolder |
10938 | 156 |
#outGeneratorHolder |
10192 | 157 |
). |
158 |
||
159 |
! ! |
|
160 |
||
161 |
!ChangeSetDiffList methodsFor:'accessing'! |
|
162 |
||
163 |
listEntryIconGenerator |
|
164 |
^ listEntryIconGenerator |
|
165 |
! |
|
166 |
||
167 |
listEntryIconGenerator:aBlock |
|
168 |
listEntryIconGenerator := aBlock. |
|
169 |
! |
|
170 |
||
171 |
listEntryLabelGenerator |
|
172 |
^ listEntryLabelGenerator |
|
173 |
! |
|
174 |
||
175 |
listEntryLabelGenerator:aBlock |
|
176 |
listEntryLabelGenerator := aBlock. |
|
177 |
! ! |
|
178 |
||
179 |
!ChangeSetDiffList methodsFor:'aspects'! |
|
180 |
||
181 |
listHolder |
|
182 |
"return/create the 'difflistHolder' value holder (automatically generated)" |
|
183 |
||
184 |
listHolder isNil ifTrue:[ |
|
185 |
listHolder := ValueHolder new. |
|
186 |
]. |
|
187 |
^ listHolder |
|
188 |
! ! |
|
189 |
||
190 |
!ChangeSetDiffList methodsFor:'change & update'! |
|
191 |
||
192 |
update: aspect with: param from: sender |
|
193 |
||
194 |
aspect == #resolution ifTrue:[^(self componentAt: #List) invalidateRepairNow: true]. |
|
195 |
||
196 |
sender == selectionHolder ifTrue:[^self selectionChanged]. |
|
197 |
super update: aspect with: param from: sender. |
|
198 |
||
199 |
"Modified: / 24-11-2009 / 18:34:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
200 |
! ! |
|
201 |
||
202 |
!ChangeSetDiffList methodsFor:'generators'! |
|
203 |
||
204 |
makeGenerator |
|
205 |
||
206 |
^Iterator on: |
|
207 |
[:whatToDo| |
|
208 |
self selectionHolder value do: |
|
209 |
[:each|each model do: whatToDo]] |
|
210 |
||
211 |
"Modified: / 26-11-2009 / 17:23:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
212 |
! ! |
|
213 |
||
214 |
!ChangeSetDiffList methodsFor:'private'! |
|
215 |
||
216 |
listEntryIconFor:aDiffComponent |
|
217 |
|a hasA b hasB hasBase| |
|
218 |
||
219 |
aDiffComponent isDiffSet ifTrue:[ |
|
220 |
^ nil |
|
221 |
]. |
|
222 |
hasA := (a := aDiffComponent versionA) notNil and:[a isMethodRemoveChange not]. |
|
223 |
hasB := (b := aDiffComponent versionB) notNil and:[b isMethodRemoveChange not]. |
|
224 |
hasBase := aDiffComponent versionBase notNil. |
|
225 |
(hasA & hasB & hasBase) ifTrue:[ |
|
10217 | 226 |
^ ToolbarIconLibrary versionABBase12x12 |
10192 | 227 |
]. |
228 |
(hasA & hasB) ifTrue:[ |
|
10217 | 229 |
^ ToolbarIconLibrary versionAB12x12 |
10192 | 230 |
]. |
231 |
(hasA & hasBase) ifTrue:[ |
|
10217 | 232 |
^ ToolbarIconLibrary versionABase12x12 |
10192 | 233 |
]. |
234 |
(hasA) ifTrue:[ |
|
10217 | 235 |
^ ToolbarIconLibrary versionA12x12 |
10192 | 236 |
]. |
237 |
(hasB & hasBase) ifTrue:[ |
|
10217 | 238 |
^ ToolbarIconLibrary versionBBase12x12 |
10192 | 239 |
]. |
240 |
(hasB) ifTrue:[ |
|
10217 | 241 |
^ ToolbarIconLibrary versionB12x12 |
10192 | 242 |
]. |
243 |
^ nil |
|
244 |
||
245 |
"Created: / 21-11-2009 / 21:58:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
246 |
"Modified: / 09-06-2011 / 08:19:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10217 | 247 |
"Modified: / 06-07-2011 / 16:38:33 / jv" |
10192 | 248 |
! |
249 |
||
250 |
listEntryLabelFor:diff |
|
251 |
||
252 |
^listEntryLabelGenerator |
|
253 |
ifNotNil: [listEntryLabelGenerator value: diff] |
|
254 |
ifNil:[diff name] |
|
255 |
||
256 |
"Modified: / 24-11-2009 / 10:00:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
257 |
! |
|
258 |
||
259 |
makeDependent |
|
260 |
||
261 |
"Nothing to do" |
|
262 |
! |
|
263 |
||
264 |
makeIndependent |
|
265 |
||
266 |
"Nothing to do" |
|
267 |
! |
|
268 |
||
269 |
updateList |
|
270 |
"Superclass Tools::BrowserList says that I am responsible to implement this method" |
|
271 |
||
272 |
| newDiffs newList | |
|
273 |
self listHolder value ? #() do: [:entry|entry model removeDependent: self]. |
|
274 |
||
275 |
newDiffs := self inGeneratorHolder value ? #(). |
|
10246 | 276 |
(newDiffs isKindOf: ChangeSetDiffComponent) ifTrue: |
10192 | 277 |
[newDiffs := newDiffs diffs]. |
10926 | 278 |
newDiffs := self filterList: newDiffs. |
13264
4a0cdaf356ec
class: Tools::ChangeSetDiffList
Claus Gittinger <cg@exept.de>
parents:
10938
diff
changeset
|
279 |
newList := OrderedCollection new. |
10192 | 280 |
newDiffs do: |
281 |
[:item| |
|
282 |
newList add:(ListEntry model: item application: self). |
|
283 |
item addDependent: self]. |
|
10251 | 284 |
|
285 |
newList sort:[:a :b|a label < b label]. |
|
10192 | 286 |
self listHolder value:newList |
287 |
||
10251 | 288 |
"Modified: / 07-07-2011 / 14:17:26 / jv" |
10926 | 289 |
"Modified: / 29-11-2011 / 16:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13264
4a0cdaf356ec
class: Tools::ChangeSetDiffList
Claus Gittinger <cg@exept.de>
parents:
10938
diff
changeset
|
290 |
"Modified: / 30-07-2013 / 19:30:18 / cg" |
10192 | 291 |
! ! |
292 |
||
293 |
!ChangeSetDiffList::ListEntry class methodsFor:'instance creation'! |
|
294 |
||
295 |
model: model application: application |
|
296 |
||
297 |
^self new |
|
298 |
model: model; |
|
299 |
application: application |
|
300 |
||
301 |
"Created: / 24-11-2009 / 18:29:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
302 |
! ! |
|
303 |
||
304 |
!ChangeSetDiffList::ListEntry methodsFor:'accessing'! |
|
305 |
||
306 |
application |
|
307 |
^ application |
|
308 |
! |
|
309 |
||
310 |
application:aDiffList |
|
311 |
application := aDiffList. |
|
312 |
! |
|
313 |
||
314 |
icon |
|
315 |
||
316 |
^application |
|
317 |
ifNotNil:[application listEntryIconFor: model] |
|
318 |
ifNil:[nil] |
|
319 |
||
320 |
"Created: / 24-11-2009 / 18:26:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
321 |
! |
|
322 |
||
323 |
label |
|
324 |
||
325 |
^application |
|
326 |
ifNotNil:[application listEntryLabelFor: model] |
|
327 |
ifNil:[model displayString] |
|
328 |
||
329 |
"Created: / 24-11-2009 / 18:26:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
330 |
"Modified: / 26-11-2009 / 17:33:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
331 |
! |
|
332 |
||
333 |
model |
|
334 |
^ model |
|
335 |
! |
|
336 |
||
337 |
model:aDiffComponent |
|
338 |
model := aDiffComponent. |
|
339 |
! ! |
|
340 |
||
341 |
!ChangeSetDiffList::ListEntry methodsFor:'displaying'! |
|
342 |
||
343 |
displayOn: aGC x: x y: y opaque: opaque |
|
344 |
||
345 |
| icon | |
|
346 |
(icon := self icon) ifNotNil:[icon displayOn: aGC x: x y: y - icon height opaque: opaque]. |
|
347 |
self label displayOn: aGC x: x + 16 y:y opaque: opaque |
|
348 |
||
349 |
"Created: / 24-11-2009 / 18:21:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
350 |
! ! |
|
351 |
||
352 |
!ChangeSetDiffList class methodsFor:'documentation'! |
|
353 |
||
354 |
version_CVS |
|
13264
4a0cdaf356ec
class: Tools::ChangeSetDiffList
Claus Gittinger <cg@exept.de>
parents:
10938
diff
changeset
|
355 |
^ '$Header: /cvs/stx/stx/libtool/Tools__ChangeSetDiffList.st,v 1.7 2013-07-30 17:35:29 cg Exp $' |
10192 | 356 |
! |
357 |
||
358 |
version_SVN |
|
13264
4a0cdaf356ec
class: Tools::ChangeSetDiffList
Claus Gittinger <cg@exept.de>
parents:
10938
diff
changeset
|
359 |
^ '$Id: Tools__ChangeSetDiffList.st,v 1.7 2013-07-30 17:35:29 cg Exp $' |
10192 | 360 |
! ! |
13264
4a0cdaf356ec
class: Tools::ChangeSetDiffList
Claus Gittinger <cg@exept.de>
parents:
10938
diff
changeset
|
361 |