author | Claus Gittinger <cg@exept.de> |
Fri, 09 Aug 2019 17:22:23 +0200 | |
changeset 18978 | ff91b0569f14 |
parent 18594 | c0508c7f1fcb |
child 18980 | 9a7a39ce4d6f |
permissions | -rw-r--r-- |
18978 | 1 |
"{ Encoding: utf8 }" |
2 |
||
13818 | 3 |
" |
4 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
11105 | 14 |
"{ Package: 'stx:libtool' }" |
15 |
||
15245
824d31e08f0f
class: DirectoryDifferenceViewApplication
Claus Gittinger <cg@exept.de>
parents:
14500
diff
changeset
|
16 |
"{ NameSpace: Smalltalk }" |
824d31e08f0f
class: DirectoryDifferenceViewApplication
Claus Gittinger <cg@exept.de>
parents:
14500
diff
changeset
|
17 |
|
11105 | 18 |
AbstractFileFinderApplicationComponent subclass:#DirectoryDifferenceViewApplication |
19 |
instanceVariableNames:'directory1Holder directory2Holder directory1 directory2 |
|
20 |
filesOnlyInDirectory1 filesOnlyInDirectory2 |
|
21 |
filesWhichAreDifferent directoriesOnlyInDirectory1 |
|
11121 | 22 |
directoriesOnlyInDirectory2 namePatternHolder |
18978 | 23 |
excludedNamePatternHolder excludedDirectoryNamePatternHolder |
24 |
ignoreCaseInNameHolder ignoreCaseInExcludedNameHolder |
|
25 |
ignoreCaseInExcludedDirectoryNameHolder |
|
26 |
ignoreCaseInDirectoryNameHolder filesSkippedCount |
|
27 |
directoriesSkippedCount' |
|
11105 | 28 |
classVariableNames:'' |
29 |
poolDictionaries:'' |
|
30 |
category:'Interface-Tools-File' |
|
31 |
! |
|
32 |
||
13818 | 33 |
!DirectoryDifferenceViewApplication class methodsFor:'documentation'! |
34 |
||
35 |
copyright |
|
36 |
" |
|
37 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
38 |
All Rights Reserved |
|
39 |
||
40 |
This software is furnished under a license and may be used |
|
41 |
only in accordance with the terms of that license and with the |
|
42 |
inclusion of the above copyright notice. This software may not |
|
43 |
be provided or otherwise made available to, or used by, any |
|
44 |
other person. No title to or ownership of the software is |
|
45 |
hereby transferred. |
|
46 |
" |
|
18978 | 47 |
! |
48 |
||
49 |
documentation |
|
50 |
" |
|
51 |
documentation to be added. |
|
52 |
||
53 |
class: |
|
54 |
<a short class summary here, describing what instances represent> |
|
55 |
||
56 |
responsibilities: |
|
57 |
<describing what my main role is> |
|
58 |
||
59 |
collaborators: |
|
60 |
<describing with whom and how I talk to> |
|
61 |
||
62 |
API: |
|
63 |
<public api and main messages> |
|
64 |
||
65 |
example: |
|
66 |
<a one-line examples on how to use - can also be in a separate example method> |
|
67 |
||
68 |
implementation: |
|
69 |
<implementation points> |
|
70 |
||
71 |
[author:] |
|
72 |
exept MBP |
|
73 |
||
74 |
[instance variables:] |
|
75 |
||
76 |
[class variables:] |
|
77 |
||
78 |
[see also:] |
|
79 |
||
80 |
" |
|
81 |
! |
|
82 |
||
83 |
examples |
|
84 |
" |
|
85 |
Notice that everything between [exBegin] and [exEnd] is extracted by the html-doc generator |
|
86 |
to create nicely formatted and clickable executable examples in the generated html-doc. |
|
87 |
(see the browser's class-documentation menu items for more) |
|
88 |
||
89 |
opening the application: |
|
90 |
[exBegin] |
|
91 |
DirectoryDifferenceViewApplication open |
|
92 |
[exEnd] |
|
93 |
||
94 |
opening the application on some model: |
|
95 |
[exBegin] |
|
96 |
DirectoryDifferenceViewApplication openOn:aModel |
|
97 |
[exEnd] |
|
98 |
" |
|
13818 | 99 |
! ! |
11105 | 100 |
|
11121 | 101 |
!DirectoryDifferenceViewApplication class methodsFor:'help specs'! |
102 |
||
17912 | 103 |
helpSpec |
11121 | 104 |
"This resource specification was automatically generated |
105 |
by the UIHelpTool of ST/X." |
|
106 |
||
107 |
"Do not manually edit this!! If it is corrupted, |
|
108 |
the UIHelpTool may not be able to read the specification." |
|
109 |
||
110 |
" |
|
18978 | 111 |
UIHelpTool openOnClass:DirectoryDifferenceViewApplication |
11121 | 112 |
" |
113 |
||
114 |
<resource: #help> |
|
115 |
||
17912 | 116 |
^ super helpSpec addPairsFrom:#( |
11121 | 117 |
|
18978 | 118 |
#excludedDirectoryNamePattern |
119 |
'Directory name(s) to skip.\Can be matchPatterns, separated by ";"' |
|
11121 | 120 |
|
121 |
#excludedNamePattern |
|
18978 | 122 |
'File name(s) to skip.\Can be matchPatterns, separated by ";"' |
123 |
||
124 |
#ignoreCaseInExcludedDirectoryName |
|
125 |
'Ignore case in directory name exclude pattern(s)' |
|
126 |
||
127 |
#ignoreCaseInExcludedName |
|
128 |
'Ignore case in file name exclude pattern(s)' |
|
129 |
||
130 |
#ignoreCaseInName |
|
131 |
'Ignore case in file name pattern(s)' |
|
132 |
||
133 |
#namePattern |
|
134 |
'Filename(s) to search for.\Can be matchPatterns, separated by ";".\(eg. "*.c ; *.h" searches for C and header files. So does "*.[ch]")' |
|
11121 | 135 |
|
136 |
#searchDirectory1 |
|
137 |
'The first folder, to be compared against folder2' |
|
138 |
||
139 |
#searchDirectory2 |
|
140 |
'The second folder, to be compared against folder1' |
|
141 |
||
142 |
) |
|
143 |
! ! |
|
144 |
||
11105 | 145 |
!DirectoryDifferenceViewApplication class methodsFor:'interface specs'! |
146 |
||
147 |
windowSpec |
|
148 |
"This resource specification was automatically generated |
|
149 |
by the UIPainter of ST/X." |
|
150 |
||
151 |
"Do not manually edit this!! If it is corrupted, |
|
152 |
the UIPainter may not be able to read the specification." |
|
153 |
||
154 |
" |
|
155 |
UIPainter new openOnClass:DirectoryDifferenceViewApplication andSelector:#windowSpec |
|
156 |
DirectoryDifferenceViewApplication new openInterface:#windowSpec |
|
157 |
DirectoryDifferenceViewApplication open |
|
158 |
" |
|
159 |
||
160 |
<resource: #canvas> |
|
161 |
||
162 |
^ |
|
18978 | 163 |
#(FullSpec |
164 |
name: windowSpec |
|
165 |
uuid: '523f01a8-baab-11e9-a284-10ddb1cc5928' |
|
166 |
window: |
|
167 |
(WindowSpec |
|
168 |
label: 'Directory Diff' |
|
169 |
name: 'Directory Diff' |
|
170 |
uuid: '09a5b9c0-baa9-11e9-a284-10ddb1cc5928' |
|
171 |
min: (Point 377 131) |
|
172 |
bounds: (Rectangle 0 0 758 512) |
|
173 |
) |
|
174 |
component: |
|
175 |
(SpecCollection |
|
176 |
collection: ( |
|
177 |
(MenuPanelSpec |
|
178 |
name: 'ToolBar1' |
|
179 |
layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
180 |
uuid: '09a5bd8a-baa9-11e9-a284-10ddb1cc5928' |
|
181 |
level: 0 |
|
182 |
menu: searchMenu |
|
183 |
textDefault: true |
|
184 |
) |
|
185 |
(ProgressIndicatorSpec |
|
186 |
name: 'ProgressIndicator1' |
|
187 |
layout: (LayoutFrame 125 0 11 0 231 0 21 0) |
|
188 |
uuid: '09a5c06e-baa9-11e9-a284-10ddb1cc5928' |
|
189 |
visibilityChannel: enableStop |
|
190 |
backgroundColor: (Color 0.0 67.0 67.0) |
|
191 |
showPercentage: false |
|
192 |
isActivityIndicator: true |
|
193 |
) |
|
194 |
(ViewSpec |
|
195 |
name: 'Box1' |
|
196 |
layout: (LayoutFrame 0 0.0 32 0 0 1.0 154 0) |
|
197 |
uuid: '09a5c2d0-baa9-11e9-a284-10ddb1cc5928' |
|
198 |
component: |
|
199 |
(SpecCollection |
|
200 |
collection: ( |
|
201 |
(LabelSpec |
|
202 |
label: 'Directory1:' |
|
203 |
name: 'DirectoryLabel' |
|
204 |
layout: (LayoutFrame 2 0 7 0 154 0 24 0) |
|
205 |
activeHelpKey: searchDirectory1 |
|
206 |
uuid: '09a5c42e-baa9-11e9-a284-10ddb1cc5928' |
|
207 |
translateLabel: true |
|
208 |
adjust: right |
|
209 |
) |
|
210 |
(FilenameInputFieldSpec |
|
211 |
name: 'DirectoryEntryField' |
|
212 |
layout: (LayoutFrame 156 0 4 0 0 1 24 0) |
|
213 |
activeHelpKey: searchDirectory1 |
|
214 |
uuid: '09a5c67c-baa9-11e9-a284-10ddb1cc5928' |
|
215 |
model: directory1Holder |
|
216 |
immediateAccept: true |
|
217 |
acceptOnPointerLeave: false |
|
218 |
) |
|
219 |
(LabelSpec |
|
220 |
label: 'Directory2:' |
|
221 |
name: 'Label2' |
|
222 |
layout: (LayoutFrame 2 0 31 0 154 0 48 0) |
|
223 |
activeHelpKey: searchDirectory2 |
|
224 |
uuid: '09a5ca00-baa9-11e9-a284-10ddb1cc5928' |
|
225 |
translateLabel: true |
|
226 |
adjust: right |
|
227 |
) |
|
228 |
(FilenameInputFieldSpec |
|
229 |
name: 'FilenameEntryField1' |
|
230 |
layout: (LayoutFrame 156 0 28 0 0 1 48 0) |
|
231 |
activeHelpKey: searchDirectory2 |
|
232 |
uuid: '09a5cb40-baa9-11e9-a284-10ddb1cc5928' |
|
233 |
model: directory2Holder |
|
234 |
immediateAccept: true |
|
235 |
acceptOnPointerLeave: false |
|
236 |
) |
|
237 |
(LabelSpec |
|
238 |
label: 'Compare Files Named:' |
|
239 |
name: 'FileNameLabel' |
|
240 |
layout: (LayoutFrame 2 0 55 0 154 0 72 0) |
|
241 |
activeHelpKey: namePattern |
|
242 |
uuid: '09a5ccda-baa9-11e9-a284-10ddb1cc5928' |
|
243 |
translateLabel: true |
|
244 |
adjust: right |
|
245 |
) |
|
246 |
(InputFieldSpec |
|
247 |
name: 'FileNameEntryField' |
|
248 |
layout: (LayoutFrame 156 0 52 0 -180 1 72 0) |
|
249 |
activeHelpKey: namePattern |
|
250 |
uuid: '09a5cdf2-baa9-11e9-a284-10ddb1cc5928' |
|
251 |
tabable: true |
|
252 |
model: namePatternHolder |
|
253 |
immediateAccept: true |
|
254 |
acceptOnLeave: false |
|
255 |
acceptOnPointerLeave: false |
|
256 |
) |
|
257 |
(CheckBoxSpec |
|
258 |
label: 'Ignore Case' |
|
259 |
name: 'IgnoreCaseInNameCheckBox' |
|
260 |
layout: (LayoutFrame -169 1 53 0 -4 1 76 0) |
|
261 |
activeHelpKey: ignoreCaseInName |
|
262 |
uuid: '09a5cfb4-baa9-11e9-a284-10ddb1cc5928' |
|
263 |
tabable: true |
|
264 |
model: ignoreCaseInNameHolder |
|
265 |
translateLabel: true |
|
266 |
) |
|
267 |
(LabelSpec |
|
268 |
label: 'But Not Named:' |
|
269 |
name: 'Label1' |
|
270 |
layout: (LayoutFrame 2 0 79 0 190 0 96 0) |
|
271 |
activeHelpKey: excludedNamePattern |
|
272 |
uuid: '09a5d16c-baa9-11e9-a284-10ddb1cc5928' |
|
273 |
translateLabel: true |
|
274 |
adjust: right |
|
275 |
) |
|
276 |
(InputFieldSpec |
|
277 |
name: 'EntryField1' |
|
278 |
layout: (LayoutFrame 190 0 76 0 -180 1 96 0) |
|
279 |
activeHelpKey: excludedNamePattern |
|
280 |
uuid: '09a5d284-baa9-11e9-a284-10ddb1cc5928' |
|
281 |
tabable: true |
|
282 |
model: excludedNamePatternHolder |
|
283 |
immediateAccept: true |
|
284 |
acceptOnLeave: false |
|
285 |
acceptOnPointerLeave: false |
|
286 |
) |
|
287 |
(CheckBoxSpec |
|
288 |
label: 'Ignore Case' |
|
289 |
name: 'CheckBox1' |
|
290 |
layout: (LayoutFrame -169 1 77 0 -4 1 100 0) |
|
291 |
activeHelpKey: ignoreCaseInExcludedName |
|
292 |
uuid: '09a5d414-baa9-11e9-a284-10ddb1cc5928' |
|
293 |
tabable: true |
|
294 |
model: ignoreCaseInExcludedNameHolder |
|
295 |
translateLabel: true |
|
296 |
) |
|
297 |
(LabelSpec |
|
298 |
label: 'Ignore Folders Named:' |
|
299 |
name: 'Label3' |
|
300 |
layout: (LayoutFrame 2 0 103 0 190 0 120 0) |
|
301 |
activeHelpKey: excludedDirectoryNamePattern |
|
302 |
uuid: '09a5d518-baa9-11e9-a284-10ddb1cc5928' |
|
303 |
translateLabel: true |
|
304 |
adjust: right |
|
305 |
) |
|
306 |
(InputFieldSpec |
|
307 |
name: 'EntryField2' |
|
308 |
layout: (LayoutFrame 190 0 100 0 -180 1 120 0) |
|
309 |
activeHelpKey: excludedDirectoryNamePattern |
|
310 |
uuid: '09a5d63a-baa9-11e9-a284-10ddb1cc5928' |
|
311 |
tabable: true |
|
312 |
model: excludedDirectoryNamePatternHolder |
|
313 |
immediateAccept: true |
|
314 |
acceptOnLeave: false |
|
315 |
acceptOnPointerLeave: false |
|
316 |
) |
|
317 |
(CheckBoxSpec |
|
318 |
label: 'Ignore Case' |
|
319 |
name: 'CheckBox2' |
|
320 |
layout: (LayoutFrame -169 1 101 0 -4 1 124 0) |
|
321 |
activeHelpKey: ignoreCaseInExcludedDirectoryName |
|
322 |
uuid: '09a5d7d4-baa9-11e9-a284-10ddb1cc5928' |
|
323 |
tabable: true |
|
324 |
model: ignoreCaseInExcludedDirectoryNameHolder |
|
325 |
translateLabel: true |
|
326 |
) |
|
11105 | 327 |
) |
328 |
) |
|
18978 | 329 |
) |
330 |
(VariableVerticalPanelSpec |
|
331 |
name: 'VariableVerticalPanel1' |
|
332 |
layout: (LayoutFrame 0 0.0 164 0 0 1.0 0 1) |
|
333 |
uuid: '09a5d914-baa9-11e9-a284-10ddb1cc5928' |
|
334 |
component: |
|
335 |
(SpecCollection |
|
336 |
collection: ( |
|
337 |
(DataSetSpec |
|
338 |
name: 'Table1' |
|
339 |
uuid: '09a5daa4-baa9-11e9-a284-10ddb1cc5928' |
|
340 |
model: selectionHolder |
|
341 |
hasHorizontalScrollBar: true |
|
342 |
hasVerticalScrollBar: true |
|
343 |
dataList: matchedFilesList |
|
344 |
doubleClickSelector: fileDoubleClick: |
|
345 |
columnHolder: searchResultTable |
|
346 |
valueChangeSelector: fileSelected: |
|
347 |
multipleSelectOk: true |
|
348 |
) |
|
349 |
(ArbitraryComponentSpec |
|
350 |
name: 'DiffTextView' |
|
351 |
uuid: '09a5deaa-baa9-11e9-a284-10ddb1cc5928' |
|
352 |
hasHorizontalScrollBar: true |
|
353 |
hasVerticalScrollBar: true |
|
354 |
component: DiffTextView |
|
355 |
) |
|
11105 | 356 |
) |
357 |
) |
|
18978 | 358 |
handles: (Any 0.5 1.0) |
359 |
) |
|
11105 | 360 |
) |
361 |
) |
|
18978 | 362 |
) |
11105 | 363 |
! ! |
364 |
||
11123 | 365 |
!DirectoryDifferenceViewApplication class methodsFor:'menu specs'! |
366 |
||
367 |
searchMenu |
|
368 |
"This resource specification was automatically generated |
|
369 |
by the MenuEditor of ST/X." |
|
370 |
||
371 |
"Do not manually edit this!! If it is corrupted, |
|
372 |
the MenuEditor may not be able to read the specification." |
|
373 |
||
374 |
||
375 |
" |
|
376 |
MenuEditor new openOnClass:FindFileApplication andSelector:#searchMenu |
|
377 |
(Menu new fromLiteralArrayEncoding:(FindFileApplication searchMenu)) startUp |
|
378 |
" |
|
379 |
||
380 |
<resource: #menu> |
|
381 |
||
382 |
^ |
|
383 |
#(Menu |
|
384 |
( |
|
385 |
(MenuItem |
|
386 |
label: 'Search' |
|
387 |
itemValue: doSearch |
|
388 |
translateLabel: true |
|
389 |
isButton: true |
|
390 |
labelImage: (ResourceRetriever ToolbarIconLibrary searchFileIcon) |
|
391 |
) |
|
392 |
(MenuItem |
|
393 |
enabled: enableStop |
|
394 |
label: 'Stop' |
|
395 |
itemValue: stop |
|
396 |
translateLabel: true |
|
397 |
isButton: true |
|
398 |
isVisible: enableStop |
|
399 |
labelImage: (ResourceRetriever XPToolbarIconLibrary stop22x22Icon) |
|
400 |
) |
|
401 |
(MenuItem |
|
402 |
label: 'Close' |
|
403 |
itemValue: doClose |
|
404 |
translateLabel: true |
|
405 |
isButton: true |
|
406 |
startGroup: right |
|
407 |
isVisible: false |
|
408 |
labelImage: (ResourceRetriever ToolbarIconLibrary removeTabIcon) |
|
409 |
) |
|
410 |
) |
|
411 |
nil |
|
412 |
nil |
|
413 |
) |
|
414 |
! ! |
|
415 |
||
11105 | 416 |
!DirectoryDifferenceViewApplication class methodsFor:'tableColumns specs'! |
417 |
||
418 |
searchResultTable |
|
419 |
"This resource specification was automatically generated |
|
420 |
by the DataSetBuilder of ST/X." |
|
421 |
||
422 |
"Do not manually edit this!! If it is corrupted, |
|
423 |
the DataSetBuilder may not be able to read the specification." |
|
424 |
||
425 |
" |
|
426 |
DataSetBuilder new openOnClass:DirectoryDifferenceViewApplication andSelector:#searchResultTable |
|
427 |
" |
|
428 |
||
429 |
<resource: #tableColumns> |
|
430 |
||
431 |
^#( |
|
432 |
(DataSetColumnSpec |
|
433 |
label: 'Filename' |
|
434 |
id: 'FileName' |
|
435 |
labelButtonType: Button |
|
436 |
model: at: |
|
437 |
menuFromApplication: false |
|
438 |
writeSelector: at:put: |
|
439 |
showRowSeparator: false |
|
440 |
showColSeparator: false |
|
441 |
) |
|
442 |
(DataSetColumnSpec |
|
443 |
label: 'Diff' |
|
444 |
id: 'Diff' |
|
445 |
labelButtonType: Button |
|
446 |
model: at: |
|
447 |
menuFromApplication: false |
|
448 |
writeSelector: at:put: |
|
449 |
showRowSeparator: false |
|
450 |
showColSeparator: false |
|
451 |
) |
|
452 |
) |
|
453 |
||
454 |
! ! |
|
455 |
||
456 |
!DirectoryDifferenceViewApplication methodsFor:'accessing'! |
|
457 |
||
458 |
directory1:directory1Arg directory2:directory2Arg |
|
459 |
self directory1Holder value:directory1Arg. |
|
460 |
self directory2Holder value:directory2Arg. |
|
461 |
||
462 |
"/ self namePatternHolder value:newPattern. |
|
463 |
self enableStop value:false. |
|
464 |
self enableSearch value:true. |
|
465 |
^ true. |
|
466 |
||
467 |
"Modified: / 12-01-2012 / 01:36:54 / cg" |
|
468 |
! |
|
469 |
||
470 |
directory1Holder |
|
471 |
directory1Holder isNil ifTrue:[ |
|
472 |
directory1Holder := nil asValue |
|
473 |
]. |
|
474 |
^ directory1Holder |
|
475 |
||
476 |
"Created: / 12-01-2012 / 01:37:31 / cg" |
|
477 |
! |
|
478 |
||
479 |
directory2Holder |
|
480 |
directory2Holder isNil ifTrue:[ |
|
481 |
directory2Holder := nil asValue |
|
482 |
]. |
|
483 |
^ directory2Holder |
|
484 |
||
485 |
"Created: / 12-01-2012 / 01:37:41 / cg" |
|
486 |
! ! |
|
487 |
||
11116 | 488 |
!DirectoryDifferenceViewApplication methodsFor:'actions'! |
489 |
||
490 |
fileSelected:entries |
|
491 |
|entry file fn1 fn2 text1 text2 differ| |
|
492 |
||
493 |
entries isEmptyOrNil ifTrue:[^ self]. |
|
494 |
||
495 |
entry := self shownList at:entries first. |
|
496 |
file := entry first. |
|
497 |
||
498 |
fn1 := self directory1Holder value asFilename construct:file. |
|
499 |
fn2 := self directory2Holder value asFilename construct:file. |
|
15245
824d31e08f0f
class: DirectoryDifferenceViewApplication
Claus Gittinger <cg@exept.de>
parents:
14500
diff
changeset
|
500 |
(fn1 exists and:[fn1 isRegularFile]) ifTrue:[ |
14500
dac4006a72c5
class: DirectoryDifferenceViewApplication
Claus Gittinger <cg@exept.de>
parents:
13818
diff
changeset
|
501 |
text1 := fn1 contentsAsString. |
11116 | 502 |
]. |
15245
824d31e08f0f
class: DirectoryDifferenceViewApplication
Claus Gittinger <cg@exept.de>
parents:
14500
diff
changeset
|
503 |
(fn2 exists and:[fn2 isRegularFile]) ifTrue:[ |
14500
dac4006a72c5
class: DirectoryDifferenceViewApplication
Claus Gittinger <cg@exept.de>
parents:
13818
diff
changeset
|
504 |
text2 := fn2 contentsAsString. |
11116 | 505 |
]. |
506 |
differ := builder componentAt:'DiffTextView'. |
|
507 |
differ text1:(text1 ? '') text2:(text2 ? ''). |
|
508 |
||
509 |
"Created: / 12-01-2012 / 03:21:52 / cg" |
|
510 |
! ! |
|
511 |
||
11121 | 512 |
!DirectoryDifferenceViewApplication methodsFor:'aspects'! |
513 |
||
18978 | 514 |
excludedDirectoryNamePatternHolder |
515 |
excludedDirectoryNamePatternHolder isNil ifTrue:[ |
|
516 |
excludedDirectoryNamePatternHolder := '' asValue. |
|
517 |
]. |
|
518 |
^ excludedDirectoryNamePatternHolder. |
|
519 |
||
520 |
"Created: / 13-01-2012 / 14:42:47 / cg" |
|
521 |
! |
|
522 |
||
11121 | 523 |
excludedNamePatternHolder |
524 |
excludedNamePatternHolder isNil ifTrue:[ |
|
525 |
excludedNamePatternHolder := '' asValue. |
|
526 |
]. |
|
527 |
^ excludedNamePatternHolder. |
|
528 |
||
529 |
"Created: / 13-01-2012 / 14:42:47 / cg" |
|
530 |
! |
|
531 |
||
18978 | 532 |
ignoreCaseInDirectoryNameHolder |
533 |
||
534 |
ignoreCaseInDirectoryNameHolder isNil ifTrue:[ |
|
535 |
ignoreCaseInDirectoryNameHolder := true asValue. |
|
536 |
]. |
|
537 |
^ ignoreCaseInDirectoryNameHolder. |
|
538 |
||
539 |
"Created: / 13-01-2012 / 14:37:28 / cg" |
|
540 |
! |
|
541 |
||
542 |
ignoreCaseInExcludedDirectoryNameHolder |
|
543 |
||
544 |
ignoreCaseInExcludedDirectoryNameHolder isNil ifTrue:[ |
|
545 |
ignoreCaseInExcludedDirectoryNameHolder := true asValue. |
|
546 |
]. |
|
547 |
^ ignoreCaseInExcludedDirectoryNameHolder. |
|
548 |
||
549 |
"Created: / 13-01-2012 / 14:37:28 / cg" |
|
550 |
! |
|
551 |
||
552 |
ignoreCaseInExcludedNameHolder |
|
553 |
||
554 |
ignoreCaseInExcludedNameHolder isNil ifTrue:[ |
|
555 |
ignoreCaseInExcludedNameHolder := true asValue. |
|
556 |
]. |
|
557 |
^ ignoreCaseInExcludedNameHolder. |
|
558 |
||
559 |
"Created: / 13-01-2012 / 14:37:28 / cg" |
|
560 |
! |
|
561 |
||
562 |
ignoreCaseInNameHolder |
|
563 |
||
564 |
ignoreCaseInNameHolder isNil ifTrue:[ |
|
565 |
ignoreCaseInNameHolder := true asValue. |
|
566 |
]. |
|
567 |
^ ignoreCaseInNameHolder. |
|
568 |
||
569 |
"Created: / 13-01-2012 / 14:37:28 / cg" |
|
570 |
! |
|
571 |
||
11121 | 572 |
namePatternHolder |
573 |
||
574 |
namePatternHolder isNil ifTrue:[ |
|
575 |
namePatternHolder := '*' asValue. |
|
576 |
]. |
|
577 |
^ namePatternHolder. |
|
578 |
||
579 |
"Created: / 13-01-2012 / 14:37:28 / cg" |
|
580 |
! ! |
|
581 |
||
11105 | 582 |
!DirectoryDifferenceViewApplication methodsFor:'comparing'! |
583 |
||
584 |
doSearch |
|
18978 | 585 |
|dir1 dir2 |
586 |
namePattern excludedNamePattern excludedDirectoryNamePattern |
|
587 |
ignoreCaseInName ignoreCaseInExcludeName ignoreCaseInExcludeDirectoryName |
|
588 |
fileExcludeFilterOrNil directoryExcludeFilterOrNil checkDir| |
|
11105 | 589 |
|
590 |
filesOnlyInDirectory1 := OrderedCollection new. |
|
591 |
filesOnlyInDirectory2 := OrderedCollection new. |
|
592 |
directoriesOnlyInDirectory1 := OrderedCollection new. |
|
593 |
directoriesOnlyInDirectory2 := OrderedCollection new. |
|
594 |
filesWhichAreDifferent := OrderedCollection new. |
|
595 |
||
18978 | 596 |
filesSkippedCount := directoriesSkippedCount := 0. |
597 |
||
11105 | 598 |
dir1 := self directory1Holder value. |
599 |
dir1 isNil ifTrue:[^ self]. |
|
600 |
||
601 |
dir2 := self directory2Holder value. |
|
602 |
dir2 isNil ifTrue:[^ self]. |
|
603 |
||
604 |
dir1 := dir1 asFilename. |
|
605 |
dir2 := dir2 asFilename. |
|
606 |
||
11123 | 607 |
dir1 pathName = dir2 pathName ifTrue:[ |
608 |
self notify:('Same folder.' allBold). |
|
609 |
^ self. |
|
610 |
]. |
|
611 |
||
11121 | 612 |
namePattern := self namePatternHolder value. |
11123 | 613 |
namePattern notEmptyOrNil ifTrue:[ |
18978 | 614 |
namePattern := namePattern withoutSeparators. |
615 |
(namePattern isEmptyOrNil or:[namePattern = '*']) ifTrue:[ |
|
616 |
namePattern := nil |
|
617 |
] |
|
11123 | 618 |
]. |
18978 | 619 |
|
620 |
ignoreCaseInName := self ignoreCaseInNameHolder value. |
|
621 |
ignoreCaseInExcludeName := self ignoreCaseInExcludedNameHolder value. |
|
622 |
ignoreCaseInExcludeDirectoryName := self ignoreCaseInExcludedDirectoryNameHolder value. |
|
623 |
||
11121 | 624 |
excludedNamePattern := self excludedNamePatternHolder value. |
11123 | 625 |
excludedNamePattern notEmptyOrNil ifTrue:[ |
18978 | 626 |
excludedNamePattern := excludedNamePattern withoutSeparators. |
627 |
excludedNamePattern notEmptyOrNil ifTrue:[ |
|
628 |
fileExcludeFilterOrNil := |
|
629 |
ignoreCaseInExcludeName |
|
630 |
ifTrue:[ [:baseName | (excludedNamePattern compoundMatch:baseName caseSensitive:false) not ] ] |
|
631 |
ifFalse:[ [:baseName | (excludedNamePattern compoundMatch:baseName caseSensitive:true) not ] ]. |
|
632 |
]. |
|
11123 | 633 |
]. |
18978 | 634 |
|
635 |
excludedDirectoryNamePattern := self excludedDirectoryNamePatternHolder value. |
|
636 |
excludedDirectoryNamePattern notEmptyOrNil ifTrue:[ |
|
637 |
excludedDirectoryNamePattern := excludedDirectoryNamePattern withoutSeparators. |
|
638 |
excludedDirectoryNamePattern notEmptyOrNil ifTrue:[ |
|
639 |
checkDir := |
|
640 |
ignoreCaseInExcludeDirectoryName |
|
641 |
ifTrue:[ [:dir | (excludedDirectoryNamePattern compoundMatch:(dir baseName) caseSensitive:false) not ] ] |
|
642 |
ifFalse:[ [:dir | (excludedDirectoryNamePattern compoundMatch:(dir baseName) caseSensitive:true) not ] ]. |
|
643 |
directoryExcludeFilterOrNil := |
|
644 |
[:fn | |
|
645 |
(checkDir value:fn) ifFalse:[ |
|
646 |
directoriesSkippedCount := directoriesSkippedCount + 1. |
|
647 |
false. |
|
648 |
] ifTrue:[ |
|
649 |
true |
|
650 |
] |
|
651 |
]. |
|
652 |
]. |
|
653 |
]. |
|
654 |
||
11564 | 655 |
self matchedFilesList removeAll. |
656 |
self windowGroup repairDamage. |
|
11121 | 657 |
|
11105 | 658 |
self |
659 |
startSearchTask:[ |
|
660 |
self changeInformationTo:'Directory Diff - searching ' toTab:true. |
|
661 |
||
662 |
self shownListHolder valueHolder:(self matchedFilesList). |
|
663 |
||
18978 | 664 |
dir1 |
665 |
recursiveDirectoryContentsDo:[:relFn1 | |
|
666 |
|fn1 fn2 fn1BaseName| |
|
11105 | 667 |
|
18978 | 668 |
fn1 := dir1 construct:relFn1. |
669 |
fn1BaseName := fn1 baseName. |
|
670 |
(namePattern isNil or:[namePattern compoundMatch:fn1BaseName caseSensitive:ignoreCaseInName not]) ifTrue:[ |
|
671 |
(fileExcludeFilterOrNil isNil or:[fileExcludeFilterOrNil value:fn1BaseName]) ifTrue:[ |
|
672 |
fn2 := dir2 construct:relFn1. |
|
673 |
fn1 isDirectory ifTrue:[ |
|
674 |
self notify:('Comparing %1...' bindWith:relFn1 asString allBold). |
|
675 |
fn2 exists ifFalse:[ |
|
676 |
directoriesOnlyInDirectory1 add:fn1. |
|
677 |
self matchedFilesList add:{ relFn1 . 'Directory only in directory1' }. |
|
11121 | 678 |
]. |
679 |
] ifFalse:[ |
|
18978 | 680 |
fn2 exists ifTrue:[ |
681 |
filesSearchedCount := filesSearchedCount + 1. |
|
682 |
(fn1 sameContentsAs:fn2) ifFalse:[ |
|
683 |
filesWhichAreDifferent add:fn1. |
|
684 |
self matchedFilesList add:{ relFn1 . 'Different' }. |
|
685 |
]. |
|
686 |
] ifFalse:[ |
|
687 |
filesOnlyInDirectory1 add:fn1. |
|
688 |
self matchedFilesList add:{ relFn1 . 'File only in directory1' }. |
|
689 |
]. |
|
11121 | 690 |
]. |
18978 | 691 |
] ifFalse:[ |
692 |
filesSkippedCount := filesSkippedCount + 1. |
|
693 |
] |
|
11121 | 694 |
] |
695 |
] |
|
18978 | 696 |
filterForVisitingDirectories:directoryExcludeFilterOrNil. |
697 |
||
698 |
dir2 |
|
699 |
recursiveDirectoryContentsDo:[:relFn2 | |
|
700 |
|fn1 fn2 fn2BaseName| |
|
11105 | 701 |
|
18978 | 702 |
fn2 := dir2 construct:relFn2. |
703 |
fn2BaseName := fn2 baseName. |
|
704 |
(namePattern isNil or:[namePattern compoundMatch:fn2BaseName caseSensitive:ignoreCaseInName not]) ifTrue:[ |
|
705 |
(fileExcludeFilterOrNil isNil or:[fileExcludeFilterOrNil value:fn2BaseName]) ifFalse:[ |
|
706 |
fn1 := dir1 construct:relFn2. |
|
707 |
fn1 exists ifFalse:[ |
|
708 |
fn1 isDirectory ifTrue:[ |
|
709 |
directoriesOnlyInDirectory1 add:fn1. |
|
710 |
self matchedFilesList add:{ relFn2 . 'Directory only in directory2' }. |
|
711 |
] ifFalse:[ |
|
712 |
filesOnlyInDirectory2 add:fn2. |
|
713 |
self matchedFilesList add:{ relFn2 . 'File only in directory2' }. |
|
714 |
] |
|
715 |
]. |
|
11121 | 716 |
]. |
18978 | 717 |
] ifFalse:[ |
718 |
filesSkippedCount := filesSkippedCount + 1. |
|
719 |
] |
|
11121 | 720 |
] |
18978 | 721 |
filterForVisitingDirectories:directoryExcludeFilterOrNil. |
722 |
||
723 |
Transcript showCR:'--- search summary ------'. |
|
724 |
directoriesSkippedCount ~~ 0 ifTrue:[ |
|
725 |
Transcript showCR:'%1 directories skipped' with:directoriesSkippedCount. |
|
726 |
]. |
|
727 |
filesSkippedCount ~~ 0 ifTrue:[ |
|
728 |
Transcript showCR:'%1 files skipped' with:filesSkippedCount. |
|
11105 | 729 |
]. |
730 |
filesOnlyInDirectory1 notEmpty ifTrue:[ |
|
18594 | 731 |
Transcript showCR:'%1 files only in directory1' with:filesOnlyInDirectory1 size. |
11105 | 732 |
]. |
733 |
filesOnlyInDirectory2 notEmpty ifTrue:[ |
|
18594 | 734 |
Transcript showCR:'%1 files only in directory2' with:filesOnlyInDirectory2 size. |
11105 | 735 |
]. |
736 |
directoriesOnlyInDirectory1 notEmpty ifTrue:[ |
|
18594 | 737 |
Transcript showCR:'%1 directories only in directory1' with:directoriesOnlyInDirectory1 size. |
11105 | 738 |
]. |
739 |
directoriesOnlyInDirectory2 notEmpty ifTrue:[ |
|
18594 | 740 |
Transcript showCR:'%1 directories only in directory2' with:directoriesOnlyInDirectory2 size. |
11105 | 741 |
]. |
742 |
filesWhichAreDifferent notEmpty ifTrue:[ |
|
18594 | 743 |
Transcript showCR:'%1 files are different' with:filesWhichAreDifferent size. |
11105 | 744 |
] |
745 |
] |
|
746 |
name:'Directory Diff'. |
|
747 |
||
748 |
"Created: / 12-01-2012 / 01:07:20 / cg" |
|
18594 | 749 |
"Modified: / 15-02-2019 / 09:42:51 / Claus Gittinger" |
18978 | 750 |
! |
751 |
||
752 |
generateResultStringForTimeElapsed:timeDuration |
|
753 |
"at the end of a search, generate a nice informative summary string. |
|
754 |
Redefined to generate a different message." |
|
755 |
||
756 |
|timeMillis timeString nIn1 nIn2 nDifferent| |
|
757 |
||
758 |
timeMillis := timeDuration asMilliseconds. |
|
759 |
timeString := timeDuration printStringForApproximation. |
|
760 |
||
761 |
nIn1 := filesOnlyInDirectory1 size. |
|
762 |
nIn2 := filesOnlyInDirectory1 size. |
|
763 |
nDifferent := filesWhichAreDifferent size. |
|
764 |
||
765 |
^ resources |
|
766 |
string:('different:%1, only in one:%2 / %3 (%4 files visited; %6 files/s).') |
|
767 |
with:nDifferent |
|
768 |
with:nIn1 |
|
769 |
with:nIn2 |
|
770 |
with:filesSearchedCount |
|
771 |
with:(UnitConverter fileSizeSIStringFor:(bytesSearchedCount * 1000 / (timeMillis max:1))) |
|
772 |
with:((filesSearchedCount * 1000 / (timeMillis max:1)) asFixedPoint:1). |
|
11105 | 773 |
! ! |
774 |
||
775 |
!DirectoryDifferenceViewApplication methodsFor:'startup & release'! |
|
776 |
||
777 |
postOpenWith:aBuilder |
|
778 |
super postOpenWith:aBuilder. |
|
779 |
self doSearch |
|
780 |
||
781 |
"Created: / 12-01-2012 / 01:41:18 / cg" |
|
782 |
! ! |
|
783 |
||
784 |
!DirectoryDifferenceViewApplication class methodsFor:'documentation'! |
|
785 |
||
786 |
version |
|
17708 | 787 |
^ '$Header$' |
11105 | 788 |
! |
789 |
||
790 |
version_CVS |
|
17708 | 791 |
^ '$Header$' |
11105 | 792 |
! ! |
13818 | 793 |