author | Claus Gittinger <cg@exept.de> |
Mon, 20 Jul 1998 18:31:36 +0200 | |
changeset 1731 | e0918756a20f |
parent 1702 | 962056a31c06 |
child 1732 | 099fb9d23958 |
permissions | -rw-r--r-- |
36 | 1 |
" |
2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
1317 | 3 |
All Rights Reserved |
36 | 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 |
StandardSystemView subclass:#FileBrowser |
|
1010 | 14 |
instanceVariableNames:'labelView filterField fileListView subView currentDirectory |
15 |
fileList checkBlock checkDelta timeOfLastCheck showLongList |
|
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
16 |
showDotFiles myName killButton pauseToggle compressTabs |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
17 |
lockUpdate previousDirectory currentFileName timeOfFileRead |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
18 |
tabSpec commandView commandIndex fileEncoding tabRulerView |
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
19 |
scrollView icons listUpdateProcess currentFileInFileName' |
1010 | 20 |
classVariableNames:'DirectoryHistory DirectoryHistoryWhere HistorySize DefaultIcon |
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
21 |
CommandHistory CommandHistorySize Icons DefaultCommandPerSuffix' |
1010 | 22 |
poolDictionaries:'' |
23 |
category:'Interface-Browsers' |
|
36 | 24 |
! |
25 |
||
763
94a8d188b52d
care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
26 |
!FileBrowser class methodsFor:'documentation'! |
36 | 27 |
|
28 |
copyright |
|
29 |
" |
|
30 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
1317 | 31 |
All Rights Reserved |
36 | 32 |
|
33 |
This software is furnished under a license and may be used |
|
34 |
only in accordance with the terms of that license and with the |
|
35 |
inclusion of the above copyright notice. This software may not |
|
36 |
be provided or otherwise made available to, or used by, any |
|
37 |
other person. No title to or ownership of the software is |
|
38 |
hereby transferred. |
|
39 |
" |
|
40 |
! |
|
41 |
||
42 |
documentation |
|
43 |
" |
|
44 |
this used to be a very simple demo application, |
|
45 |
but migrated into a quite nice tool, includes all kinds of |
|
46 |
warning and information boxes, background processes for directory- |
|
47 |
reading and internationalized strings. A good example for beginners, |
|
100 | 48 |
on how to do things .... (and maybe how not to do things ;-, since some |
49 |
stuff is historic and was implemented at times when better mechanisms |
|
50 |
were not available) |
|
52 | 51 |
|
36 | 52 |
See additional information in 'doc/misc/fbrowser.doc'. |
45 | 53 |
|
52 | 54 |
WARNING: files edited with FileBrowser will have leading spaces (multiple-8) |
1317 | 55 |
being replaced by tabs. If tabs are to be preserved at other |
56 |
positions (for example, sendmail-config files) they will be |
|
57 |
corrupt after being written. |
|
508 | 58 |
|
59 |
[instance variables]: |
|
60 |
||
1317 | 61 |
checkDelta <Integer> number of seconds of check interval |
62 |
(looks ever so often if shown directory |
|
63 |
has changed). You may make this number |
|
64 |
higher, if your network-times are |
|
65 |
incorrect and thus, the filebrowser |
|
66 |
checks too often. |
|
67 |
||
68 |
compressTabs <Boolean> if true, leading spaces will be |
|
69 |
replaced by tabs when saving text |
|
52 | 70 |
|
71 |
some of the defaults (long/short list etc.) can be set by the resource file; |
|
72 |
see FileBrowser>>initialize for more details.. |
|
508 | 73 |
|
74 |
[author:] |
|
1317 | 75 |
Claus Gittinger |
36 | 76 |
" |
203 | 77 |
! ! |
36 | 78 |
|
763
94a8d188b52d
care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
79 |
!FileBrowser class methodsFor:'instance creation'! |
36 | 80 |
|
81 |
openOn:aDirectoryPath |
|
82 |
"start a new FileBrowser in a pathname" |
|
83 |
||
84 |
^ (self new currentDirectory:aDirectoryPath) open |
|
85 |
||
52 | 86 |
" |
87 |
FileBrowser openOn:'aDirectoryPath' |
|
88 |
FileBrowser openOn:'/etc' |
|
89 |
FileBrowser openOn:'..' |
|
90 |
FileBrowser openOn:'.' |
|
91 |
" |
|
93 | 92 |
! |
93 |
||
94 |
openOnFileNamed:aFilename |
|
95 |
"start a new FileBrowser on a file" |
|
96 |
||
97 |
|f browser| |
|
98 |
||
99 |
f := aFilename asFilename. |
|
1124 | 100 |
f isDirectory ifTrue:[ |
1689 | 101 |
^ self openOn:aFilename |
1124 | 102 |
]. |
1689 | 103 |
|
93 | 104 |
browser := self new. |
105 |
browser currentDirectory:f directoryName. |
|
1689 | 106 |
browser updateCurrentDirectory. |
93 | 107 |
browser showFile:f baseName. |
1689 | 108 |
|
109 |
^ browser open. |
|
93 | 110 |
|
111 |
" |
|
112 |
FileBrowser openOnFileNamed:'Makefile' |
|
113 |
FileBrowser openOnFileNamed:'../Makefile' |
|
114 |
FileBrowser openOnFileNamed:'/tmp/foo' |
|
115 |
" |
|
1124 | 116 |
|
1689 | 117 |
"Modified: / 17.6.1998 / 11:25:29 / cg" |
36 | 118 |
! ! |
119 |
||
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
120 |
!FileBrowser class methodsFor:'class initialization'! |
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
121 |
|
1178
f5f4d0c605db
lazy initialization of Icons
Claus Gittinger <cg@exept.de>
parents:
1173
diff
changeset
|
122 |
initializeIcons |
1239
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
123 |
|resources| |
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
124 |
|
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
125 |
resources := self classResources. |
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
126 |
|
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
127 |
Icons := IdentityDictionary new. |
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
128 |
|
1147 | 129 |
#( |
1329 | 130 |
(#directory 'ICON_DIRECTORY' 'tiny_yellow_dir.xpm' ) |
131 |
(#directoryLocked 'ICON_DIRECTORY_LOCKED' 'tiny_yellow_dir_locked.xpm') |
|
132 |
(#directoryLink 'ICON_DIRECTORY_LINK' 'tiny_yellow_dir_link.xpm' ) |
|
133 |
(#file 'ICON_FILE' 'tiny_file_plain.xpm' ) |
|
134 |
(#fileLink 'ICON_FILE_LINK' 'tiny_file_link.xpm' ) |
|
135 |
(#fileLocked 'ICON_FILE_LOCKED' 'tiny_file_lock.xpm' ) |
|
136 |
(#imageFile 'ICON_IMAGE_FILE' 'tiny_file_pix.xpm' ) |
|
137 |
(#textFile 'ICON_TEXT_FILE' 'tiny_file_text.xpm' ) |
|
138 |
||
1239
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
139 |
) do:[:entry | |
1329 | 140 |
|key resource defaultName nm| |
141 |
||
142 |
key := entry at:1. |
|
143 |
resource := entry at:2. |
|
144 |
defaultName := entry at:3. |
|
145 |
||
146 |
nm := resources at:resource default:nil. |
|
147 |
nm isNil ifTrue:[ |
|
148 |
nm := 'bitmaps/xpmBitmaps/document_images/' , defaultName |
|
149 |
]. |
|
150 |
Icons at:key put:(Image fromFile:nm). |
|
1147 | 151 |
] |
152 |
||
153 |
" |
|
1178
f5f4d0c605db
lazy initialization of Icons
Claus Gittinger <cg@exept.de>
parents:
1173
diff
changeset
|
154 |
self initializeIcons |
1147 | 155 |
" |
156 |
||
1253 | 157 |
"Modified: 28.7.1997 / 09:19:45 / cg" |
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
158 |
! ! |
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
159 |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
160 |
!FileBrowser class methodsFor:'command history'! |
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
161 |
|
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
162 |
addToCommandHistory:aCommandString for:aFilename |
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
163 |
|cmd suffix| |
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
164 |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
165 |
(aCommandString notNil and:[aCommandString notEmpty]) ifTrue:[ |
1317 | 166 |
CommandHistory notNil ifTrue:[ |
167 |
CommandHistory addFirst:aCommandString. |
|
168 |
CommandHistory size > CommandHistorySize ifTrue:[ |
|
169 |
CommandHistory removeLast |
|
170 |
] |
|
171 |
]. |
|
172 |
aFilename notNil ifTrue:[ |
|
173 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
174 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
175 |
DefaultCommandPerSuffix := Dictionary new. |
|
176 |
]. |
|
177 |
suffix := aFilename asFilename suffix. |
|
178 |
suffix notNil ifTrue:[ |
|
179 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
180 |
] |
|
181 |
] |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
182 |
] |
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
183 |
|
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
184 |
"Created: 14.11.1996 / 14:58:13 / cg" |
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
185 |
! ! |
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
186 |
|
763
94a8d188b52d
care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
187 |
!FileBrowser class methodsFor:'defaults'! |
73 | 188 |
|
189 |
defaultIcon |
|
1147 | 190 |
"return the file browsers default window icon" |
191 |
||
1287 | 192 |
<resource: #style (#FILEBROWSER_ICON #FILEBROWSER_ICON_FILE)> |
193 |
||
194 |
|nm i res| |
|
1147 | 195 |
|
196 |
(i := DefaultIcon) isNil ifTrue:[ |
|
1317 | 197 |
res := self classResources. |
198 |
i := res at:'FILEBROWSER_ICON' default:nil. |
|
199 |
i isNil ifTrue:[ |
|
200 |
nm := res at:'FILEBROWSER_ICON_FILE' default:'FBrowser.xbm'. |
|
201 |
i := Image fromFile:nm resolution:100. |
|
202 |
i isNil ifTrue:[ |
|
203 |
i := Image fromFile:('bitmaps/' , nm) resolution:100. |
|
204 |
i isNil ifTrue:[ |
|
205 |
i := StandardSystemView defaultIcon |
|
206 |
] |
|
207 |
] |
|
208 |
]. |
|
209 |
i notNil ifTrue:[ |
|
210 |
DefaultIcon := i := i on:Display |
|
211 |
] |
|
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
212 |
]. |
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
213 |
^ i |
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
214 |
|
1147 | 215 |
"Modified: 19.3.1997 / 20:48:34 / ca" |
1287 | 216 |
"Modified: 15.8.1997 / 15:27:19 / cg" |
73 | 217 |
! ! |
218 |
||
1119 | 219 |
!FileBrowser methodsFor:'drag & drop'! |
172 | 220 |
|
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
221 |
canDrop:aCollectionOfDropObjects |
1119 | 222 |
"I accept fileObjects only" |
223 |
||
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
224 |
aCollectionOfDropObjects do:[:aDropObject | |
1317 | 225 |
aDropObject isFileObject ifFalse:[ |
226 |
aDropObject isTextObject ifFalse:[^ false]. |
|
227 |
] |
|
1122
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
228 |
]. |
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
229 |
^ true |
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
230 |
|
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
231 |
"Modified: 11.4.1997 / 12:41:59 / cg" |
1118 | 232 |
! |
233 |
||
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
234 |
drop:aCollectionOfDropObjects at:aPoint |
1122
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
235 |
"handle drops" |
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
236 |
|
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
237 |
aCollectionOfDropObjects do:[:aDropObject | |
1317 | 238 |
self dropSingleObject:aDropObject at:aPoint |
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
239 |
] |
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
240 |
|
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
241 |
"Modified: 11.4.1997 / 12:43:36 / cg" |
1122
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
242 |
! |
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
243 |
|
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
244 |
dropSingleObject:someObject at:aPoint |
1119 | 245 |
"handle drops; if its a directory, change to it. |
1124 | 246 |
If its a file, change to its directory and select the file. |
247 |
If its text, paste it into the codeView." |
|
1119 | 248 |
|
1122
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
249 |
|newDir newFile| |
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
250 |
|
1124 | 251 |
someObject isFileObject ifTrue:[ |
1317 | 252 |
someObject isDirectory ifTrue:[ |
253 |
newDir := someObject theObject pathName. |
|
254 |
] ifFalse:[ |
|
255 |
newDir := someObject theObject directoryName. |
|
256 |
newFile := someObject theObject baseName. |
|
257 |
]. |
|
258 |
||
259 |
newDir notNil ifTrue:[ |
|
260 |
newDir ~= currentDirectory pathName ifTrue:[ |
|
261 |
self changeDirectoryTo:newDir. |
|
262 |
] |
|
263 |
]. |
|
264 |
newFile notNil ifTrue:[ |
|
265 |
newFile ~= currentFileName ifTrue:[ |
|
266 |
fileListView selection:(fileList indexOf:newFile). |
|
267 |
self doFileGet:false. |
|
268 |
] |
|
269 |
]. |
|
270 |
^ self |
|
1122
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
271 |
]. |
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
272 |
|
1124 | 273 |
someObject isTextObject ifTrue:[ |
1317 | 274 |
subView paste:someObject theObject. |
275 |
^ self |
|
1118 | 276 |
]. |
1124 | 277 |
|
278 |
"Modified: 6.4.1997 / 14:46:44 / cg" |
|
1119 | 279 |
! ! |
280 |
||
281 |
!FileBrowser methodsFor:'events'! |
|
1118 | 282 |
|
1010 | 283 |
handlesKeyPress:key inView:view |
284 |
"this method is reached via delegation: are we prepared to handle |
|
285 |
a keyPress in some other view ?" |
|
286 |
||
1396 | 287 |
<resource: #keyboard (#GotoLine #InspectIt #CmdI #Cmdu #DoIt #Delete #BackSpace #Accept #CmdF #CmdD)> |
1010 | 288 |
|
289 |
view == fileListView ifTrue:[ |
|
1418 | 290 |
(key == #Delete |
291 |
or:[key == #BackSpace |
|
292 |
or:[key == #Accept |
|
293 |
or:[key == #CmdI |
|
294 |
or:[key == #CmdF |
|
295 |
or:[key == #CmdD |
|
296 |
or:[key == #Cmdu |
|
297 |
or:[key == #InspectIt |
|
298 |
or:[key == #GotoLine |
|
299 |
or:[key == #DoIt]]]]]]]]]) ifTrue:[^ true]. |
|
1010 | 300 |
]. |
301 |
^ false |
|
302 |
||
1396 | 303 |
"Created: / 28.1.1997 / 14:03:20 / stefan" |
304 |
"Modified: / 20.6.1997 / 16:35:01 / cg" |
|
305 |
"Modified: / 16.1.1998 / 16:50:39 / stefan" |
|
1010 | 306 |
! |
307 |
||
308 |
keyPress:key x:x y:y view:view |
|
309 |
"this method is reached via delegation from the fileListView" |
|
310 |
||
311 |
<resource: #keyboard (#GotoLine #InspectIt #CmdI #Cmdu #DoIt #Delete #BackSpace #Accept)> |
|
312 |
||
313 |
(key == #Delete or:[key == #BackSpace]) ifTrue:[ |
|
1418 | 314 |
self fileRemove. |
315 |
^ self |
|
1010 | 316 |
]. |
317 |
(key == #Accept) ifTrue:[ |
|
1418 | 318 |
self fileFileIn. |
319 |
^ self |
|
1010 | 320 |
]. |
321 |
(key == #GotoLine) ifTrue:[ |
|
1418 | 322 |
self fileGet. |
323 |
^ self |
|
1010 | 324 |
]. |
325 |
(key == #DoIt) ifTrue:[ |
|
1418 | 326 |
self fileExecute. |
327 |
^ self |
|
1010 | 328 |
]. |
329 |
(key == #InspectIt) ifTrue:[ |
|
1418 | 330 |
self fileGetInfo. |
331 |
^ self |
|
1010 | 332 |
]. |
333 |
(key == #CmdI) ifTrue:[ |
|
1418 | 334 |
self fileGetLongInfo. |
335 |
^ self |
|
1010 | 336 |
]. |
337 |
(key == #Cmdu) ifTrue:[ |
|
1418 | 338 |
self updateCurrentDirectory. |
339 |
^ self |
|
1396 | 340 |
]. |
341 |
(key == #CmdF) ifTrue:[ |
|
1418 | 342 |
self newFile. |
343 |
^ self |
|
1396 | 344 |
]. |
345 |
(key == #CmdD) ifTrue:[ |
|
1418 | 346 |
self newDirectory. |
347 |
^ self |
|
1010 | 348 |
]. |
349 |
fileListView keyPress:key x:x y:y |
|
350 |
||
1396 | 351 |
"Created: / 28.1.1997 / 14:03:56 / stefan" |
352 |
"Modified: / 20.6.1997 / 16:35:08 / cg" |
|
353 |
"Modified: / 16.1.1998 / 16:51:38 / stefan" |
|
1010 | 354 |
! |
355 |
||
172 | 356 |
mapped |
357 |
super mapped. |
|
358 |
" |
|
359 |
whant to know about changed history |
|
360 |
" |
|
361 |
self updateCurrentDirectory |
|
362 |
! |
|
363 |
||
364 |
visibilityChange:how |
|
365 |
|wasVisible| |
|
366 |
||
367 |
wasVisible := shown. |
|
368 |
super visibilityChange:how. |
|
369 |
(wasVisible not and:[shown]) ifTrue:[ |
|
1481 | 370 |
" |
371 |
start checking again |
|
372 |
" |
|
373 |
Processor removeTimedBlock:checkBlock. |
|
374 |
Processor addTimedBlock:checkBlock afterSeconds:checkDelta. |
|
172 | 375 |
] |
1481 | 376 |
|
377 |
"Modified: / 18.2.1998 / 17:57:44 / cg" |
|
172 | 378 |
! ! |
379 |
||
380 |
!FileBrowser methodsFor:'fileList user interaction'! |
|
381 |
||
382 |
changeDisplayMode |
|
383 |
"toggle from long to short listing (and vice-versa)" |
|
384 |
||
385 |
showLongList := showLongList not. |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
386 |
self showOrHideTabView. |
172 | 387 |
self updateCurrentDirectory |
747 | 388 |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
389 |
"Modified: 19.4.1997 / 09:50:14 / cg" |
172 | 390 |
! |
391 |
||
392 |
changeDotFileVisibility |
|
393 |
"turn on/off visibility of files whose name starts with '.'" |
|
394 |
||
395 |
showDotFiles := showDotFiles not. |
|
396 |
self updateCurrentDirectory |
|
397 |
! |
|
398 |
||
1327 | 399 |
fileDoubleClick:lineNr |
400 |
"double click on a file - get its contents" |
|
401 |
||
402 |
self fileSelect:lineNr. |
|
403 |
self fileGet:true |
|
404 |
! |
|
405 |
||
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
406 |
fileEncoding |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
407 |
"open a dialog to allow change of the files character encoding. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
408 |
Files are converted to internal encoding when read, and converted back |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
409 |
to this encoding when saved. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
410 |
The default encoding is nil, which means that files are already in |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
411 |
the internal encoding (which is iso8859). |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
412 |
Notice: currently, not too many encodings are supported by the system." |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
413 |
|
495
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
414 |
|dialog list descr encodings encodingNames idx| |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
415 |
|
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
416 |
list := SelectionInList new. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
417 |
|
495
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
418 |
descr := CharacterArray supportedExternalEncodings. |
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
419 |
encodings := descr at:2. |
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
420 |
encodingNames := descr at:1. |
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
421 |
|
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
422 |
list list:encodingNames. |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
423 |
list selectionIndex:(encodings indexOf:fileEncoding ifAbsent:1). |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
424 |
|
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
425 |
dialog := Dialog new. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
426 |
|
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
427 |
dialog addTextLabel:(resources string:'ENCODING_MSG') withCRs. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
428 |
dialog addVerticalSpace. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
429 |
dialog addListBoxOn:list withNumberOfLines:5. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
430 |
|
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
431 |
dialog addAbortButton; addOkButton. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
432 |
dialog open. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
433 |
|
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
434 |
dialog accepted ifTrue:[ |
1317 | 435 |
idx := list selectionIndex. |
436 |
fileEncoding := encodings at:idx. |
|
437 |
subView externalEncoding:fileEncoding. |
|
438 |
||
439 |
self validateFontEncodingFor:fileEncoding ask:true. |
|
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
440 |
]. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
441 |
|
1219 | 442 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
443 |
! |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
444 |
|
172 | 445 |
fileExecute |
446 |
"if text was modified show a queryBox, |
|
447 |
otherwise pop up execute box immediately" |
|
448 |
||
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
449 |
|action sel fileName| |
172 | 450 |
|
451 |
" |
|
452 |
this replaces everything by the commands output ... |
|
453 |
" |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
454 |
action := [:command | |
1317 | 455 |
self class addToCommandHistory:command for:fileName. |
456 |
self doExecuteCommand:command replace:true |
|
457 |
]. |
|
172 | 458 |
|
459 |
(self askIfModified:'contents has not been saved.\\Modifications will be lost when command is executed.' |
|
1317 | 460 |
yesButton:'execute') ifFalse:[^ self]. |
172 | 461 |
|
462 |
"/ " |
|
463 |
"/ this inserts the commands output ... |
|
464 |
"/ " |
|
465 |
"/ action := [:command| self doExecuteCommand:command replace:false]. |
|
466 |
"/ |
|
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
467 |
|
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
468 |
sel := fileListView selection. |
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
469 |
sel size == 1 ifTrue:[ |
1317 | 470 |
fileName := fileList at:sel first |
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
471 |
]. |
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
472 |
self askForCommandFor:fileName thenDo:action |
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
473 |
|
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
474 |
"Modified: 14.11.1996 / 14:59:34 / cg" |
172 | 475 |
! |
476 |
||
477 |
fileFileIn |
|
478 |
"fileIn the selected file(s)" |
|
479 |
||
480 |
self fileFileInLazy:false |
|
481 |
! |
|
482 |
||
483 |
fileFileInLazy |
|
484 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
485 |
||
486 |
self fileFileInLazy:true |
|
487 |
! |
|
488 |
||
489 |
fileFileInLazy:lazy |
|
490 |
"fileIn the selected file(s)" |
|
491 |
||
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
492 |
|aStream path oldPath wasLazy bos prevCurrentFileName| |
172 | 493 |
|
494 |
self selectedFilesDo:[:fileName | |
|
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
495 |
path := currentDirectory filenameFor:fileName. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
496 |
path type == #regular ifTrue:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
497 |
prevCurrentFileName := currentFileInFileName. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
498 |
currentFileInFileName := fileName. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
499 |
|
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
500 |
(ObjectFileLoader notNil |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
501 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
502 |
Object abortSignal catch:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
503 |
|p| |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
504 |
|
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
505 |
"/ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
506 |
"/ look if already loaded ... then unload first |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
507 |
"/ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
508 |
p := path pathName. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
509 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
510 |
(Dialog confirm:(resources |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
511 |
string:'%1 is already loaded; load anyway ?' |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
512 |
with:p)) ifFalse:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
513 |
^ self |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
514 |
]. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
515 |
Transcript showCR:'unloading old ' , p , ' ...'. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
516 |
ObjectFileLoader unloadObjectFile:p. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
517 |
]. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
518 |
|
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
519 |
Transcript showCR:'loading ' , p , ' ...'. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
520 |
ObjectFileLoader loadObjectFile:p. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
521 |
Class addInfoRecord:('fileIn ' , fileName) |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
522 |
] |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
523 |
] ifFalse:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
524 |
(path hasSuffix:'cls') ifTrue:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
525 |
aStream := path readStream. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
526 |
aStream notNil ifTrue:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
527 |
bos := BinaryObjectStorage onOld:aStream. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
528 |
Class nameSpaceQuerySignal |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
529 |
answer:Smalltalk |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
530 |
do:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
531 |
bos next. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
532 |
]. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
533 |
bos close |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
534 |
] |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
535 |
] ifFalse:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
536 |
((path hasSuffix:'class') |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
537 |
or:[(path hasSuffix:'cla')]) ifTrue:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
538 |
JavaClassReader notNil ifTrue:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
539 |
JavaClassReader loadFile:(path pathName) |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
540 |
] |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
541 |
] ifFalse:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
542 |
aStream := path readStream. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
543 |
aStream notNil ifTrue:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
544 |
[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
545 |
Class withoutUpdatingChangesDo:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
546 |
oldPath := Smalltalk systemPath. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
547 |
Smalltalk systemPath:(oldPath copy addFirst:currentDirectory pathName; yourself). |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
548 |
wasLazy := Compiler compileLazy:lazy. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
549 |
aStream fileIn. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
550 |
]. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
551 |
Class addInfoRecord:('fileIn ' , fileName) |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
552 |
] valueNowOrOnUnwindDo:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
553 |
Compiler compileLazy:wasLazy. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
554 |
Smalltalk systemPath:oldPath. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
555 |
aStream close |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
556 |
] |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
557 |
] |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
558 |
] |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
559 |
] |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
560 |
] |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
561 |
]. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
562 |
currentFileInFileName := prevCurrentFileName |
172 | 563 |
] |
564 |
||
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
565 |
"Modified: / 19.9.1997 / 23:42:22 / stefan" |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
566 |
"Modified: / 18.6.1998 / 15:30:38 / cg" |
172 | 567 |
! |
568 |
||
569 |
fileGet |
|
570 |
"get contents of selected file into subView. |
|
571 |
If text was modified show a queryBox, |
|
572 |
otherwise get it immediately" |
|
573 |
||
633
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
574 |
self fileGet:false |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
575 |
|
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
576 |
"Modified: 19.6.1996 / 09:38:45 / cg" |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
577 |
! |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
578 |
|
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
579 |
fileGet:viaDoubleClick |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
580 |
"get contents of selected file into subView. |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
581 |
If text was modified show a queryBox, |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
582 |
otherwise get it immediately" |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
583 |
|
172 | 584 |
|fileName msg label| |
585 |
||
1110
9ec4692e9cda
dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents:
1104
diff
changeset
|
586 |
(subView modified not or:[subView contentsWasSaved]) ifTrue:[ |
1329 | 587 |
self doFileGet:viaDoubleClick. |
588 |
^ self |
|
1110
9ec4692e9cda
dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents:
1104
diff
changeset
|
589 |
]. |
172 | 590 |
fileName := self getSelectedFileName. |
591 |
fileName notNil ifTrue:[ |
|
1329 | 592 |
(currentDirectory filenameFor:fileName) isDirectory ifTrue:[ |
593 |
msg := 'contents has not been saved.\\Modifications will be lost when directory is changed.'. |
|
594 |
label := 'change'. |
|
595 |
] ifFalse:[ |
|
596 |
msg := 'contents has not been saved.\\Modifications will be lost when new file is read.'. |
|
597 |
label := 'get'. |
|
598 |
]. |
|
599 |
(self ask:(resources at:msg) yesButton:label) ifTrue:[ |
|
600 |
subView modified:false. |
|
601 |
self doFileGet:viaDoubleClick |
|
602 |
] |
|
172 | 603 |
] |
633
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
604 |
|
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
605 |
"Created: 19.6.1996 / 09:38:35 / cg" |
1162 | 606 |
"Modified: 23.4.1997 / 13:04:11 / cg" |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
607 |
"Modified: 18.9.1997 / 16:27:34 / stefan" |
172 | 608 |
! |
609 |
||
610 |
fileGetInfo |
|
611 |
"show short file (stat)-info" |
|
612 |
||
613 |
self fileGetInfo:false |
|
614 |
! |
|
615 |
||
616 |
fileGetInfo:longInfo |
|
617 |
"get info on selected file - show it in a box" |
|
618 |
||
1672
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
619 |
|string box updater| |
172 | 620 |
|
621 |
string := self getFileInfoString:longInfo. |
|
622 |
string notNil ifTrue:[ |
|
1672
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
623 |
box := InfoBox title:string. |
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
624 |
updater := [ |
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
625 |
[true] whileTrue:[ |
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
626 |
Delay waitForSeconds:2. |
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
627 |
string := self getFileInfoString:longInfo. |
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
628 |
box title:string |
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
629 |
] |
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
630 |
] fork. |
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
631 |
|
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
632 |
box showAtPointer. |
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
633 |
updater terminate. |
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
634 |
box destroy |
172 | 635 |
] |
636 |
! |
|
637 |
||
638 |
fileGetLongInfo |
|
639 |
"show long stat (file)-info" |
|
640 |
||
641 |
self fileGetInfo:true |
|
642 |
! |
|
643 |
||
644 |
fileInsert |
|
1162 | 645 |
"insert contents of file at the cursor position" |
172 | 646 |
|
647 |
|fileName| |
|
648 |
||
649 |
fileName := self getSelectedFileName. |
|
650 |
fileName notNil ifTrue:[ |
|
1317 | 651 |
self showFile:fileName insert:true encoding:fileEncoding |
172 | 652 |
] |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
653 |
|
1162 | 654 |
"Modified: 23.4.1997 / 13:06:06 / cg" |
172 | 655 |
! |
656 |
||
657 |
fileListMenu |
|
658 |
"return the menu to show in the fileList" |
|
659 |
||
1235
13610578a5d2
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
660 |
<resource: #programMenu> |
1040 | 661 |
|
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
662 |
|labels shorties selectors m sel ns subLabels subSelectors| |
172 | 663 |
|
664 |
labels := #( |
|
1628 | 665 |
'spawn' |
666 |
'-' |
|
667 |
'get contents' |
|
668 |
'insert contents' |
|
669 |
'show info' |
|
670 |
'show full info' |
|
671 |
). |
|
1193
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
672 |
|
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
673 |
((ns := Project current defaultNameSpace) notNil |
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
674 |
and:[ns ~~ Smalltalk]) ifTrue:[ |
1628 | 675 |
labels := labels copyWith:(resources string:'fileIn (into ''%1'')' with:(Project current defaultNameSpace name)) |
1193
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
676 |
] ifFalse:[ |
1628 | 677 |
labels := labels copyWith:'fileIn' |
1193
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
678 |
]. |
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
679 |
|
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
680 |
labels := labels , #( |
1628 | 681 |
'-' |
682 |
'update' |
|
683 |
'-' |
|
684 |
'execute unix command ...' |
|
685 |
'st/x tools' |
|
686 |
'-' |
|
687 |
'remove' |
|
688 |
'rename ...' |
|
689 |
'-' |
|
690 |
'display long list' |
|
691 |
'show all files' |
|
692 |
'encoding ...' |
|
693 |
'-' |
|
694 |
'create directory ...' |
|
695 |
'create file ...' |
|
696 |
). |
|
172 | 697 |
|
698 |
selectors := #( |
|
1628 | 699 |
fileSpawn |
700 |
nil |
|
701 |
fileGet |
|
702 |
fileInsert |
|
703 |
fileGetInfo |
|
704 |
fileGetLongInfo |
|
705 |
fileFileIn |
|
706 |
nil |
|
707 |
updateCurrentDirectory |
|
708 |
nil |
|
709 |
fileExecute |
|
710 |
stxTools |
|
711 |
nil |
|
712 |
fileRemove |
|
713 |
fileRename |
|
714 |
nil |
|
715 |
changeDisplayMode |
|
716 |
changeDotFileVisibility |
|
717 |
fileEncoding |
|
718 |
nil |
|
719 |
newDirectory |
|
720 |
newFile |
|
721 |
). |
|
172 | 722 |
|
1010 | 723 |
shorties := #( |
1628 | 724 |
nil |
725 |
nil |
|
726 |
GotoLine |
|
727 |
nil |
|
728 |
InspectIt |
|
729 |
CmdI |
|
730 |
Accept |
|
731 |
nil |
|
732 |
Cmdu |
|
733 |
nil |
|
734 |
DoIt |
|
735 |
nil |
|
736 |
nil |
|
737 |
Delete |
|
738 |
nil |
|
739 |
nil |
|
740 |
nil |
|
741 |
nil |
|
742 |
nil |
|
743 |
nil |
|
744 |
CmdD |
|
745 |
CmdF |
|
746 |
). |
|
1010 | 747 |
|
172 | 748 |
m := PopUpMenu |
1628 | 749 |
labels:(resources array:labels) |
750 |
selectors:selectors |
|
751 |
accelerators:shorties |
|
752 |
receiver:self. |
|
172 | 753 |
|
754 |
showDotFiles ifTrue:[ |
|
1628 | 755 |
m labelAt:#changeDotFileVisibility put:(resources string:'hide hidden files') |
172 | 756 |
]. |
757 |
showLongList ifTrue:[ |
|
1628 | 758 |
m labelAt:#changeDisplayMode put:(resources string:'display short list') |
172 | 759 |
]. |
760 |
||
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
761 |
subLabels := #( |
1628 | 762 |
'Changes browser' |
763 |
'Editor' |
|
764 |
'HTML reader' |
|
765 |
'Image inspect' |
|
766 |
'show file differences' |
|
1731 | 767 |
'terminal' |
1628 | 768 |
). |
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
769 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
770 |
subSelectors := #( |
1628 | 771 |
openChangesBrowser |
772 |
openEditor |
|
773 |
openHTMLReader |
|
774 |
openImageInspector |
|
775 |
openDiffView |
|
1731 | 776 |
openTerminal |
1628 | 777 |
). |
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
778 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
779 |
JavaInterpreter notNil ifTrue:[ |
1628 | 780 |
subLabels := subLabels , #('Java Applet Viewer'). |
781 |
subSelectors := subSelectors , #(openAppletViewer). |
|
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
782 |
]. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
783 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
784 |
m subMenuAt:#stxTools |
1628 | 785 |
put:(PopUpMenu |
786 |
labels:(resources array:subLabels) |
|
787 |
selectors:subSelectors |
|
788 |
receiver:self). |
|
172 | 789 |
|
790 |
((sel := fileListView selection) isNil or:[sel isEmpty]) ifTrue:[ |
|
1628 | 791 |
m disableAll:#(fileGet fileInsert |
792 |
fileGetInfo fileGetLongInfo |
|
793 |
fileFileIn fileFileInLazy |
|
794 |
fileRemove fileRename). |
|
795 |
(m subMenuAt:#stxTools) |
|
796 |
disableAll:#(openChangesBrowser openEditor openHTMLReader openImageInspector) |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
797 |
] ifFalse:[ |
1628 | 798 |
fileListView selection size > 1 ifTrue:[ |
799 |
m disableAll:#( fileGet fileInsert fileGetInfo fileGetLongInfo fileRename ) |
|
800 |
] |
|
172 | 801 |
]. |
802 |
||
803 |
^m |
|
252 | 804 |
|
1396 | 805 |
"Modified: / 16.1.1998 / 16:42:59 / stefan" |
1731 | 806 |
"Modified: / 20.7.1998 / 18:17:18 / cg" |
172 | 807 |
! |
808 |
||
809 |
filePrint |
|
1162 | 810 |
"send a files contents to the printer (not in the menu)" |
811 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
812 |
|fileName path inStream printStream line| |
172 | 813 |
|
294 | 814 |
self withWaitCursorDo:[ |
1329 | 815 |
fileName := self getSelectedFileName. |
816 |
fileName notNil ifTrue:[ |
|
817 |
path := currentDirectory filenameFor:fileName. |
|
818 |
(path type == #regular) ifTrue:[ |
|
819 |
inStream := path readStream. |
|
820 |
inStream isNil ifFalse:[ |
|
821 |
printStream := PrinterStream new. |
|
822 |
printStream notNil ifTrue:[ |
|
823 |
[inStream atEnd] whileFalse:[ |
|
824 |
line := inStream nextLine. |
|
825 |
printStream nextPutLine:line. |
|
826 |
]. |
|
827 |
printStream close |
|
828 |
]. |
|
829 |
inStream close |
|
830 |
] |
|
831 |
] |
|
832 |
]. |
|
833 |
0 "compiler hint" |
|
172 | 834 |
] |
294 | 835 |
|
1162 | 836 |
"Modified: 23.4.1997 / 13:05:40 / cg" |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
837 |
"Modified: 18.9.1997 / 16:29:17 / stefan" |
172 | 838 |
! |
839 |
||
840 |
fileRemove |
|
841 |
"remove the selected file(s). |
|
842 |
Query if user really wants to remove the file. |
|
843 |
- should be enhanced, to look for a ~/.trash directory |
|
844 |
and move files there if it exists (without asking in this case)." |
|
845 |
||
846 |
|sel q| |
|
847 |
||
848 |
sel := fileListView selection. |
|
849 |
sel notNil ifTrue:[ |
|
1317 | 850 |
sel size > 1 ifTrue:[ |
851 |
q := resources string:'remove selected files ?' |
|
852 |
] ifFalse:[ |
|
853 |
q := resources string:'remove ''%1'' ?' with:(fileList at:sel first) |
|
854 |
]. |
|
855 |
(self ask:q yesButton:'remove') ifTrue:[self doRemove] |
|
172 | 856 |
] |
857 |
! |
|
858 |
||
859 |
fileRename |
|
860 |
"rename the selected file(s)" |
|
861 |
||
862 |
|queryBox| |
|
863 |
||
864 |
queryBox := FilenameEnterBox new. |
|
865 |
queryBox okText:(resources at:'rename'). |
|
866 |
self selectedFilesDo:[:oldName | |
|
1317 | 867 |
queryBox title:(resources string:'rename ''%1'' to:' with:oldName). |
868 |
queryBox initialText:oldName. |
|
869 |
queryBox action:[:newName | self doRename:oldName to:newName]. |
|
870 |
queryBox showAtPointer |
|
172 | 871 |
] |
872 |
! |
|
873 |
||
874 |
fileSelect:lineNr |
|
875 |
"selected a file - do nothing here" |
|
1162 | 876 |
|
172 | 877 |
^ self |
1162 | 878 |
|
879 |
"Modified: 23.4.1997 / 13:04:55 / cg" |
|
172 | 880 |
! |
881 |
||
882 |
fileSpawn |
|
883 |
"start another FileBrowser on the selected directory or |
|
884 |
on the same directory if none is selected." |
|
885 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
886 |
|any path| |
172 | 887 |
|
888 |
any := false. |
|
889 |
self selectedFilesDo:[:fileName | |
|
1329 | 890 |
path := currentDirectory filenameFor:fileName. |
891 |
path isDirectory ifTrue:[ |
|
892 |
self class openOn:(path pathName). |
|
893 |
any := true |
|
894 |
] |
|
172 | 895 |
]. |
896 |
any ifFalse:[ |
|
1329 | 897 |
self class openOn:currentDirectory pathName |
172 | 898 |
] |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
899 |
|
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
900 |
"Modified: 18.9.1997 / 16:32:39 / stefan" |
172 | 901 |
! |
902 |
||
903 |
newDirectory |
|
904 |
"ask for and create a new directory" |
|
905 |
||
906 |
|queryBox| |
|
907 |
||
908 |
queryBox := FilenameEnterBox |
|
1317 | 909 |
title:(resources at:'create new directory:') withCRs |
910 |
okText:(resources at:'create') |
|
911 |
action:[:newName | self doCreateDirectory:newName]. |
|
172 | 912 |
queryBox showAtPointer |
1162 | 913 |
|
914 |
"Modified: 23.4.1997 / 13:04:27 / cg" |
|
172 | 915 |
! |
916 |
||
917 |
newFile |
|
918 |
"ask for and create a new file" |
|
919 |
||
920 |
|sel queryBox| |
|
921 |
||
922 |
queryBox := FilenameEnterBox |
|
1418 | 923 |
title:(resources at:'create new file:') withCRs |
924 |
okText:(resources at:'create') |
|
925 |
action:[:newName | newName isEmpty ifFalse:[self doCreateFile:newName]]. |
|
172 | 926 |
sel := subView selection. |
927 |
sel notNil ifTrue:[ |
|
1418 | 928 |
queryBox initialText:(sel asString) |
172 | 929 |
]. |
930 |
queryBox showAtPointer |
|
381 | 931 |
|
1396 | 932 |
"Modified: / 23.4.1997 / 13:04:38 / cg" |
933 |
"Modified: / 16.1.1998 / 16:54:00 / stefan" |
|
172 | 934 |
! |
935 |
||
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
936 |
openAppletViewer |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
937 |
|numItems| |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
938 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
939 |
(numItems := fileListView selection size) > 2 ifTrue:[ |
1329 | 940 |
(self |
941 |
confirm:(resources string:'open for each of the %1 items ?' |
|
942 |
with:numItems)) ifFalse:[^ self]. |
|
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
943 |
]. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
944 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
945 |
JavaInterpreter releaseAllJavaResources. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
946 |
Java markAllClassesUninitialized. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
947 |
Java initAllStaticFields. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
948 |
Java initAllClasses. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
949 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
950 |
self selectedFilesDo:[:fileName | |
1329 | 951 |
|p path| |
952 |
||
953 |
path := currentDirectory filenameFor:fileName. |
|
954 |
path isDirectory ifFalse:[ |
|
955 |
p := Java |
|
956 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
957 |
argumentString:path pathName. |
|
958 |
p resume. |
|
959 |
] |
|
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
960 |
]. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
961 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
962 |
"Modified: 15.8.1997 / 05:03:02 / cg" |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
963 |
"Modified: 18.9.1997 / 17:00:59 / stefan" |
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
964 |
! |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
965 |
|
172 | 966 |
openChangesBrowser |
967 |
"open a change browser on the selected file(s)" |
|
968 |
||
969 |
self openTool:ChangesBrowser |
|
970 |
! |
|
971 |
||
252 | 972 |
openDiffView |
973 |
"open a diff-view" |
|
974 |
||
488
26f8da377672
allow diff of browsers text with file
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
975 |
|box name1 name2 text1 text2 d err nm here l1| |
252 | 976 |
|
961 | 977 |
name1 := ValueHolder newString. |
252 | 978 |
name2 := self getSelectedFileName asValue. |
979 |
here := currentDirectory pathName. |
|
980 |
||
981 |
box := DialogBox new. |
|
982 |
box addTextLabel:'show difference between:'. |
|
983 |
box addFilenameInputFieldOn:name1 in:here tabable:true. |
|
984 |
box addTextLabel:'and:'. |
|
985 |
box addFilenameInputFieldOn:name2 in:here tabable:true. |
|
986 |
||
987 |
box addAbortButton; addOkButton. |
|
988 |
||
989 |
box showAtPointer. |
|
990 |
||
991 |
box accepted ifTrue:[ |
|
1329 | 992 |
name1 := name1 value. |
993 |
name1 isEmpty ifTrue:[ |
|
994 |
text1 := subView contents. |
|
995 |
name1 := nil. |
|
996 |
l1 := 'browser contents' |
|
997 |
] ifFalse:[ |
|
998 |
name1 := currentDirectory filenameFor:name1. |
|
999 |
name1 isReadable ifFalse:[ |
|
1000 |
nm := name1. |
|
1001 |
name1 exists ifFalse:[ |
|
1002 |
err := '%1 does not exist'. |
|
1003 |
] ifTrue:[ |
|
1004 |
err := '%1 is not readable' |
|
1005 |
]. |
|
1006 |
]. |
|
1007 |
l1 := name1 pathName |
|
1008 |
]. |
|
1009 |
||
1010 |
name2 := currentDirectory filenameFor:name2 value. |
|
1011 |
err isNil ifTrue:[ |
|
1012 |
name2 isReadable ifFalse:[ |
|
1013 |
nm := name2. |
|
1014 |
name2 exists ifFalse:[ |
|
1015 |
err := '%1 does not exist'. |
|
1016 |
] ifTrue:[ |
|
1017 |
err := '%1 is not readable' |
|
1018 |
]. |
|
1019 |
]. |
|
1020 |
]. |
|
1021 |
err notNil ifTrue:[ |
|
1022 |
self warn:(resources string:err with:nm pathName). |
|
1023 |
^ self |
|
1024 |
]. |
|
1025 |
||
1026 |
self withWaitCursorDo:[ |
|
1027 |
name1 notNil ifTrue:[ |
|
1028 |
text1 := name1 contents. |
|
1029 |
]. |
|
1030 |
text2 := name2 contents. |
|
1031 |
d := DiffTextView |
|
1032 |
openOn:text1 label:l1 |
|
1033 |
and:text2 label:name2 pathName. |
|
1034 |
d label:'file differences'. |
|
1035 |
] |
|
252 | 1036 |
]. |
1037 |
||
1038 |
"Created: 7.12.1995 / 20:33:58 / cg" |
|
961 | 1039 |
"Modified: 16.1.1997 / 00:51:22 / cg" |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1040 |
"Modified: 18.9.1997 / 17:31:46 / stefan" |
267 | 1041 |
! |
1042 |
||
1043 |
openEditor |
|
1044 |
self openTool:EditTextView |
|
1045 |
! |
|
1046 |
||
1047 |
openHTMLReader |
|
556 | 1048 |
self openTool:HTMLDocumentView |
1049 |
||
1050 |
"Modified: 20.5.1996 / 20:30:58 / cg" |
|
267 | 1051 |
! |
1052 |
||
1053 |
openImageInspector |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1054 |
|img path| |
267 | 1055 |
|
1056 |
self selectedFilesDo:[:fileName | |
|
1329 | 1057 |
path := currentDirectory filenameFor:fileName. |
1058 |
path isDirectory ifFalse:[ |
|
1059 |
img := Image fromFile:(path pathName). |
|
1060 |
img notNil ifTrue:[ |
|
1061 |
img inspect |
|
1062 |
] ifFalse:[ |
|
1063 |
self warn:'unknown format: ' , fileName |
|
1064 |
] |
|
1065 |
] |
|
267 | 1066 |
]. |
1067 |
||
1068 |
"Modified: 17.9.1995 / 17:41:24 / claus" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1069 |
"Modified: 18.9.1997 / 17:05:04 / stefan" |
267 | 1070 |
! |
1071 |
||
1731 | 1072 |
openTerminal |
1073 |
VT100TerminalView open |
|
1074 |
||
1075 |
"Created: / 20.7.1998 / 18:18:15 / cg" |
|
1076 |
! |
|
1077 |
||
267 | 1078 |
openTool:aToolClass |
1079 |
"open a tool on the selected file(s)" |
|
1080 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1081 |
|numItems path| |
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
1082 |
|
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
1083 |
(numItems := fileListView selection size) > 2 ifTrue:[ |
1329 | 1084 |
(self |
1085 |
confirm:(resources string:'open for each of the %1 items ?' |
|
1086 |
with:numItems)) ifFalse:[^ self]. |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
1087 |
]. |
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
1088 |
|
267 | 1089 |
self selectedFilesDo:[:fileName | |
1329 | 1090 |
path := currentDirectory filenameFor:fileName. |
1091 |
path isDirectory ifFalse:[ |
|
1092 |
aToolClass openOn:(path pathName). |
|
1093 |
] |
|
267 | 1094 |
]. |
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
1095 |
|
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
1096 |
"Modified: 14.11.1996 / 16:01:32 / cg" |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1097 |
"Modified: 18.9.1997 / 17:06:18 / stefan" |
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1098 |
! |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1099 |
|
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1100 |
showOrHideTabView |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1101 |
"depending on the showLongList setting, show or hde the tabSpec view" |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1102 |
|
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1103 |
showLongList ifTrue:[ |
1317 | 1104 |
false "self is3D" ifTrue:[ |
1105 |
scrollView topInset:(tabRulerView superView height). |
|
1106 |
tabRulerView superView leftInset:(fileListView originRelativeTo:scrollView) x. |
|
1107 |
] ifFalse:[ |
|
1108 |
scrollView topInset:(tabRulerView height). |
|
1109 |
tabRulerView leftInset:(fileListView originRelativeTo:scrollView) x. |
|
1110 |
]. |
|
1111 |
tabRulerView hiddenTabs:#(1). |
|
1112 |
tabRulerView fixedTabs:#(1). |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1113 |
] ifFalse:[ |
1317 | 1114 |
scrollView topInset:0 |
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1115 |
]. |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1116 |
tabSpec := nil. |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1117 |
|
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1118 |
"Created: 19.4.1997 / 09:50:02 / cg" |
172 | 1119 |
! ! |
1120 |
||
1121 |
!FileBrowser methodsFor:'help '! |
|
1122 |
||
1123 |
helpTextFor:aComponent |
|
1124 |
|s| |
|
1125 |
||
1126 |
aComponent == subView ifTrue:[ |
|
1317 | 1127 |
s := 'HELP_SUBVIEW' |
172 | 1128 |
]. |
1129 |
aComponent == fileListView ifTrue:[ |
|
1317 | 1130 |
s := 'HELP_FILELIST' |
172 | 1131 |
]. |
1132 |
aComponent == filterField ifTrue:[ |
|
1317 | 1133 |
s := 'HELP_FILTER' |
172 | 1134 |
]. |
1135 |
aComponent == labelView ifTrue:[ |
|
1317 | 1136 |
s := 'HELP_PATHFIELD' |
172 | 1137 |
]. |
1138 |
aComponent == commandView ifTrue:[ |
|
1317 | 1139 |
s := 'HELP_COMMANDVIEW' |
172 | 1140 |
]. |
1141 |
s notNil ifTrue:[ |
|
1317 | 1142 |
^ resources string:s |
172 | 1143 |
]. |
1144 |
^ nil |
|
1145 |
! ! |
|
1146 |
||
36 | 1147 |
!FileBrowser methodsFor:'initialization'! |
1148 |
||
172 | 1149 |
currentDirectory:aDirectoryPath |
1150 |
"set the directory to be browsed" |
|
1151 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1152 |
currentDirectory := aDirectoryPath asFilename. |
172 | 1153 |
self changed:#path. |
1327 | 1154 |
|
172 | 1155 |
" |
1156 |
tell my subview (whatever that is) to start its file-dialog |
|
1157 |
(i.e. save-as etc.) in that directory |
|
1158 |
" |
|
1159 |
(subView respondsTo:#directoryForFileDialog:) ifTrue:[ |
|
1329 | 1160 |
subView directoryForFileDialog:currentDirectory |
172 | 1161 |
] |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1162 |
|
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1163 |
"Modified: 16.9.1997 / 14:56:17 / stefan" |
1327 | 1164 |
"Modified: 21.9.1997 / 11:28:49 / cg" |
172 | 1165 |
! |
1166 |
||
1167 |
focusSequence |
|
1168 |
"return the sequence in which ALT-CursorRight steps focus" |
|
1169 |
||
1170 |
|fs| |
|
1171 |
||
1172 |
fs := Array |
|
1418 | 1173 |
with:labelView |
1317 | 1174 |
with:filterField |
1175 |
with:fileListView |
|
1176 |
with:subView. |
|
172 | 1177 |
|
1178 |
commandView notNil ifTrue:[ |
|
1317 | 1179 |
fs := fs copyWith:commandView |
172 | 1180 |
]. |
1181 |
^fs |
|
1182 |
! |
|
1183 |
||
1184 |
initEvents |
|
1185 |
super initEvents. |
|
1186 |
self enableEvent:#visibilityChange. |
|
1187 |
! |
|
1188 |
||
36 | 1189 |
initialize |
1102 | 1190 |
|frame spacing halfSpacing v topFrame labelFrame filterModel |
1329 | 1191 |
buttonPanel img| |
36 | 1192 |
|
1193 |
super initialize. |
|
1194 |
||
819
b78a26650047
initialize fileEncoding to #iso8859
Claus Gittinger <cg@exept.de>
parents:
807
diff
changeset
|
1195 |
fileEncoding := #iso8859. "/ native ST/X encoding |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1196 |
|
52 | 1197 |
"if true, will replace leading spaces by tabs on |
1198 |
file write. If false, they will be written as spaces |
|
1199 |
" |
|
1200 |
compressTabs := resources at:'COMPRESS_TABS' default:true. |
|
1201 |
||
1202 |
" |
|
1203 |
showing long or short by default |
|
1204 |
" |
|
1311 | 1205 |
showLongList := resources at:'LONG_LIST' default:false. |
52 | 1206 |
|
1207 |
" |
|
1208 |
show hidden files or not ? |
|
1209 |
" |
|
1210 |
showDotFiles := resources at:'SHOW_DOT_FILES' default:false. |
|
1211 |
||
1212 |
||
45 | 1213 |
lockUpdate := false. |
1214 |
||
132 | 1215 |
CommandHistory isNil ifTrue:[ |
1495 | 1216 |
CommandHistory := OrderedCollection new. |
1217 |
CommandHistorySize := 50 |
|
132 | 1218 |
]. |
36 | 1219 |
DirectoryHistory isNil ifTrue:[ |
1495 | 1220 |
DirectoryHistory := OrderedCollection new. |
1221 |
DirectoryHistoryWhere := OrderedCollection new. |
|
1222 |
HistorySize := 15. |
|
36 | 1223 |
]. |
132 | 1224 |
commandIndex := 0. |
36 | 1225 |
|
1495 | 1226 |
icons := IdentityDictionary new. |
1227 |
||
1228 |
Icons isNil ifTrue:[ |
|
1229 |
self class initializeIcons |
|
1230 |
]. |
|
1231 |
||
36 | 1232 |
myName := (resources string:self class name). |
1233 |
self label:myName. |
|
45 | 1234 |
|
93 | 1235 |
labelFrame := View |
1495 | 1236 |
origin:(0.0 @ 0.0) |
1237 |
corner:(1.0 @ (font height * 2)) |
|
1238 |
in:self. |
|
52 | 1239 |
|
105 | 1240 |
styleSheet name = #st80 ifTrue:[ |
1495 | 1241 |
labelFrame level:1 |
45 | 1242 |
]. |
36 | 1243 |
|
1244 |
spacing := ViewSpacing. |
|
1245 |
halfSpacing := spacing // 2. |
|
1246 |
||
1100
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
1247 |
" |
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
1248 |
checkBlock is executed by the Processor every checkDelta seconds. |
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
1249 |
We use #pushEvent: to perform the directory update |
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
1250 |
in our windowgroups process. |
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
1251 |
" |
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
1252 |
checkBlock := [self pushEvent:#checkIfDirectoryHasChanged]. |
45 | 1253 |
checkDelta := resources at:'CHECK_DELTA' default:10. |
36 | 1254 |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1255 |
currentDirectory := Filename currentDirectory. |
36 | 1256 |
|
344
3f881dbee13a
use a model for the filter field
Claus Gittinger <cg@exept.de>
parents:
333
diff
changeset
|
1257 |
filterModel := '*' asValue. |
45 | 1258 |
filterField := EditField in:labelFrame. |
1071 | 1259 |
filterField |
1495 | 1260 |
origin:[((width // 4 * 3) + halfSpacing) @ halfSpacing] |
1261 |
corner:(1.0 @ (filterField heightIncludingBorder + halfSpacing + halfSpacing) ). |
|
1071 | 1262 |
filterField rightInset:halfSpacing. |
344
3f881dbee13a
use a model for the filter field
Claus Gittinger <cg@exept.de>
parents:
333
diff
changeset
|
1263 |
filterField model:filterModel. |
45 | 1264 |
|
36 | 1265 |
self initializeFilterPattern. |
344
3f881dbee13a
use a model for the filter field
Claus Gittinger <cg@exept.de>
parents:
333
diff
changeset
|
1266 |
filterModel onChangeSend:#filterPatternChanged to:self. |
3f881dbee13a
use a model for the filter field
Claus Gittinger <cg@exept.de>
parents:
333
diff
changeset
|
1267 |
"/ filterField leaveAction:[:key | fileListView scrollToTop. self updateCurrentDirectory]. |
36 | 1268 |
|
1327 | 1269 |
"/ labelView := Label in:labelFrame. |
1270 |
"/ labelView origin:(halfSpacing @ halfSpacing) |
|
1271 |
"/ extent:[((width // 4 * 3) - spacing - borderWidth) |
|
1272 |
"/ @ |
|
1273 |
"/ (filterField heightIncludingBorder) |
|
1274 |
"/ "(font height + font descent)" |
|
1275 |
"/ ]. |
|
1276 |
"/ labelView adjust:#right. |
|
1277 |
"/ labelView borderWidth:0. |
|
1278 |
"/ labelView model:self; menu:#labelMenu; aspect:#path; labelMessage:#path. |
|
1279 |
"/ labelFrame model:self; menu:#labelMenu. |
|
1280 |
||
1281 |
labelView := FilenameEditField in:labelFrame. |
|
1282 |
labelView |
|
1495 | 1283 |
origin:(halfSpacing @ halfSpacing) |
1284 |
extent:[((width // 4 * 3) - spacing - borderWidth) |
|
1285 |
@ |
|
1286 |
(filterField heightIncludingBorder) |
|
1287 |
"(font height + font descent)" |
|
1288 |
]. |
|
1327 | 1289 |
labelView menu:#labelMenu; aspect:#path; changeMessage:#pathChanged:. |
1290 |
labelView model:self. |
|
1291 |
labelView backgroundColor:(labelFrame viewBackground). |
|
73 | 1292 |
labelFrame model:self; menu:#labelMenu. |
1329 | 1293 |
labelView cursorType:#solidCaret; cursorTypeNoFocus:#none. |
1294 |
labelView level:0. |
|
1295 |
labelView borderWidth:0. |
|
1296 |
||
1297 |
killButton := Button label:(resources string:'kill') in:self. |
|
1298 |
"/ killButton origin:(halfSpacing @ halfSpacing) |
|
1299 |
"/ extent:(killButton width @ filterField height). |
|
1300 |
killButton origin:(halfSpacing @ 1.0). |
|
1301 |
killButton topInset:(killButton height negated). |
|
1302 |
killButton beInvisible. |
|
1303 |
||
1304 |
pauseToggle := Toggle label:(resources string:'pause') in:self. |
|
1305 |
"/ pauseToggle origin:((killButton corner x + 50) @ halfSpacing) |
|
1306 |
"/ extent:(pauseToggle width @ filterField height). |
|
1307 |
pauseToggle origin:((killButton corner x + ViewSpacing + 20) @ 1.0). |
|
1308 |
pauseToggle topInset:(pauseToggle height negated). |
|
1309 |
pauseToggle beInvisible. |
|
36 | 1310 |
|
132 | 1311 |
self initializeCommandViewIn:self. |
1312 |
||
1313 |
"/ frame := VariableVerticalPanel |
|
1314 |
"/ origin:[frame borderWidth negated |
|
1315 |
"/ @ |
|
1316 |
"/ labelFrame height |
|
1317 |
"/ "/ (labelView height + labelView origin y + spacing) |
|
1318 |
"/ ] |
|
1319 |
"/ corner:(1.0 @ 1.0) |
|
1320 |
"/ in:self. |
|
1321 |
||
1322 |
frame := VariableVerticalPanel origin:0.0@0.0 corner:1.0@1.0 in:self. |
|
1323 |
frame topInset:labelFrame height. |
|
1324 |
commandView notNil ifTrue:[ |
|
1495 | 1325 |
frame bottomInset:(commandView height + spacing + spacing) |
132 | 1326 |
]. |
36 | 1327 |
|
1102 | 1328 |
topFrame := View in:frame. |
36 | 1329 |
topFrame origin:(0.0 @ 0.0) corner:(1.0 @ 0.3). |
1330 |
||
1104 | 1331 |
false "self is3D" ifTrue:[ |
1495 | 1332 |
v := View in:topFrame. |
1333 |
v level:-1. |
|
1334 |
tabRulerView := TabSpecRuler in:v. |
|
1335 |
tabRulerView level:1. |
|
1336 |
v origin:(0.0@0.0) corner:(1.0@10). |
|
1337 |
tabRulerView origin:(0.0@0.0) corner:(1.0@1.0). |
|
1104 | 1338 |
] ifFalse:[ |
1495 | 1339 |
tabRulerView := TabSpecRuler in:topFrame. |
1340 |
tabRulerView origin:(0.0@0.0) corner:(1.0@10). |
|
1104 | 1341 |
]. |
1102 | 1342 |
tabRulerView borderWidth:0. |
1343 |
tabRulerView synchronousOperation:true. |
|
1344 |
||
1345 |
scrollView := ScrollableView in:topFrame. |
|
1346 |
scrollView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
1347 |
||
1348 |
fileListView := SelectionInListView new. |
|
1349 |
scrollView scrolledView:fileListView. |
|
36 | 1350 |
fileListView action:[:lineNr | self fileSelect:lineNr]. |
1326 | 1351 |
fileListView doubleClickAction:[:lineNr | self fileDoubleClick:lineNr]. |
36 | 1352 |
fileListView multipleSelectOk:true. |
1010 | 1353 |
fileListView delegate:self. |
98 | 1354 |
fileListView menuHolder:self; menuPerformer:self; menuMessage:#fileListMenu. |
1122
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
1355 |
fileListView allowDrag:true. |
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1356 |
fileListView dragObjectConverter:[:obj | |
1495 | 1357 |
|dir nm path idx| |
1358 |
||
1359 |
nm := obj theObject asString. |
|
1360 |
idx := fileListView list indexOf:nm. |
|
1361 |
idx == 0 ifTrue:[ |
|
1362 |
"/ cannot happen ... |
|
1363 |
nil |
|
1364 |
] ifFalse:[ |
|
1365 |
nm := fileList at:idx. |
|
1366 |
dir := currentDirectory pathName asFilename. |
|
1367 |
path := dir constructString:nm. |
|
1368 |
DropObject newFile:path. |
|
1369 |
] |
|
1370 |
]. |
|
1158
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1371 |
|
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1372 |
"/ sigh - must be delayed - origin is not yet fixe |
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1373 |
"/ tabRulerView leftInset:(fileListView originRelativeTo:scrollView) x. |
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1374 |
"/ self showOrHideTabView. |
1102 | 1375 |
|
36 | 1376 |
v := self initializeSubViewIn:frame. |
132 | 1377 |
|
36 | 1378 |
v origin:(0.0 @ 0.3) corner:(1.0 @ 1.0). |
1379 |
subView := v scrolledView. |
|
1380 |
(subView respondsTo:#directoryForFileDialog:) ifTrue:[ |
|
1495 | 1381 |
subView directoryForFileDialog:currentDirectory |
36 | 1382 |
]. |
1383 |
||
1329 | 1384 |
"/ buttonPanel := HorizontalPanelView in:self. |
1385 |
"/ buttonPanel horizontalLayout:#leftSpace. |
|
1386 |
"/ buttonPanel verticalSpace:0. |
|
1387 |
"/ "/ buttonPanel verticalLayout:#top. |
|
1388 |
"/ buttonPanel borderWidth:0. |
|
1389 |
"/ |
|
1390 |
"/ buttonPanel |
|
1391 |
"/ origin:(0.5 @ halfSpacing) |
|
1392 |
"/ extent:[((width // 4) - spacing - borderWidth) |
|
1393 |
"/ @ |
|
1394 |
"/ (buttonPanel preferredExtent y max:(labelView height)) |
|
1395 |
"/ ]. |
|
1396 |
"/ "/ buttonPanel level:-1. |
|
1397 |
"/ |
|
1398 |
"/ upButton := Button in:buttonPanel. |
|
1399 |
"/ img := Image fromFile:'bitmaps/xpmBitmaps/document_images/tiny_yellow_dir_up.xpm'. |
|
1400 |
"/ upButton label:(img ? 'up'). |
|
1401 |
"/ upButton action:[self changeToParentDirectory]. |
|
1328 | 1402 |
|
36 | 1403 |
ObjectMemory addDependent:self. |
132 | 1404 |
|
1405 |
"Modified: 6.9.1995 / 20:26:06 / claus" |
|
1329 | 1406 |
"Modified: 16.9.1997 / 14:52:46 / stefan" |
1341 | 1407 |
"Modified: 8.10.1997 / 17:07:27 / cg" |
36 | 1408 |
! |
1409 |
||
132 | 1410 |
initializeCommandViewIn:frame |
1411 |
"set up the command view - can be redefined in subclasses as empty, |
|
1412 |
if no commandView is wanted" |
|
1413 |
||
1414 |
||
1415 |
commandView := EditField origin:0.0@1.0 corner:1.0@1.0 in:frame. |
|
1303 | 1416 |
commandView allInset:ViewSpacing//2. |
132 | 1417 |
commandView topInset:(commandView preferredExtent y negated - ViewSpacing). |
1418 |
||
133 | 1419 |
"/ commandView contents:'** no commands which require input here **'. |
132 | 1420 |
|
142 | 1421 |
commandView entryCompletionBlock:[:contents | |
1329 | 1422 |
|newString| |
1423 |
||
1424 |
newString := Filename |
|
1425 |
filenameCompletionFor:contents |
|
1426 |
directory:currentDirectory |
|
1427 |
directoriesOnly:false |
|
1428 |
filesOnly:false |
|
1429 |
ifMultiple:[:dir | commandView flash.]. |
|
1430 |
commandView contents:newString. |
|
1431 |
commandView cursorToEndOfLine. |
|
132 | 1432 |
]. |
1433 |
commandView leaveAction:[:key | |
|
1329 | 1434 |
|cmd nCmd empty| |
1435 |
||
1436 |
(key == #CursorDown |
|
1437 |
or:[key == #CursorUp]) ifTrue:[ |
|
1438 |
nCmd := CommandHistory size. |
|
1439 |
nCmd == 0 ifTrue:[ |
|
1440 |
empty := true |
|
1441 |
] ifFalse:[ |
|
1442 |
key == #CursorUp ifTrue:[ |
|
1443 |
commandIndex == nCmd ifTrue:[ |
|
1444 |
commandView flash. |
|
1445 |
]. |
|
1446 |
commandIndex := (commandIndex + 1) min:nCmd |
|
1447 |
] ifFalse:[ |
|
1448 |
commandIndex == 1 ifTrue:[ |
|
1449 |
commandView flash. |
|
1450 |
empty := true. |
|
1451 |
]. |
|
1452 |
commandIndex := (commandIndex - 1) max:1. |
|
1453 |
]. |
|
1454 |
]. |
|
1455 |
empty == true ifTrue:[ |
|
1456 |
commandView contents:nil |
|
1457 |
] ifFalse:[ |
|
1458 |
commandView contents:(CommandHistory at:commandIndex). |
|
1459 |
] |
|
1460 |
]. |
|
1461 |
key == #Return ifTrue:[ |
|
1462 |
cmd := commandView contents. |
|
1463 |
||
1464 |
subView insertLine:( |
|
1465 |
Text string:('>> ' , cmd) |
|
1466 |
emphasis:(Array with:#bold with:#underline with:(#color->Color blue)) |
|
539
33b603dd30ba
replaced ColoredListEntry by Text
Claus Gittinger <cg@exept.de>
parents:
525
diff
changeset
|
1467 |
"/ ColoredListEntry string:('>> ' , cmd) color:Color blue |
1329 | 1468 |
) |
1469 |
before:(subView cursorLine). |
|
1470 |
subView cursorDown:1. |
|
133 | 1471 |
|
1472 |
"/ subView insertStringAtCursor:cmd. |
|
1473 |
"/ subView insertCharAtCursor:(Character cr). |
|
132 | 1474 |
|
1329 | 1475 |
(cmd notNil and:[cmd notEmpty]) ifTrue:[ |
1476 |
self class addToCommandHistory:cmd for:nil. |
|
1477 |
self doExecuteCommand:cmd replace:false. |
|
1478 |
commandView contents:nil. |
|
1479 |
commandIndex := 0 |
|
1480 |
] |
|
1481 |
] |
|
132 | 1482 |
]. |
1483 |
||
133 | 1484 |
"Modified: 7.9.1995 / 15:48:45 / claus" |
1303 | 1485 |
"Modified: 30.8.1997 / 19:22:52 / cg" |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1486 |
"Modified: 18.9.1997 / 16:55:01 / stefan" |
132 | 1487 |
! |
1488 |
||
172 | 1489 |
initializeFilterPattern |
1490 |
"set an initial matchpattern - can be redefined in subclasses" |
|
1491 |
||
344
3f881dbee13a
use a model for the filter field
Claus Gittinger <cg@exept.de>
parents:
333
diff
changeset
|
1492 |
filterField model value:'*' |
172 | 1493 |
! |
1494 |
||
1495 |
initializeSubViewIn:frame |
|
1496 |
"set up the contents view - can be redefined in subclasses for |
|
1497 |
different view types (SoundFileBrowser/ImageBrowsers etc.)" |
|
1498 |
||
1499 |
^ HVScrollableView for:CodeView miniScrollerH:true miniScrollerV:false in:frame. |
|
1158
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1500 |
! |
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1501 |
|
1247 | 1502 |
postRealize |
1503 |
super postRealize. |
|
1158
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1504 |
self showOrHideTabView. |
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1505 |
|
1247 | 1506 |
"Created: 24.7.1997 / 18:13:46 / cg" |
172 | 1507 |
! ! |
1508 |
||
1509 |
!FileBrowser methodsFor:'misc user interaction'! |
|
1510 |
||
1511 |
destroy |
|
1512 |
"destroy view and boxes" |
|
1513 |
||
1514 |
ObjectMemory removeDependent:self. |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1515 |
self stopUpdateProcess. |
172 | 1516 |
checkBlock := nil. |
1517 |
super destroy |
|
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
1518 |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1519 |
"Modified: 19.4.1997 / 13:51:48 / cg" |
172 | 1520 |
! |
1521 |
||
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1522 |
discardChangesDialog |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1523 |
"ask the user if changes should be discarded, |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1524 |
return true if changes should be discarded, false otherwise" |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1525 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1526 |
^ self askIfModified:'contents has not been saved.\\Modifications will be lost when directory is changed.' |
1393 | 1527 |
yesButton:'change' |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1528 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1529 |
"Created: 2.10.1997 / 14:08:37 / stefan" |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1530 |
! |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1531 |
|
346 | 1532 |
filterPatternChanged |
1533 |
fileListView scrollToTop. |
|
1534 |
self updateCurrentDirectory |
|
1535 |
! |
|
1536 |
||
172 | 1537 |
terminate |
1538 |
"exit FileBrowser" |
|
1539 |
||
1540 |
(self askIfModified:'contents has not been saved.\\Modifications will be lost when FileBrowser is closed.' |
|
1317 | 1541 |
yesButton:'close') ifTrue:[self destroy] |
172 | 1542 |
! |
1543 |
||
1544 |
update:what with:someArgument from:changedObject |
|
1545 |
realized ifFalse:[^ self]. |
|
36 | 1546 |
|
172 | 1547 |
(what == #aboutToExit) ifTrue:[ |
1317 | 1548 |
"system wants to shut down this |
1549 |
- if text was modified, pop up, and ask user and save if requested." |
|
1550 |
||
1551 |
(subView modified and:[subView contentsWasSaved not]) ifTrue:[ |
|
1552 |
self raiseDeiconified. |
|
1553 |
||
1554 |
(self |
|
1555 |
ask:(resources at:'FileBrowser:\\contents has not been saved.\\Save before exiting ?') |
|
1556 |
yesButton:'save' |
|
1557 |
noButton:'don''t save') |
|
1558 |
ifTrue:[ |
|
1559 |
subView acceptAction notNil ifTrue:[ |
|
1560 |
subView accept |
|
1561 |
] ifFalse:[ |
|
1562 |
subView save |
|
1563 |
] |
|
1564 |
] |
|
1565 |
]. |
|
1566 |
^ self |
|
172 | 1567 |
]. |
1568 |
changedObject == tabSpec ifTrue:[ |
|
1317 | 1569 |
fileListView invalidate |
172 | 1570 |
]. |
380 | 1571 |
|
585
be0241bf7268
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
564
diff
changeset
|
1572 |
"Modified: 29.5.1996 / 16:13:43 / cg" |
172 | 1573 |
! ! |
1574 |
||
1575 |
!FileBrowser methodsFor:'pathField user interaction'! |
|
1576 |
||
1271 | 1577 |
addDirToJavaClassPath |
1578 |
"add the current path to javas classPath |
|
1579 |
(only available with ST/J System" |
|
1580 |
||
1581 |
Java addToClassPath:currentDirectory pathName |
|
1582 |
||
1583 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
1584 |
"Created: 1.8.1997 / 21:25:22 / cg" |
|
1585 |
! |
|
1586 |
||
1272 | 1587 |
addDirToJavaSourcePath |
1588 |
"add the current path to javas sourcePath |
|
1589 |
(only available with ST/J System" |
|
1590 |
||
1591 |
Java addToSourcePath:currentDirectory pathName |
|
1592 |
||
1593 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
1594 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
1595 |
! |
|
1596 |
||
172 | 1597 |
changeCurrentDirectory |
1598 |
"if text was modified show a queryBox, |
|
1329 | 1599 |
otherwise ask for & change to that directory" |
172 | 1600 |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1601 |
self discardChangesDialog ifTrue:[ |
1393 | 1602 |
self queryForDirectoryToChange |
36 | 1603 |
] |
1329 | 1604 |
|
1605 |
"Modified: 21.9.1997 / 23:45:35 / cg" |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1606 |
"Modified: 2.10.1997 / 14:09:02 / stefan" |
36 | 1607 |
! |
1608 |
||
172 | 1609 |
changeDirectoryTo:aDirectoryName |
1610 |
"sent from label menu to change back to a previous directory" |
|
132 | 1611 |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1612 |
self discardChangesDialog ifTrue:[ |
1393 | 1613 |
self doChangeCurrentDirectoryTo:aDirectoryName updateHistory:false. |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1614 |
]. |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1615 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1616 |
"Modified: 2.10.1997 / 14:09:24 / stefan" |
172 | 1617 |
! |
1618 |
||
1329 | 1619 |
changeToDefaultDirectory |
1620 |
"if text was modified show a queryBox, |
|
1621 |
otherwise change immediately to the default directory" |
|
1622 |
||
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1623 |
self discardChangesDialog ifTrue:[ |
1393 | 1624 |
self doChangeToDefaultDirectory |
1329 | 1625 |
] |
1626 |
||
1627 |
"Modified: 21.9.1997 / 23:45:04 / cg" |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1628 |
"Modified: 2.10.1997 / 14:09:33 / stefan" |
1329 | 1629 |
! |
1630 |
||
172 | 1631 |
changeToHomeDirectory |
1632 |
"if text was modified show a queryBox, |
|
1329 | 1633 |
otherwise change immediately to the home directory" |
132 | 1634 |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1635 |
self discardChangesDialog ifTrue:[ |
1393 | 1636 |
self doChangeToHomeDirectory |
172 | 1637 |
] |
1329 | 1638 |
|
1639 |
"Modified: 21.9.1997 / 23:45:10 / cg" |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1640 |
"Modified: 2.10.1997 / 14:09:42 / stefan" |
172 | 1641 |
! |
45 | 1642 |
|
172 | 1643 |
changeToParentDirectory |
1644 |
"if text was modified show a queryBox, |
|
1329 | 1645 |
otherwise change immediately to the parent directory" |
45 | 1646 |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1647 |
self discardChangesDialog ifTrue:[ |
1393 | 1648 |
self doChangeToParentDirectory |
36 | 1649 |
] |
1329 | 1650 |
|
1651 |
"Modified: 21.9.1997 / 23:45:15 / cg" |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1652 |
"Modified: 2.10.1997 / 14:09:55 / stefan" |
98 | 1653 |
! |
1654 |
||
172 | 1655 |
copyPath |
1656 |
"copy current path into cut & paste buffer" |
|
1657 |
||
873 | 1658 |
self setTextSelection:currentDirectory pathName |
1659 |
||
1660 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
172 | 1661 |
! |
1662 |
||
1663 |
labelMenu |
|
1040 | 1664 |
"return the popUpMenu for the path label" |
1665 |
||
1235
13610578a5d2
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
1666 |
<resource: #programMenu> |
1040 | 1667 |
|
172 | 1668 |
|labels selectors args menu| |
1669 |
||
1670 |
labels := #( |
|
1418 | 1671 |
'copy path' |
1672 |
'-' |
|
1673 |
'up' |
|
1674 |
'back' |
|
1675 |
'change to home-directory' |
|
1676 |
'change to default-directory' |
|
1677 |
'change directory ...' |
|
1678 |
). |
|
98 | 1679 |
|
172 | 1680 |
selectors := #( |
1418 | 1681 |
copyPath |
1682 |
nil |
|
1683 |
changeToParentDirectory |
|
1684 |
changeToPreviousDirectory |
|
1685 |
changeToHomeDirectory |
|
1686 |
changeToDefaultDirectory |
|
1687 |
changeCurrentDirectory |
|
1688 |
). |
|
1400 | 1689 |
|
1690 |
(JavaClassReader notNil and:[JavaClassReader isLoaded]) ifTrue:[ |
|
1418 | 1691 |
labels := labels , #('-' 'add to JavaClassPath' 'add to JavaSourcePath' 'remove from JavaClassPath' 'remove from JavaSourcePath'). |
1692 |
selectors := selectors , #(nil #addDirToJavaClassPath #addDirToJavaSourcePath #removeDirFromJavaClassPath #removeDirFromJavaSourcePath). |
|
1271 | 1693 |
]. |
1694 |
||
172 | 1695 |
args := Array new:(labels size). |
126 | 1696 |
|
172 | 1697 |
DirectoryHistory size > 0 ifTrue:[ |
1418 | 1698 |
labels := labels copyWith:'-'. |
1699 |
selectors := selectors copyWith:nil. |
|
1700 |
args := args copyWith:nil. |
|
1701 |
||
1702 |
DirectoryHistory do:[:dirName | |
|
1703 |
labels := labels copyWith:dirName. |
|
1704 |
selectors := selectors copyWith:#changeDirectoryTo:. |
|
1705 |
args := args copyWith:dirName |
|
1706 |
] |
|
123 | 1707 |
]. |
172 | 1708 |
|
1709 |
menu := PopUpMenu |
|
1418 | 1710 |
labels:(resources array:labels) |
1711 |
selectors:selectors |
|
1712 |
args:args |
|
1713 |
receiver:self. |
|
172 | 1714 |
|
1715 |
previousDirectory isNil ifTrue:[ |
|
1418 | 1716 |
menu disable:#changeToPreviousDirectory. |
132 | 1717 |
]. |
1400 | 1718 |
(JavaClassReader notNil and:[JavaClassReader isLoaded]) ifTrue:[ |
1418 | 1719 |
(Java classPath includes:currentDirectory pathName) ifTrue:[ |
1720 |
menu disable:#addDirToJavaClassPath |
|
1721 |
] ifFalse:[ |
|
1722 |
menu disable:#removeDirFromJavaClassPath |
|
1723 |
]. |
|
1724 |
(Java sourcePath includes:currentDirectory pathName) ifTrue:[ |
|
1725 |
menu disable:#addDirToJavaSourcePath |
|
1726 |
] ifFalse:[ |
|
1727 |
menu disable:#removeDirFromJavaSourcePath |
|
1728 |
]. |
|
1393 | 1729 |
]. |
172 | 1730 |
^menu. |
1040 | 1731 |
|
1400 | 1732 |
"Modified: / 17.1.1998 / 10:49:16 / cg" |
172 | 1733 |
! |
1734 |
||
1327 | 1735 |
pathChanged:newPath |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1736 |
"change directory to newPath. If newPath is a filename, change |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1737 |
to its directory and get get the file." |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1738 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1739 |
|f name idx| |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1740 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1741 |
self discardChangesDialog ifTrue:[ |
1393 | 1742 |
f := newPath asFilename. |
1743 |
(f isDirectory) ifTrue:[ |
|
1744 |
self changeDirectoryTo:newPath |
|
1745 |
] ifFalse:[ |
|
1746 |
self changeDirectoryTo:(f directoryName). |
|
1747 |
self changed:#path. |
|
1748 |
name := f baseName. |
|
1749 |
idx := fileList indexOf:name. |
|
1750 |
fileListView selection:idx. |
|
1751 |
self fileSelect:name. |
|
1752 |
self fileGet:true. |
|
1753 |
]. |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1754 |
] ifFalse:[ |
1393 | 1755 |
self changed:#path. |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1756 |
]. |
1327 | 1757 |
|
1758 |
"Created: 21.9.1997 / 10:43:12 / cg" |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1759 |
"Modified: 7.10.1997 / 14:10:39 / stefan" |
1327 | 1760 |
! |
1761 |
||
172 | 1762 |
queryForDirectoryToChange |
1763 |
"query for new directory" |
|
123 | 1764 |
|
1168
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
1765 |
|queryBox dirName| |
98 | 1766 |
|
172 | 1767 |
queryBox := FilenameEnterBox |
1317 | 1768 |
title:(resources at:'change directory to:') withCRs |
1769 |
okText:(resources at:'change') |
|
1770 |
action:[:newName | dirName := newName]. |
|
172 | 1771 |
"/ queryBox initialText:''. |
1168
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
1772 |
queryBox showAtPointer. |
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
1773 |
queryBox destroy. |
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
1774 |
self doChangeCurrentDirectoryTo:dirName updateHistory:true. |
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
1775 |
|
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
1776 |
"Modified: 28.4.1997 / 19:50:52 / cg" |
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
1777 |
"Modified: 28.4.1997 / 22:30:40 / dq" |
1271 | 1778 |
! |
1779 |
||
1780 |
removeDirFromJavaClassPath |
|
1781 |
"remove the current path from javas classPath |
|
1782 |
(only available with ST/J System" |
|
1783 |
||
1784 |
Java removeFromClassPath:currentDirectory pathName |
|
1785 |
||
1786 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
1787 |
"Created: 1.8.1997 / 21:25:36 / cg" |
|
1272 | 1788 |
! |
1789 |
||
1790 |
removeDirFromJavaSourcePath |
|
1791 |
"remove the current path from javas sourcePath |
|
1792 |
(only available with ST/J System" |
|
1793 |
||
1794 |
Java removeFromSourcePath:currentDirectory pathName |
|
1795 |
||
1796 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
1797 |
"Created: 2.8.1997 / 14:11:41 / cg" |
|
36 | 1798 |
! ! |
1799 |
||
1800 |
!FileBrowser methodsFor:'private'! |
|
1801 |
||
172 | 1802 |
ask:question yesButton:yesButtonText |
1803 |
"common method to ask a yes/no question; return true or false" |
|
36 | 1804 |
|
172 | 1805 |
^ self ask:question yesButton:yesButtonText noButton:'cancel' |
1806 |
! |
|
93 | 1807 |
|
172 | 1808 |
ask:question yesButton:yesButtonText noButton:noButtonText |
36 | 1809 |
"common method to ask a yes/no question" |
1810 |
||
380 | 1811 |
^ Dialog |
1317 | 1812 |
confirm:question withCRs |
1813 |
yesLabel:(resources at:yesButtonText) |
|
1814 |
noLabel:(resources at:noButtonText) |
|
37 | 1815 |
|
380 | 1816 |
"Modified: 21.2.1996 / 01:19:21 / cg" |
36 | 1817 |
! |
1818 |
||
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1819 |
askForCommandFor:fileName thenDo:aBlock |
172 | 1820 |
"setup and launch a querybox to ask for unix command. |
1821 |
Then evaluate aBlock passing the command-string as argument." |
|
93 | 1822 |
|
1170 | 1823 |
|box| |
93 | 1824 |
|
172 | 1825 |
box := FilenameEnterBox |
1329 | 1826 |
title:(resources at:'execute unix command:') |
1827 |
okText:(resources at:'execute') |
|
1828 |
action:aBlock. |
|
79 | 1829 |
|
172 | 1830 |
fileName notNil ifTrue:[ |
1329 | 1831 |
self initialCommandFor:fileName into:box. |
172 | 1832 |
]. |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1833 |
box directory:currentDirectory. |
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1834 |
box showAtPointer. |
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1835 |
box destroy. |
36 | 1836 |
|
172 | 1837 |
"Modified: 7.9.1995 / 10:31:54 / claus" |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1838 |
"Modified: 16.9.1997 / 15:35:10 / stefan" |
36 | 1839 |
! |
1840 |
||
98 | 1841 |
askIfModified:question yesButton:yesButtonText |
1842 |
"tell user, that code has been modified - let her confirm" |
|
1843 |
||
1844 |
(subView modified not or:[subView contentsWasSaved]) ifTrue:[ |
|
1393 | 1845 |
^ true |
98 | 1846 |
]. |
1340 | 1847 |
(self ask:(resources string:question) yesButton:yesButtonText) ifTrue:[ |
1393 | 1848 |
"/ reset modified flag so question is asked only once |
1849 |
subView modified:false. |
|
1850 |
^ true |
|
1340 | 1851 |
]. |
1852 |
^ false |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1853 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
1854 |
"Modified: 2.10.1997 / 14:23:47 / stefan" |
98 | 1855 |
! |
1856 |
||
1162 | 1857 |
getSelectedFileName |
1858 |
"returns the currently selected file; shows an error if |
|
1859 |
multiple files are selected" |
|
1860 |
||
1861 |
|sel| |
|
1862 |
||
1863 |
sel := fileListView selection. |
|
1864 |
(sel size > 1) ifTrue:[ |
|
1317 | 1865 |
self onlyOneSelection |
1162 | 1866 |
] ifFalse:[ |
1317 | 1867 |
sel notNil ifTrue:[ |
1868 |
^ fileList at:sel first |
|
1869 |
] |
|
1162 | 1870 |
]. |
1871 |
^ nil |
|
1872 |
! |
|
1873 |
||
1874 |
onlyOneSelection |
|
1875 |
"show a warning, that only one file must be selected for |
|
1876 |
this operation" |
|
1877 |
||
1878 |
self warn:'exactly one file must be selected !!' |
|
1879 |
! |
|
1880 |
||
1881 |
selectedFilesDo:aBlock |
|
1882 |
"evaluate aBlock on all selected files; |
|
1883 |
show a wait cursor while doing this" |
|
1884 |
||
1885 |
|sel| |
|
1886 |
||
1887 |
sel := fileListView selection. |
|
1888 |
sel notNil ifTrue:[ |
|
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
1889 |
self withWaitCursorDo:[ |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
1890 |
sel do:[:aSelectionIndex | |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
1891 |
aBlock value:(fileList at:aSelectionIndex ) |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
1892 |
] |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
1893 |
] |
1162 | 1894 |
] |
1895 |
||
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
1896 |
"Modified: / 18.6.1998 / 15:29:06 / cg" |
1162 | 1897 |
! |
1898 |
||
1899 |
show:something |
|
1900 |
"show something in subview and undef acceptAction" |
|
1901 |
||
1902 |
subView contents:something. |
|
1903 |
subView acceptAction:nil. |
|
1904 |
subView modified:false. |
|
1905 |
currentFileName := nil |
|
1906 |
! |
|
1907 |
||
1908 |
showAlert:aString with:anErrorString |
|
1909 |
"show an alertbox, displaying the last Unix-error" |
|
1910 |
||
1911 |
|msg| |
|
1912 |
||
1913 |
anErrorString isNil ifTrue:[ |
|
1317 | 1914 |
msg := aString |
1162 | 1915 |
] ifFalse:[ |
1317 | 1916 |
msg := aString , '\\(' , anErrorString , ')' |
1162 | 1917 |
]. |
1918 |
self warn:msg withCRs |
|
1919 |
! |
|
1920 |
||
1921 |
withoutHiddenFiles:aCollection |
|
1922 |
"remove hidden files (i.e. those that start with '.') from |
|
1923 |
the list in aCollection" |
|
1924 |
||
1925 |
|newCollection| |
|
1926 |
||
1927 |
newCollection := aCollection species new. |
|
1928 |
aCollection do:[:fname | |
|
1317 | 1929 |
|ignore| |
1930 |
||
1931 |
ignore := false. |
|
1932 |
||
1933 |
((fname startsWith:'.') and:[fname ~= '..']) ifTrue:[ |
|
1934 |
showDotFiles ifFalse:[ |
|
1935 |
ignore := true |
|
1936 |
] |
|
1937 |
]. |
|
1938 |
ignore ifFalse:[ |
|
1939 |
newCollection add:fname |
|
1940 |
] |
|
1162 | 1941 |
]. |
1942 |
^ newCollection |
|
1943 |
||
1944 |
"Modified: 21.2.1996 / 01:33:18 / cg" |
|
1945 |
! ! |
|
1946 |
||
1947 |
!FileBrowser methodsFor:'private - actions & command execution'! |
|
1948 |
||
1949 |
binaryFileAction:aFilename |
|
1950 |
"for some binary files, if double clicked, we can do some useful |
|
1951 |
action ..." |
|
1952 |
||
1330 | 1953 |
(currentDirectory construct:aFilename) isExecutableProgram ifTrue:[ |
1329 | 1954 |
(OperatingSystem executeCommand:'cd ', currentDirectory pathName, '; ',aFilename) |
1955 |
ifTrue:[^true]. |
|
1162 | 1956 |
]. |
1957 |
^ self imageAction:aFilename |
|
1958 |
||
1959 |
"Modified: 19.6.1996 / 09:44:07 / cg" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1960 |
"Modified: 18.9.1997 / 17:18:04 / stefan" |
1162 | 1961 |
! |
1962 |
||
1358 | 1963 |
doExecuteCommand:commandArg replace:replace |
1162 | 1964 |
"execute a unix command inserting the output of the command. |
1965 |
If replace is true, all text is replaced by the commands output; |
|
1966 |
otherwise, its inserted as selected text at the cursor position." |
|
1967 |
||
1493 | 1968 |
|command stream line lnr myProcess myPriority startLine startCol stopSignal |
1969 |
pauseSignal access stillReplacing pauseHolder lowerFrameView| |
|
1162 | 1970 |
|
1358 | 1971 |
command := commandArg asString. |
1972 |
||
1162 | 1973 |
access := Semaphore forMutualExclusion name:'accessLock'. |
1974 |
stopSignal := Signal new. |
|
1335
4f8ee6e1d8e1
Use signal instead polling for pauseButton in #doExecuteCommand:replace:.
Stefan Vogel <sv@exept.de>
parents:
1334
diff
changeset
|
1975 |
pauseSignal := Signal new. |
1162 | 1976 |
|
1977 |
" |
|
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1978 |
The following is tricky: |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1979 |
the pauseToggle & killButton will |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1980 |
be handled by their own windowGroup process. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1981 |
This means, that they respond to events even though |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1982 |
I myself am reading the commands output. |
1162 | 1983 |
" |
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1984 |
|
1329 | 1985 |
commandView beInvisible. |
1986 |
||
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1987 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1988 |
must take kill & pauseButtons out of my group |
1162 | 1989 |
" |
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1990 |
killButton windowGroup:nil. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1991 |
pauseToggle windowGroup:nil. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1992 |
|
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1993 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1994 |
bring them to front, and turn hidden-mode off |
1162 | 1995 |
" |
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1996 |
killButton raise; beVisible. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1997 |
pauseToggle raise; beVisible. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
1998 |
|
1162 | 1999 |
" |
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2000 |
kill will make me raise the stopSignal when pressed |
1162 | 2001 |
" |
2002 |
killButton |
|
1508
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2003 |
action:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2004 |
stream notNil ifTrue:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2005 |
access critical:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2006 |
myProcess interruptWith:[stopSignal raiseRequest]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2007 |
] |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2008 |
] |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2009 |
]. |
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2010 |
|
1162 | 2011 |
" |
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2012 |
pause makes me stop reading the commands output |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2013 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2014 |
pauseHolder := false asValue. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2015 |
pauseToggle model:pauseHolder. |
1335
4f8ee6e1d8e1
Use signal instead polling for pauseButton in #doExecuteCommand:replace:.
Stefan Vogel <sv@exept.de>
parents:
1334
diff
changeset
|
2016 |
pauseToggle pressAction:[ |
1508
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2017 |
stream notNil ifTrue:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2018 |
access critical:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2019 |
myProcess interruptWith:[pauseSignal raiseRequest]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2020 |
] |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2021 |
] |
1335
4f8ee6e1d8e1
Use signal instead polling for pauseButton in #doExecuteCommand:replace:.
Stefan Vogel <sv@exept.de>
parents:
1334
diff
changeset
|
2022 |
]. |
4f8ee6e1d8e1
Use signal instead polling for pauseButton in #doExecuteCommand:replace:.
Stefan Vogel <sv@exept.de>
parents:
1334
diff
changeset
|
2023 |
|
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2024 |
|
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2025 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2026 |
start kill button under its own windowgroup |
1162 | 2027 |
" |
2028 |
killButton openAutonomous. |
|
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2029 |
killButton windowGroup process processGroupId:(Processor activeProcess id). |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2030 |
|
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2031 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2032 |
and add the pauseToggle to its windowGroup |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2033 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2034 |
pauseToggle windowGroup:(killButton windowGroup). |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2035 |
|
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2036 |
|
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
2037 |
lowerFrameView := subView superView. |
1162 | 2038 |
|
2039 |
" |
|
2040 |
go fork a pipe and read it |
|
2041 |
" |
|
2042 |
self label:(myName , ': executing ' , (command copyTo:(20 min:command size)) , ' ...'). |
|
2043 |
[ |
|
2044 |
self withWaitCursorDo:[ |
|
1508
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2045 |
stopSignal catch:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2046 |
pauseSignal handle:[:ex| |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2047 |
|noPauseSema| |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2048 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2049 |
"/ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2050 |
"/ allow interaction with |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2051 |
"/ the codeView via the other windowGroup |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2052 |
"/ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2053 |
lowerFrameView windowGroup:(killButton windowGroup). |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2054 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2055 |
"/ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2056 |
"/ wait for pause to be turned off |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2057 |
"/ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2058 |
noPauseSema := Semaphore new. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2059 |
pauseHolder onChangeSend:#signal to:noPauseSema. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2060 |
noPauseSema wait. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2061 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2062 |
"/ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2063 |
"/ no interaction with the codeView ... |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2064 |
"/ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2065 |
lowerFrameView windowGroup:(self windowGroup). |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2066 |
ex proceed. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2067 |
] do:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2068 |
startLine := subView cursorLine. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2069 |
startCol := subView cursorCol. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2070 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2071 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2072 |
this can be a time consuming operation; therefore lower my priority |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2073 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2074 |
myProcess := Processor activeProcess. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2075 |
myPriority := myProcess priority. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2076 |
myProcess priority:(Processor userBackgroundPriority). |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2077 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2078 |
stream := PipeStream |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2079 |
readingFrom:command |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2080 |
errorDisposition:#inline |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2081 |
inDirectory:currentDirectory. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2082 |
stream notNil ifTrue:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2083 |
[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2084 |
|codeView lines noPauseSema| |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2085 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2086 |
stream buffered:true. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2087 |
codeView := subView. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2088 |
codeView unselect. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2089 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2090 |
replace ifTrue:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2091 |
codeView list:nil. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2092 |
lnr := 1. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2093 |
]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2094 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2095 |
stillReplacing := replace. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2096 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2097 |
[stream readWait. stream atEnd] whileFalse:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2098 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2099 |
data available; read up to 100 lines |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2100 |
and insert as a single junk. This speeds up |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2101 |
display of long output (less line-scrolling). |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2102 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2103 |
lines := OrderedCollection new:100. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2104 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2105 |
[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2106 |
line := stream nextLine. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2107 |
line notNil ifTrue:[lines add:line]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2108 |
] doWhile:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2109 |
stream canReadWithoutBlocking |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2110 |
and:[stream atEnd not |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2111 |
and:[lines size < 100]] |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2112 |
]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2113 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2114 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2115 |
need this critical section; otherwise, |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2116 |
we could get the signal while waiting for |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2117 |
an expose event ... |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2118 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2119 |
access critical:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2120 |
lines size > 0 ifTrue:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2121 |
stillReplacing ifTrue:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2122 |
lines do:[:line | |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2123 |
codeView at:lnr put:line withTabsExpanded. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2124 |
codeView cursorToBottom; cursorDown:1. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2125 |
lnr := lnr + 1. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2126 |
lnr > codeView list size ifTrue:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2127 |
stillReplacing := false |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2128 |
] |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2129 |
]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2130 |
] ifFalse:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2131 |
codeView insertLines:lines before:codeView cursorLine. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2132 |
codeView cursorDown:lines size. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2133 |
] |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2134 |
]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2135 |
]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2136 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2137 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2138 |
give others running at same prio a chance too |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2139 |
(especially other FileBrowsers doing the same) |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2140 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2141 |
Processor yield |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2142 |
]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2143 |
] valueNowOrOnUnwindDo:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2144 |
stream shutDown "close". stream := nil. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2145 |
]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2146 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2147 |
"/ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2148 |
"/ the command could have changed the directory |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2149 |
"/ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2150 |
self updateCurrentDirectoryIfChanged |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2151 |
]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2152 |
replace ifTrue:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2153 |
subView modified:false. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2154 |
]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2155 |
] |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2156 |
] |
1162 | 2157 |
] |
2158 |
] valueNowOrOnUnwindDo:[ |
|
1508
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2159 |
|wg| |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2160 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2161 |
self label:myName; iconLabel:myName. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2162 |
myProcess notNil ifTrue:[myProcess priority:myPriority]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2163 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2164 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2165 |
hide the button, and make sure it will stay |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2166 |
hidden when we are realized again |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2167 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2168 |
killButton beInvisible. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2169 |
pauseToggle beInvisible. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2170 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2171 |
commandView beVisible. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2172 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2173 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2174 |
remove the killButton from its group |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2175 |
(otherwise, it will be destroyed when we shut down the group) |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2176 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2177 |
wg := killButton windowGroup. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2178 |
killButton windowGroup:nil. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2179 |
pauseToggle windowGroup:nil. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2180 |
|
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2181 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2182 |
shut down the kill buttons windowgroup |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2183 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2184 |
wg notNil ifTrue:[ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2185 |
wg process terminate. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2186 |
]. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2187 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2188 |
clear its action (actually not needed, but |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2189 |
releases reference to thisContext earlier) |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2190 |
" |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2191 |
killButton action:nil. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2192 |
pauseToggle pressAction:nil. |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2193 |
"/ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2194 |
"/ allow interaction with the codeView |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2195 |
"/ (bring it back into my group) |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2196 |
"/ |
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2197 |
lowerFrameView windowGroup:(self windowGroup). |
1162 | 2198 |
]. |
2199 |
||
2200 |
currentFileName isNil ifTrue:[ |
|
1508
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2201 |
subView modified:false. |
1162 | 2202 |
]. |
2203 |
||
2204 |
subView size > 10000 ifTrue:[ |
|
1508
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2205 |
self warn:'text quite large now - please cut off some lines' |
1162 | 2206 |
] |
2207 |
||
1358 | 2208 |
"Modified: / 21.9.1995 / 11:18:46 / claus" |
2209 |
"Modified: / 26.10.1997 / 16:05:35 / cg" |
|
1508
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
2210 |
"Modified: / 6.3.1998 / 17:32:03 / stefan" |
1162 | 2211 |
! |
2212 |
||
2213 |
imageAction:aFilename |
|
2214 |
"for some image files, if double clicked, we can do some useful |
|
2215 |
action ..." |
|
2216 |
||
2217 |
|img| |
|
2218 |
||
2219 |
(Image isImageFileSuffix:(aFilename asFilename suffix)) |
|
2220 |
ifTrue:[ |
|
1418 | 2221 |
img := Image fromFile:(currentDirectory construct:aFilename). |
2222 |
img notNil ifTrue:[ |
|
2223 |
ImageEditor openOnImage:img. |
|
1410 | 2224 |
"/ img inspect. |
1418 | 2225 |
^ true |
2226 |
] |
|
1162 | 2227 |
]. |
2228 |
^ false |
|
2229 |
||
2230 |
"Created: 19.6.1996 / 09:43:50 / cg" |
|
2231 |
"Modified: 18.4.1997 / 14:56:04 / cg" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2232 |
"Modified: 18.9.1997 / 16:35:48 / stefan" |
1410 | 2233 |
|
2234 |
||
1162 | 2235 |
! |
2236 |
||
2237 |
initialCommandFor:fileName into:aBox |
|
2238 |
"set a useful initial command for execute box." |
|
2239 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2240 |
|cmd select path suffix| |
1162 | 2241 |
|
2242 |
"/ XXX should be changed to take stuff from a config file |
|
2243 |
"/ XXX or from resources. |
|
2244 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2245 |
path := currentDirectory filenameFor:fileName. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2246 |
(path type == #regular) ifTrue:[ |
1542 | 2247 |
path isExecutableProgram ifTrue:[ |
2248 |
aBox initialText:(fileName , ' <arguments>'). |
|
2249 |
^ self |
|
2250 |
]. |
|
2251 |
||
2252 |
select := true. |
|
2253 |
||
2254 |
"some heuristics - my personal preferences ... |
|
2255 |
(actually this should come from a configfile)" |
|
2256 |
||
2257 |
(fileName endsWith:'akefile') ifTrue:[ |
|
2258 |
aBox initialText:'make target' selectFrom:6 to:11. |
|
2259 |
^ self |
|
2260 |
]. |
|
2261 |
||
2262 |
suffix := path suffix. |
|
2263 |
(suffix = 'C') ifTrue:[ |
|
2264 |
cmd := 'g++ -c %1'. |
|
2265 |
select := 6. |
|
2266 |
] ifFalse:[ |
|
2267 |
suffix := suffix asLowercase. |
|
2268 |
(suffix = 'taz') ifTrue:[ |
|
2269 |
aBox initialText:'zcat %1 | tar tvf -'. |
|
2270 |
select := false. |
|
2271 |
]. |
|
2272 |
(suffix = 'tar') ifTrue:[ |
|
2273 |
cmd := 'tar tvf %1'. |
|
2274 |
select := 7. |
|
2275 |
]. |
|
2276 |
(suffix = 'zoo') ifTrue:[ |
|
2277 |
cmd := 'zoo -list %1'. |
|
2278 |
select := 9. |
|
2279 |
]. |
|
2280 |
(suffix = 'zip') ifTrue:[ |
|
2281 |
cmd := 'unzip -l %1'. |
|
2282 |
select := 8. |
|
2283 |
]. |
|
2284 |
(suffix = 'jar') ifTrue:[ |
|
2285 |
cmd := 'unzip -l %1'. |
|
2286 |
select := 8. |
|
2287 |
]. |
|
2288 |
(suffix = 'z') ifTrue:[ |
|
2289 |
(fileName endsWith:'tar.z') ifTrue:[ |
|
2290 |
cmd := 'zcat %1 | tar tvf -'. |
|
2291 |
select := false. |
|
2292 |
] ifFalse:[ |
|
2293 |
cmd := 'uncompress %1' |
|
2294 |
]. |
|
2295 |
]. |
|
2296 |
(suffix = 'gz') ifTrue:[ |
|
2297 |
(fileName endsWith:'tar.gz') ifTrue:[ |
|
2298 |
cmd := ('gunzip < %1 | tar tvf -' ). |
|
2299 |
select := false. |
|
2300 |
] ifFalse:[ |
|
2301 |
cmd := 'gunzip %1'. |
|
2302 |
]. |
|
2303 |
]. |
|
2304 |
(suffix = 'tgz') ifTrue:[ |
|
2305 |
cmd := ('gunzip < %1 | tar tvf -' ). |
|
2306 |
select := false. |
|
2307 |
]. |
|
2308 |
(suffix = 'html') ifTrue:[ |
|
2309 |
cmd := 'netscape %1' |
|
2310 |
]. |
|
2311 |
(suffix = 'htm') ifTrue:[ |
|
2312 |
cmd := 'netscape %1' |
|
2313 |
]. |
|
2314 |
(suffix = 'uue') ifTrue:[ |
|
2315 |
cmd := 'uudecode %1' |
|
2316 |
]. |
|
2317 |
(suffix = 'c') ifTrue:[ |
|
2318 |
cmd := 'cc -c %1'. |
|
2319 |
select := 5. |
|
2320 |
]. |
|
2321 |
(suffix = 'cc') ifTrue:[ |
|
2322 |
cmd := 'g++ -c %1'. |
|
2323 |
select := 6. |
|
2324 |
]. |
|
2325 |
(suffix = 'xbm') ifTrue:[ |
|
2326 |
cmd := 'bitmap %1' |
|
2327 |
]. |
|
2328 |
(suffix = 'ps') ifTrue:[ |
|
2329 |
cmd := 'ghostview %1' |
|
2330 |
]. |
|
2331 |
((suffix = '1') or:[suffix = 'man']) ifTrue:[ |
|
2332 |
cmd := 'nroff -man %1'. |
|
2333 |
select := 10. |
|
2334 |
]. |
|
2335 |
]. |
|
2336 |
||
2337 |
cmd isNil ifTrue:[ |
|
2338 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
2339 |
cmd := '<cmd>' |
|
2340 |
] ifFalse:[ |
|
2341 |
cmd := DefaultCommandPerSuffix |
|
2342 |
at:suffix |
|
2343 |
ifAbsent:'<cmd>'. |
|
2344 |
]. |
|
2345 |
cmd := cmd , ' %1'. |
|
2346 |
]. |
|
2347 |
||
2348 |
cmd := cmd bindWith:fileName. |
|
2349 |
select == false ifTrue:[ |
|
2350 |
aBox initialText:cmd |
|
2351 |
] ifFalse:[ |
|
2352 |
select isInteger ifFalse:[ |
|
2353 |
select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1. |
|
2354 |
]. |
|
2355 |
aBox initialText:cmd selectFrom:1 to:select |
|
2356 |
] |
|
1162 | 2357 |
] |
2358 |
||
1542 | 2359 |
"Modified: / 24.9.1997 / 16:34:52 / stefan" |
2360 |
"Modified: / 9.4.1998 / 17:15:57 / cg" |
|
1162 | 2361 |
! |
2362 |
||
2363 |
nonBinaryFileAction:aFilename |
|
2364 |
"for some nonBinary files, if double clicked, we can do some useful |
|
2365 |
action ..." |
|
2366 |
||
1493 | 2367 |
|fullPath| |
1162 | 2368 |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2369 |
fullPath := currentDirectory filenameFor:aFilename. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2370 |
((fullPath hasSuffix:'htm') or:[fullPath hasSuffix:'html']) ifTrue:[ |
1329 | 2371 |
HTMLDocumentView openOn:fullPath pathName. |
2372 |
^ true |
|
1162 | 2373 |
]. |
2374 |
||
2375 |
OperatingSystem isUNIXlike ifTrue:[ |
|
1329 | 2376 |
(#('.man' '.1' '.2' '.3') findFirst:[:suff | fullPath hasSuffix:suff]) ~~ 0 |
2377 |
ifTrue:[ |
|
2378 |
HTMLDocumentView openFullOnText:(HTMLDocGenerator manPageForFile:fullPath pathName). |
|
2379 |
^ true |
|
2380 |
] |
|
1162 | 2381 |
]. |
2382 |
^ self imageAction:aFilename |
|
2383 |
||
2384 |
"Created: 19.6.1996 / 09:36:38 / cg" |
|
2385 |
"Modified: 4.4.1997 / 10:49:00 / cg" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2386 |
"Modified: 18.9.1997 / 16:58:40 / stefan" |
1162 | 2387 |
! ! |
2388 |
||
2389 |
!FileBrowser methodsFor:'private - directory stuff'! |
|
2390 |
||
1371
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2391 |
addToHistory:path |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2392 |
|pos idx| |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2393 |
|
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2394 |
(DirectoryHistory includes:path) ifFalse:[ |
1393 | 2395 |
DirectoryHistory size >= HistorySize ifTrue:[ |
2396 |
DirectoryHistory removeLast. |
|
2397 |
DirectoryHistoryWhere removeLast |
|
2398 |
] |
|
1371
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2399 |
] ifTrue:[ |
1393 | 2400 |
"already been there before; move the entry to |
2401 |
the beginning, so it will fall out later." |
|
2402 |
||
2403 |
idx := DirectoryHistory indexOf:path. |
|
2404 |
DirectoryHistory removeIndex:idx. |
|
2405 |
pos := DirectoryHistoryWhere at:idx. |
|
2406 |
DirectoryHistoryWhere removeIndex:idx. |
|
1371
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2407 |
]. |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2408 |
DirectoryHistory addFirst:path. |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2409 |
DirectoryHistoryWhere addFirst:pos. |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2410 |
|
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2411 |
"Created: / 8.11.1997 / 17:16:29 / cg" |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2412 |
! |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2413 |
|
172 | 2414 |
changeToPreviousDirectory |
2415 |
"if text was modified show a queryBox, |
|
2416 |
otherwise change immediately to previous directory." |
|
93 | 2417 |
|
172 | 2418 |
previousDirectory isNil ifTrue:[^ self]. |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2419 |
self discardChangesDialog ifTrue:[ |
1393 | 2420 |
self doChangeCurrentDirectoryTo:previousDirectory updateHistory:false |
172 | 2421 |
] |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2422 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2423 |
"Modified: 2.10.1997 / 14:13:40 / stefan" |
36 | 2424 |
! |
2425 |
||
98 | 2426 |
checkIfDirectoryHasChanged |
2427 |
"every checkDelta secs, check if directoy has changed and update the list if so. |
|
2428 |
Also, we check if the file shown has been touched in the meanwhile (for example, |
|
2429 |
from another browser) and say 'outdated' in the label if so. |
|
2430 |
This avoids confusion if the same file is being edited by two browsers. (or other editors). |
|
2431 |
If the text shown in the codeView has been edited, 'modified' is shown. |
|
2432 |
" |
|
2433 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2434 |
|oldSelection nOld newState msg newLabel t| |
98 | 2435 |
|
2436 |
shown ifTrue:[ |
|
1481 | 2437 |
currentDirectory notNil ifTrue:[ |
2438 |
lockUpdate ifTrue:[ |
|
2439 |
Processor removeTimedBlock:checkBlock. |
|
2440 |
Processor addTimedBlock:checkBlock afterSeconds:checkDelta. |
|
2441 |
^ self |
|
2442 |
]. |
|
2443 |
||
2444 |
subView modified ifTrue:[ |
|
2445 |
newState := ' (modified)' |
|
2446 |
]. |
|
2447 |
||
2448 |
(currentDirectory isReadable) ifTrue:[ |
|
2449 |
Processor removeTimedBlock:checkBlock. |
|
2450 |
||
2451 |
t := currentDirectory modificationTime. |
|
2452 |
(t notNil and:[t > timeOfLastCheck]) ifTrue:[ |
|
2453 |
nOld := fileListView numberOfSelections. |
|
2454 |
oldSelection := fileListView selectionValue. |
|
2455 |
self updateCurrentDirectory. |
|
2456 |
nOld ~~ 0 ifTrue:[ |
|
2457 |
nOld > 1 ifTrue:[ |
|
2458 |
oldSelection do:[:element | |
|
2459 |
fileListView addElementToSelection:element |
|
2460 |
] |
|
2461 |
] ifFalse:[ |
|
2462 |
fileListView selectElementWithoutScroll:oldSelection |
|
2463 |
] |
|
2464 |
]. |
|
2465 |
] ifFalse:[ |
|
2466 |
Processor addTimedBlock:checkBlock afterSeconds:checkDelta |
|
2467 |
]. |
|
2468 |
||
2469 |
currentFileName notNil ifTrue:[ |
|
2470 |
|f| |
|
2471 |
f := currentDirectory construct:currentFileName. |
|
2472 |
f exists ifFalse:[ |
|
2473 |
newState := ' (removed)'. |
|
2474 |
] ifTrue:[ |
|
2475 |
f modificationTime > timeOfFileRead ifTrue:[ |
|
2476 |
newState := ' (outdated)'. |
|
2477 |
subView modified ifTrue:[ |
|
2478 |
newState := ' (modified & outdated)' |
|
2479 |
] |
|
2480 |
]. |
|
2481 |
]. |
|
2482 |
]. |
|
2483 |
] ifFalse:[ |
|
2484 |
" |
|
2485 |
if the directory has been deleted, or is not readable ... |
|
2486 |
" |
|
2487 |
(currentDirectory exists) ifFalse:[ |
|
2488 |
msg := 'FileBrowser:\\directory %1 is gone ?!!?' |
|
2489 |
] ifTrue:[ |
|
2490 |
msg := 'FileBrowser:\\directory %1 is no longer readable ?!!?' |
|
2491 |
]. |
|
2492 |
self warn:(resources string:msg with:currentDirectory pathName) withCRs. |
|
2493 |
||
2494 |
fileListView contents:nil. |
|
2495 |
newLabel := myName , ': directory is gone !!'. |
|
2496 |
"/ Processor addTimedBlock:checkBlock afterSeconds:checkDelta |
|
2497 |
]. |
|
2498 |
||
2499 |
newState notNil ifTrue:[ |
|
2500 |
newLabel := myName. |
|
2501 |
currentFileName notNil ifTrue:[ |
|
2502 |
newLabel := newLabel , ': ' , currentFileName |
|
2503 |
]. |
|
2504 |
newLabel := newLabel , newState. |
|
2505 |
]. |
|
2506 |
newLabel notNil ifTrue:[ |
|
2507 |
self label:newLabel. |
|
2508 |
] |
|
2509 |
] |
|
98 | 2510 |
] |
1168
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
2511 |
|
1380
547d31bfa12c
warning string fixed when directory vanishes
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
2512 |
"Modified: / 28.4.1997 / 22:31:02 / dq" |
547d31bfa12c
warning string fixed when directory vanishes
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
2513 |
"Modified: / 16.9.1997 / 15:17:15 / stefan" |
1481 | 2514 |
"Modified: / 18.2.1998 / 17:57:49 / cg" |
98 | 2515 |
! |
2516 |
||
172 | 2517 |
doChangeCurrentDirectoryTo:fileName updateHistory:updateHistory |
2518 |
"verify argument is name of a readable & executable directory |
|
2519 |
and if so, go there" |
|
2520 |
||
1317 | 2521 |
|msg path idx f| |
172 | 2522 |
|
2523 |
self label:myName; iconLabel:myName. |
|
2524 |
fileName notNil ifTrue:[ |
|
1393 | 2525 |
f := (currentDirectory filenameFor:fileName) asAbsoluteFilename. |
2526 |
(f isDirectory) ifTrue:[ |
|
2527 |
(f isReadable) ifTrue:[ |
|
2528 |
(f isExecutable) ifTrue:[ |
|
2529 |
path := currentDirectory pathName. |
|
2530 |
previousDirectory := path. |
|
2531 |
||
2532 |
" |
|
2533 |
remember where we are positioned in the fileList |
|
2534 |
(in case we want to return) |
|
2535 |
" |
|
2536 |
idx := DirectoryHistory indexOf:path. |
|
2537 |
idx ~~ 0 ifTrue:[ |
|
2538 |
DirectoryHistoryWhere at:idx put:fileListView firstLineShown |
|
2539 |
]. |
|
2540 |
||
2541 |
updateHistory ifTrue:[ |
|
2542 |
self addToHistory:path. |
|
2543 |
]. |
|
2544 |
||
2545 |
self setCurrentDirectory:(f pathName). |
|
2546 |
||
2547 |
"/ fetch the new path. |
|
2548 |
path := currentDirectory pathName. |
|
2549 |
||
2550 |
" |
|
2551 |
if we have already been there, look for the |
|
2552 |
position offset, and scroll the fileList |
|
2553 |
" |
|
2554 |
idx := DirectoryHistory indexOf:path. |
|
2555 |
idx ~~ 0 ifTrue:[ |
|
2556 |
|pos| |
|
2557 |
||
2558 |
pos := DirectoryHistoryWhere at:idx. |
|
2559 |
pos notNil ifTrue:[ |
|
2560 |
fileListView scrollToLine:pos. |
|
2561 |
] |
|
2562 |
]. |
|
2563 |
||
2564 |
updateHistory ifTrue:[ |
|
2565 |
self addToHistory:path. |
|
2566 |
]. |
|
2567 |
||
2568 |
^ self |
|
2569 |
]. |
|
2570 |
msg := 'cannot change directory to ''%1'' !!' |
|
2571 |
] ifFalse:[ |
|
2572 |
msg := 'cannot read directory ''%1'' !!' |
|
2573 |
] |
|
2574 |
] ifFalse:[ |
|
2575 |
OperatingSystem platformName == #vms ifTrue:[ |
|
2576 |
"/ cannot tell if it exists or is simply invisible ... |
|
2577 |
msg := '''%1'' is not a directory or unreadable !!' |
|
2578 |
] ifFalse:[ |
|
2579 |
msg := '''%1'' is not a directory !!' |
|
2580 |
] |
|
2581 |
]. |
|
2582 |
self showAlert:(resources string:msg with:fileName) with:nil |
|
172 | 2583 |
] |
1166
0029f77ccea7
when updating the directoryList,
Claus Gittinger <cg@exept.de>
parents:
1162
diff
changeset
|
2584 |
|
1371
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2585 |
"Modified: / 18.9.1997 / 18:22:30 / stefan" |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
2586 |
"Modified: / 8.11.1997 / 17:17:17 / cg" |
1329 | 2587 |
! |
2588 |
||
2589 |
doChangeToDefaultDirectory |
|
2590 |
"go to parent directory" |
|
2591 |
||
2592 |
self doChangeCurrentDirectoryTo:(Filename currentDirectory pathName) updateHistory:true |
|
2593 |
||
2594 |
"Created: 21.9.1997 / 23:45:59 / cg" |
|
172 | 2595 |
! |
2596 |
||
2597 |
doChangeToHomeDirectory |
|
2598 |
"go to home directory" |
|
2599 |
||
2600 |
self doChangeCurrentDirectoryTo:(OperatingSystem getHomeDirectory) updateHistory:true |
|
2601 |
! |
|
2602 |
||
2603 |
doChangeToParentDirectory |
|
1317 | 2604 |
"go to parent directory" |
36 | 2605 |
|
172 | 2606 |
self doChangeCurrentDirectoryTo:'..' updateHistory:true |
2607 |
! |
|
2608 |
||
2609 |
doCreateDirectory:newName |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2610 |
|f| |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2611 |
|
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2612 |
f := currentDirectory filenameFor:newName. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2613 |
f exists ifTrue:[ |
1329 | 2614 |
self warn:'%1 already exists.' with:newName. |
2615 |
^ self |
|
172 | 2616 |
]. |
2617 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2618 |
f makeDirectory ifTrue:[ |
1329 | 2619 |
self updateCurrentDirectoryIfChanged |
172 | 2620 |
] ifFalse:[ |
1329 | 2621 |
self showAlert:(resources string:'cannot create directory ''%1'' !!' with:newName) |
2622 |
with:(OperatingSystem lastErrorString) |
|
172 | 2623 |
] |
1157
667a57034e40
only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
2624 |
|
667a57034e40
only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
2625 |
"Modified: 19.4.1997 / 15:30:32 / cg" |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2626 |
"Modified: 18.9.1997 / 17:21:25 / stefan" |
172 | 2627 |
! |
2628 |
||
1162 | 2629 |
setCurrentDirectory:aPathName |
2630 |
"setup for another directory" |
|
2631 |
||
2632 |
|newDirectory| |
|
2633 |
||
2634 |
aPathName isEmpty ifTrue:[^ self]. |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2635 |
newDirectory := currentDirectory filenameFor:aPathName. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2636 |
newDirectory isDirectory ifTrue:[ |
1329 | 2637 |
self currentDirectory:newDirectory. |
2638 |
currentFileName notNil ifTrue:[ |
|
2639 |
fileListView contents:nil. |
|
2640 |
currentFileName := nil. |
|
2641 |
] ifFalse:[ |
|
2642 |
fileListView setSelection:nil. |
|
2643 |
fileListView scrollToTop. |
|
2644 |
]. |
|
2645 |
self updateCurrentDirectory. |
|
2646 |
self showInfo. |
|
172 | 2647 |
] |
294 | 2648 |
|
1162 | 2649 |
"Modified: 21.9.1995 / 11:22:45 / claus" |
2650 |
"Modified: 25.5.1996 / 12:27:01 / cg" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2651 |
"Modified: 18.9.1997 / 17:08:07 / stefan" |
912
dae70963b64c
define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents:
874
diff
changeset
|
2652 |
! |
dae70963b64c
define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents:
874
diff
changeset
|
2653 |
|
1162 | 2654 |
updateCurrentDirectoryIfChanged |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2655 |
(currentDirectory modificationTime > timeOfLastCheck) ifTrue:[ |
1329 | 2656 |
self updateCurrentDirectory |
1162 | 2657 |
] |
2658 |
||
2659 |
"Modified: 19.4.1997 / 15:30:03 / cg" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2660 |
"Modified: 16.9.1997 / 15:35:52 / stefan" |
1162 | 2661 |
! ! |
2662 |
||
2663 |
!FileBrowser methodsFor:'private - encoding'! |
|
172 | 2664 |
|
395 | 2665 |
guessEncodingFrom:aBuffer |
988 | 2666 |
"look for a string |
1317 | 2667 |
encoding #name |
988 | 2668 |
or: |
1317 | 2669 |
encoding: name |
1209 | 2670 |
within the given buffer |
2671 |
(which is usually the first few bytes of a textFile). |
|
2672 |
If thats not found, use heuristics (in CharacterArray) to guess." |
|
988 | 2673 |
|
395 | 2674 |
|n "{Class: SmallInteger }" |
1209 | 2675 |
binary idx s w enc| |
395 | 2676 |
|
2677 |
binary := false. |
|
2678 |
n := aBuffer size. |
|
2679 |
||
1223 | 2680 |
(idx := aBuffer findString:'charset=') ~~ 0 ifTrue:[ |
1317 | 2681 |
s := ReadStream on:aBuffer. |
2682 |
s position:idx + 8. |
|
2683 |
s skipSeparators. |
|
2684 |
w := s upToSeparator. |
|
2685 |
w notNil ifTrue:[ |
|
2686 |
(idx := w indexOf:$") ~~ 0 ifTrue:[ |
|
2687 |
w := w copyTo:idx-1 |
|
2688 |
]. |
|
2689 |
^ w asSymbol |
|
2690 |
]. |
|
1223 | 2691 |
]. |
807 | 2692 |
(idx := aBuffer findString:'encoding') ~~ 0 ifTrue:[ |
1317 | 2693 |
s := ReadStream on:aBuffer. |
2694 |
s position:idx + 8. |
|
2695 |
s skipSeparators. |
|
2696 |
s peek == $: ifTrue:[ |
|
2697 |
s next. |
|
2698 |
s skipSeparators. |
|
2699 |
]. |
|
2700 |
||
2701 |
s peek == $# ifTrue:[ |
|
2702 |
s next. |
|
2703 |
s skipSeparators. |
|
2704 |
]. |
|
2705 |
w := s upToSeparator. |
|
2706 |
w notNil ifTrue:[ |
|
2707 |
^ w asSymbol |
|
2708 |
]. |
|
807 | 2709 |
]. |
2710 |
||
395 | 2711 |
1 to:n do:[:i | |
1317 | 2712 |
(aBuffer at:i) isPrintable ifFalse:[binary := true]. |
395 | 2713 |
]. |
807 | 2714 |
|
395 | 2715 |
binary ifTrue:[ |
1317 | 2716 |
"/ look for JIS7 / EUC encoding |
2717 |
||
2718 |
enc := CharacterArray guessEncodingFrom:aBuffer. |
|
2719 |
enc notNil ifTrue:[ |
|
2720 |
^ enc |
|
2721 |
]. |
|
2722 |
||
2723 |
"/ if the encoding has been set to any non iso setting, |
|
2724 |
"/ assume its what we defined ... |
|
2725 |
||
2726 |
(('iso*' match:fileEncoding) or:['ascii*' match:fileEncoding]) ifTrue:[ |
|
2727 |
^ #binary |
|
2728 |
]. |
|
2729 |
^ fileEncoding ? #binary |
|
395 | 2730 |
]. |
2731 |
^ #ascii |
|
2732 |
||
2733 |
"Created: 26.2.1996 / 17:43:08 / cg" |
|
1223 | 2734 |
"Modified: 1.7.1997 / 00:00:27 / cg" |
1214
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2735 |
! |
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2736 |
|
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2737 |
preferredFontEncodingFor:fileEncoding |
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2738 |
"given a file encoding, return corresponding preferred fontEncoding |
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2739 |
match pattern" |
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2740 |
|
1223 | 2741 |
|fe| |
2742 |
||
2743 |
fe := MIMETypes fontForCharset:fileEncoding. |
|
2744 |
fe notNil ifTrue:[^ fe]. |
|
1221 | 2745 |
^ 'iso8859*' |
1214
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2746 |
|
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2747 |
"Created: 28.6.1997 / 20:47:35 / cg" |
1223 | 2748 |
"Modified: 1.7.1997 / 00:04:56 / cg" |
395 | 2749 |
! |
2750 |
||
1140 | 2751 |
validateFontEncodingFor:newEncoding ask:ask |
2752 |
"if required, query user if he/she wants to change to another font, |
|
2753 |
which is able to display text encoded as specified by newEncoding" |
|
2754 |
||
1214
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
2755 |
|fontsEncoding msg filter f defaultFont pref| |
1140 | 2756 |
|
2757 |
fontsEncoding := subView font encoding. |
|
2758 |
||
1221 | 2759 |
pref := self preferredFontEncodingFor:newEncoding. |
2760 |
||
2761 |
(pref match:fontsEncoding) ifTrue:[ |
|
1317 | 2762 |
^ self |
1140 | 2763 |
]. |
1221 | 2764 |
"/ stupid ... |
2765 |
pref = 'ascii*' ifTrue:[ |
|
1317 | 2766 |
(fontsEncoding match:'iso8859*') ifTrue:[ |
2767 |
^ self |
|
2768 |
] |
|
1140 | 2769 |
]. |
2770 |
||
1221 | 2771 |
filter := [:f | |coding| |
1317 | 2772 |
(coding := f encoding) notNil |
2773 |
and:[pref match:coding]]. |
|
1221 | 2774 |
|
2775 |
defaultFont := TextView defaultFont onDevice:device. |
|
2776 |
(pref match:(defaultFont encoding)) ifFalse:[ |
|
1317 | 2777 |
defaultFont := nil. |
1140 | 2778 |
]. |
2779 |
||
1221 | 2780 |
defaultFont isNil ifTrue:[ |
1317 | 2781 |
(pref = 'ascii*' |
2782 |
or:[pref = 'iso8859*']) ifTrue:[ |
|
2783 |
defaultFont := FontDescription family:'courier' face:'medium' style:'roman' size:12 |
|
2784 |
] |
|
1221 | 2785 |
]. |
2786 |
||
2787 |
defaultFont isNil ifTrue:[ |
|
1317 | 2788 |
defaultFont := device |
2789 |
listOfAvailableFonts |
|
2790 |
detect:[:f | filter value:f] |
|
2791 |
ifNone:nil. |
|
2792 |
defaultFont isNil ifTrue:[ |
|
2793 |
||
2794 |
"/ flush list, and refetch font list |
|
2795 |
"/ (in case someone just changed the font path ...) |
|
2796 |
||
2797 |
device flushListOfAvailableFonts. |
|
2798 |
defaultFont := device |
|
2799 |
listOfAvailableFonts |
|
2800 |
detect:[:f | filter value:f] |
|
2801 |
ifNone:nil. |
|
2802 |
]. |
|
2803 |
||
2804 |
defaultFont isNil ifTrue:[ |
|
2805 |
self warn:'your display does not seem to provide any ' , newEncoding , '-encoded font.'. |
|
2806 |
^ self. |
|
2807 |
] |
|
1221 | 2808 |
]. |
2809 |
||
2810 |
msg := 'switch to a %1 encoded font ?'. |
|
2811 |
(ask not or:[self confirm:(resources string:msg with:pref) withCRs]) |
|
2812 |
ifTrue:[ |
|
1317 | 2813 |
self withWaitCursorDo:[ |
2814 |
f := FontPanel |
|
2815 |
fontFromUserInitial:defaultFont |
|
2816 |
title:(resources string:'font selection') |
|
2817 |
filter:filter. |
|
2818 |
f notNil ifTrue:[ |
|
2819 |
subView font:f |
|
2820 |
] |
|
2821 |
] |
|
1140 | 2822 |
] |
2823 |
||
2824 |
"Created: 26.10.1996 / 12:06:54 / cg" |
|
1221 | 2825 |
"Modified: 30.6.1997 / 17:46:46 / cg" |
1162 | 2826 |
! ! |
2827 |
||
2828 |
!FileBrowser methodsFor:'private - file stuff'! |
|
2829 |
||
2830 |
doCreateFile:newName |
|
2831 |
"create an empty file" |
|
2832 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2833 |
|aStream f| |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2834 |
|
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2835 |
f := currentDirectory filenameFor:newName. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2836 |
f exists ifTrue:[ |
1329 | 2837 |
(self |
2838 |
ask:(resources string:'%1 already exists\\truncate ?' with:newName) |
|
2839 |
yesButton:'truncate' |
|
2840 |
) ifFalse:[^ self]. |
|
1162 | 2841 |
]. |
2842 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2843 |
FileStream openErrorSignal handle:[:ex| |
1329 | 2844 |
^ self showAlert:(resources string:'cannot create file ''%1'' !!' with:newName) |
2845 |
with:(FileStream lastErrorString) |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2846 |
] do:[ |
1329 | 2847 |
aStream := f newReadWriteStream. |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2848 |
]. |
1162 | 2849 |
aStream notNil ifTrue:[ |
1329 | 2850 |
aStream close. |
2851 |
self updateCurrentDirectoryIfChanged |
|
1162 | 2852 |
] ifFalse:[ |
1329 | 2853 |
self showAlert:(resources string:'cannot create file ''%1'' !!' with:newName) |
2854 |
with:(FileStream lastErrorString) |
|
1162 | 2855 |
] |
2856 |
||
2857 |
"Modified: 23.4.1997 / 13:19:12 / cg" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2858 |
"Modified: 18.9.1997 / 17:21:45 / stefan" |
1140 | 2859 |
! |
2860 |
||
1162 | 2861 |
doFileGet:viaDoubleClick |
2862 |
"get selected file - show contents in subView. |
|
2863 |
This is invoked either by the 'get file' menu item, or via double click. |
|
2864 |
When invoked via the menu (viaDoubleClick argument is false), |
|
2865 |
the automatic file action is not performed - instead, the file is always |
|
2866 |
shown in the codeView (if possible). |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2867 |
This distinction was done to allow xpm or xbm files (which have an automatic |
1162 | 2868 |
action) to be edited." |
2869 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2870 |
|fileName iconLbl winLbl f| |
1162 | 2871 |
|
2872 |
self withReadCursorDo:[ |
|
1329 | 2873 |
fileName := self getSelectedFileName. |
2874 |
fileName notNil ifTrue:[ |
|
2875 |
f := currentDirectory construct:fileName. |
|
2876 |
f isDirectory ifTrue:[ |
|
2877 |
self doChangeCurrentDirectoryTo:fileName updateHistory:true. |
|
2878 |
winLbl := myName. |
|
2879 |
iconLbl := myName |
|
2880 |
] ifFalse:[ |
|
2881 |
f exists ifFalse:[ |
|
2882 |
self warn:(resources string:'oops, ''%1'' is gone or unreadable.' with:fileName). |
|
2883 |
^ self |
|
2884 |
]. |
|
2885 |
timeOfFileRead := f modificationTime. |
|
2886 |
self showFile:fileName insert:false encoding:fileEncoding doubleClick:viaDoubleClick. |
|
2887 |
currentFileName := fileName. |
|
2888 |
||
2889 |
self fileTypeSpecificActions. |
|
2890 |
||
2891 |
subView acceptAction:[:theCode | |
|
2892 |
self withCursor:(Cursor write) do:[ |
|
2893 |
self writeFile:fileName text:theCode encoding:fileEncoding. |
|
2894 |
timeOfFileRead := f modificationTime. |
|
2895 |
self label:myName , ': ' , currentFileName |
|
2896 |
] |
|
2897 |
]. |
|
2898 |
||
2899 |
winLbl := myName , ': ' , fileName. |
|
2900 |
f isWritable ifFalse:[ |
|
2901 |
winLbl := winLbl , ' (readonly)' |
|
2902 |
]. |
|
2903 |
iconLbl := fileName |
|
2904 |
]. |
|
2905 |
self label:winLbl. |
|
2906 |
self iconLabel:iconLbl. |
|
2907 |
] |
|
1162 | 2908 |
] |
2909 |
||
2910 |
"Created: 19.6.1996 / 09:39:07 / cg" |
|
2911 |
"Modified: 23.4.1997 / 13:19:01 / cg" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2912 |
"Modified: 18.9.1997 / 17:35:31 / stefan" |
1162 | 2913 |
! |
2914 |
||
2915 |
doRemove |
|
2916 |
"remove the selected file(s) - no questions asked" |
|
2917 |
||
1493 | 2918 |
|msg idx needUpdate toRemove updateRunning f| |
1162 | 2919 |
|
2920 |
updateRunning := listUpdateProcess notNil. |
|
2921 |
self stopUpdateProcess. |
|
2922 |
toRemove := OrderedCollection new. |
|
2923 |
||
2924 |
"/ |
|
2925 |
"/ did the directory change in the meanwhile ? |
|
2926 |
"/ |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2927 |
needUpdate := (currentDirectory modificationTime > timeOfLastCheck). |
1162 | 2928 |
|
2929 |
lockUpdate := true. |
|
2930 |
[ |
|
1481 | 2931 |
self selectedFilesDo:[:fileName | |
2932 |
|contents| |
|
2933 |
||
2934 |
f := currentDirectory construct:fileName. |
|
2935 |
OperatingSystem accessDeniedErrorSignal handle:[:ex| |
|
2936 |
"was not able to remove it" |
|
2937 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
2938 |
self showAlert:msg with:(OperatingSystem lastErrorString) |
|
2939 |
] do:[ |
|
2940 |
(f isSymbolicLink not and:[f isDirectory]) ifTrue:[ |
|
2941 |
contents := f directoryContents. |
|
2942 |
contents isEmpty ifTrue:[ |
|
2943 |
f remove |
|
2944 |
] ifFalse:[ |
|
2945 |
(self |
|
2946 |
ask:(resources string:'directory ''%1'' is not empty\remove anyway ?' with:fileName) |
|
2947 |
yesButton:'remove') |
|
2948 |
ifFalse:[ |
|
2949 |
^ self |
|
2950 |
]. |
|
2951 |
f recursiveRemove |
|
2952 |
]. |
|
2953 |
] ifFalse:[ |
|
2954 |
f remove. |
|
2955 |
]. |
|
1162 | 2956 |
" |
1481 | 2957 |
self show:nil |
1162 | 2958 |
" |
1481 | 2959 |
idx := fileList indexOf:fileName. |
2960 |
idx ~~ 0 ifTrue:[ |
|
2961 |
toRemove add:idx. |
|
2962 |
] |
|
2963 |
]. |
|
2964 |
]. |
|
1162 | 2965 |
] valueNowOrOnUnwindDo:[ |
1481 | 2966 |
lockUpdate := false. |
2967 |
fileListView setSelection:nil. |
|
2968 |
||
2969 |
"/ |
|
2970 |
"/ remove reverse - otherwise indices are wrong |
|
2971 |
"/ |
|
2972 |
toRemove sort. |
|
2973 |
toRemove reverseDo:[:idx | |
|
2974 |
fileList removeIndex:idx. |
|
2975 |
fileListView removeIndex:idx. |
|
2976 |
]. |
|
2977 |
||
2978 |
updateRunning ifTrue:[ |
|
2979 |
self updateCurrentDirectory |
|
2980 |
] ifFalse:[ |
|
2981 |
" |
|
2982 |
install a new check after some time |
|
2983 |
" |
|
2984 |
needUpdate ifFalse:[timeOfLastCheck := AbsoluteTime now]. |
|
2985 |
Processor removeTimedBlock:checkBlock. |
|
2986 |
Processor addTimedBlock:checkBlock afterSeconds:checkDelta. |
|
2987 |
] |
|
1162 | 2988 |
] |
2989 |
||
1374
b3a1e95a6220
Do not ask for nonempty directory if remove target is a symlink
Stefan Vogel <sv@exept.de>
parents:
1371
diff
changeset
|
2990 |
"Modified: / 20.11.1997 / 17:39:14 / stefan" |
1481 | 2991 |
"Modified: / 18.2.1998 / 17:57:25 / cg" |
1162 | 2992 |
! |
2993 |
||
2994 |
doRename:oldName to:newName |
|
1331
73e712c85588
Handle errors when renaming files.
Stefan Vogel <sv@exept.de>
parents:
1330
diff
changeset
|
2995 |
"rename a file (or directory)" |
1162 | 2996 |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2997 |
|old new| |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2998 |
|
1162 | 2999 |
(oldName notNil and:[newName notNil]) ifTrue:[ |
1393 | 3000 |
(oldName isBlank or:[newName isBlank]) ifFalse:[ |
3001 |
old := currentDirectory filenameFor:oldName. |
|
3002 |
new := currentDirectory filenameFor:newName. |
|
3003 |
OperatingSystem errorSignal handle:[:ex| |
|
3004 |
self showAlert:(resources string:'cannot rename file ''%1'' to %2 !!' |
|
3005 |
with:oldName with:newName) |
|
3006 |
with:(OperatingSystem lastErrorString) |
|
3007 |
] do:[ |
|
3008 |
old renameTo:new. |
|
3009 |
]. |
|
3010 |
self updateCurrentDirectoryIfChanged. |
|
3011 |
] |
|
1162 | 3012 |
] |
3013 |
||
3014 |
"Modified: 23.4.1997 / 13:19:37 / cg" |
|
1331
73e712c85588
Handle errors when renaming files.
Stefan Vogel <sv@exept.de>
parents:
1330
diff
changeset
|
3015 |
"Modified: 24.9.1997 / 09:20:00 / stefan" |
1162 | 3016 |
! ! |
3017 |
||
3018 |
!FileBrowser methodsFor:'private - file type & info'! |
|
3019 |
||
3020 |
fileCommentStrings |
|
3021 |
"return a useful comment definition; based upon the fileName for now" |
|
3022 |
||
3023 |
"/ for now, |
|
3024 |
"/ define comment strings, by heuristics; |
|
3025 |
"/ (should look for some mode= or similar string |
|
3026 |
"/ found in the file itself - like emacs does it) |
|
3027 |
||
3028 |
(currentFileName = 'Make.proto' |
|
3029 |
or:[currentFileName = 'Makefile' |
|
3030 |
or:[currentFileName = 'makefile']]) ifTrue:[ |
|
1317 | 3031 |
^ #('#' (nil nil)). |
1162 | 3032 |
]. |
3033 |
((currentFileName endsWith:'.c') |
|
3034 |
or:[(currentFileName endsWith:'.C')]) ifTrue:[ |
|
1317 | 3035 |
^ #(nil ('/*' '*/')). |
1162 | 3036 |
]. |
3037 |
((currentFileName endsWith:'.cc') |
|
3038 |
or:[(currentFileName endsWith:'.CC')]) ifTrue:[ |
|
1317 | 3039 |
^ #('//' ('/*' '*/')). |
1162 | 3040 |
]. |
3041 |
(currentFileName endsWith:'.java') ifTrue:[ |
|
1317 | 3042 |
^ #('//' (nil nil)). |
1162 | 3043 |
]. |
3044 |
||
3045 |
"/ smalltalk comments |
|
3046 |
||
3047 |
^ #('"/' ('"' '"')). |
|
3048 |
||
3049 |
"Created: 7.1.1997 / 20:30:00 / cg" |
|
3050 |
"Modified: 23.4.1997 / 13:11:49 / cg" |
|
3051 |
! |
|
3052 |
||
3053 |
fileTypeSpecificActions |
|
3054 |
"any special fileTypeSpecific actions are done here, |
|
3055 |
when a new file is selected" |
|
3056 |
||
3057 |
|commentStrings| |
|
3058 |
||
3059 |
commentStrings := self fileCommentStrings. |
|
3060 |
commentStrings notNil ifTrue:[ |
|
1317 | 3061 |
subView |
3062 |
commentStrings:#('#' (nil nil)). |
|
1162 | 3063 |
]. |
3064 |
||
3065 |
"Modified: 7.1.1997 / 20:30:54 / cg" |
|
3066 |
! |
|
3067 |
||
3068 |
getFileInfoString:longInfo |
|
3069 |
"get stat info on selected file - return a string which can be |
|
3070 |
shown in a box" |
|
3071 |
||
3072 |
|fileName f fullPath text info fileOutput type modeBits modeString s ts| |
|
3073 |
||
3074 |
fileName := self getSelectedFileName. |
|
3075 |
fileName isNil ifTrue:[^ nil]. |
|
3076 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3077 |
f := currentDirectory construct:fileName. |
1162 | 3078 |
info := f info. |
3079 |
||
3080 |
info isNil ifTrue:[ |
|
1329 | 3081 |
self showAlert:(resources string:'cannot get info of ''%1'' !!' with:fileName) |
3082 |
with:(OperatingSystem lastErrorString). |
|
3083 |
^ nil |
|
1162 | 3084 |
]. |
3085 |
||
3086 |
text := StringCollection new. |
|
3087 |
f isSymbolicLink ifTrue:[ |
|
1329 | 3088 |
text add:(resources string:'symbolic link to: %1' with:(f linkInfo path)) |
1162 | 3089 |
]. |
3090 |
||
3091 |
type := info type. |
|
3092 |
(longInfo and:[type == #regular]) ifTrue:[ |
|
1329 | 3093 |
fullPath := currentDirectory pathName asFilename constructString:fileName. |
3094 |
fileOutput := fullPath asFilename fileType. |
|
1162 | 3095 |
]. |
3096 |
||
3097 |
s := (resources at:'type: '). |
|
3098 |
fileOutput isNil ifTrue:[ |
|
1329 | 3099 |
s := s , type asString |
1162 | 3100 |
] ifFalse:[ |
1329 | 3101 |
s := s , 'regular (' , fileOutput , ')' |
1162 | 3102 |
]. |
3103 |
text add:s. |
|
3104 |
text add:(resources string:'size: %1' with:(info size) printString). |
|
3105 |
||
3106 |
modeBits := info mode. |
|
3107 |
modeString := self getModeString:modeBits. |
|
3108 |
longInfo ifTrue:[ |
|
1329 | 3109 |
text add:(resources string:'access: %1 (%2)' |
3110 |
with:modeString |
|
3111 |
with:(modeBits printStringRadix:8)) |
|
1162 | 3112 |
] ifFalse:[ |
1329 | 3113 |
text add:(resources string:'access: %1' with:modeString) |
1162 | 3114 |
]. |
3115 |
text add:(resources string:'owner: %1' |
|
1329 | 3116 |
with:(OperatingSystem getUserNameFromID:(info uid))). |
1162 | 3117 |
longInfo ifTrue:[ |
1329 | 3118 |
text add:(resources string:'group: %1' |
3119 |
with:(OperatingSystem getGroupNameFromID:(info gid))). |
|
3120 |
||
3121 |
ts := info accessed. |
|
3122 |
text add:(resources string:'last access: %1 %2' |
|
3123 |
with:(ts asTime printString) |
|
3124 |
with:(ts asDate printString)). |
|
3125 |
||
3126 |
ts := info modified. |
|
3127 |
text add:(resources string:'last modification: %1 %2' |
|
3128 |
with:(ts asTime printString) |
|
3129 |
with:(ts asDate printString)). |
|
1162 | 3130 |
]. |
3131 |
^ text asString |
|
3132 |
||
3133 |
"Modified: 8.9.1995 / 11:59:28 / claus" |
|
3134 |
"Modified: 1.11.1996 / 20:47:52 / cg" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3135 |
"Modified: 18.9.1997 / 16:34:31 / stefan" |
1162 | 3136 |
! |
3137 |
||
3138 |
getInfoFile |
|
3139 |
"get filename of a description-file (.dir.info, README etc.); |
|
3140 |
This file is automatically shown when a directory is enterred. |
|
3141 |
You can add more names below if you like." |
|
3142 |
||
3143 |
#( |
|
3144 |
'.dir.info' |
|
3145 |
'README' |
|
3146 |
'ReadMe' |
|
3147 |
'Readme' |
|
3148 |
'readme' |
|
3149 |
'read.me' |
|
3150 |
'Read.me' |
|
3151 |
'READ.ME' |
|
1272 | 3152 |
'README.TXT' |
3153 |
'readme.txt' |
|
3154 |
'Readme.txt' |
|
1307 | 3155 |
'Info.txt' |
3156 |
'info.txt' |
|
3157 |
'INFO.TXT' |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3158 |
) do:[:f | |
1329 | 3159 |
|n| |
3160 |
n := currentDirectory construct:f. |
|
3161 |
(n isReadable and:[n isDirectory not]) ifTrue:[ |
|
3162 |
^ f. |
|
3163 |
] |
|
1140 | 3164 |
]. |
1162 | 3165 |
^ nil |
3166 |
||
1272 | 3167 |
"Modified: 3.8.1997 / 16:50:33 / cg" |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3168 |
"Modified: 16.9.1997 / 15:26:53 / stefan" |
1162 | 3169 |
! |
3170 |
||
3171 |
getModeString:modeBits |
|
3172 |
"convert file-mode bits into a more user-friendly string. |
|
3173 |
This is wrong here - should be moved into OperatingSystem." |
|
3174 |
||
3175 |
^ self getModeString:modeBits |
|
1317 | 3176 |
with:#( 'owner:' $r $w $x |
3177 |
' group:' $r $w $x |
|
3178 |
' others:' $r $w $x ) |
|
1140 | 3179 |
! |
3180 |
||
1162 | 3181 |
getModeString:modeBits with:texts |
3182 |
"convert file-mode bits into a more user-friendly string. |
|
3183 |
This is wrong here - should be moved into OperatingSystem." |
|
3184 |
||
3185 |
|bits modeString| |
|
3186 |
||
3187 |
bits := modeBits bitAnd:8r777. |
|
3188 |
modeString := ''. |
|
3189 |
||
3190 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
3191 |
with: texts do:[:bitMask :access | |
|
1317 | 3192 |
|ch| |
3193 |
||
3194 |
bitMask isNil ifTrue:[ |
|
3195 |
modeString := modeString , (resources string:access) |
|
3196 |
] ifFalse:[ |
|
3197 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
3198 |
ch := $- |
|
3199 |
] ifFalse:[ |
|
3200 |
ch := access |
|
3201 |
]. |
|
3202 |
modeString := modeString copyWith:ch |
|
3203 |
] |
|
633
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
3204 |
]. |
1162 | 3205 |
^ modeString |
3206 |
! |
|
3207 |
||
3208 |
showInfo |
|
3209 |
"show directory info when dir has changed" |
|
3210 |
||
3211 |
|info txt| |
|
3212 |
||
3213 |
info := self getInfoFile. |
|
3214 |
info notNil ifTrue:[ |
|
1317 | 3215 |
txt := self readFile:info |
1162 | 3216 |
]. |
3217 |
self show:txt. |
|
3218 |
! |
|
3219 |
||
3220 |
sizePrintString:size |
|
3221 |
"helper for update-directory to return a string with a files size. |
|
3222 |
This one gives the size in byte, Kb or Mb depending on size. |
|
3223 |
If you dont like this, just uncomment the first statement below." |
|
3224 |
||
3225 |
|unitString n| |
|
3226 |
||
3227 |
" |
|
3228 |
^ size printString. |
|
3229 |
" |
|
3230 |
unitString := ''. |
|
3231 |
size < (500 * 1024) ifTrue:[ |
|
1317 | 3232 |
size < 1024 ifTrue:[ |
3233 |
n := size |
|
3234 |
] ifFalse:[ |
|
3235 |
n := (size * 10 // 1024 / 10.0). |
|
3236 |
unitString := ' Kb' |
|
3237 |
] |
|
1162 | 3238 |
] ifFalse:[ |
1317 | 3239 |
n := (size * 10 // 1024 // 1024 / 10.0). |
3240 |
unitString := ' Mb' |
|
1162 | 3241 |
]. |
3242 |
^ (n printStringLeftPaddedTo:5) , unitString. |
|
3243 |
! ! |
|
3244 |
||
3245 |
!FileBrowser methodsFor:'private - file-I/O'! |
|
3246 |
||
3247 |
readFile:fileName |
|
3248 |
"read in the file, answer its contents as StringCollection" |
|
3249 |
||
3250 |
^ self readFile:fileName lineDelimiter:Character cr encoding:nil |
|
3251 |
||
3252 |
"Modified: 22.2.1996 / 14:57:08 / cg" |
|
3253 |
! |
|
3254 |
||
3255 |
readFile:fileName lineDelimiter:aCharacter encoding:encoding |
|
3256 |
"read in the file, return its contents as StringCollection. |
|
3257 |
The files lines are delimited by aCharacter. |
|
3258 |
If encoding is nonNil, the file is assumed to be coded according to |
|
3259 |
that symbol, and #decodeString: should be able to convert it." |
|
3260 |
||
3261 |
|stream text msg sz| |
|
3262 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3263 |
stream := (currentDirectory construct:fileName) readStream. |
1162 | 3264 |
stream isNil ifTrue:[ |
1329 | 3265 |
msg := (resources string:'cannot read file ''%1'' !!' with:fileName). |
3266 |
self showAlert:msg with:(FileStream lastErrorString). |
|
3267 |
^ nil |
|
1162 | 3268 |
]. |
3269 |
||
3270 |
" |
|
3271 |
for very big files, give ObjectMemory a hint, to preallocate more |
|
3272 |
" |
|
1311 | 3273 |
(sz := stream fileSize) > 1000000 ifTrue:[ |
1329 | 3274 |
Processor activeProcess withPriority:Processor userBackgroundPriority do:[ |
3275 |
ObjectMemory announceSpaceNeed:(sz + (sz // 5)) "/ add 20% for tab expansion |
|
3276 |
]. |
|
1162 | 3277 |
]. |
3278 |
||
3279 |
text := self readStream:stream lineDelimiter:aCharacter encoding:encoding. |
|
3280 |
stream close. |
|
3281 |
^ text |
|
3282 |
||
3283 |
"Created: 22.2.1996 / 14:56:48 / cg" |
|
3284 |
"Modified: 8.10.1996 / 21:01:57 / cg" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3285 |
"Modified: 18.9.1997 / 17:06:54 / stefan" |
1162 | 3286 |
! |
3287 |
||
3288 |
readStream:aStream |
|
3289 |
"read in from aStream, answer its contents as StringCollection" |
|
3290 |
||
3291 |
^ self readStream:aStream lineDelimiter:Character cr encoding:nil |
|
3292 |
||
3293 |
"Modified: 22.2.1996 / 14:58:40 / cg" |
|
633
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
3294 |
! |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
3295 |
|
1162 | 3296 |
readStream:aStream lineDelimiter:aCharacter encoding:encoding |
3297 |
"read from aStream, answer its contents as StringCollection. |
|
3298 |
The files lines are delimited by aCharacter. |
|
3299 |
If encoding is nonNil, the file is assumed to be coded according to |
|
3300 |
that symbol, and #decodeString: should be able to convert it." |
|
3301 |
||
3302 |
|text line enc| |
|
3303 |
||
3304 |
text := StringCollection new. |
|
3305 |
||
3306 |
enc := encoding. |
|
3307 |
enc == #iso8859 ifTrue:[ |
|
1317 | 3308 |
enc := nil |
1162 | 3309 |
]. |
3310 |
||
3311 |
aCharacter == Character cr ifTrue:[ |
|
1317 | 3312 |
[aStream atEnd] whileFalse:[ |
3313 |
line := aStream nextLine withTabsExpanded. |
|
3314 |
enc notNil ifTrue:[ |
|
3315 |
line := line decodeFrom:enc |
|
3316 |
]. |
|
3317 |
text add:line |
|
3318 |
]. |
|
1162 | 3319 |
] ifFalse:[ |
1317 | 3320 |
[aStream atEnd] whileFalse:[ |
3321 |
line := (aStream upTo:aCharacter) withTabsExpanded. |
|
3322 |
enc notNil ifTrue:[ |
|
3323 |
line := line decodeFrom:enc |
|
3324 |
]. |
|
3325 |
text add:line |
|
3326 |
]. |
|
633
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
3327 |
]. |
1162 | 3328 |
^ text |
3329 |
||
3330 |
"Created: 22.2.1996 / 14:58:25 / cg" |
|
3331 |
"Modified: 2.4.1997 / 21:31:36 / cg" |
|
3332 |
! |
|
3333 |
||
3334 |
showFile:fileName |
|
3335 |
"show contents of fileName in subView" |
|
3336 |
||
1689 | 3337 |
fileListView selection:(fileList indexOf:fileName). |
3338 |
self fileGet |
|
3339 |
||
3340 |
"Modified: / 17.6.1998 / 11:26:13 / cg" |
|
1162 | 3341 |
! |
3342 |
||
3343 |
showFile:fileName insert:insert encoding:encoding |
|
3344 |
"show/insert contents of fileName in subView" |
|
3345 |
||
3346 |
^ self |
|
1317 | 3347 |
showFile:fileName insert:insert encoding:encoding doubleClick:false |
1162 | 3348 |
|
3349 |
"Modified: 19.6.1996 / 09:40:19 / cg" |
|
3350 |
! |
|
3351 |
||
3352 |
showFile:fileName insert:insert encoding:encoding doubleClick:viaDoubleClick |
|
3353 |
"show/insert contents of fileName in subView" |
|
3354 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3355 |
|path buffer s n i ok convert text msg eol guess action enc |
1214
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
3356 |
fontsEncoding pref failWarning| |
1162 | 3357 |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3358 |
path := currentDirectory filenameFor:fileName. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3359 |
(path type == #regular) ifFalse:[ |
1329 | 3360 |
"asked for a non-file - ignore it ..." |
3361 |
path exists ifFalse:[ |
|
3362 |
msg := '''%1'' does not exist !!'. |
|
3363 |
] ifTrue:[ |
|
3364 |
msg := '''%1'' is not a regular file !!'. |
|
3365 |
]. |
|
3366 |
self warn:(resources string:msg with:fileName). |
|
3367 |
^ self |
|
1162 | 3368 |
]. |
3369 |
||
3370 |
"/ |
|
3371 |
"/ check if file is a text file |
|
3372 |
"/ |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3373 |
s := path readStream. |
1162 | 3374 |
s isNil ifTrue:[ |
1329 | 3375 |
self showAlert:(resources string:'cannot read file ''%1'' !!' with:fileName) |
3376 |
with:(FileStream lastErrorString). |
|
3377 |
^ nil |
|
1162 | 3378 |
]. |
3379 |
||
1222
f2952fc3ced9
look at more when guessing the encoding
Claus Gittinger <cg@exept.de>
parents:
1221
diff
changeset
|
3380 |
buffer := String new:4096. |
f2952fc3ced9
look at more when guessing the encoding
Claus Gittinger <cg@exept.de>
parents:
1221
diff
changeset
|
3381 |
n := s nextBytes:4096 into:buffer. |
1162 | 3382 |
s close. |
3383 |
||
3384 |
enc := encoding. |
|
3385 |
ok := true. |
|
3386 |
guess := self guessEncodingFrom:buffer. |
|
3387 |
||
3388 |
guess == #binary ifTrue:[ |
|
1329 | 3389 |
ok := false. |
3390 |
viaDoubleClick ifTrue:[ |
|
3391 |
(self binaryFileAction:fileName) ifTrue:[^ self]. |
|
3392 |
]. |
|
3393 |
(self confirm:(resources string:'''%1'' seems to be a binary file - show anyway ?' with:fileName)) |
|
3394 |
ifFalse:[^ self] |
|
1162 | 3395 |
] ifFalse:[ |
1329 | 3396 |
viaDoubleClick ifTrue:[ |
3397 |
(self nonBinaryFileAction:fileName) ifTrue:[^ self]. |
|
3398 |
]. |
|
3399 |
||
3400 |
fontsEncoding := subView font encoding. |
|
3401 |
pref := self preferredFontEncodingFor:guess. |
|
3402 |
||
3403 |
ok := pref match:fontsEncoding. |
|
3404 |
ok ifFalse:[ |
|
3405 |
pref = 'iso8859*' ifTrue:[ |
|
3406 |
ok := 'ascii*' match:fontsEncoding |
|
3407 |
] |
|
3408 |
]. |
|
3409 |
ok ifTrue:[ |
|
3410 |
fileEncoding := guess. |
|
3411 |
enc := guess. |
|
3412 |
] ifFalse:[ |
|
3413 |
action := Dialog choose:(resources string:'''%1'' seems to require a %2 font.' with:fileName with:pref) |
|
3414 |
labels:(resources array:#('cancel' 'show' 'change font')) |
|
3415 |
values:#(nil #show #encoding) |
|
3416 |
default:#encoding. |
|
3417 |
action isNil ifTrue:[^ self]. |
|
3418 |
action == #encoding ifTrue:[ |
|
3419 |
fileEncoding := guess asSymbol. |
|
3420 |
subView externalEncoding:fileEncoding. |
|
3421 |
self validateFontEncodingFor:fileEncoding ask:false. |
|
3422 |
] ifFalse:[ |
|
3423 |
self information:(resources string:'Individual characters may be invisible/wrong in this font.') |
|
3424 |
]. |
|
3425 |
enc := fileEncoding. |
|
3426 |
]. |
|
1162 | 3427 |
]. |
3428 |
||
3429 |
convert := false. |
|
1329 | 3430 |
"/ ok ifTrue:[ |
3431 |
"/ "/ |
|
3432 |
"/ "/ check if line delimiter is a cr |
|
3433 |
"/ "/ |
|
3434 |
"/ i := buffer indexOf:Character cr. |
|
3435 |
"/ i == 0 ifTrue:[ |
|
3436 |
"/ "/ |
|
3437 |
"/ "/ no newline found - try cr |
|
3438 |
"/ "/ |
|
3439 |
"/ i := buffer indexOf:(Character value:13). |
|
3440 |
"/ i ~~ 0 ifTrue:[ |
|
3441 |
"/ convert := self confirm:(resources string:'''%1'' seems to have CR as line delimiter - convert to NL ?' with:fileName). |
|
3442 |
"/ ] |
|
3443 |
"/ ] |
|
3444 |
"/ ]. |
|
1162 | 3445 |
|
3446 |
insert ifFalse:[ |
|
1329 | 3447 |
"/ release old text first |
3448 |
"/ - we might need the memory in case of huge files |
|
3449 |
"/ (helps if you have a 4Mb file in the view, |
|
3450 |
"/ and click on another biggy) |
|
3451 |
||
3452 |
subView contents:nil. |
|
1162 | 3453 |
]. |
3454 |
||
3455 |
convert ifTrue:[ |
|
1329 | 3456 |
eol := Character value:13 |
1162 | 3457 |
] ifFalse:[ |
1329 | 3458 |
eol := Character cr |
1162 | 3459 |
]. |
1212 | 3460 |
|
1214
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
3461 |
failWarning := false. |
1212 | 3462 |
CharacterArray decodingFailedSignal handle:[:ex | |
1329 | 3463 |
|errStr| |
3464 |
||
3465 |
failWarning ifFalse:[ |
|
3466 |
errStr := resources string:ex errorString. |
|
3467 |
(self confirm:(resources |
|
3468 |
string:'An error occurred while decoding:\%1\\The file has either a different encoding or is corrupted.\\Continue ?' |
|
3469 |
with:errStr) withCRs) |
|
3470 |
ifFalse:[ |
|
3471 |
^ self |
|
3472 |
]. |
|
3473 |
failWarning := true. |
|
3474 |
]. |
|
3475 |
ex proceed. |
|
1212 | 3476 |
] do:[ |
1329 | 3477 |
text := self readFile:fileName lineDelimiter:eol encoding:enc. |
1212 | 3478 |
]. |
1162 | 3479 |
|
3480 |
insert ifFalse:[ |
|
1329 | 3481 |
self show:text |
1162 | 3482 |
] ifTrue:[ |
1329 | 3483 |
subView insertSelectedStringAtCursor:text asString |
1162 | 3484 |
]. |
3485 |
||
3486 |
"Created: 19.6.1996 / 09:39:52 / cg" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3487 |
"Modified: 18.9.1997 / 17:10:20 / stefan" |
1329 | 3488 |
"Modified: 22.9.1997 / 10:02:38 / cg" |
1162 | 3489 |
! |
3490 |
||
3491 |
writeFile:fileName text:someText encoding:encoding |
|
1353 | 3492 |
|stream errReason msg startNr nLines string| |
3493 |
||
3494 |
errReason := ''. |
|
3495 |
FileStream streamErrorSignal handle:[:ex | |
|
1393 | 3496 |
errReason := ex errorString. |
3497 |
ex return. |
|
1353 | 3498 |
] do:[ |
1393 | 3499 |
stream := (currentDirectory filenameFor:fileName) writeStream. |
1353 | 3500 |
]. |
1162 | 3501 |
stream isNil ifTrue:[ |
1393 | 3502 |
msg := (resources string:'cannot write file ''%1'' !!' with:fileName). |
3503 |
self showAlert:msg with:errReason. |
|
3504 |
^ self. |
|
1353 | 3505 |
]. |
3506 |
||
3507 |
someText isString ifTrue:[ |
|
1393 | 3508 |
stream nextPutAll:someText. |
1162 | 3509 |
] ifFalse:[ |
1393 | 3510 |
"/ |
3511 |
"/ on some systems, writing linewise is very slow (via NFS) |
|
3512 |
"/ therefore we convert to a string and write it in chunks. |
|
3513 |
"/ To avoid creating huge strings, we do it in blocks of 1000 lines. |
|
3514 |
"/ |
|
3515 |
startNr := 1. |
|
3516 |
nLines := someText size. |
|
3517 |
[startNr <= nLines] whileTrue:[ |
|
3518 |
string := someText asStringWithCRsFrom:startNr |
|
3519 |
to:((startNr + 1000) min:nLines) |
|
3520 |
compressTabs:compressTabs. |
|
3521 |
encoding notNil ifTrue:[ |
|
3522 |
string := string encodeInto:encoding |
|
3523 |
]. |
|
3524 |
stream nextPutAll:string. |
|
3525 |
startNr := startNr + 1000 + 1. |
|
3526 |
]. |
|
1353 | 3527 |
]. |
3528 |
||
3529 |
stream close. |
|
3530 |
subView modified:false |
|
1162 | 3531 |
|
3532 |
"Created: 22.2.1996 / 15:03:10 / cg" |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3533 |
"Modified: 18.9.1997 / 17:12:44 / stefan" |
1353 | 3534 |
"Modified: 22.10.1997 / 12:34:38 / cg" |
1140 | 3535 |
! ! |
3536 |
||
3537 |
!FileBrowser methodsFor:'private - presentation'! |
|
3538 |
||
3539 |
defineTabulatorsForLongList |
|
3540 |
"define the tabs for the long list" |
|
3541 |
||
3542 |
tabSpec := TabulatorSpecification new. |
|
3543 |
tabSpec unit:#inch. |
|
3544 |
"/ tabSpec positions:#(0 0.25 2.3 4.3 5.3 6.0 6.5). |
|
3545 |
tabSpec widths: #(0.25 2 2.0 1 0.5 0.5 1"any"). |
|
3546 |
" icon name mode owner group size type" |
|
3547 |
tabSpec align: #(#left #left #left #right #right #decimal #left). |
|
3548 |
tabSpec addDependent:self. |
|
3549 |
||
3550 |
tabRulerView tabulatorSpecification:tabSpec. |
|
3551 |
||
3552 |
"Modified: 17.4.1997 / 02:56:07 / cg" |
|
172 | 3553 |
! |
3554 |
||
1140 | 3555 |
defineTabulatorsForShortList |
3556 |
"define the tabs for the short list" |
|
3557 |
||
3558 |
tabSpec := TabulatorSpecification new. |
|
3559 |
tabSpec unit:#inch. |
|
3560 |
"/ tabSpec positions:#(0 0.25 ). |
|
3561 |
tabSpec widths: #(0.25 2 ). |
|
3562 |
" icon name" |
|
3563 |
tabSpec align: #(#left #left). |
|
3564 |
tabSpec addDependent:self. |
|
3565 |
||
3566 |
tabRulerView tabulatorSpecification:tabSpec. |
|
3567 |
||
3568 |
"Created: 17.4.1997 / 02:51:41 / cg" |
|
3569 |
"Modified: 17.4.1997 / 02:55:17 / cg" |
|
3570 |
! |
|
3571 |
||
3572 |
iconForFile:aFilenameString |
|
1147 | 3573 |
"given a fileName, return an appropriate icon" |
3574 |
||
1253 | 3575 |
|f icn key key2 suff mime| |
1140 | 3576 |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3577 |
f := currentDirectory construct:aFilenameString. |
1140 | 3578 |
f isDirectory ifTrue:[ |
1495 | 3579 |
f isSymbolicLink ifTrue:[ |
3580 |
key := #directoryLink |
|
3581 |
] ifFalse:[ |
|
3582 |
key := #directory. |
|
3583 |
(f isReadable not or:[f isExecutable not]) ifTrue:[ |
|
3584 |
key := #directoryLocked |
|
3585 |
]. |
|
3586 |
] |
|
1147 | 3587 |
] ifFalse:[ |
1495 | 3588 |
f isSymbolicLink ifTrue:[ |
3589 |
f isReadable not ifTrue:[ |
|
3590 |
key := #fileLocked |
|
3591 |
] ifFalse:[ |
|
3592 |
key := #fileLink |
|
3593 |
] |
|
3594 |
] ifFalse:[ |
|
3595 |
key := key2 := #file. |
|
3596 |
(f isReadable not) ifTrue:[ |
|
3597 |
key := #fileLocked |
|
3598 |
] ifFalse:[ |
|
3599 |
suff := f suffix. |
|
3600 |
mime := MIMETypes mimeTypeForSuffix:suff. |
|
3601 |
mime notNil ifTrue:[ |
|
3602 |
(mime startsWith:'image/') ifTrue:[ |
|
3603 |
key := #imageFile |
|
3604 |
] ifFalse:[ |
|
3605 |
(mime startsWith:'text/') ifTrue:[ |
|
3606 |
key := #textFile |
|
3607 |
] |
|
3608 |
] |
|
3609 |
]. |
|
3610 |
]. |
|
3611 |
]. |
|
1141 | 3612 |
]. |
1147 | 3613 |
|
1239
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
3614 |
icn := icons at:key ifAbsent:nil. |
1495 | 3615 |
icn notNil ifTrue:[ |
3616 |
^ icn |
|
1141 | 3617 |
]. |
1495 | 3618 |
|
3619 |
icn := Icons at:key ifAbsent:nil. |
|
3620 |
||
1253 | 3621 |
icn isNil ifTrue:[ |
1495 | 3622 |
( (key := key2) isNil |
3623 |
or:[(icn := icons at:key ifAbsent:nil) notNil |
|
3624 |
or:[(icn := Icons at:key ifAbsent:nil) isNil]] |
|
3625 |
) ifTrue:[ |
|
3626 |
^ icn |
|
3627 |
] |
|
1253 | 3628 |
]. |
1495 | 3629 |
|
3630 |
icn := icn copy on:device. |
|
3631 |
icn clearMaskedPixels. |
|
3632 |
icons at:key put:icn. |
|
1239
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
3633 |
^ icn |
1141 | 3634 |
|
1253 | 3635 |
"Modified: 28.7.1997 / 09:19:11 / cg" |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3636 |
"Modified: 18.9.1997 / 16:35:28 / stefan" |
36 | 3637 |
! |
3638 |
||
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
3639 |
stopUpdateProcess |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
3640 |
Processor removeTimedBlock:checkBlock. |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
3641 |
listUpdateProcess notNil ifTrue:[ |
1317 | 3642 |
listUpdateProcess terminate. |
3643 |
listUpdateProcess := nil. |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
3644 |
]. |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
3645 |
|
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
3646 |
"Created: 19.4.1997 / 13:51:34 / cg" |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
3647 |
! |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
3648 |
|
36 | 3649 |
updateCurrentDirectory |
3650 |
"update listView with directory contents" |
|
3651 |
||
49 | 3652 |
"the code below may look somewhat complex - |
3653 |
it reads the directory first for the names, |
|
1151
194b10bad6da
great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents:
1147
diff
changeset
|
3654 |
then (in followup sweeps over the files) gets the |
194b10bad6da
great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents:
1147
diff
changeset
|
3655 |
files type, info and icon in a forked subprocess. |
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
3656 |
This makes the Filebrowsers list update faster, since the fileInfo |
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
3657 |
(i.e. stat-calls) may take long - especially on NFS-mounted directories. |
49 | 3658 |
The file reading is done at lower priority, to let user continue |
3659 |
his work in other views. However, to be fair to other fileBrowser, |
|
3660 |
which may also read directories at low prio, give up the processor |
|
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
3661 |
after every entry. This shares the cpu among all fileBrowsers; |
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
3662 |
Therefore, browsers which read short directories will finish first. |
49 | 3663 |
ST/X users love this behavior ;-) |
3664 |
" |
|
3665 |
||
294 | 3666 |
self withReadCursorDo:[ |
1487
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3667 |
|files matchPattern list passDone f| |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3668 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3669 |
self stopUpdateProcess. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3670 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3671 |
timeOfLastCheck := AbsoluteTime now. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3672 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3673 |
files := currentDirectory asFilename fullDirectoryContents. |
1329 | 3674 |
|
3675 |
"/ (files includes:(Filename parentDirectoryName)) ifTrue:[ |
|
3676 |
"/ upButton enable. |
|
3677 |
"/ ] ifFalse:[ |
|
3678 |
"/ upButton disable. |
|
3679 |
"/ ]. |
|
3680 |
||
1487
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3681 |
"/ show files which are either directories |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3682 |
"/ or match the current pattern |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3683 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3684 |
matchPattern := filterField contents. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3685 |
(matchPattern notNil and:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3686 |
matchPattern isEmpty not and:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3687 |
matchPattern ~= '*']]) ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3688 |
files := files select:[:aName | |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3689 |
((currentDirectory construct:aName) isDirectory) |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3690 |
or:[matchPattern compoundMatch:aName] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3691 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3692 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3693 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3694 |
files size == 0 ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3695 |
self information:('directory ', currentDirectory pathName, ' vanished'). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3696 |
^ self |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3697 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3698 |
files sort. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3699 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3700 |
files := self withoutHiddenFiles:files. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3701 |
fileList := files copy. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3702 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3703 |
tabSpec isNil ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3704 |
showLongList ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3705 |
self defineTabulatorsForLongList |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3706 |
] ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3707 |
self defineTabulatorsForShortList |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3708 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3709 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3710 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3711 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3712 |
"/ first show all the names - this can be done fast ... |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3713 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3714 |
list := files collect:[:fileName | |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3715 |
|entry| |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3716 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3717 |
entry := MultiColListEntry new. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3718 |
entry tabulatorSpecification:tabSpec. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3719 |
entry colAt:1 put:nil. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3720 |
entry colAt:2 put:fileName. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3721 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3722 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3723 |
fileListView setList:list expandTabs:false. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3724 |
passDone := Array new:list size withAll:0. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3725 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3726 |
" |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3727 |
this is a time consuming operation (especially, if reading an |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3728 |
NFS-mounted directory); therefore, start a low prio process, |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3729 |
which fills in the remaining fields in the fileList ... |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3730 |
" |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3731 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3732 |
listUpdateProcess := [ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3733 |
|prevUid prevGid fileNameString nameString groupString |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3734 |
modeString info line len |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3735 |
anyImages lineIndex aFileName |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3736 |
entry typ f p typeString done endIndex |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3737 |
state stopAtEnd nextState img prevFirstLine prevLastLine |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3738 |
numVisible dirSuffix thisIsVMS| |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3739 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3740 |
dirSuffix := Filename directorySuffix. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3741 |
dirSuffix size > 0 ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3742 |
dirSuffix := '.' , dirSuffix asLowercase. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3743 |
thisIsVMS := OperatingSystem platformName == #vms. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3744 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3745 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3746 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3747 |
"/ then walk over the files, adding more info |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3748 |
"/ (since we have to stat each file, this may take a while longer) |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3749 |
"/ Visible items are always filled first. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3750 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3751 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3752 |
"/ the state machine |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3753 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3754 |
nextState := IdentityDictionary new. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3755 |
showLongList ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3756 |
nextState add:(#visibleIcons -> #visibleAttributes). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3757 |
nextState add:(#visibleAttributes -> #visibleTypes). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3758 |
nextState add:(#visibleTypes -> #visibleImages). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3759 |
nextState add:(#visibleImages -> #nextPageIcons). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3760 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3761 |
nextState add:(#nextPageIcons -> #nextPageAttributes). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3762 |
nextState add:(#nextPageAttributes -> #nextPageTypes). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3763 |
nextState add:(#nextPageTypes -> #nextPageImages). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3764 |
nextState add:(#nextPageImages -> #previousPageIcons). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3765 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3766 |
nextState add:(#previousPageIcons -> #previousPageAttributes). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3767 |
nextState add:(#previousPageAttributes -> #previousPageTypes). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3768 |
nextState add:(#previousPageTypes -> #previousPageImages). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3769 |
nextState add:(#previousPageImages -> #remainingIcons). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3770 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3771 |
nextState add:(#remainingIcons -> #remainingAttributes). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3772 |
nextState add:(#remainingAttributes -> #remainingTypes). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3773 |
nextState add:(#remainingTypes -> #remainingImages). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3774 |
nextState add:(#remainingImages -> nil). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3775 |
] ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3776 |
nextState add:(#visibleIcons -> #nextPageIcons). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3777 |
nextState add:(#nextPageIcons -> #previousPageIcons). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3778 |
nextState add:(#previousPageIcons -> #remainingIcons). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3779 |
nextState add:(#remainingIcons -> nil). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3780 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3781 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3782 |
anyImages := false. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3783 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3784 |
lineIndex := prevFirstLine := fileListView firstLineShown. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3785 |
endIndex := prevLastLine := fileListView lastLineShown. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3786 |
endIndex := endIndex min:(files size). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3787 |
state := #visibleIcons. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3788 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3789 |
done := false. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3790 |
[done] whileFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3791 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3792 |
"/ if multiple FileBrowsers are reading, let others |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3793 |
"/ make some progress too |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3794 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3795 |
Processor yield. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3796 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3797 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3798 |
"/ could be destroyed in the meanwhile ... |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3799 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3800 |
realized ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3801 |
listUpdateProcess := nil. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3802 |
Processor activeProcess terminate |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3803 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3804 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3805 |
((prevFirstLine ~~ fileListView firstLineShown) |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3806 |
or:[prevLastLine ~~ fileListView lastLineShown]) ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3807 |
"/ start all over again |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3808 |
lineIndex := prevFirstLine := fileListView firstLineShown. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3809 |
endIndex := prevLastLine := fileListView lastLineShown. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3810 |
endIndex := endIndex min:(files size). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3811 |
state := #visibleIcons. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3812 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3813 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3814 |
(lineIndex between:1 and:(files size)) ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3815 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3816 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3817 |
"/ expand the next entry ... |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3818 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3819 |
aFileName := files at:lineIndex. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3820 |
entry := fileListView at:lineIndex. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3821 |
f := currentDirectory construct:aFileName. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3822 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3823 |
(state endsWith:'Icons') ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3824 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3825 |
"/ pass 1 - icons |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3826 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3827 |
(passDone at:lineIndex) < 1 ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3828 |
(f isDirectory |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3829 |
and:[(aFileName ~= '..') and:[aFileName ~= '.']] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3830 |
) ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3831 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3832 |
"/ the following suffix cutOff is not really required, |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3833 |
"/ but makes the list look better on VMS ... |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3834 |
fileNameString := aFileName. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3835 |
dirSuffix notNil ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3836 |
(aFileName asLowercase endsWith:dirSuffix) ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3837 |
fileNameString := aFileName copyWithoutLast:(dirSuffix size). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3838 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3839 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3840 |
fileNameString := fileNameString , ' ...' |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3841 |
] ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3842 |
fileNameString := aFileName. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3843 |
thisIsVMS == true ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3844 |
(aFileName endsWith:'.') ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3845 |
aFileName ~= '..' ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3846 |
fileNameString := aFileName copyWithoutLast:1 |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3847 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3848 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3849 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3850 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3851 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3852 |
showLongList ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3853 |
len := fileNameString size. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3854 |
(len > 20) ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3855 |
fileNameString := (fileNameString contractTo:20) |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3856 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3857 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3858 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3859 |
entry colAt:1 put:(self iconForFile:aFileName). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3860 |
entry colAt:2 put:fileNameString. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3861 |
|
1507 | 3862 |
"/fileListView at:lineIndex put:entry. |
3863 |
fileListView withoutRedrawAt:lineIndex put:entry. |
|
3864 |
fileListView invalidateLine:lineIndex. |
|
1487
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3865 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3866 |
anyImages ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3867 |
(Image isImageFileSuffix:(aFileName asFilename suffix)) |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3868 |
ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3869 |
anyImages := true |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3870 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3871 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3872 |
passDone at:lineIndex put:1 |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3873 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3874 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3875 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3876 |
(state endsWith:'Attributes') ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3877 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3878 |
"/ pass 2 - everything except fileType (which takes very long) |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3879 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3880 |
(passDone at:lineIndex) < 2 ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3881 |
info := f info. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3882 |
info isNil ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3883 |
"not accessable - usually a symlink, |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3884 |
to a nonexisting/nonreadable file |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3885 |
" |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3886 |
f isSymbolicLink ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3887 |
p := f linkInfo path. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3888 |
typeString := 'broken symbolic link to ' , p |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3889 |
] ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3890 |
typeString := 'unknown' |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3891 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3892 |
] ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3893 |
typ := (info type). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3894 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3895 |
modeString := self getModeString:(info at:#mode) |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3896 |
with:#( '' $r $w $x |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3897 |
' ' $r $w $x |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3898 |
' ' $r $w $x ). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3899 |
entry colAt:3 put:modeString. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3900 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3901 |
((info uid) ~~ prevUid) ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3902 |
prevUid := (info uid). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3903 |
nameString := OperatingSystem getUserNameFromID:prevUid. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3904 |
nameString := nameString contractTo:10. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3905 |
nameString := nameString , (String new:(10 - nameString size)) |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3906 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3907 |
nameString isNil ifTrue:[nameString := '???']. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3908 |
entry colAt:4 put:nameString withoutSpaces. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3909 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3910 |
((info gid) ~~ prevGid) ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3911 |
prevGid := (info gid). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3912 |
groupString := OperatingSystem getGroupNameFromID:prevGid. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3913 |
groupString := groupString contractTo:10. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3914 |
groupString := groupString , (String new:(10 - groupString size)) |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3915 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3916 |
groupString isNil ifTrue:[groupString := '???']. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3917 |
entry colAt:5 put:groupString withoutSpaces. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3918 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3919 |
(typ == #regular) ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3920 |
entry colAt:6 put:(self sizePrintString:(info size)). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3921 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3922 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3923 |
f isSymbolicLink ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3924 |
p := f linkInfo path. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3925 |
typeString := 'symbolic link to ' , p |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3926 |
] ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3927 |
typeString := typ asString |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3928 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3929 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3930 |
entry colAt:7 put:typeString. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3931 |
|
1507 | 3932 |
"/ fileListView at:lineIndex put:entry. |
3933 |
fileListView withoutRedrawAt:lineIndex put:entry. |
|
3934 |
fileListView invalidateLine:lineIndex. |
|
1487
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3935 |
passDone at:lineIndex put:2. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3936 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3937 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3938 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3939 |
(state endsWith:'Types') ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3940 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3941 |
"/ pass 3: add fileType |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3942 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3943 |
(passDone at:lineIndex) < 3 ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3944 |
info := f info. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3945 |
info notNil ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3946 |
f isSymbolicLink ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3947 |
(Image isImageFileSuffix:(f suffix)) ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3948 |
typeString := f fileType. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3949 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3950 |
entry colAt:7 put:typeString. |
1507 | 3951 |
"/ fileListView at:lineIndex put:entry |
3952 |
fileListView withoutRedrawAt:lineIndex put:entry. |
|
3953 |
fileListView invalidateLine:lineIndex. |
|
1487
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3954 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3955 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3956 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3957 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3958 |
passDone at:lineIndex put:3 |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3959 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3960 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3961 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3962 |
(state endsWith:'Images') ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3963 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3964 |
"/ pass 4: read images |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3965 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3966 |
(passDone at:lineIndex) < 4 ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3967 |
(Image isImageFileSuffix:(f suffix)) ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3968 |
f isDirectory ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3969 |
img := Image fromFile:(f pathName). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3970 |
img notNil ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3971 |
img := img magnifiedTo:16@16. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3972 |
img := img on:self device. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3973 |
entry colAt:7 put:img. |
1507 | 3974 |
"/ fileListView at:lineIndex put:entry |
3975 |
fileListView withoutRedrawAt:lineIndex put:entry. |
|
3976 |
fileListView invalidateLine:lineIndex. |
|
1487
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3977 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3978 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3979 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3980 |
passDone at:lineIndex put:4 |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3981 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3982 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3983 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3984 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3985 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3986 |
"/ advance to the next line |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3987 |
"/ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3988 |
lineIndex := lineIndex + 1. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3989 |
lineIndex > endIndex ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3990 |
"/ finished this round ... |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3991 |
"/ see what we are going for ... |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3992 |
numVisible := (fileListView lastLineShown - fileListView firstLineShown + 1). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3993 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3994 |
state := nextState at:state ifAbsent:nil. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3995 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3996 |
state isNil ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3997 |
done := true |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3998 |
] ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
3999 |
(state startsWith:'visible') ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4000 |
lineIndex := fileListView firstLineShown. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4001 |
endIndex := fileListView lastLineShown. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4002 |
endIndex := endIndex min:(files size). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4003 |
] ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4004 |
(state startsWith:'nextPage') ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4005 |
lineIndex := fileListView lastLineShown + 1. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4006 |
endIndex := lineIndex + numVisible. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4007 |
endIndex := endIndex min:(files size). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4008 |
lineIndex := lineIndex min:(files size). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4009 |
] ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4010 |
(state startsWith:'previousPage') ifTrue:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4011 |
endIndex := fileListView firstLineShown - 1. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4012 |
lineIndex := endIndex - numVisible. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4013 |
lineIndex := lineIndex max:1. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4014 |
endIndex := endIndex min:(files size). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4015 |
endIndex := endIndex max:1. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4016 |
] ifFalse:[ |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4017 |
"/ remaining |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4018 |
lineIndex := 1. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4019 |
endIndex := files size. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4020 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4021 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4022 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4023 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4024 |
] |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4025 |
]. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4026 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4027 |
listUpdateProcess := nil. |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4028 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4029 |
] forkAt:(Processor activePriority - 1). |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4030 |
|
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4031 |
" |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4032 |
install a new check after some time |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4033 |
" |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4034 |
Processor addTimedBlock:checkBlock afterSeconds:checkDelta |
36 | 4035 |
] |
142 | 4036 |
|
1487
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4037 |
"Modified: / 21.9.1995 / 11:40:23 / claus" |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4038 |
"Modified: / 28.4.1997 / 22:30:30 / dq" |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
4039 |
"Modified: / 18.9.1997 / 18:28:30 / stefan" |
1507 | 4040 |
"Modified: / 5.3.1998 / 01:27:53 / cg" |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
4041 |
! ! |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
4042 |
|
172 | 4043 |
!FileBrowser methodsFor:'queries'! |
73 | 4044 |
|
1700
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
4045 |
fileName |
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4046 |
"return my current fileName - during fileIn, the file |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4047 |
which is being loaded is returned. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4048 |
This is provided for VW fileIn scripts, which walk the |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4049 |
context hierarchy and ask the fileBrowser for the name." |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4050 |
|
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4051 |
|f| |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4052 |
|
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4053 |
f := currentFileInFileName ? currentFileName. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4054 |
f isNil ifTrue:[^ nil]. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4055 |
^ self path asFilename construct:f |
1700
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
4056 |
|
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
4057 |
" |
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
4058 |
(FileBrowser openOnFileNamed:'Makefile') fileName |
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
4059 |
" |
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
4060 |
|
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4061 |
"Modified: / 18.6.1998 / 15:27:35 / cg" |
1700
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
4062 |
! |
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
4063 |
|
172 | 4064 |
path |
4065 |
"return my currentDirectories pathName; |
|
1329 | 4066 |
sent from the pathField to aquire the pathname when I changed directory" |
4067 |
||
4068 |
"/ somewhat tricky: first ask it for the full pathName, |
|
4069 |
"/ then convert it to a directory name |
|
4070 |
"/ (which only makes a difference on VMS) |
|
4071 |
||
4072 |
^ currentDirectory asFilename pathName asFilename osNameForDirectory |
|
49 | 4073 |
! ! |
4074 |
||
763
94a8d188b52d
care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
4075 |
!FileBrowser class methodsFor:'documentation'! |
203 | 4076 |
|
4077 |
version |
|
1731 | 4078 |
^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.229 1998-07-20 16:31:36 cg Exp $' |
381 | 4079 |
! ! |