author | ca |
Mon, 24 Oct 2005 11:25:21 +0200 | |
changeset 2859 | f85df09584d5 |
parent 2832 | e1f6a7c48552 |
child 2902 | 7365e48e82f2 |
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. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
435 |
indicatorTask priority:(prio - 1). |
2259 | 436 |
indicatorTask priorityRange:(prio-1 to:prio). |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
437 |
indicatorTask resume. |
2259 | 438 |
] |
439 |
]. |
|
440 |
! |
|
441 |
||
442 |
stopIndicatorValidationFor:anItem |
|
2806 | 443 |
"stop the indicator validation for an item" |
444 |
||
2259 | 445 |
self criticalDo:[ |
2306 | 446 |
indicatorList notNil ifTrue:[ |
2259 | 447 |
indicatorList removeIdentical:anItem ifAbsent:nil. |
448 |
anItem resetFetchIndicator. |
|
449 |
] |
|
450 |
]. |
|
451 |
! |
|
452 |
||
453 |
updateIndicatorCycle |
|
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
454 |
"run fetching indicator (hasChildren info) task cycle. |
2259 | 455 |
This is done in the background to avoid long startup |
456 |
delays, in case the indicator information takes long to |
|
2806 | 457 |
gather (i.e. when reading remote directories)" |
2510
ba2eed40ba9f
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
2493
diff
changeset
|
458 |
|
2259 | 459 |
|repeat task item| |
460 |
||
461 |
repeat := true. |
|
462 |
task := indicatorTask. |
|
463 |
||
2806 | 464 |
[ |
465 |
[ task notNil ] whileTrue:[ |
|
466 |
self criticalDo:[ |
|
467 |
( dependents size ~~ 0 "/ no dependencies (stop task) |
|
468 |
and:[indicatorList size ~~ 0] "/ nothing to do |
|
469 |
) ifTrue:[ |
|
470 |
item := indicatorList removeFirst. |
|
2259 | 471 |
|
2806 | 472 |
(self includesIdentical:item) ifFalse:[ |
473 |
"/ item is no longer visible |
|
474 |
item resetFetchIndicator. |
|
475 |
item := nil |
|
476 |
] |
|
477 |
] ifFalse:[ |
|
478 |
item := indicatorTask := task := nil |
|
2259 | 479 |
] |
2806 | 480 |
]. |
481 |
item notNil ifTrue:[ |
|
482 |
item fetchIndicator. |
|
483 |
Processor yield. |
|
484 |
]. |
|
485 |
] |
|
486 |
] ifCurtailed:[ |
|
2306 | 487 |
task notNil ifTrue:[ |
2259 | 488 |
"/ oops, process terminated |
489 |
self criticalDo:[ |
|
490 |
"/ test whether a new task already started |
|
491 |
indicatorTask == task ifTrue:[ |
|
492 |
indicatorTask := nil |
|
493 |
] |
|
494 |
] |
|
495 |
] |
|
496 |
]. |
|
497 |
! ! |
|
498 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
499 |
!HierarchicalFileList::HierarchicalFileItem class methodsFor:'instance creation'! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
500 |
|
2297 | 501 |
fileName:aFileName |
502 |
^ self forContentsItem:(DirectoryContents contentsItemForFileName:aFileName) |
|
503 |
! |
|
504 |
||
2299 | 505 |
forContentsItem:aContentsItem |
2294 | 506 |
|item cls| |
507 |
||
2299 | 508 |
cls := HierarchicalFileList::File. |
509 |
||
510 |
aContentsItem notNil ifTrue:[ |
|
511 |
aContentsItem isRemoteDirectory ifTrue:[ |
|
512 |
cls := HierarchicalFileList::RemoteDirectory |
|
2294 | 513 |
] ifFalse:[ |
2299 | 514 |
aContentsItem isDirectory ifTrue:[ |
515 |
cls := HierarchicalFileList::Directory |
|
516 |
] |
|
517 |
]. |
|
2294 | 518 |
]. |
519 |
item := cls basicNew initialize. |
|
2299 | 520 |
item contentsItem:aContentsItem. |
2297 | 521 |
^ item |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
522 |
! |
1390 | 523 |
|
2294 | 524 |
new |
525 |
self error. |
|
1390 | 526 |
! ! |
527 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
528 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'accessing'! |
1390 | 529 |
|
530 |
baseName |
|
2297 | 531 |
^ contentsItem fileName baseName. |
532 |
! |
|
533 |
||
534 |
contentsItem:aContentsItem |
|
535 |
contentsItem := aContentsItem |
|
2293 | 536 |
! |
537 |
||
1390 | 538 |
fileName |
2297 | 539 |
^ contentsItem fileName |
1390 | 540 |
! |
541 |
||
2294 | 542 |
fileName:aFilename |
2297 | 543 |
self halt. |
544 |
contentsItem := DirectoryContents contentsItemForFileName:aFilename |
|
545 |
||
546 |
"/ fileName = aFilename ifFalse:[ |
|
547 |
"/ fileName := aFilename. |
|
548 |
"/ self changed:#label |
|
549 |
"/ ]. |
|
1390 | 550 |
! |
551 |
||
2293 | 552 |
fileSize |
2297 | 553 |
|fileInfo| |
554 |
||
555 |
fileInfo := contentsItem info. |
|
2293 | 556 |
fileInfo isNil ifTrue:[^ nil]. |
2832 | 557 |
^ fileInfo fileSize |
2293 | 558 |
! |
2267 | 559 |
|
2293 | 560 |
group |
2832 | 561 |
"returns the printable group" |
562 |
||
2297 | 563 |
|fileInfo gid group| |
2294 | 564 |
|
2297 | 565 |
fileInfo := contentsItem info. |
2294 | 566 |
fileInfo notNil ifTrue:[ |
567 |
gid := fileInfo gid. |
|
2293 | 568 |
|
2294 | 569 |
gid notNil ifTrue:[ |
570 |
(LastGIDToGroupNameMapping notNil and:[gid == LastGIDToGroupNameMapping key]) ifTrue:[ |
|
571 |
^ LastGIDToGroupNameMapping value |
|
572 |
]. |
|
2293 | 573 |
group := OperatingSystem getGroupNameFromID:gid. |
574 |
LastGIDToGroupNameMapping := gid -> group. |
|
2832 | 575 |
^ group |
2293 | 576 |
] |
2267 | 577 |
]. |
2294 | 578 |
^ '???' |
2267 | 579 |
! |
580 |
||
1390 | 581 |
icon |
2832 | 582 |
"returns the icon" |
583 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
584 |
icon isNil ifTrue:[ |
2387 | 585 |
self isRemoteDirectory ifTrue:[ |
586 |
icon := FileBrowser iconForKeyMatching:#directoryNetwork |
|
587 |
] ifFalse:[ |
|
588 |
icon := FileBrowser iconForFile:(self fileName). |
|
589 |
] |
|
1390 | 590 |
]. |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
591 |
^ icon. |
1390 | 592 |
! |
593 |
||
594 |
label |
|
2832 | 595 |
"returns the printable name, the baseName" |
596 |
||
2297 | 597 |
^ contentsItem fileName baseName |
1390 | 598 |
! |
599 |
||
2293 | 600 |
modificationTime |
2832 | 601 |
"returns the absolute time of modification" |
2297 | 602 |
|
603 |
|fileInfo| |
|
604 |
||
605 |
fileInfo := contentsItem info. |
|
2293 | 606 |
fileInfo isNil ifTrue:[^ nil]. |
2297 | 607 |
^ fileInfo modificationTime |
2293 | 608 |
! |
609 |
||
610 |
owner |
|
2832 | 611 |
"returns the printable owner" |
612 |
||
2297 | 613 |
|fileInfo uid owner| |
2294 | 614 |
|
2297 | 615 |
fileInfo := contentsItem info. |
2294 | 616 |
fileInfo notNil ifTrue:[ |
617 |
uid := fileInfo uid. |
|
2293 | 618 |
|
2294 | 619 |
uid notNil ifTrue:[ |
620 |
(LastUIDToUserNameMapping notNil and:[uid == LastUIDToUserNameMapping key]) ifTrue:[ |
|
621 |
^ LastUIDToUserNameMapping value |
|
622 |
]. |
|
2293 | 623 |
owner := OperatingSystem getUserNameFromID:uid. |
624 |
LastUIDToUserNameMapping := uid -> owner. |
|
2832 | 625 |
^ owner |
2293 | 626 |
] |
627 |
]. |
|
2294 | 628 |
|
629 |
^ '???' |
|
2293 | 630 |
! |
631 |
||
1390 | 632 |
pathName |
2832 | 633 |
"returns the pathName" |
634 |
||
2297 | 635 |
^ contentsItem fileName pathName |
2267 | 636 |
! |
637 |
||
2293 | 638 |
permissions |
2832 | 639 |
"returns the permissions as printable string" |
640 |
||
2297 | 641 |
|fileInfo mode perms| |
2267 | 642 |
|
2297 | 643 |
fileInfo := contentsItem info. |
2294 | 644 |
fileInfo notNil ifTrue:[ |
645 |
mode := fileInfo mode. |
|
646 |
||
647 |
mode notNil ifTrue:[ |
|
648 |
perms := String new:9 withAll:$-. |
|
2293 | 649 |
|
2294 | 650 |
1 to:9 by:3 do:[:i| |
651 |
(mode bitAt:i ) == 1 ifTrue:[perms at:10 - i put:$x]. |
|
652 |
(mode bitAt:i + 1) == 1 ifTrue:[perms at:9 - i put:$w]. |
|
653 |
(mode bitAt:i + 2) == 1 ifTrue:[perms at:8 - i put:$r]. |
|
654 |
]. |
|
655 |
^ perms |
|
656 |
] |
|
2293 | 657 |
]. |
2294 | 658 |
^ '???' |
2293 | 659 |
! |
660 |
||
661 |
suffix |
|
2832 | 662 |
"returns the suffix of the file" |
663 |
||
2294 | 664 |
(OperatingSystem isUNIXlike and:[(self baseName at:1) == $.]) ifTrue:[ |
665 |
^ '' |
|
2267 | 666 |
]. |
2297 | 667 |
^ contentsItem fileName suffix |
2294 | 668 |
! ! |
669 |
||
670 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'change & update'! |
|
671 |
||
672 |
changed:aParameter |
|
2832 | 673 |
"the item changed; send a change notification" |
674 |
||
2294 | 675 |
aParameter == #icon ifTrue:[ icon := nil ]. |
676 |
super changed:aParameter. |
|
677 |
! ! |
|
678 |
||
679 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'instance creation'! |
|
680 |
||
681 |
fileName:aFilename fileInfo:aFileInfoOrNil |
|
2297 | 682 |
self halt. |
683 |
"/ fileName := aFilename. |
|
684 |
"/ fileInfo := aFileInfoOrNil. |
|
1390 | 685 |
! ! |
686 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
687 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'invalidate'! |
1390 | 688 |
|
689 |
invalidate |
|
690 |
self invalidateRepairNow:false |
|
691 |
! |
|
692 |
||
693 |
invalidateRepairNow |
|
694 |
self invalidateRepairNow:true |
|
695 |
! |
|
696 |
||
697 |
invalidateRepairNow:doRepair |
|
698 |
"invalidate the contents; dependent on the boolean |
|
699 |
do repair immediately |
|
700 |
" |
|
701 |
||
702 |
||
1866 | 703 |
! |
704 |
||
705 |
matchBlockChanged |
|
2832 | 706 |
"called if the matchBlock changed" |
1390 | 707 |
! ! |
708 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
709 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'printing'! |
2127 | 710 |
|
2479 | 711 |
printOn:aStream |
712 |
super printOn:aStream. |
|
713 |
' for: ' printOn:aStream. |
|
714 |
self fileName printOn:aStream |
|
715 |
! |
|
716 |
||
2127 | 717 |
printString |
718 |
||
719 |
^ super printString, ' for: ', self fileName asString |
|
720 |
! ! |
|
721 |
||
2270 | 722 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'protocol'! |
723 |
||
724 |
flushChildren |
|
2832 | 725 |
"flush the children (because node is not visible) |
726 |
Can be redefined by subclass" |
|
727 |
||
2270 | 728 |
children := nil. |
729 |
! ! |
|
730 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
731 |
!HierarchicalFileList::HierarchicalFileItem methodsFor:'queries'! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
732 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
733 |
isDirectory |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
734 |
^ false |
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 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
737 |
isRemoteDirectory |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
738 |
^ false |
2267 | 739 |
! |
740 |
||
2832 | 741 |
isWritable |
742 |
^ self fileName isWritable |
|
743 |
! |
|
744 |
||
2267 | 745 |
time |
746 |
^ self valueAt:#modified |
|
2223
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 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
749 |
!HierarchicalFileList::File methodsFor:'accessing'! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
750 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
751 |
children |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
752 |
"always returns an empty list |
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 |
! ! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
756 |
|
1390 | 757 |
!HierarchicalFileList::File methodsFor:'queries'! |
758 |
||
759 |
hasChildren |
|
760 |
"always returns false |
|
761 |
" |
|
762 |
^ false |
|
763 |
! ! |
|
764 |
||
2259 | 765 |
!HierarchicalFileList::Directory class methodsFor:'documentation'! |
766 |
||
767 |
documentation |
|
768 |
" |
|
769 |
[Instance variables:] |
|
770 |
||
2267 | 771 |
fetchOperation <Symbol/Boolean> nil if children is nil, no information about has children |
772 |
#fetching registered in list to be updated for indication |
|
773 |
#hasChildren registered in list to be updated for indication |
|
774 |
#hasNoChildren has children but children list might be nil (remote) |
|
2259 | 775 |
" |
776 |
! ! |
|
777 |
||
2475 | 778 |
!HierarchicalFileList::Directory class methodsFor:'initialization'! |
779 |
||
780 |
initialize |
|
781 |
StateUnknown := nil. |
|
782 |
StateHasChildren := #hasChildren. |
|
783 |
StateHasNoChildren := #hasNoChildren. |
|
784 |
StateFetching := #fetching |
|
785 |
||
786 |
" |
|
787 |
self initialize |
|
788 |
" |
|
789 |
! ! |
|
790 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
791 |
!HierarchicalFileList::Directory methodsFor:'accessing'! |
1390 | 792 |
|
793 |
children |
|
2832 | 794 |
"returns the collection of children or nil" |
795 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
796 |
|model| |
1390 | 797 |
|
2306 | 798 |
children notNil ifTrue:[ ^ children ]. |
1390 | 799 |
|
2259 | 800 |
model := self model. |
2306 | 801 |
model isNil ifTrue:[ ^ nil ]. |
1390 | 802 |
|
2259 | 803 |
model criticalDo:[ |
2306 | 804 |
children isNil ifTrue:[ self readChildren ]. |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
805 |
]. |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
806 |
^ children |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
807 |
! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
808 |
|
2475 | 809 |
icon |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
810 |
"returns the icon" |
2475 | 811 |
|
812 |
|nameKey| |
|
2270 | 813 |
|
2387 | 814 |
isExpanded ifTrue:[ |
2475 | 815 |
(makeIconGray == true) ifTrue:[ |
816 |
nameKey := #directoryOpenGray |
|
817 |
] ifFalse:[ |
|
818 |
nameKey := #directoryOpen |
|
819 |
] |
|
820 |
] ifFalse:[ |
|
2428 | 821 |
makeIconGray == true ifTrue:[ |
2475 | 822 |
nameKey := #directoryGray |
823 |
] |
|
2387 | 824 |
]. |
2475 | 825 |
|
826 |
nameKey notNil ifTrue:[ |
|
827 |
^ FileBrowser iconForKeyMatching:nameKey |
|
2428 | 828 |
]. |
2475 | 829 |
|
2387 | 830 |
icon isNil ifTrue:[ |
831 |
^ super icon |
|
832 |
]. |
|
833 |
^ icon |
|
834 |
! |
|
835 |
||
2457 | 836 |
label |
837 |
"returns the printable name, the baseName |
|
838 |
" |
|
2654 | 839 |
parent isHierarchicalItem ifFalse:[ |
840 |
"no parent exists, thus we have to test for rootDirectory |
|
841 |
" |
|
842 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
843 |
contentsItem fileName isRootDirectory ifTrue:[ |
|
844 |
^ contentsItem fileName pathName |
|
845 |
] |
|
846 |
]. |
|
2457 | 847 |
]. |
848 |
^ contentsItem fileName baseName |
|
849 |
! |
|
850 |
||
2428 | 851 |
makeIconGray:something |
2475 | 852 |
"set/clear the flag which enforces the icon to be shown in grey" |
2428 | 853 |
|
854 |
makeIconGray := something. |
|
855 |
! |
|
856 |
||
2425
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 |
"set the value of the instance variable 'modificationTime' (automatically generated)" |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
859 |
|
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
860 |
modificationTime := something. |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
861 |
! |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
862 |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
863 |
readChildren |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
864 |
"reads the list of children |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
865 |
" |
2259 | 866 |
|model list hadChildren hasChildren| |
867 |
||
2475 | 868 |
self forgetAboutChildren. |
869 |
||
2259 | 870 |
model := self model. |
2306 | 871 |
model isNil ifTrue:[ |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
872 |
"/ must reread later |
2475 | 873 |
modificationTime := children := nil. |
874 |
^ nil |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
875 |
]. |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
876 |
|
2259 | 877 |
hadChildren := children size ~~ 0. |
878 |
||
879 |
"/ set to suppress reading of children |
|
1867 | 880 |
children := #(). |
2297 | 881 |
modificationTime := self fileName modificationTime. |
2259 | 882 |
model stopIndicatorValidationFor:self. |
883 |
||
1867 | 884 |
list := model childrenFor:self. |
885 |
||
886 |
list size ~~ 0 ifTrue:[ |
|
887 |
list do:[:aChild| aChild parent:self]. |
|
888 |
children := list. |
|
1390 | 889 |
]. |
2259 | 890 |
hasChildren := children size ~~ 0. |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
891 |
|
2259 | 892 |
hasChildren ~~ hadChildren ifTrue:[ |
893 |
self changed:#redraw |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
894 |
]. |
1390 | 895 |
^ children |
896 |
! ! |
|
897 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
898 |
!HierarchicalFileList::Directory methodsFor:'accessing-hierarchy'! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
899 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
900 |
collapse |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
901 |
super collapse. |
2270 | 902 |
|
903 |
children notNil ifTrue:[ |
|
904 |
children do:[:el| el flushChildren ] |
|
905 |
]. |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
906 |
! |
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
907 |
|
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
908 |
expand |
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
909 |
"expand children; must redefine to raise a notification |
2832 | 910 |
if children are not yet initialized and after initialization empty." |
2270 | 911 |
|
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
912 |
super expand. |
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
913 |
! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
914 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
915 |
recursiveCollapse |
2270 | 916 |
|
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
917 |
super recursiveCollapse. |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
918 |
! |
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 |
recursiveExpand |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
921 |
"redefined to expand |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
922 |
" |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
923 |
self expand |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
924 |
|
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
925 |
|
2104
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
926 |
! ! |
327f2f77ec12
support remote file-systems (not reading contents of directory if not yet initialized)
ca
parents:
2095
diff
changeset
|
927 |
|
2259 | 928 |
!HierarchicalFileList::Directory methodsFor:'fetching'! |
929 |
||
930 |
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
|
931 |
|linkName fileName hasChildren info| |
2267 | 932 |
|
2583 | 933 |
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
|
934 |
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
|
935 |
(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
|
936 |
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
|
937 |
] ifFalse:[ |
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
938 |
linkName := fileName name. |
2583 | 939 |
]. |
2734
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
940 |
|
2766
04990ee7e604
dont automaticly fetch indicator for nfs mounted filesystems only
Michael Beyl <mb@exept.de>
parents:
2734
diff
changeset
|
941 |
(OperatingSystem mountPoints contains:[:mp | mp mountPointPath = linkName and:[mp isRemote]]) ifTrue:[ |
2583 | 942 |
"do not follow mounted directories automatically (could be an NFS hardlink)" |
943 |
^ self. |
|
944 |
]. |
|
945 |
||
946 |
hasChildren := DirectoryContents directoryNamed:fileName detect:(self model matchBlock). |
|
2475 | 947 |
self knownToHaveChildren:hasChildren. |
2809 | 948 |
"/ self assert:children isNil. |
2475 | 949 |
|
2734
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
950 |
(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
|
951 |
"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
|
952 |
modificationTime := info modificationTime. |
2267 | 953 |
]. |
2259 | 954 |
! |
955 |
||
956 |
fetchIndicator |
|
2475 | 957 |
"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
|
958 |
Called by the indocator update process." |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
959 |
|
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
960 |
|stateBefore stateNow| |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
961 |
|
2306 | 962 |
children notNil ifTrue:[ |
2259 | 963 |
"/ children already read |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
964 |
self knownToHaveChildren:(children size > 0). |
2475 | 965 |
^ self |
2259 | 966 |
]. |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
967 |
quickChildrenInfo == StateFetching ifFalse:[ |
2475 | 968 |
"/ children will be updated in a second.... |
2259 | 969 |
^ self |
970 |
]. |
|
971 |
||
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
972 |
stateBefore := quickChildrenInfo. |
2259 | 973 |
self basicFetchIndicator. |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
974 |
stateNow := quickChildrenInfo. |
2259 | 975 |
|
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
976 |
stateBefore ~~ stateNow ifTrue:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
977 |
self changed:#redraw |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
978 |
]. |
2475 | 979 |
|
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
980 |
"/ children notNil ifTrue:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
981 |
"/ self forgetAboutChildren. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
982 |
"/ children notEmpty ifTrue:[ self changed:#redraw ]. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
983 |
"/ ] ifFalse:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
984 |
"/ "/ is a remote or very slow file system |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
985 |
"/ self isKnownToHaveChildren ifTrue:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
986 |
"/ self changed:#redraw |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
987 |
"/ ]. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
988 |
"/ ]. |
2259 | 989 |
! |
990 |
||
991 |
resetFetchIndicator |
|
992 |
"update indication cycle has deregistered the item |
|
993 |
" |
|
2475 | 994 |
|
995 |
self forgetAboutChildren. |
|
996 |
! ! |
|
997 |
||
998 |
!HierarchicalFileList::Directory methodsFor:'private'! |
|
999 |
||
1000 |
flushChildren |
|
2832 | 1001 |
"flush the children because the node is going to be invisible." |
1002 |
||
2859 | 1003 |
children notNil ifTrue:[ |
1004 |
self knownToHaveChildren:(children size ~~ 0). |
|
1005 |
children := nil. |
|
1006 |
] ifFalse:[ |
|
1007 |
"/ state is unknown |
|
1008 |
self forgetAboutChildren. |
|
1009 |
]. |
|
2475 | 1010 |
! ! |
1011 |
||
2493 | 1012 |
!HierarchicalFileList::Directory methodsFor:'private-quick children info'! |
2475 | 1013 |
|
1014 |
forgetAboutChildren |
|
1015 |
quickChildrenInfo := StateUnknown |
|
1016 |
! |
|
1017 |
||
1018 |
isChildrenInfoValid |
|
1019 |
^ quickChildrenInfo ~~ StateUnknown and:[quickChildrenInfo ~~ StateFetching] |
|
1020 |
! |
|
1021 |
||
1022 |
isFetchingChildrenInfo |
|
1023 |
^ quickChildrenInfo == StateFetching |
|
1024 |
! |
|
1025 |
||
1026 |
isKnownToHaveChildren |
|
1027 |
^ quickChildrenInfo == StateHasChildren |
|
1028 |
! |
|
1029 |
||
1030 |
isKnownToHaveNoChildren |
|
1031 |
^ quickChildrenInfo == StateHasNoChildren |
|
1032 |
! |
|
1033 |
||
1034 |
knownToHaveChildren:aBoolean |
|
1035 |
aBoolean ifTrue:[ |
|
1036 |
quickChildrenInfo := StateHasChildren. |
|
1037 |
] ifFalse:[ |
|
1038 |
quickChildrenInfo := StateHasNoChildren. |
|
1039 |
]. |
|
1040 |
! |
|
1041 |
||
1042 |
setFetchingChildrenInfo |
|
1043 |
quickChildrenInfo := StateFetching |
|
2259 | 1044 |
! ! |
1045 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1046 |
!HierarchicalFileList::Directory methodsFor:'queries'! |
1390 | 1047 |
|
2475 | 1048 |
canExpand |
1049 |
super canExpand ifTrue:[^ true]. |
|
2832 | 1050 |
|
1051 |
"/ in case we are currently fetching the subdirectory |
|
1052 |
"/ self isFetchingChildrenInfo ifTrue:[ |
|
2525 | 1053 |
"/self halt. |
2832 | 1054 |
"/ ]. |
2475 | 1055 |
|
1056 |
^ false |
|
1057 |
! |
|
1058 |
||
1390 | 1059 |
hasChildren |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1060 |
"returns true if children exist" |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1061 |
|
2259 | 1062 |
|model| |
1063 |
||
1064 |
children notNil ifTrue:[ |
|
2475 | 1065 |
self forgetAboutChildren. |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1066 |
children size ~~ 0 ifTrue:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1067 |
^ true |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1068 |
]. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1069 |
isExpanded := false. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1070 |
children := #(). |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1071 |
^ false |
2259 | 1072 |
]. |
1073 |
||
2475 | 1074 |
self isFetchingChildrenInfo ifTrue:[ |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1075 |
^ true. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1076 |
"/ ^ false. |
2475 | 1077 |
]. |
1078 |
self isChildrenInfoValid ifTrue:[ |
|
1079 |
^ self isKnownToHaveChildren |
|
2259 | 1080 |
]. |
1081 |
||
1082 |
model := self model. |
|
1083 |
||
1084 |
model notNil ifTrue:[ |
|
2475 | 1085 |
self setFetchingChildrenInfo. |
2259 | 1086 |
model startIndicatorValidationFor:self. |
1087 |
] ifFalse:[ |
|
2267 | 1088 |
self error:'should not happen' mayProceed:true. |
2475 | 1089 |
self forgetAboutChildren |
2259 | 1090 |
]. |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1091 |
children size ~~ 0 ifTrue:[ ^ true]. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1092 |
|
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1093 |
self isFetchingChildrenInfo ifTrue:[ |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1094 |
^ true. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1095 |
"/ ^ false. |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1096 |
]. |
2475 | 1097 |
^ false |
1390 | 1098 |
! |
1099 |
||
1100 |
isDirectory |
|
2832 | 1101 |
"always true here" |
1102 |
||
1390 | 1103 |
^ true |
1104 |
! ! |
|
1105 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1106 |
!HierarchicalFileList::Directory methodsFor:'validation'! |
1390 | 1107 |
|
2267 | 1108 |
invalidateRepairNow:doRepair |
2832 | 1109 |
"invalidate contents" |
1110 |
||
2475 | 1111 |
modificationTime := nil. |
1112 |
self forgetAboutChildren |
|
2267 | 1113 |
|
1114 |
isExpanded ifFalse:[ |
|
1115 |
children := nil |
|
1116 |
] ifTrue:[ |
|
1117 |
doRepair ifTrue:[ |
|
1118 |
self monitoringCycle |
|
1119 |
] ifFalse:[ |
|
1120 |
children size == 0 ifTrue:[ |
|
1121 |
"/ expanded but no children added, thus can reset the children |
|
1122 |
children := nil |
|
1123 |
] |
|
1124 |
] |
|
1125 |
]. |
|
1126 |
! |
|
1127 |
||
1128 |
matchBlockChanged |
|
1129 |
"called if the matchBlock changed |
|
1130 |
" |
|
1131 |
modificationTime := nil. |
|
1132 |
||
1133 |
isExpanded ifFalse:[ |
|
2475 | 1134 |
children := nil. |
1135 |
self forgetAboutChildren |
|
2267 | 1136 |
] ifTrue:[ |
1137 |
self monitoringCycle. |
|
1138 |
||
1139 |
children size ~~ 0 ifTrue:[ |
|
1140 |
children do:[:aChild| aChild matchBlockChanged ] |
|
1141 |
] |
|
1142 |
]. |
|
1143 |
! |
|
1144 |
||
1145 |
monitoringCycle |
|
1146 |
"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
|
1147 |
!!!!!!!! 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
|
1148 |
|
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
1149 |
|fileName unusedDict addedItems mergedList size modifyTime model timeChanged info| |
2267 | 1150 |
|
2583 | 1151 |
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
|
1152 |
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
|
1153 |
info isNil ifTrue:[^ self]. |
2267 | 1154 |
|
2734
4934113dc4c0
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
2654
diff
changeset
|
1155 |
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
|
1156 |
timeChanged := modifyTime ~= modificationTime. |
2267 | 1157 |
modificationTime := modifyTime. |
1158 |
||
2306 | 1159 |
children notNil ifTrue:[ |
2267 | 1160 |
timeChanged ifFalse:[ |
1161 |
^ self |
|
1162 |
]. |
|
1163 |
]. |
|
2475 | 1164 |
|
2583 | 1165 |
DirectoryContents flushCachedDirectoryFor:fileName. |
2267 | 1166 |
isExpanded ifFalse:[ |
1167 |
timeChanged ifTrue:[ |
|
2475 | 1168 |
children := nil. |
1169 |
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
|
1170 |
self changed:#redraw. |
2267 | 1171 |
]. |
1172 |
^ self |
|
1173 |
]. |
|
2475 | 1174 |
|
2306 | 1175 |
children isNil ifTrue:[ children := #() ]. "/ disable update during merge |
2267 | 1176 |
|
2475 | 1177 |
self forgetAboutChildren. |
1178 |
model := self model. |
|
1179 |
mergedList := model childrenFor:self. |
|
2267 | 1180 |
|
1181 |
mergedList size == 0 ifTrue:[ |
|
1182 |
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
|
1183 |
^ self |
2267 | 1184 |
]. |
1185 |
||
1186 |
size := children size. |
|
1187 |
size == 0 ifTrue:[ |
|
1188 |
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
|
1189 |
^ self |
2267 | 1190 |
]. |
1191 |
||
1192 |
model criticalDo:[ |
|
1193 |
addedItems := OrderedCollection new:128. |
|
1194 |
unusedDict := Dictionary new:size. |
|
1195 |
||
1196 |
children do:[:el| unusedDict at:(el fileName) put:el ]. |
|
1197 |
||
1198 |
mergedList keysAndValuesDo:[:anIndex :anItem| |item| |
|
1199 |
item := unusedDict removeKey:(anItem fileName) ifAbsent:nil. |
|
1200 |
||
1201 |
item notNil ifTrue:[ |
|
1202 |
mergedList at:anIndex put:item |
|
1203 |
] ifFalse:[ |
|
1204 |
addedItems add:anItem. |
|
1205 |
anItem parent:self. |
|
1206 |
]. |
|
1207 |
]. |
|
1208 |
"/ 12 is hardcoded !!!!!!!! |
|
1209 |
||
1210 |
(unusedDict size + addedItems size) > 12 ifTrue:[ |
|
1211 |
"/ generate two nofifications: collapse and expand |
|
1212 |
self collapse. |
|
1213 |
children := mergedList. |
|
1214 |
self expand. |
|
1215 |
] ifFalse:[ |
|
1216 |
unusedDict do:[:el| self remove:el ]. |
|
1217 |
||
1218 |
addedItems notEmpty ifTrue:[ |
|
1219 |
self addAll:addedItems |
|
1220 |
]. |
|
1221 |
"/ children order changed test |
|
1222 |
children := mergedList. |
|
1223 |
self childrenOrderChanged. |
|
1224 |
]. |
|
1225 |
]. |
|
2425
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 |
|
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1228 |
updateList |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1229 |
|
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1230 |
modificationTime := nil. |
7421b8bb7d31
reset modificationtime for updates to get the new files on remote systems where times are different
penk
parents:
2388
diff
changeset
|
1231 |
self monitoringCycle. |
1390 | 1232 |
! ! |
1233 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1234 |
!HierarchicalFileList::RemoteDirectory methodsFor:'queries'! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1235 |
|
2267 | 1236 |
hasChildren |
2808
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1237 |
"returns true if children exist" |
2ee9a7008a6d
update - StateUnknown is treated like \"hasChildren\".
Claus Gittinger <cg@exept.de>
parents:
2806
diff
changeset
|
1238 |
|
2267 | 1239 |
children notNil ifTrue:[ |
2475 | 1240 |
self forgetAboutChildren. |
2267 | 1241 |
^ children size ~~ 0 |
1242 |
]. |
|
2475 | 1243 |
|
1244 |
"/ assume that there are children; |
|
1245 |
"/ this might be wrong and clicking on the expand-icon |
|
1246 |
"/ will then not perform an expand, but remove the can-expand indicator. |
|
1247 |
self knownToHaveChildren:true. |
|
1248 |
^ true |
|
2267 | 1249 |
! |
1250 |
||
2223
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1251 |
isRemoteDirectory |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1252 |
^ true |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1253 |
! ! |
c34e7fd25e53
monitoring; delayed for directories; never for remoteDirectories
penk
parents:
2180
diff
changeset
|
1254 |
|
1390 | 1255 |
!HierarchicalFileList class methodsFor:'documentation'! |
1256 |
||
1257 |
version |
|
2859 | 1258 |
^ '$Header: /cvs/stx/stx/libwidg2/HierarchicalFileList.st,v 1.58 2005-10-24 09:25:21 ca Exp $' |
1390 | 1259 |
! ! |
2475 | 1260 |
|
1261 |
HierarchicalFileList::Directory initialize! |