author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 08 Feb 2012 01:52:38 +0100 | |
changeset 984 | b2a56a7b9539 |
parent 975 | 252400afabd6 |
child 1017 | a1cb2fc93f11 |
permissions | -rw-r--r-- |
775 | 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 |
" |
|
403 | 26 |
"{ Package: 'stx:libsvn' }" |
9 | 27 |
|
28 |
"{ NameSpace: SVN }" |
|
29 |
||
30 |
Browser subclass:#WorkingCopyBrowser |
|
984 | 31 |
instanceVariableNames:'workingCopyEntriesHolder' |
9 | 32 |
classVariableNames:'' |
33 |
poolDictionaries:'' |
|
34 |
category:'SVN-UI-Browsers' |
|
35 |
! |
|
36 |
||
775 | 37 |
!WorkingCopyBrowser class methodsFor:'documentation'! |
38 |
||
39 |
copyright |
|
40 |
" |
|
41 |
Copyright (c) 2007-2010 Jan Vrany |
|
42 |
Copyright (c) 2009-2010 eXept Software AG |
|
43 |
||
44 |
Permission is hereby granted, free of charge, to any person |
|
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
52 |
||
53 |
The above copyright notice and this permission notice shall be |
|
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
64 |
||
65 |
" |
|
66 |
! ! |
|
67 |
||
68 |
!WorkingCopyBrowser class methodsFor:'instance creation'! |
|
69 |
||
70 |
on: aWorkingCopy |
|
71 |
||
72 |
^self new workingCopy: aWorkingCopy |
|
73 |
! ! |
|
9 | 74 |
|
75 |
!WorkingCopyBrowser 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 |
" |
|
775 | 85 |
UIPainter new openOnClass:SVN::WorkingCopyBrowser andSelector:#windowSpec |
86 |
SVN::WorkingCopyBrowser new openInterface:#windowSpec |
|
87 |
SVN::WorkingCopyBrowser open |
|
9 | 88 |
" |
89 |
||
90 |
<resource: #canvas> |
|
91 |
||
92 |
^ |
|
93 |
#(FullSpec |
|
94 |
name: windowSpec |
|
95 |
window: |
|
96 |
(WindowSpec |
|
97 |
label: 'Working Copy Status' |
|
98 |
name: 'Working Copy Status' |
|
99 |
min: (Point 10 10) |
|
975 | 100 |
bounds: (Rectangle 0 0 586 403) |
9 | 101 |
) |
102 |
component: |
|
103 |
(SpecCollection |
|
104 |
collection: ( |
|
105 |
(DataSetSpec |
|
106 |
name: 'WCEntryTable' |
|
107 |
layout: (LayoutFrame 0 0 0 0 0 1 -30 1) |
|
108 |
model: selectionHolder |
|
775 | 109 |
menu: entryMenu |
9 | 110 |
hasHorizontalScrollBar: true |
111 |
hasVerticalScrollBar: true |
|
984 | 112 |
dataList: workingCopyEntriesHolder |
9 | 113 |
useIndex: false |
114 |
columnHolder: wcEntryTableColumns |
|
984 | 115 |
showLabels: false |
9 | 116 |
) |
117 |
(CheckBoxSpec |
|
984 | 118 |
label: 'Show only modified entries' |
9 | 119 |
name: 'ShowOnlyChanged' |
975 | 120 |
layout: (LayoutFrame 0 0 -30 1 -170 1 0 1) |
9 | 121 |
model: showOnlyChanged |
122 |
translateLabel: true |
|
123 |
) |
|
975 | 124 |
(LinkButtonSpec |
125 |
label: 'Browse working copy' |
|
126 |
name: 'BrowseWC' |
|
127 |
layout: (LayoutFrame -170 1 -30 1 0 1 0 1) |
|
128 |
translateLabel: true |
|
129 |
labelChannel: browseWorkingCopyLabel |
|
130 |
adjust: right |
|
131 |
model: browseWorkingCopy |
|
132 |
) |
|
9 | 133 |
) |
134 |
||
135 |
) |
|
136 |
) |
|
137 |
! ! |
|
138 |
||
139 |
!WorkingCopyBrowser class methodsFor:'menu specs'! |
|
140 |
||
775 | 141 |
entryMenu |
9 | 142 |
"This resource specification was automatically generated |
143 |
by the MenuEditor of ST/X." |
|
144 |
||
145 |
"Do not manually edit this!! If it is corrupted, |
|
146 |
the MenuEditor may not be able to read the specification." |
|
147 |
||
148 |
" |
|
775 | 149 |
MenuEditor new openOnClass:SVN::WorkingCopyBrowser andSelector:#entryMenu |
150 |
(Menu new fromLiteralArrayEncoding:(SVN::WorkingCopyBrowser entryMenu)) startUp |
|
9 | 151 |
" |
152 |
||
153 |
<resource: #menu> |
|
154 |
||
155 |
^ |
|
156 |
#(Menu |
|
157 |
( |
|
158 |
(MenuItem |
|
775 | 159 |
label: 'Show changes' |
160 |
itemValue: entryMenuShowChanges |
|
9 | 161 |
translateLabel: true |
775 | 162 |
labelImage: (ResourceRetriever #'SVN::IconLibrary' compare 'Show changes') |
9 | 163 |
) |
164 |
(MenuItem |
|
775 | 165 |
label: '-' |
166 |
) |
|
167 |
(MenuItem |
|
168 |
label: 'Revert' |
|
169 |
itemValue: entryMenuRevert |
|
9 | 170 |
translateLabel: true |
775 | 171 |
labelImage: (ResourceRetriever #'SVN::IconLibrary' revert 'Revert') |
9 | 172 |
) |
173 |
) |
|
174 |
nil |
|
175 |
nil |
|
176 |
) |
|
775 | 177 |
! ! |
9 | 178 |
|
775 | 179 |
!WorkingCopyBrowser class methodsFor:'others'! |
180 |
||
181 |
version_CVS |
|
182 |
^ '$Header$' |
|
9 | 183 |
! ! |
184 |
||
185 |
!WorkingCopyBrowser class methodsFor:'plugIn spec'! |
|
186 |
||
187 |
aspectSelectors |
|
188 |
"This resource specification was automatically generated |
|
189 |
by the UIPainter of ST/X." |
|
190 |
||
191 |
"Do not manually edit this. If it is corrupted, |
|
192 |
the UIPainter may not be able to read the specification." |
|
193 |
||
194 |
"Return a description of exported aspects; |
|
195 |
these can be connected to aspects of an embedding application |
|
196 |
(if this app is embedded in a subCanvas)." |
|
197 |
||
198 |
^ #( |
|
199 |
#model |
|
200 |
). |
|
201 |
||
202 |
! ! |
|
203 |
||
204 |
!WorkingCopyBrowser class methodsFor:'tableColumns specs'! |
|
205 |
||
206 |
wcEntryTableColumns |
|
207 |
"This resource specification was automatically generated |
|
208 |
by the DataSetBuilder of ST/X." |
|
209 |
||
210 |
"Do not manually edit this!! If it is corrupted, |
|
211 |
the DataSetBuilder may not be able to read the specification." |
|
212 |
||
213 |
" |
|
984 | 214 |
DataSetBuilder new openOnClass:SVN::WorkingCopyBrowser andSelector:#wcEntryTableColumns |
9 | 215 |
" |
216 |
||
217 |
<resource: #tableColumns> |
|
218 |
||
219 |
^#( |
|
220 |
(DataSetColumnSpec |
|
221 |
label: '' |
|
222 |
activeHelpKey: '' |
|
984 | 223 |
activeHelpKeyForLabel: '' |
224 |
labelButtonType: None |
|
225 |
width: 22 |
|
226 |
minWidth: 22 |
|
227 |
editorType: CheckToggle |
|
228 |
rendererType: CheckToggle |
|
229 |
model: include |
|
230 |
menuFromApplication: false |
|
231 |
printSelector: include |
|
232 |
showRowSeparator: false |
|
233 |
showColSeparator: false |
|
234 |
) |
|
235 |
(DataSetColumnSpec |
|
236 |
label: '' |
|
237 |
activeHelpKey: '' |
|
238 |
activeHelpKeyForLabel: '' |
|
9 | 239 |
labelButtonType: Button |
984 | 240 |
width: 22 |
241 |
minWidth: 22 |
|
242 |
menuFromApplication: false |
|
9 | 243 |
printSelector: statusIcon |
244 |
canSelect: false |
|
245 |
showRowSeparator: false |
|
246 |
showColSeparator: false |
|
247 |
) |
|
248 |
(DataSetColumnSpec |
|
249 |
label: 'Container' |
|
984 | 250 |
labelAlignment: left |
9 | 251 |
activeHelpKey: '' |
984 | 252 |
activeHelpKeyForLabel: '' |
9 | 253 |
labelButtonType: Button |
984 | 254 |
menuFromApplication: false |
9 | 255 |
printSelector: pathText |
256 |
canSelect: false |
|
257 |
showRowSeparator: false |
|
258 |
showColSeparator: false |
|
259 |
) |
|
260 |
(DataSetColumnSpec |
|
261 |
label: 'Rev' |
|
262 |
activeHelpKey: '' |
|
984 | 263 |
activeHelpKeyForLabel: '' |
9 | 264 |
labelButtonType: Button |
984 | 265 |
usePreferredWidth: true |
266 |
menuFromApplication: false |
|
9 | 267 |
printSelector: revision |
268 |
canSelect: false |
|
269 |
showRowSeparator: false |
|
270 |
showColSeparator: false |
|
271 |
) |
|
272 |
(DataSetColumnSpec |
|
273 |
label: 'Author' |
|
984 | 274 |
labelAlignment: left |
9 | 275 |
activeHelpKey: '' |
984 | 276 |
activeHelpKeyForLabel: '' |
9 | 277 |
labelButtonType: Button |
984 | 278 |
usePreferredWidth: true |
279 |
menuFromApplication: false |
|
9 | 280 |
printSelector: author |
281 |
canSelect: false |
|
282 |
showRowSeparator: false |
|
283 |
showColSeparator: false |
|
284 |
) |
|
285 |
(DataSetColumnSpec |
|
286 |
label: 'Date' |
|
287 |
activeHelpKey: '' |
|
984 | 288 |
activeHelpKeyForLabel: '' |
9 | 289 |
labelButtonType: Button |
984 | 290 |
usePreferredWidth: true |
291 |
menuFromApplication: false |
|
9 | 292 |
printSelector: date |
293 |
canSelect: false |
|
294 |
showRowSeparator: false |
|
295 |
showColSeparator: false |
|
296 |
) |
|
297 |
) |
|
984 | 298 |
|
9 | 299 |
! ! |
300 |
||
301 |
!WorkingCopyBrowser methodsFor:'accessing'! |
|
302 |
||
303 |
workingCopy |
|
304 |
||
305 |
^self model |
|
306 |
||
307 |
"Created: / 11-04-2008 / 10:20:36 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
308 |
"Modified: / 12-04-2008 / 21:02:26 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
309 |
! |
|
310 |
||
311 |
workingCopy: aWorkingCopy |
|
312 |
||
313 |
self model: aWorkingCopy |
|
314 |
||
315 |
"Created: / 11-04-2008 / 10:20:22 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
316 |
"Modified: / 12-04-2008 / 21:02:34 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
317 |
! ! |
|
318 |
||
975 | 319 |
!WorkingCopyBrowser methodsFor:'actions'! |
320 |
||
321 |
browseWorkingCopy |
|
322 |
||
323 |
^UserPreferences current fileBrowserClass |
|
324 |
openOnDirectory: self workingCopy path |
|
325 |
||
326 |
"Created: / 05-02-2012 / 01:23:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
327 |
! |
|
328 |
||
329 |
browseWorkingCopyLabel |
|
330 |
||
331 |
^'Browse working copy...' asText |
|
332 |
colorizeAllWith: Color blue; |
|
333 |
actionForAll:[ self browseWorkingCopy ]; |
|
334 |
yourself |
|
335 |
||
336 |
"Created: / 05-02-2012 / 01:28:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
337 |
! ! |
|
338 |
||
9 | 339 |
!WorkingCopyBrowser methodsFor:'aspects'! |
340 |
||
341 |
showOnlyChanged |
|
342 |
||
343 |
|holder| |
|
344 |
||
345 |
(holder := builder bindingAt:#showOnlyChanged) isNil ifTrue:[ |
|
346 |
holder := true asValue. |
|
984 | 347 |
holder onChangeSend: #updateWorkingCopyEntries to: self. |
9 | 348 |
builder aspectAt:#showOnlyChanged put:holder. |
349 |
]. |
|
350 |
^ holder. |
|
351 |
||
352 |
"Created: / 21-10-2008 / 18:53:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
984 | 353 |
"Modified: / 08-02-2012 / 00:43:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
354 |
! |
|
355 |
||
356 |
workingCopyEntriesHolder |
|
357 |
"return/create the 'workingCopyEntriesHolder' value holder (automatically generated)" |
|
358 |
||
359 |
workingCopyEntriesHolder isNil ifTrue:[ |
|
360 |
workingCopyEntriesHolder := ValueHolder new. |
|
361 |
]. |
|
362 |
^ workingCopyEntriesHolder |
|
363 |
||
364 |
"Modified: / 08-02-2012 / 00:46:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9 | 365 |
! |
366 |
||
984 | 367 |
workingCopyEntriesHolder:something |
368 |
"set the 'workingCopyEntriesHolder' value holder (automatically generated)" |
|
9 | 369 |
|
984 | 370 |
workingCopyEntriesHolder := something. |
371 |
! ! |
|
9 | 372 |
|
984 | 373 |
!WorkingCopyBrowser methodsFor:'change & update'! |
9 | 374 |
|
984 | 375 |
updateWorkingCopyEntries |
376 |
| entries | |
|
377 |
||
378 |
entries := self model status. |
|
379 |
self showOnlyChanged value ifTrue: [ |
|
380 |
entries := entries reject: [:entry | entry status isNormal ] |
|
9 | 381 |
]. |
382 |
||
984 | 383 |
self workingCopyEntriesHolder value: entries |
384 |
||
385 |
"Created: / 08-02-2012 / 00:43:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9 | 386 |
! ! |
387 |
||
388 |
!WorkingCopyBrowser methodsFor:'hooks'! |
|
389 |
||
390 |
commonPostBuild |
|
391 |
||
984 | 392 |
self updateWorkingCopyEntries. |
393 |
self modelHolder onChangeSend: #updateWorkingCopyEntries to: self. |
|
9 | 394 |
|
395 |
"Created: / 11-04-2008 / 10:33:10 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
396 |
"Modified: / 12-04-2008 / 21:05:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
984 | 397 |
"Modified: / 08-02-2012 / 00:47:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9 | 398 |
! ! |
399 |
||
400 |
!WorkingCopyBrowser methodsFor:'menu actions'! |
|
401 |
||
775 | 402 |
entryMenuRevert |
9 | 403 |
|
775 | 404 |
| entry | |
9 | 405 |
entry := self selection. |
775 | 406 |
entry ifNotNil:[entry revert] |
407 |
||
408 |
"Modified: / 09-10-2008 / 20:30:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
409 |
"Created: / 05-12-2009 / 20:10:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
410 |
! |
|
9 | 411 |
|
775 | 412 |
entryMenuShowChanges |
413 |
self entryMenuShowChangesAgainst:SVN::Revision head |
|
414 |
||
415 |
"Modified: / 09-10-2008 / 20:30:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
416 |
"Created: / 05-12-2009 / 20:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9 | 417 |
! |
418 |
||
775 | 419 |
entryMenuShowChangesAgainst:rev |
420 |
|wc entry wcChangeSet repoChangeSet diffset lang | |
|
9 | 421 |
wc := self model. |
422 |
entry := self selection. |
|
775 | 423 |
lang := entry programmingLanguage. |
424 |
(lang notNil and: [lang isSmalltalk]) ifTrue:[ |
|
425 |
wcChangeSet := wc changeSetForContainer:entry path. |
|
426 |
wcChangeSet name: wcChangeSet name, ' (working copy)'. |
|
427 |
repoChangeSet := wc branch changeSetForContainer:entry path revision:rev. |
|
428 |
diffset := ChangeSetDiff versionA:wcChangeSet versionB:repoChangeSet. |
|
429 |
(Tools::ChangeSetDiffTool new) |
|
430 |
beSingleColumn; |
|
431 |
diffset:diffset; |
|
432 |
title:('%1: Diffbetween working copy and rev. %2 ' bindWith: entry path with: rev printString); |
|
433 |
open |
|
434 |
] ifFalse:[ |
|
435 |
| text1 text2 | |
|
436 |
text1 := (wc containerReadStreamFor: entry path) contents asString. |
|
437 |
text2 := wc branch cat: entry path. |
|
438 |
(Tools::TextDiffTool new) |
|
817
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
439 |
labelA: 'Working copy'; |
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
440 |
labelB: ('r %1' bindWith: rev printString); |
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
441 |
textA: text1; textB: text2; |
775 | 442 |
title:('%1: Diffbetween working copy and rev. %2 ' bindWith: entry path with: rev printString); |
443 |
open |
|
444 |
] |
|
9 | 445 |
|
446 |
"Created: / 09-10-2008 / 20:14:24 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
447 |
"Modified: / 09-08-2009 / 14:14:21 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
775 | 448 |
"Modified: / 07-07-2011 / 23:09:09 / jv" |
817
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
449 |
"Modified: / 01-09-2011 / 12:15:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9 | 450 |
! ! |
451 |
||
452 |
!WorkingCopyBrowser methodsFor:'private'! |
|
453 |
||
454 |
workingCopyEntries |
|
455 |
| status | |
|
456 |
||
457 |
status := self model status. |
|
458 |
^ self showOnlyChanged value |
|
459 |
ifTrue: [ status reject: [:entry | entry status isNormal ] ] |
|
460 |
ifFalse: [ status ] |
|
461 |
||
462 |
"Created: / 21-10-2008 / 18:55:34 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
463 |
"Modified: / 18-08-2009 / 09:12:04 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
464 |
! ! |
|
465 |
||
466 |
!WorkingCopyBrowser class methodsFor:'documentation'! |
|
467 |
||
817
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
468 |
version |
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
469 |
^ '$Header$' |
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
470 |
! |
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
471 |
|
210 | 472 |
version_SVN |
817
c258e10fedc3
checkin to get version methods correct
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
775
diff
changeset
|
473 |
^ '§Id: SVN__WorkingCopyBrowser.st 367 2011-09-01 11:32:31Z vranyj1 §' |
9 | 474 |
! ! |