author | Claus Gittinger <cg@exept.de> |
Mon, 13 Mar 2006 16:55:08 +0100 | |
changeset 2937 | ade850cf77ae |
parent 2902 | 7365e48e82f2 |
child 2952 | 10e34346944b |
permissions | -rw-r--r-- |
1431 | 1 |
" |
2 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
1780 | 14 |
"{ Package: 'stx:libwidg2' }" |
15 |
||
1390 | 16 |
HierarchicalList subclass:#HierarchicalFileList |
2298
22e95baad346
showCursor and mountPoints instance variables removed
penk
parents:
2297
diff
changeset
|
17 |
instanceVariableNames:'matchBlock indicatorList indicatorTask sortBlock' |
2138 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'Views-Support' |
|
1390 | 21 |
! |
22 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
23 |
HierarchicalItem subclass:#HierarchicalFileItem |
2297 | 24 |
instanceVariableNames:'icon contentsItem' |
2293 | 25 |
classVariableNames:'LastUIDToUserNameMapping LastGIDToGroupNameMapping' |
2138 | 26 |
poolDictionaries:'' |
27 |
privateIn:HierarchicalFileList |
|
1390 | 28 |
! |
29 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
30 |
HierarchicalFileList::HierarchicalFileItem subclass:#File |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
31 |
instanceVariableNames:'' |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
32 |
classVariableNames:'' |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
33 |
poolDictionaries:'' |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
34 |
privateIn:HierarchicalFileList |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
35 |
! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
36 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
37 |
HierarchicalFileList::HierarchicalFileItem subclass:#Directory |
2475 | 38 |
instanceVariableNames:'modificationTime makeIconGray quickChildrenInfo' |
39 |
classVariableNames:'StateUnknown StateHasChildren StateHasNoChildren StateFetching' |
|
2138 | 40 |
poolDictionaries:'' |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
41 |
privateIn:HierarchicalFileList |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
42 |
! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
43 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
44 |
HierarchicalFileList::Directory subclass:#RemoteDirectory |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
45 |
instanceVariableNames:'' |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
46 |
classVariableNames:'' |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
47 |
poolDictionaries:'' |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
48 |
privateIn:HierarchicalFileList |
1390 | 49 |
! |
50 |
||
1431 | 51 |
!HierarchicalFileList class methodsFor:'documentation'! |
52 |
||
53 |
copyright |
|
54 |
" |
|
55 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
56 |
All Rights Reserved |
|
57 |
||
58 |
This software is furnished under a license and may be used |
|
59 |
only in accordance with the terms of that license and with the |
|
60 |
inclusion of the above copyright notice. This software may not |
|
61 |
be provided or otherwise made available to, or used by, any |
|
62 |
other person. No title to or ownership of the software is |
|
63 |
hereby transferred. |
|
64 |
" |
|
65 |
||
66 |
! ! |
|
1390 | 67 |
|
68 |
!HierarchicalFileList class methodsFor:'examples'! |
|
69 |
||
2180 | 70 |
examples |
2130 | 71 |
" |
2306 | 72 |
open filebrowser without monitoring cycle |
73 |
||
2180 | 74 |
[exBegin] |
2306 | 75 |
|top sel list directory| |
1390 | 76 |
|
77 |
list := HierarchicalFileList new. |
|
78 |
list showRoot:false. |
|
2130 | 79 |
list matchBlock:[:fn :isDir| true ]. |
1390 | 80 |
|
2306 | 81 |
directory := Filename currentDirectory. |
82 |
directory := Filename homeDirectory. |
|
83 |
||
84 |
list directory:(directory asAbsoluteFilename). |
|
85 |
||
1390 | 86 |
top := StandardSystemView new; extent:300@300. |
87 |
sel := ScrollableView for:HierarchicalListView miniScroller:true |
|
88 |
origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
89 |
||
90 |
sel doubleClickAction:[:i| (list at:i) toggleExpand ]. |
|
91 |
sel indicatorAction:[:i| (list at:i) toggleExpand ]. |
|
92 |
||
2296 | 93 |
sel hasConstantHeight:true. |
2259 | 94 |
sel list:list. |
95 |
||
1390 | 96 |
top open. |
2259 | 97 |
[exEnd] |
2306 | 98 |
|
99 |
||
100 |
open filebrowser and monitore contents |
|
101 |
[exBegin] |
|
102 |
|top sel list directory| |
|
103 |
||
104 |
list := HierarchicalFileList new. |
|
105 |
list showRoot:false. |
|
106 |
list matchBlock:[:fn :isDir| true ]. |
|
107 |
||
108 |
directory := Filename currentDirectory. |
|
109 |
directory := Filename homeDirectory. |
|
110 |
||
111 |
list directory:(directory asAbsoluteFilename). |
|
112 |
||
113 |
top := StandardSystemView new; extent:300@300. |
|
114 |
sel := ScrollableView for:HierarchicalListView miniScroller:true |
|
115 |
origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
116 |
||
117 |
sel doubleClickAction:[:i| (list at:i) toggleExpand ]. |
|
118 |
sel indicatorAction:[:i| (list at:i) toggleExpand ]. |
|
119 |
||
120 |
sel hasConstantHeight:true. |
|
121 |
sel list:list. |
|
122 |
list monitoringTaskDelay:0.5. |
|
123 |
top open. |
|
124 |
[exEnd] |
|
125 |
||
2180 | 126 |
" |
1390 | 127 |
! ! |
128 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
129 |
!HierarchicalFileList class methodsFor:'helpers'! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
130 |
|
2293 | 131 |
forInfoItem:aItem |
132 |
"instance creation helper |
|
133 |
" |
|
134 |
| info fileType retItem| |
|
135 |
||
136 |
info := aItem info. |
|
137 |
fileType := aItem type. |
|
138 |
retItem := self itemFor:aItem fileName fileType:fileType. |
|
139 |
retItem fileInfo:info. |
|
140 |
^ retItem |
|
141 |
! |
|
142 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
143 |
itemFor:aFileOrDirectoryName fileType:fileType |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
144 |
"instance creation helper |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
145 |
" |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
146 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
147 |
fileType == #directory ifTrue:[ |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
148 |
^ Directory fileName:aFileOrDirectoryName. |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
149 |
]. |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
150 |
fileType == #remoteDirectory ifTrue:[ |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
151 |
^ RemoteDirectory fileName:aFileOrDirectoryName. |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
152 |
]. |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
153 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
154 |
^ File fileName:aFileOrDirectoryName. |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
155 |
! ! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
156 |
|
1390 | 157 |
!HierarchicalFileList methodsFor:'accessing'! |
158 |
||
159 |
directory |
|
2806 | 160 |
"returns the root directory or nil" |
161 |
||
1390 | 162 |
^ root notNil ifTrue:[root fileName] ifFalse:[nil] |
163 |
! |
|
164 |
||
165 |
directory:aDirectory |
|
2806 | 166 |
"set the root directory or nil" |
167 |
||
2272 | 168 |
self directory:aDirectory expand:true |
169 |
! |
|
170 |
||
171 |
directory:aDirectory expand:doExpand |
|
2806 | 172 |
"set the root directory or nil; |
173 |
reuse old items if existent" |
|
174 |
||
2388 | 175 |
|oldDir newDir oldRoot newRoot index changeToParent children| |
2294 | 176 |
|
2388 | 177 |
( aDirectory isNil |
178 |
or:[(newDir := aDirectory asFilename) exists not] |
|
179 |
) ifTrue:[ |
|
2294 | 180 |
self root:nil. |
2388 | 181 |
^ self |
1390 | 182 |
]. |
2299 | 183 |
|
2388 | 184 |
newDir isDirectory ifFalse:[ |
185 |
newDir := newDir directory |
|
186 |
]. |
|
187 |
newDir := newDir asCanonicalizedFilename. |
|
188 |
oldDir := self directory. |
|
189 |
||
190 |
oldDir = newDir ifTrue:[^ self]. |
|
191 |
oldRoot := root. |
|
192 |
||
193 |
changeToParent := false. |
|
194 |
||
195 |
oldDir notNil ifTrue:[ |
|
196 |
oldDir directory = newDir ifTrue:[ |
|
197 |
changeToParent := true. |
|
198 |
] ifFalse:[ |
|
199 |
"search for existing item |
|
200 |
" |
|
201 |
self do:[:el| |
|
202 |
el fileName = newDir ifTrue:[ |
|
203 |
el parent:nil. |
|
204 |
self root:el. |
|
205 |
doExpand ifTrue:[ el expand ]. |
|
206 |
^ self |
|
207 |
]. |
|
208 |
]. |
|
209 |
]. |
|
210 |
]. |
|
211 |
newRoot := HierarchicalFileItem fileName:newDir. |
|
212 |
newRoot setExpanded:false. "/ to supress change notifications |
|
213 |
self root:newRoot. |
|
214 |
||
215 |
children := newRoot children ? #(). |
|
216 |
||
217 |
"/ disable <cd ..> handling |
|
218 |
changeToParent := false. |
|
219 |
||
220 |
changeToParent ifTrue:[ |
|
221 |
index := children findFirst:[:el| el fileName = oldDir ]. |
|
222 |
index ~~ 0 ifTrue:[ newRoot at:index put:oldRoot ]. |
|
223 |
]. |
|
2475 | 224 |
doExpand ifTrue:[ newRoot enforcedExpand ]. |
2259 | 225 |
! |
226 |
||
227 |
root:aRoot |
|
228 |
self criticalDo:[ |
|
2306 | 229 |
indicatorList notNil ifTrue:[ |
2259 | 230 |
indicatorList do:[:el| el resetFetchIndicator ]. |
231 |
indicatorList removeAll. |
|
232 |
] |
|
233 |
]. |
|
2306 | 234 |
aRoot notNil ifTrue:[ |
2267 | 235 |
self showRoot ifFalse:[aRoot setExpanded:true ] |
2259 | 236 |
]. |
237 |
^ super root:aRoot |
|
1390 | 238 |
! ! |
239 |
||
240 |
!HierarchicalFileList methodsFor:'actions'! |
|
241 |
||
242 |
matchBlock |
|
2806 | 243 |
"set the matchBlock - if non-nil, it controls which files are visible." |
244 |
||
1390 | 245 |
^ matchBlock |
246 |
! |
|
247 |
||
248 |
matchBlock:aBlock |
|
2806 | 249 |
"set the matchBlock - if non-nil, it controls which files are visible." |
250 |
||
1390 | 251 |
matchBlock := aBlock. |
1866 | 252 |
|
253 |
root notNil ifTrue:[ |
|
1867 | 254 |
self recursionLock critical:[ |
255 |
self stopMonitoringTask. |
|
256 |
root matchBlockChanged. |
|
257 |
]. |
|
258 |
self startMonitoringTask. |
|
1866 | 259 |
]. |
2293 | 260 |
! |
261 |
||
262 |
sortBlock |
|
2296 | 263 |
sortBlock notNil ifTrue:[ ^ sortBlock ]. |
264 |
||
265 |
sortBlock := [:a :b| |aIsDir| |
|
266 |
aIsDir := a isDirectory. |
|
267 |
aIsDir == b isDirectory ifTrue:[a fileName name <= b fileName name] |
|
268 |
ifFalse:[aIsDir]. |
|
2293 | 269 |
]. |
270 |
^ sortBlock |
|
271 |
! |
|
272 |
||
273 |
sortBlock:aBlock |
|
274 |
sortBlock := aBlock. |
|
275 |
||
276 |
root notNil ifTrue:[ |
|
277 |
self recursionLock critical:[ |
|
278 |
self stopMonitoringTask. |
|
2294 | 279 |
root recursiveSort:aBlock. |
2293 | 280 |
]. |
281 |
self startMonitoringTask. |
|
282 |
]. |
|
1390 | 283 |
! ! |
284 |
||
2493 | 285 |
!HierarchicalFileList methodsFor:'private-monitoring task'! |
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
286 |
|
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
287 |
monitoringCycle |
2425
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
288 |
|
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
289 |
self monitoringCycle:false |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
290 |
! |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
291 |
|
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
292 |
monitoringCycle:update |
2806 | 293 |
"the action performed by the monitoring task; |
294 |
tests whether directory is expanded; |
|
295 |
otherwise we do not have to evaluate the directory contents. |
|
296 |
TODO: Think about remote file-systems" |
|
297 |
||
2380 | 298 |
|index item| |
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
299 |
|
2429 | 300 |
item := root. |
301 |
item isNil ifTrue:[^ self]. |
|
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
302 |
|
2429 | 303 |
self showRoot ifTrue:[ index := 2 ] "/ root is part of list (discard first entry) |
304 |
ifFalse:[ index := 1 ]. "/ root not part of list |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
305 |
|
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
306 |
[item notNil] whileTrue:[ |
2380 | 307 |
dependents size == 0 ifTrue:[ ^ self ]. |
308 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
309 |
item isDirectory ifTrue:[ |
2425
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
310 |
update ifTrue:[ |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
311 |
item modificationTime:nil. |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
312 |
]. |
2267 | 313 |
item monitoringCycle |
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
314 |
]. |
2809 | 315 |
"/ Processor yield. |
2429 | 316 |
item := self at:index ifAbsent:nil. |
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
317 |
index := index + 1. |
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
318 |
]. |
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
319 |
! ! |
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
320 |
|
1390 | 321 |
!HierarchicalFileList methodsFor:'protocol'! |
322 |
||
323 |
childrenFor:anItem |
|
324 |
"returns all visible children derived from the physical |
|
2806 | 325 |
directory contents." |
326 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
327 |
|contents list matchBlock| |
1390 | 328 |
|
2130 | 329 |
anItem isDirectory ifFalse:[^ #()]. |
1390 | 330 |
|
2248 | 331 |
contents := DirectoryContents directoryNamed:anItem fileName. |
2306 | 332 |
contents isNil ifTrue:[ ^ #() ]. |
1390 | 333 |
|
2248 | 334 |
list := OrderedCollection new. |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
335 |
matchBlock := self matchBlockFor:anItem. |
2130 | 336 |
|
2297 | 337 |
contents itemsDo:[:anItem| |
338 |
(matchBlock isNil or:[matchBlock value:(anItem fileName) value:(anItem isDirectory)]) ifTrue:[ |
|
339 |
list add:(HierarchicalFileItem forContentsItem:anItem). |
|
1390 | 340 |
] |
341 |
]. |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
342 |
|
2130 | 343 |
list isEmpty ifTrue:[^ #()]. |
2293 | 344 |
list sort:self sortBlock. |
2248 | 345 |
^ list |
1390 | 346 |
! |
347 |
||
348 |
hasChildrenFor:anItem |
|
349 |
"returns true if the physical directory contains at least |
|
2806 | 350 |
one visible item; otherwise false." |
351 |
||
1390 | 352 |
|block| |
353 |
||
354 |
anItem isDirectory ifFalse:[ |
|
355 |
^ false |
|
356 |
]. |
|
357 |
||
358 |
(block := self matchBlockFor:anItem) isNil ifTrue:[ |
|
359 |
block := [:aFilename :isDirectory| true ] |
|
360 |
]. |
|
361 |
^ DirectoryContents directoryNamed:(anItem fileName) detect:block |
|
362 |
! |
|
363 |
||
364 |
matchBlockFor:anItem |
|
365 |
"get the matchBlock - if non-nil, it controls which files are |
|
2806 | 366 |
visible within the physical directory" |
367 |
||
1390 | 368 |
^ matchBlock |
2425
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
369 |
! |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
370 |
|
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
371 |
updateList |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
372 |
|
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
373 |
self monitoringCycle:true |
1390 | 374 |
! ! |
375 |
||
1581 | 376 |
!HierarchicalFileList methodsFor:'searching'! |
377 |
||
2272 | 378 |
findLastForFile:aPathOrFile |
379 |
"find last item which matches the path or file |
|
2806 | 380 |
returns the item or nil if not contained in self" |
381 |
||
2272 | 382 |
|file searchItem rootDir rootComponents searchComponents| |
1581 | 383 |
|
2272 | 384 |
(aPathOrFile isNil or:[root isNil]) ifTrue:[ |
1582 | 385 |
^ nil |
1581 | 386 |
]. |
387 |
||
2272 | 388 |
file := aPathOrFile asFilename. |
389 |
file exists ifFalse:[ ^ nil ]. |
|
1581 | 390 |
|
2272 | 391 |
rootDir := root fileName asAbsoluteFilename. |
2290
29e279812a45
search not for absoluteFilename in searchItem to get the link files
penk
parents:
2272
diff
changeset
|
392 |
"/ file := file asAbsoluteFilename. |
2272 | 393 |
|
1581 | 394 |
|
2290
29e279812a45
search not for absoluteFilename in searchItem to get the link files
penk
parents:
2272
diff
changeset
|
395 |
"/ (file pathName startsWith:(rootDir pathName)) ifFalse:[ |
29e279812a45
search not for absoluteFilename in searchItem to get the link files
penk
parents:
2272
diff
changeset
|
396 |
(file asString startsWith:(rootDir pathName)) ifFalse:[ |
2272 | 397 |
"not included" |
398 |
^ nil |
|
1581 | 399 |
]. |
2272 | 400 |
rootComponents := rootDir components. |
2299 | 401 |
searchComponents := file asCanonicalizedFilename components. |
2272 | 402 |
searchItem := root. |
1581 | 403 |
|
2272 | 404 |
searchComponents from:(rootComponents size + 1) do:[:aName| |child| |
405 |
child := searchItem detect:[:el| el baseName = aName ] ifNone:nil. |
|
406 |
||
407 |
child isNil ifTrue:[ ^ searchItem ]. |
|
408 |
searchItem := child. |
|
1581 | 409 |
]. |
2272 | 410 |
^ searchItem |
1581 | 411 |
! ! |
412 |
||
2259 | 413 |
!HierarchicalFileList methodsFor:'update'! |
414 |
||
415 |
startIndicatorValidationFor:anItem |
|
2806 | 416 |
"an item will be registered for an indication update" |
417 |
||
2259 | 418 |
|prio| |
419 |
||
420 |
self criticalDo:[ |
|
421 |
indicatorList size == 0 ifTrue:[ |
|
422 |
indicatorList := OrderedCollection new. |
|
423 |
] ifFalse:[ |
|
424 |
indicatorList removeIdentical:anItem ifAbsent:nil. |
|
425 |
]. |
|
426 |
"/ indicatorList addFirst:anItem. |
|
427 |
indicatorList add:anItem. |
|
428 |
||
2306 | 429 |
indicatorTask isNil ifTrue:[ |
2259 | 430 |
prio := Processor activePriority. |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
431 |
indicatorTask := |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
432 |
[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
433 |
self updateIndicatorCycle. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
434 |
] newProcess. |
2259 | 435 |
indicatorTask priorityRange:(prio-1 to:prio). |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
436 |
indicatorTask resume. |
2259 | 437 |
] |
438 |
]. |
|
439 |
! |
|
440 |
||
441 |
stopIndicatorValidationFor:anItem |
|
2806 | 442 |
"stop the indicator validation for an item" |
443 |
||
2259 | 444 |
self criticalDo:[ |
2306 | 445 |
indicatorList notNil ifTrue:[ |
2259 | 446 |
indicatorList removeIdentical:anItem ifAbsent:nil. |
447 |
anItem resetFetchIndicator. |
|
448 |
] |
|
449 |
]. |
|
450 |
! |
|
451 |
||
452 |
updateIndicatorCycle |
|
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
453 |
"run fetching indicator (hasChildren info) task cycle. |
2259 | 454 |
This is done in the background to avoid long startup |
455 |
delays, in case the indicator information takes long to |
|
2806 | 456 |
gather (i.e. when reading remote directories)" |
2510
ba2eed40ba9f
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
2493
diff
changeset
|
457 |
|
2259 | 458 |
|repeat task item| |
459 |
||
460 |
repeat := true. |
|
461 |
task := indicatorTask. |
|
462 |
||
2806 | 463 |
[ |
464 |
[ task notNil ] whileTrue:[ |
|
465 |
self criticalDo:[ |
|
466 |
( dependents size ~~ 0 "/ no dependencies (stop task) |
|
467 |
and:[indicatorList size ~~ 0] "/ nothing to do |
|
468 |
) ifTrue:[ |
|
469 |
item := indicatorList removeFirst. |
|
2259 | 470 |
|
2806 | 471 |
(self includesIdentical:item) ifFalse:[ |
472 |
"/ item is no longer visible |
|
473 |
item resetFetchIndicator. |
|
474 |
item := nil |
|
475 |
] |
|
476 |
] ifFalse:[ |
|
477 |
item := indicatorTask := task := nil |
|
2259 | 478 |
] |
2806 | 479 |
]. |
480 |
item notNil ifTrue:[ |
|
481 |
item fetchIndicator. |
|
482 |
Processor yield. |
|
483 |
]. |
|
484 |
] |
|
485 |
] ifCurtailed:[ |
|
2306 | 486 |
task notNil ifTrue:[ |
2259 | 487 |
"/ oops, process terminated |
488 |
self criticalDo:[ |
|
489 |
"/ test whether a new task already started |
|
490 |
indicatorTask == task ifTrue:[ |
|
491 |
indicatorTask := nil |
|
492 |
] |
|
493 |
] |
|
494 |
] |
|
495 |
]. |
|
496 |
! ! |
|
497 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
498 |
!HierarchicalFileList::HierarchicalFileItem class methodsFor:'instance creation'! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
499 |
|
2297 | 500 |
fileName:aFileName |
501 |
^ self forContentsItem:(DirectoryContents contentsItemForFileName:aFileName) |
|
502 |
! |
|
503 |
||
2299 | 504 |
forContentsItem:aContentsItem |
2294 | 505 |
|item cls| |
506 |
||
2299 | 507 |
cls := HierarchicalFileList::File. |
508 |
||
509 |
aContentsItem notNil ifTrue:[ |
|
510 |
aContentsItem isRemoteDirectory ifTrue:[ |
|
511 |
cls := HierarchicalFileList::RemoteDirectory |
|
2294 | 512 |
] ifFalse:[ |
2299 | 513 |
aContentsItem isDirectory ifTrue:[ |
514 |
cls := HierarchicalFileList::Directory |
|
515 |
] |
|
516 |
]. |
|
2294 | 517 |
]. |
518 |
item := cls basicNew initialize. |
|
2299 | 519 |
item contentsItem:aContentsItem. |
2297 | 520 |
^ item |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
521 |
! |
1390 | 522 |
|
2294 | 523 |
new |
524 |
self error. |
|
1390 | 525 |
! ! |
526 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
527 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'accessing'! |
1390 | 528 |
|
529 |
baseName |
|
2297 | 530 |
^ contentsItem fileName baseName. |
531 |
! |
|
532 |
||
533 |
contentsItem:aContentsItem |
|
534 |
contentsItem := aContentsItem |
|
2293 | 535 |
! |
536 |
||
1390 | 537 |
fileName |
2297 | 538 |
^ contentsItem fileName |
1390 | 539 |
! |
540 |
||
2294 | 541 |
fileName:aFilename |
2297 | 542 |
self halt. |
543 |
contentsItem := DirectoryContents contentsItemForFileName:aFilename |
|
544 |
||
545 |
"/ fileName = aFilename ifFalse:[ |
|
546 |
"/ fileName := aFilename. |
|
547 |
"/ self changed:#label |
|
548 |
"/ ]. |
|
1390 | 549 |
! |
550 |
||
2293 | 551 |
fileSize |
2297 | 552 |
|fileInfo| |
553 |
||
554 |
fileInfo := contentsItem info. |
|
2293 | 555 |
fileInfo isNil ifTrue:[^ nil]. |
2832 | 556 |
^ fileInfo fileSize |
2293 | 557 |
! |
2267 | 558 |
|
2293 | 559 |
group |
2832 | 560 |
"returns the printable group" |
561 |
||
2297 | 562 |
|fileInfo gid group| |
2294 | 563 |
|
2297 | 564 |
fileInfo := contentsItem info. |
2294 | 565 |
fileInfo notNil ifTrue:[ |
566 |
gid := fileInfo gid. |
|
2293 | 567 |
|
2294 | 568 |
gid notNil ifTrue:[ |
569 |
(LastGIDToGroupNameMapping notNil and:[gid == LastGIDToGroupNameMapping key]) ifTrue:[ |
|
570 |
^ LastGIDToGroupNameMapping value |
|
571 |
]. |
|
2293 | 572 |
group := OperatingSystem getGroupNameFromID:gid. |
573 |
LastGIDToGroupNameMapping := gid -> group. |
|
2832 | 574 |
^ group |
2293 | 575 |
] |
2267 | 576 |
]. |
2294 | 577 |
^ '???' |
2267 | 578 |
! |
579 |
||
1390 | 580 |
icon |
2832 | 581 |
"returns the icon" |
582 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
583 |
icon isNil ifTrue:[ |
2387 | 584 |
self isRemoteDirectory ifTrue:[ |
585 |
icon := FileBrowser iconForKeyMatching:#directoryNetwork |
|
586 |
] ifFalse:[ |
|
587 |
icon := FileBrowser iconForFile:(self fileName). |
|
588 |
] |
|
1390 | 589 |
]. |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
590 |
^ icon. |
1390 | 591 |
! |
592 |
||
593 |
label |
|
2832 | 594 |
"returns the printable name, the baseName" |
595 |
||
2297 | 596 |
^ contentsItem fileName baseName |
1390 | 597 |
! |
598 |
||
2293 | 599 |
modificationTime |
2832 | 600 |
"returns the absolute time of modification" |
2297 | 601 |
|
602 |
|fileInfo| |
|
603 |
||
604 |
fileInfo := contentsItem info. |
|
2293 | 605 |
fileInfo isNil ifTrue:[^ nil]. |
2297 | 606 |
^ fileInfo modificationTime |
2293 | 607 |
! |
608 |
||
609 |
owner |
|
2832 | 610 |
"returns the printable owner" |
611 |
||
2297 | 612 |
|fileInfo uid owner| |
2294 | 613 |
|
2297 | 614 |
fileInfo := contentsItem info. |
2294 | 615 |
fileInfo notNil ifTrue:[ |
616 |
uid := fileInfo uid. |
|
2293 | 617 |
|
2294 | 618 |
uid notNil ifTrue:[ |
619 |
(LastUIDToUserNameMapping notNil and:[uid == LastUIDToUserNameMapping key]) ifTrue:[ |
|
620 |
^ LastUIDToUserNameMapping value |
|
621 |
]. |
|
2293 | 622 |
owner := OperatingSystem getUserNameFromID:uid. |
623 |
LastUIDToUserNameMapping := uid -> owner. |
|
2832 | 624 |
^ owner |
2293 | 625 |
] |
626 |
]. |
|
2294 | 627 |
|
628 |
^ '???' |
|
2293 | 629 |
! |
630 |
||
1390 | 631 |
pathName |
2832 | 632 |
"returns the pathName" |
633 |
||
2297 | 634 |
^ contentsItem fileName pathName |
2267 | 635 |
! |
636 |
||
2293 | 637 |
permissions |
2832 | 638 |
"returns the permissions as printable string" |
639 |
||
2297 | 640 |
|fileInfo mode perms| |
2267 | 641 |
|
2297 | 642 |
fileInfo := contentsItem info. |
2294 | 643 |
fileInfo notNil ifTrue:[ |
644 |
mode := fileInfo mode. |
|
645 |
||
646 |
mode notNil ifTrue:[ |
|
647 |
perms := String new:9 withAll:$-. |
|
2293 | 648 |
|
2294 | 649 |
1 to:9 by:3 do:[:i| |
650 |
(mode bitAt:i ) == 1 ifTrue:[perms at:10 - i put:$x]. |
|
651 |
(mode bitAt:i + 1) == 1 ifTrue:[perms at:9 - i put:$w]. |
|
652 |
(mode bitAt:i + 2) == 1 ifTrue:[perms at:8 - i put:$r]. |
|
653 |
]. |
|
654 |
^ perms |
|
655 |
] |
|
2293 | 656 |
]. |
2294 | 657 |
^ '???' |
2293 | 658 |
! |
659 |
||
660 |
suffix |
|
2832 | 661 |
"returns the suffix of the file" |
662 |
||
2294 | 663 |
(OperatingSystem isUNIXlike and:[(self baseName at:1) == $.]) ifTrue:[ |
664 |
^ '' |
|
2267 | 665 |
]. |
2297 | 666 |
^ contentsItem fileName suffix |
2294 | 667 |
! ! |
668 |
||
669 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'change & update'! |
|
670 |
||
671 |
changed:aParameter |
|
2832 | 672 |
"the item changed; send a change notification" |
673 |
||
2294 | 674 |
aParameter == #icon ifTrue:[ icon := nil ]. |
675 |
super changed:aParameter. |
|
676 |
! ! |
|
677 |
||
678 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'instance creation'! |
|
679 |
||
680 |
fileName:aFilename fileInfo:aFileInfoOrNil |
|
2297 | 681 |
self halt. |
682 |
"/ fileName := aFilename. |
|
683 |
"/ fileInfo := aFileInfoOrNil. |
|
1390 | 684 |
! ! |
685 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
686 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'invalidate'! |
1390 | 687 |
|
688 |
invalidate |
|
689 |
self invalidateRepairNow:false |
|
690 |
! |
|
691 |
||
692 |
invalidateRepairNow |
|
693 |
self invalidateRepairNow:true |
|
694 |
! |
|
695 |
||
696 |
invalidateRepairNow:doRepair |
|
697 |
"invalidate the contents; dependent on the boolean |
|
698 |
do repair immediately |
|
699 |
" |
|
700 |
||
701 |
||
1866 | 702 |
! |
703 |
||
704 |
matchBlockChanged |
|
2832 | 705 |
"called if the matchBlock changed" |
1390 | 706 |
! ! |
707 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
708 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'printing'! |
2127 | 709 |
|
2479 | 710 |
printOn:aStream |
711 |
super printOn:aStream. |
|
712 |
' for: ' printOn:aStream. |
|
713 |
self fileName printOn:aStream |
|
714 |
! |
|
715 |
||
2127 | 716 |
printString |
717 |
||
718 |
^ super printString, ' for: ', self fileName asString |
|
719 |
! ! |
|
720 |
||
2270 | 721 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'protocol'! |
722 |
||
723 |
flushChildren |
|
2832 | 724 |
"flush the children (because node is not visible) |
725 |
Can be redefined by subclass" |
|
726 |
||
2270 | 727 |
children := nil. |
728 |
! ! |
|
729 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
730 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'queries'! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
731 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
732 |
isDirectory |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
733 |
^ false |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
734 |
! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
735 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
736 |
isRemoteDirectory |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
737 |
^ false |
2267 | 738 |
! |
739 |
||
2832 | 740 |
isWritable |
741 |
^ self fileName isWritable |
|
742 |
! |
|
743 |
||
2267 | 744 |
time |
745 |
^ self valueAt:#modified |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
746 |
! ! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
747 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
748 |
!HierarchicalFileList::File methodsFor:'accessing'! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
749 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
750 |
children |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
751 |
"always returns an empty list |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
752 |
" |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
753 |
^ #() |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
754 |
! ! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
755 |
|
1390 | 756 |
!HierarchicalFileList::File methodsFor:'queries'! |
757 |
||
758 |
hasChildren |
|
759 |
"always returns false |
|
760 |
" |
|
761 |
^ false |
|
762 |
! ! |
|
763 |
||
2259 | 764 |
!HierarchicalFileList::Directory class methodsFor:'documentation'! |
765 |
||
766 |
documentation |
|
767 |
" |
|
768 |
[Instance variables:] |
|
769 |
||
2267 | 770 |
fetchOperation <Symbol/Boolean> nil if children is nil, no information about has children |
771 |
#fetching registered in list to be updated for indication |
|
772 |
#hasChildren registered in list to be updated for indication |
|
773 |
#hasNoChildren has children but children list might be nil (remote) |
|
2259 | 774 |
" |
775 |
! ! |
|
776 |
||
2475 | 777 |
!HierarchicalFileList::Directory class methodsFor:'initialization'! |
778 |
||
779 |
initialize |
|
780 |
StateUnknown := nil. |
|
781 |
StateHasChildren := #hasChildren. |
|
782 |
StateHasNoChildren := #hasNoChildren. |
|
783 |
StateFetching := #fetching |
|
784 |
||
785 |
" |
|
786 |
self initialize |
|
787 |
" |
|
788 |
! ! |
|
789 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
790 |
!HierarchicalFileList::Directory methodsFor:'accessing'! |
1390 | 791 |
|
792 |
children |
|
2832 | 793 |
"returns the collection of children or nil" |
794 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
795 |
|model| |
1390 | 796 |
|
2306 | 797 |
children notNil ifTrue:[ ^ children ]. |
1390 | 798 |
|
2259 | 799 |
model := self model. |
2306 | 800 |
model isNil ifTrue:[ ^ nil ]. |
1390 | 801 |
|
2259 | 802 |
model criticalDo:[ |
2306 | 803 |
children isNil ifTrue:[ self readChildren ]. |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
804 |
]. |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
805 |
^ children |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
806 |
! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
807 |
|
2475 | 808 |
icon |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
809 |
"returns the icon" |
2475 | 810 |
|
811 |
|nameKey| |
|
2270 | 812 |
|
2387 | 813 |
isExpanded ifTrue:[ |
2475 | 814 |
(makeIconGray == true) ifTrue:[ |
815 |
nameKey := #directoryOpenGray |
|
816 |
] ifFalse:[ |
|
817 |
nameKey := #directoryOpen |
|
818 |
] |
|
819 |
] ifFalse:[ |
|
2428 | 820 |
makeIconGray == true ifTrue:[ |
2475 | 821 |
nameKey := #directoryGray |
822 |
] |
|
2387 | 823 |
]. |
2475 | 824 |
|
825 |
nameKey notNil ifTrue:[ |
|
826 |
^ FileBrowser iconForKeyMatching:nameKey |
|
2428 | 827 |
]. |
2475 | 828 |
|
2387 | 829 |
icon isNil ifTrue:[ |
830 |
^ super icon |
|
831 |
]. |
|
832 |
^ icon |
|
833 |
! |
|
834 |
||
2457 | 835 |
label |
836 |
"returns the printable name, the baseName |
|
837 |
" |
|
2654 | 838 |
parent isHierarchicalItem ifFalse:[ |
839 |
"no parent exists, thus we have to test for rootDirectory |
|
840 |
" |
|
841 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
842 |
contentsItem fileName isRootDirectory ifTrue:[ |
|
843 |
^ contentsItem fileName pathName |
|
844 |
] |
|
845 |
]. |
|
2457 | 846 |
]. |
847 |
^ contentsItem fileName baseName |
|
848 |
! |
|
849 |
||
2428 | 850 |
makeIconGray:something |
2475 | 851 |
"set/clear the flag which enforces the icon to be shown in grey" |
2428 | 852 |
|
853 |
makeIconGray := something. |
|
854 |
! |
|
855 |
||
2425
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
856 |
modificationTime:something |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
857 |
modificationTime := something. |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
858 |
! |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
859 |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
860 |
readChildren |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
861 |
"reads the list of children |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
862 |
" |
2259 | 863 |
|model list hadChildren hasChildren| |
864 |
||
2475 | 865 |
self forgetAboutChildren. |
866 |
||
2259 | 867 |
model := self model. |
2306 | 868 |
model isNil ifTrue:[ |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
869 |
"/ must reread later |
2475 | 870 |
modificationTime := children := nil. |
871 |
^ nil |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
872 |
]. |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
873 |
|
2259 | 874 |
hadChildren := children size ~~ 0. |
875 |
||
876 |
"/ set to suppress reading of children |
|
1867 | 877 |
children := #(). |
2297 | 878 |
modificationTime := self fileName modificationTime. |
2259 | 879 |
model stopIndicatorValidationFor:self. |
880 |
||
1867 | 881 |
list := model childrenFor:self. |
882 |
||
883 |
list size ~~ 0 ifTrue:[ |
|
884 |
list do:[:aChild| aChild parent:self]. |
|
885 |
children := list. |
|
1390 | 886 |
]. |
2259 | 887 |
hasChildren := children size ~~ 0. |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
888 |
|
2259 | 889 |
hasChildren ~~ hadChildren ifTrue:[ |
890 |
self changed:#redraw |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
891 |
]. |
1390 | 892 |
^ children |
893 |
! ! |
|
894 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
895 |
!HierarchicalFileList::Directory methodsFor:'accessing-hierarchy'! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
896 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
897 |
collapse |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
898 |
super collapse. |
2270 | 899 |
|
900 |
children notNil ifTrue:[ |
|
901 |
children do:[:el| el flushChildren ] |
|
902 |
]. |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
903 |
! |
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
904 |
|
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
905 |
expand |
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
906 |
"expand children; must redefine to raise a notification |
2832 | 907 |
if children are not yet initialized and after initialization empty." |
2270 | 908 |
|
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
909 |
super expand. |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
910 |
! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
911 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
912 |
recursiveCollapse |
2270 | 913 |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
914 |
super recursiveCollapse. |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
915 |
! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
916 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
917 |
recursiveExpand |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
918 |
"redefined to expand |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
919 |
" |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
920 |
self expand |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
921 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
922 |
|
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
923 |
! ! |
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
924 |
|
2259 | 925 |
!HierarchicalFileList::Directory methodsFor:'fetching'! |
926 |
||
927 |
basicFetchIndicator |
|
2734
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
928 |
|linkName fileName hasChildren info| |
2267 | 929 |
|
2583 | 930 |
fileName := self fileName. |
2734
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
931 |
info := fileName linkInfo. |
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
932 |
(info notNil and:[info isSymbolicLink]) ifTrue:[ |
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
933 |
linkName := info path. |
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
934 |
] ifFalse:[ |
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
935 |
linkName := fileName name. |
2583 | 936 |
]. |
2734
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
937 |
|
2766
04990ee7e604
dont automaticly fetch indicator for nfs mounted filesystems only
Michael Beyl <mb@exept.de>
parents:
2734
diff
changeset
|
938 |
(OperatingSystem mountPoints contains:[:mp | mp mountPointPath = linkName and:[mp isRemote]]) ifTrue:[ |
2583 | 939 |
"do not follow mounted directories automatically (could be an NFS hardlink)" |
940 |
^ self. |
|
941 |
]. |
|
942 |
||
943 |
hasChildren := DirectoryContents directoryNamed:fileName detect:(self model matchBlock). |
|
2475 | 944 |
self knownToHaveChildren:hasChildren. |
2809 | 945 |
"/ self assert:children isNil. |
2475 | 946 |
|
2734
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
947 |
(children isNil and:[info notNil]) ifTrue:[ |
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
948 |
"setup modification time to suppress monitorCycle" |
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
949 |
modificationTime := info modificationTime. |
2267 | 950 |
]. |
2259 | 951 |
! |
952 |
||
953 |
fetchIndicator |
|
2475 | 954 |
"fetch the indicator value which indicates whether children exist or not. |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
955 |
Called by the indocator update process." |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
956 |
|
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
957 |
|stateBefore stateNow| |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
958 |
|
2306 | 959 |
children notNil ifTrue:[ |
2259 | 960 |
"/ children already read |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
961 |
self knownToHaveChildren:(children size > 0). |
2475 | 962 |
^ self |
2259 | 963 |
]. |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
964 |
quickChildrenInfo == StateFetching ifFalse:[ |
2475 | 965 |
"/ children will be updated in a second.... |
2259 | 966 |
^ self |
967 |
]. |
|
968 |
||
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
969 |
stateBefore := quickChildrenInfo. |
2259 | 970 |
self basicFetchIndicator. |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
971 |
stateNow := quickChildrenInfo. |
2259 | 972 |
|
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
973 |
stateBefore ~~ stateNow ifTrue:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
974 |
self changed:#redraw |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
975 |
]. |
2475 | 976 |
|
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
977 |
"/ children notNil ifTrue:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
978 |
"/ self forgetAboutChildren. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
979 |
"/ children notEmpty ifTrue:[ self changed:#redraw ]. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
980 |
"/ ] ifFalse:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
981 |
"/ "/ is a remote or very slow file system |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
982 |
"/ self isKnownToHaveChildren ifTrue:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
983 |
"/ self changed:#redraw |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
984 |
"/ ]. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
985 |
"/ ]. |
2259 | 986 |
! |
987 |
||
988 |
resetFetchIndicator |
|
989 |
"update indication cycle has deregistered the item |
|
990 |
" |
|
2475 | 991 |
|
992 |
self forgetAboutChildren. |
|
993 |
! ! |
|
994 |
||
995 |
!HierarchicalFileList::Directory methodsFor:'private'! |
|
996 |
||
997 |
flushChildren |
|
2832 | 998 |
"flush the children because the node is going to be invisible." |
999 |
||
2859 | 1000 |
children notNil ifTrue:[ |
1001 |
self knownToHaveChildren:(children size ~~ 0). |
|
1002 |
children := nil. |
|
1003 |
] ifFalse:[ |
|
1004 |
"/ state is unknown |
|
1005 |
self forgetAboutChildren. |
|
1006 |
]. |
|
2475 | 1007 |
! ! |
1008 |
||
2493 | 1009 |
!HierarchicalFileList::Directory methodsFor:'private-quick children info'! |
2475 | 1010 |
|
1011 |
forgetAboutChildren |
|
1012 |
quickChildrenInfo := StateUnknown |
|
1013 |
! |
|
1014 |
||
1015 |
isChildrenInfoValid |
|
1016 |
^ quickChildrenInfo ~~ StateUnknown and:[quickChildrenInfo ~~ StateFetching] |
|
1017 |
! |
|
1018 |
||
1019 |
isFetchingChildrenInfo |
|
1020 |
^ quickChildrenInfo == StateFetching |
|
1021 |
! |
|
1022 |
||
1023 |
isKnownToHaveChildren |
|
1024 |
^ quickChildrenInfo == StateHasChildren |
|
1025 |
! |
|
1026 |
||
1027 |
isKnownToHaveNoChildren |
|
1028 |
^ quickChildrenInfo == StateHasNoChildren |
|
1029 |
! |
|
1030 |
||
1031 |
knownToHaveChildren:aBoolean |
|
1032 |
aBoolean ifTrue:[ |
|
1033 |
quickChildrenInfo := StateHasChildren. |
|
1034 |
] ifFalse:[ |
|
1035 |
quickChildrenInfo := StateHasNoChildren. |
|
1036 |
]. |
|
1037 |
! |
|
1038 |
||
1039 |
setFetchingChildrenInfo |
|
1040 |
quickChildrenInfo := StateFetching |
|
2259 | 1041 |
! ! |
1042 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1043 |
!HierarchicalFileList::Directory methodsFor:'queries'! |
1390 | 1044 |
|
2475 | 1045 |
canExpand |
1046 |
super canExpand ifTrue:[^ true]. |
|
2832 | 1047 |
|
1048 |
"/ in case we are currently fetching the subdirectory |
|
1049 |
"/ self isFetchingChildrenInfo ifTrue:[ |
|
2525 | 1050 |
"/self halt. |
2832 | 1051 |
"/ ]. |
2475 | 1052 |
|
1053 |
^ false |
|
1054 |
! |
|
1055 |
||
1390 | 1056 |
hasChildren |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1057 |
"returns true if children exist" |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1058 |
|
2259 | 1059 |
|model| |
1060 |
||
1061 |
children notNil ifTrue:[ |
|
2475 | 1062 |
self forgetAboutChildren. |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1063 |
children size ~~ 0 ifTrue:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1064 |
^ true |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1065 |
]. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1066 |
isExpanded := false. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1067 |
children := #(). |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1068 |
^ false |
2259 | 1069 |
]. |
1070 |
||
2475 | 1071 |
self isFetchingChildrenInfo ifTrue:[ |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1072 |
^ true. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1073 |
"/ ^ false. |
2475 | 1074 |
]. |
1075 |
self isChildrenInfoValid ifTrue:[ |
|
1076 |
^ self isKnownToHaveChildren |
|
2259 | 1077 |
]. |
1078 |
||
1079 |
model := self model. |
|
1080 |
||
1081 |
model notNil ifTrue:[ |
|
2475 | 1082 |
self setFetchingChildrenInfo. |
2259 | 1083 |
model startIndicatorValidationFor:self. |
1084 |
] ifFalse:[ |
|
2267 | 1085 |
self error:'should not happen' mayProceed:true. |
2475 | 1086 |
self forgetAboutChildren |
2259 | 1087 |
]. |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1088 |
children size ~~ 0 ifTrue:[ ^ true]. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1089 |
|
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1090 |
self isFetchingChildrenInfo ifTrue:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1091 |
^ true. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1092 |
"/ ^ false. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1093 |
]. |
2475 | 1094 |
^ false |
1390 | 1095 |
! |
1096 |
||
1097 |
isDirectory |
|
2832 | 1098 |
"always true here" |
1099 |
||
1390 | 1100 |
^ true |
1101 |
! ! |
|
1102 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1103 |
!HierarchicalFileList::Directory methodsFor:'validation'! |
1390 | 1104 |
|
2267 | 1105 |
invalidateRepairNow:doRepair |
2832 | 1106 |
"invalidate contents" |
1107 |
||
2475 | 1108 |
modificationTime := nil. |
1109 |
self forgetAboutChildren |
|
2267 | 1110 |
|
1111 |
isExpanded ifFalse:[ |
|
1112 |
children := nil |
|
1113 |
] ifTrue:[ |
|
1114 |
doRepair ifTrue:[ |
|
1115 |
self monitoringCycle |
|
1116 |
] ifFalse:[ |
|
1117 |
children size == 0 ifTrue:[ |
|
1118 |
"/ expanded but no children added, thus can reset the children |
|
1119 |
children := nil |
|
1120 |
] |
|
1121 |
] |
|
1122 |
]. |
|
1123 |
! |
|
1124 |
||
1125 |
matchBlockChanged |
|
1126 |
"called if the matchBlock changed |
|
1127 |
" |
|
1128 |
modificationTime := nil. |
|
1129 |
||
1130 |
isExpanded ifFalse:[ |
|
2475 | 1131 |
children := nil. |
1132 |
self forgetAboutChildren |
|
2267 | 1133 |
] ifTrue:[ |
1134 |
self monitoringCycle. |
|
1135 |
||
1136 |
children size ~~ 0 ifTrue:[ |
|
1137 |
children do:[:aChild| aChild matchBlockChanged ] |
|
1138 |
] |
|
1139 |
]. |
|
1140 |
! |
|
1141 |
||
1142 |
monitoringCycle |
|
1143 |
"run monitoring cycle |
|
2734
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
1144 |
!!!!!!!! called by the HierarchicalList only !!!!!!!!" |
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
1145 |
|
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
1146 |
|fileName unusedDict addedItems mergedList size modifyTime model timeChanged info| |
2267 | 1147 |
|
2583 | 1148 |
fileName := self fileName. |
2734
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
1149 |
info := fileName linkInfo. |
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
1150 |
info isNil ifTrue:[^ self]. |
2267 | 1151 |
|
2734
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
1152 |
modifyTime := info modificationTime. |
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
1153 |
timeChanged := modifyTime ~= modificationTime. |
2267 | 1154 |
modificationTime := modifyTime. |
1155 |
||
2306 | 1156 |
children notNil ifTrue:[ |
2267 | 1157 |
timeChanged ifFalse:[ |
1158 |
^ self |
|
1159 |
]. |
|
1160 |
]. |
|
2475 | 1161 |
|
2583 | 1162 |
DirectoryContents flushCachedDirectoryFor:fileName. |
2267 | 1163 |
isExpanded ifFalse:[ |
1164 |
timeChanged ifTrue:[ |
|
2475 | 1165 |
children := nil. |
1166 |
self forgetAboutChildren. |
|
2425
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1167 |
self changed:#redraw. |
2267 | 1168 |
]. |
1169 |
^ self |
|
1170 |
]. |
|
2475 | 1171 |
|
2306 | 1172 |
children isNil ifTrue:[ children := #() ]. "/ disable update during merge |
2267 | 1173 |
|
2475 | 1174 |
self forgetAboutChildren. |
1175 |
model := self model. |
|
1176 |
mergedList := model childrenFor:self. |
|
2267 | 1177 |
|
1178 |
mergedList size == 0 ifTrue:[ |
|
1179 |
self removeAll. |
|
2425
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1180 |
^ self |
2267 | 1181 |
]. |
1182 |
||
1183 |
size := children size. |
|
1184 |
size == 0 ifTrue:[ |
|
1185 |
self addAll:mergedList. |
|
2425
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1186 |
^ self |
2267 | 1187 |
]. |
1188 |
||
1189 |
model criticalDo:[ |
|
1190 |
addedItems := OrderedCollection new:128. |
|
1191 |
unusedDict := Dictionary new:size. |
|
1192 |
||
1193 |
children do:[:el| unusedDict at:(el fileName) put:el ]. |
|
1194 |
||
1195 |
mergedList keysAndValuesDo:[:anIndex :anItem| |item| |
|
1196 |
item := unusedDict removeKey:(anItem fileName) ifAbsent:nil. |
|
1197 |
||
1198 |
item notNil ifTrue:[ |
|
1199 |
mergedList at:anIndex put:item |
|
1200 |
] ifFalse:[ |
|
1201 |
addedItems add:anItem. |
|
1202 |
anItem parent:self. |
|
1203 |
]. |
|
1204 |
]. |
|
1205 |
"/ 12 is hardcoded !!!!!!!! |
|
1206 |
||
1207 |
(unusedDict size + addedItems size) > 12 ifTrue:[ |
|
1208 |
"/ generate two nofifications: collapse and expand |
|
1209 |
self collapse. |
|
1210 |
children := mergedList. |
|
1211 |
self expand. |
|
1212 |
] ifFalse:[ |
|
1213 |
unusedDict do:[:el| self remove:el ]. |
|
1214 |
||
1215 |
addedItems notEmpty ifTrue:[ |
|
1216 |
self addAll:addedItems |
|
1217 |
]. |
|
1218 |
"/ children order changed test |
|
1219 |
children := mergedList. |
|
1220 |
self childrenOrderChanged. |
|
1221 |
]. |
|
1222 |
]. |
|
2425
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1223 |
! |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1224 |
|
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1225 |
updateList |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1226 |
|
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1227 |
modificationTime := nil. |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1228 |
self monitoringCycle. |
1390 | 1229 |
! ! |
1230 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1231 |
!HierarchicalFileList::RemoteDirectory methodsFor:'queries'! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1232 |
|
2267 | 1233 |
hasChildren |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1234 |
"returns true if children exist" |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1235 |
|
2267 | 1236 |
children notNil ifTrue:[ |
2475 | 1237 |
self forgetAboutChildren. |
2267 | 1238 |
^ children size ~~ 0 |
1239 |
]. |
|
2475 | 1240 |
|
1241 |
"/ assume that there are children; |
|
1242 |
"/ this might be wrong and clicking on the expand-icon |
|
1243 |
"/ will then not perform an expand, but remove the can-expand indicator. |
|
1244 |
self knownToHaveChildren:true. |
|
1245 |
^ true |
|
2267 | 1246 |
! |
1247 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1248 |
isRemoteDirectory |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1249 |
^ true |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1250 |
! ! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1251 |
|
1390 | 1252 |
!HierarchicalFileList class methodsFor:'documentation'! |
1253 |
||
1254 |
version |
|
2937 | 1255 |
^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.60 2006-03-13 15:55:08 cg Exp $' |
1390 | 1256 |
! ! |
2475 | 1257 |
|
1258 |
HierarchicalFileList::Directory initialize! |