author | Claus Gittinger <cg@exept.de> |
Fri, 09 Oct 1998 16:18:26 +0200 | |
changeset 1920 | adffddc8cfc2 |
parent 1912 | 0c8dc1be1553 |
child 1933 | ee09e254fe18 |
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 |
1834 | 15 |
fileList checkBlock checkDelta timeOfLastCheck myName killButton |
16 |
pauseToggle compressTabs lockUpdate previousDirectory |
|
17 |
currentFileName timeOfFileRead tabSpec commandView commandIndex |
|
18 |
fileEncoding tabRulerView scrollView icons listUpdateProcess |
|
19 |
currentFileInFileName lastFileDiffDirectory sortByWhat |
|
20 |
sortCaseless showingDetails showingHiddenFiles' |
|
1010 | 21 |
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
|
22 |
CommandHistory CommandHistorySize Icons DefaultCommandPerSuffix' |
1010 | 23 |
poolDictionaries:'' |
24 |
category:'Interface-Browsers' |
|
36 | 25 |
! |
26 |
||
763
94a8d188b52d
care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
27 |
!FileBrowser class methodsFor:'documentation'! |
36 | 28 |
|
29 |
copyright |
|
30 |
" |
|
31 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
1317 | 32 |
All Rights Reserved |
36 | 33 |
|
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
43 |
documentation |
|
44 |
" |
|
45 |
this used to be a very simple demo application, |
|
46 |
but migrated into a quite nice tool, includes all kinds of |
|
47 |
warning and information boxes, background processes for directory- |
|
48 |
reading and internationalized strings. A good example for beginners, |
|
100 | 49 |
on how to do things .... (and maybe how not to do things ;-, since some |
50 |
stuff is historic and was implemented at times when better mechanisms |
|
51 |
were not available) |
|
52 | 52 |
|
36 | 53 |
See additional information in 'doc/misc/fbrowser.doc'. |
45 | 54 |
|
52 | 55 |
WARNING: files edited with FileBrowser will have leading spaces (multiple-8) |
1317 | 56 |
being replaced by tabs. If tabs are to be preserved at other |
57 |
positions (for example, sendmail-config files) they will be |
|
58 |
corrupt after being written. |
|
508 | 59 |
|
60 |
[instance variables]: |
|
61 |
||
1317 | 62 |
checkDelta <Integer> number of seconds of check interval |
63 |
(looks ever so often if shown directory |
|
64 |
has changed). You may make this number |
|
65 |
higher, if your network-times are |
|
66 |
incorrect and thus, the filebrowser |
|
67 |
checks too often. |
|
68 |
||
69 |
compressTabs <Boolean> if true, leading spaces will be |
|
70 |
replaced by tabs when saving text |
|
52 | 71 |
|
72 |
some of the defaults (long/short list etc.) can be set by the resource file; |
|
73 |
see FileBrowser>>initialize for more details.. |
|
508 | 74 |
|
75 |
[author:] |
|
1317 | 76 |
Claus Gittinger |
36 | 77 |
" |
203 | 78 |
! ! |
36 | 79 |
|
763
94a8d188b52d
care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
80 |
!FileBrowser class methodsFor:'instance creation'! |
36 | 81 |
|
82 |
openOn:aDirectoryPath |
|
83 |
"start a new FileBrowser in a pathname" |
|
84 |
||
85 |
^ (self new currentDirectory:aDirectoryPath) open |
|
86 |
||
52 | 87 |
" |
88 |
FileBrowser openOn:'aDirectoryPath' |
|
89 |
FileBrowser openOn:'/etc' |
|
90 |
FileBrowser openOn:'..' |
|
91 |
FileBrowser openOn:'.' |
|
92 |
" |
|
93 | 93 |
! |
94 |
||
95 |
openOnFileNamed:aFilename |
|
96 |
"start a new FileBrowser on a file" |
|
97 |
||
98 |
|f browser| |
|
99 |
||
100 |
f := aFilename asFilename. |
|
1124 | 101 |
f isDirectory ifTrue:[ |
1868 | 102 |
^ self openOn:aFilename |
1124 | 103 |
]. |
1689 | 104 |
|
93 | 105 |
browser := self new. |
106 |
browser currentDirectory:f directoryName. |
|
1689 | 107 |
browser updateCurrentDirectory. |
93 | 108 |
browser showFile:f baseName. |
1689 | 109 |
|
110 |
^ browser open. |
|
93 | 111 |
|
112 |
" |
|
113 |
FileBrowser openOnFileNamed:'Makefile' |
|
114 |
FileBrowser openOnFileNamed:'../Makefile' |
|
115 |
FileBrowser openOnFileNamed:'/tmp/foo' |
|
116 |
" |
|
1124 | 117 |
|
1689 | 118 |
"Modified: / 17.6.1998 / 11:25:29 / cg" |
36 | 119 |
! ! |
120 |
||
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
121 |
!FileBrowser class methodsFor:'class initialization'! |
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
122 |
|
1178
f5f4d0c605db
lazy initialization of Icons
Claus Gittinger <cg@exept.de>
parents:
1173
diff
changeset
|
123 |
initializeIcons |
1239
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
124 |
|resources| |
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
125 |
|
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
126 |
resources := self classResources. |
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
127 |
|
1784
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
128 |
Icons := Dictionary new. |
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
129 |
|
1147 | 130 |
#( |
1868 | 131 |
"/ internal-type to icon mappings. |
132 |
(#directory 'ICON_DIRECTORY' 'tiny_yellow_dir.xpm' ) |
|
133 |
(#directoryLocked 'ICON_DIRECTORY_LOCKED' 'tiny_yellow_dir_locked.xpm') |
|
134 |
(#directoryLink 'ICON_DIRECTORY_LINK' 'tiny_yellow_dir_link.xpm' ) |
|
135 |
(#file 'ICON_FILE' 'tiny_file_plain.xpm' ) |
|
136 |
(#fileLink 'ICON_FILE_LINK' 'tiny_file_link.xpm' ) |
|
137 |
(#fileLocked 'ICON_FILE_LOCKED' 'tiny_file_lock.xpm' ) |
|
138 |
(#imageFile 'ICON_IMAGE_FILE' 'tiny_file_pix.xpm' ) |
|
139 |
(#textFile 'ICON_TEXT_FILE' 'tiny_file_text.xpm' ) |
|
140 |
(#executableFile 'ICON_EXECUTABLEFILE' 'tiny_file_exec.xpm' ) |
|
141 |
||
142 |
"/ mime-type to icon mappings. |
|
143 |
('text/plain' nil 'tiny_file_text.xpm' ) |
|
144 |
('text/html' nil 'tiny_file_text.xpm' ) |
|
145 |
('application/x-smalltalk-source' nil 'tiny_file_st.xpm' ) |
|
1239
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
146 |
) do:[:entry | |
1868 | 147 |
|key resource defaultName nm| |
148 |
||
149 |
key := entry at:1. |
|
150 |
resource := entry at:2. |
|
151 |
defaultName := entry at:3. |
|
152 |
||
153 |
resource notNil ifTrue:[ |
|
154 |
nm := resources at:resource default:nil. |
|
155 |
]. |
|
156 |
nm isNil ifTrue:[ |
|
157 |
nm := 'bitmaps/xpmBitmaps/document_images/' , defaultName |
|
158 |
]. |
|
159 |
Icons at:key put:(Image fromFile:nm). |
|
1147 | 160 |
] |
161 |
||
162 |
" |
|
1178
f5f4d0c605db
lazy initialization of Icons
Claus Gittinger <cg@exept.de>
parents:
1173
diff
changeset
|
163 |
self initializeIcons |
1147 | 164 |
" |
165 |
||
1784
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
166 |
"Modified: / 1.8.1998 / 17:39:27 / cg" |
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
167 |
! ! |
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
168 |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
169 |
!FileBrowser class methodsFor:'command history'! |
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
170 |
|
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
171 |
addToCommandHistory:aCommandString for:aFilename |
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
172 |
|cmd suffix| |
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
173 |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
174 |
(aCommandString notNil and:[aCommandString notEmpty]) ifTrue:[ |
1317 | 175 |
CommandHistory notNil ifTrue:[ |
176 |
CommandHistory addFirst:aCommandString. |
|
177 |
CommandHistory size > CommandHistorySize ifTrue:[ |
|
178 |
CommandHistory removeLast |
|
179 |
] |
|
180 |
]. |
|
181 |
aFilename notNil ifTrue:[ |
|
182 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
183 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
184 |
DefaultCommandPerSuffix := Dictionary new. |
|
185 |
]. |
|
186 |
suffix := aFilename asFilename suffix. |
|
187 |
suffix notNil ifTrue:[ |
|
188 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
189 |
] |
|
190 |
] |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
191 |
] |
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
192 |
|
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
193 |
"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
|
194 |
! ! |
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
195 |
|
763
94a8d188b52d
care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
196 |
!FileBrowser class methodsFor:'defaults'! |
73 | 197 |
|
198 |
defaultIcon |
|
1147 | 199 |
"return the file browsers default window icon" |
200 |
||
1287 | 201 |
<resource: #style (#FILEBROWSER_ICON #FILEBROWSER_ICON_FILE)> |
202 |
||
203 |
|nm i res| |
|
1147 | 204 |
|
205 |
(i := DefaultIcon) isNil ifTrue:[ |
|
1317 | 206 |
res := self classResources. |
207 |
i := res at:'FILEBROWSER_ICON' default:nil. |
|
208 |
i isNil ifTrue:[ |
|
209 |
nm := res at:'FILEBROWSER_ICON_FILE' default:'FBrowser.xbm'. |
|
210 |
i := Image fromFile:nm resolution:100. |
|
211 |
i isNil ifTrue:[ |
|
212 |
i := Image fromFile:('bitmaps/' , nm) resolution:100. |
|
213 |
i isNil ifTrue:[ |
|
214 |
i := StandardSystemView defaultIcon |
|
215 |
] |
|
216 |
] |
|
217 |
]. |
|
218 |
i notNil ifTrue:[ |
|
219 |
DefaultIcon := i := i on:Display |
|
220 |
] |
|
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
221 |
]. |
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
222 |
^ i |
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
223 |
|
1147 | 224 |
"Modified: 19.3.1997 / 20:48:34 / ca" |
1287 | 225 |
"Modified: 15.8.1997 / 15:27:19 / cg" |
73 | 226 |
! ! |
227 |
||
1834 | 228 |
!FileBrowser class methodsFor:'menu specs'! |
229 |
||
230 |
baseDirectoryMenuSpec |
|
231 |
"This resource specification was automatically generated |
|
232 |
by the MenuEditor of ST/X." |
|
233 |
||
234 |
"Do not manually edit this!! If it is corrupted, |
|
235 |
the MenuEditor may not be able to read the specification." |
|
236 |
||
237 |
" |
|
238 |
MenuEditor new openOnClass:FileBrowser andSelector:#directoryMenuSpec |
|
239 |
(Menu new fromLiteralArrayEncoding:(FileBrowser directoryMenuSpec)) startUp |
|
240 |
" |
|
241 |
||
242 |
<resource: #menu> |
|
243 |
||
244 |
^ |
|
245 |
||
246 |
#(#Menu |
|
247 |
||
1868 | 248 |
#( |
249 |
#(#MenuItem |
|
250 |
#label: 'Copy Path' |
|
251 |
#translateLabel: true |
|
252 |
#value: #copyPath |
|
253 |
) |
|
254 |
#(#MenuItem |
|
255 |
#label: '-' |
|
256 |
) |
|
257 |
#(#MenuItem |
|
258 |
#label: 'Up' |
|
259 |
#translateLabel: true |
|
260 |
#value: #changeToParentDirectory |
|
261 |
#enabled: #currentDirectoryIsNotTop |
|
262 |
) |
|
263 |
#(#MenuItem |
|
264 |
#label: 'Back' |
|
265 |
#translateLabel: true |
|
266 |
#value: #changeToPreviousDirectory |
|
267 |
) |
|
268 |
#(#MenuItem |
|
269 |
#label: 'Home' |
|
270 |
#translateLabel: true |
|
271 |
#value: #changeToHomeDirectory |
|
272 |
) |
|
273 |
#(#MenuItem |
|
274 |
#label: 'Default' |
|
275 |
#translateLabel: true |
|
276 |
#value: #changeToDefaultDirectory |
|
277 |
) |
|
278 |
#(#MenuItem |
|
279 |
#label: 'Goto...' |
|
280 |
#translateLabel: true |
|
281 |
#value: #changeCurrentDirectory |
|
282 |
) |
|
283 |
) nil |
|
284 |
nil |
|
1834 | 285 |
) |
286 |
||
287 |
"Created: / 4.8.1998 / 17:21:16 / cg" |
|
1835 | 288 |
"Modified: / 14.8.1998 / 19:19:06 / cg" |
1834 | 289 |
! |
290 |
||
291 |
directoryMenuSpec |
|
292 |
"This resource specification was automatically generated |
|
293 |
by the MenuEditor of ST/X." |
|
294 |
||
295 |
"Do not manually edit this!! If it is corrupted, |
|
296 |
the MenuEditor may not be able to read the specification." |
|
297 |
||
298 |
" |
|
299 |
MenuEditor new openOnClass:FileBrowser andSelector:#directoryMenuSpec |
|
300 |
(Menu new fromLiteralArrayEncoding:(FileBrowser directoryMenuSpec)) startUp |
|
301 |
" |
|
302 |
||
303 |
<resource: #programMenu> |
|
304 |
||
305 |
|base| |
|
306 |
||
307 |
base := self baseDirectoryMenuSpec. |
|
308 |
base := base decodeAsLiteralArray. |
|
309 |
||
310 |
"/ add the history items ... |
|
311 |
||
1835 | 312 |
DirectoryHistory size > 0 ifTrue:[ |
1868 | 313 |
base addItem:(MenuItem labeled:'-'). |
314 |
DirectoryHistory do:[:dirName | |
|
315 |
base addItem:((MenuItem label:dirName value:#changeDirectoryTo:) |
|
316 |
argument:dirName; |
|
317 |
yourself). |
|
318 |
]. |
|
1834 | 319 |
]. |
320 |
||
321 |
^ base |
|
322 |
||
1837 | 323 |
"Modified: / 17.8.1998 / 10:13:05 / cg" |
1834 | 324 |
! |
325 |
||
326 |
menuPopUp |
|
327 |
"This resource specification was automatically generated |
|
328 |
by the MenuEditor of ST/X." |
|
329 |
||
330 |
"Do not manually edit this!! If it is corrupted, |
|
331 |
the MenuEditor may not be able to read the specification." |
|
332 |
||
333 |
" |
|
334 |
MenuEditor new openOnClass:FileBrowser andSelector:#menuPopUp |
|
335 |
(Menu new fromLiteralArrayEncoding:(FileBrowser menuPopUp)) startUp |
|
336 |
" |
|
337 |
||
338 |
<resource: #menu> |
|
339 |
||
340 |
^ |
|
341 |
||
342 |
#(#Menu |
|
343 |
||
1874 | 344 |
#( |
345 |
#(#MenuItem |
|
346 |
#label: 'Spawn' |
|
347 |
#translateLabel: true |
|
348 |
#value: #fileSpawn |
|
349 |
) |
|
350 |
#(#MenuItem |
|
351 |
#label: '-' |
|
352 |
) |
|
353 |
#(#MenuItem |
|
354 |
#label: 'Get Contents' |
|
355 |
#translateLabel: true |
|
356 |
#value: #fileGet |
|
357 |
#enabled: #hasSelection |
|
358 |
) |
|
359 |
#(#MenuItem |
|
360 |
#label: 'Insert Contents' |
|
361 |
#translateLabel: true |
|
362 |
#value: #fileInsert |
|
363 |
#enabled: #hasSelection |
|
364 |
) |
|
365 |
#(#MenuItem |
|
366 |
#label: 'FileIn' |
|
367 |
#translateLabel: true |
|
368 |
#value: #fileFileIn |
|
369 |
#enabled: #hasSelection |
|
370 |
) |
|
371 |
#(#MenuItem |
|
372 |
#label: '-' |
|
373 |
) |
|
374 |
#(#MenuItem |
|
375 |
#label: 'Unix Command...' |
|
376 |
#translateLabel: true |
|
377 |
#isVisible: #systemIsUnix |
|
378 |
#value: #menuOSCommand |
|
379 |
) |
|
380 |
#(#MenuItem |
|
381 |
#label: 'DOS Command...' |
|
382 |
#translateLabel: true |
|
383 |
#isVisible: #systemIsDOS |
|
384 |
#value: #menuOSCommand |
|
385 |
) |
|
386 |
#(#MenuItem |
|
387 |
#label: 'VMS Command...' |
|
388 |
#translateLabel: true |
|
389 |
#isVisible: #systemIsVMS |
|
390 |
#value: #menuOSCommand |
|
391 |
) |
|
392 |
#(#MenuItem |
|
393 |
#label: 'ST/X Tools' |
|
394 |
#translateLabel: true |
|
395 |
#submenu: |
|
396 |
#(#Menu |
|
1834 | 397 |
|
1874 | 398 |
#( |
399 |
#(#MenuItem |
|
400 |
#label: 'Changes Browser' |
|
401 |
#translateLabel: true |
|
402 |
#value: #openChangesBrowser |
|
403 |
#enabled: #hasSelection |
|
404 |
) |
|
405 |
#(#MenuItem |
|
406 |
#label: 'Editor' |
|
407 |
#translateLabel: true |
|
408 |
#value: #openEditor |
|
409 |
#enabled: #hasSelection |
|
410 |
) |
|
411 |
#(#MenuItem |
|
412 |
#label: 'HTML Reader' |
|
413 |
#translateLabel: true |
|
414 |
#value: #openHTMLReader |
|
415 |
#enabled: #hasSelection |
|
416 |
) |
|
417 |
#(#MenuItem |
|
418 |
#label: 'Image Inspect' |
|
419 |
#translateLabel: true |
|
420 |
#value: #openImageInspector |
|
421 |
#enabled: #hasSelection |
|
422 |
) |
|
423 |
#(#MenuItem |
|
424 |
#label: 'Image Editor' |
|
425 |
#translateLabel: true |
|
426 |
#value: #openImageEditor |
|
427 |
#enabled: #hasSelection |
|
428 |
) |
|
429 |
#(#MenuItem |
|
430 |
#label: 'ZipFile Tool' |
|
431 |
#translateLabel: true |
|
432 |
#value: #openZipTool |
|
433 |
#enabled: #hasZipFileSelected |
|
434 |
) |
|
435 |
#(#MenuItem |
|
436 |
#label: 'Hex Dump' |
|
437 |
#translateLabel: true |
|
438 |
#value: #fileHexDump |
|
439 |
) |
|
440 |
#(#MenuItem |
|
441 |
#label: 'Show File Differences' |
|
442 |
#translateLabel: true |
|
443 |
#value: #openDiffView |
|
444 |
) |
|
445 |
#(#MenuItem |
|
446 |
#label: 'Terminal' |
|
447 |
#translateLabel: true |
|
448 |
#isVisible: #systemIsUnix |
|
449 |
#value: #openTerminal |
|
450 |
#enabled: #systemIsUnix |
|
451 |
) |
|
452 |
) nil |
|
453 |
nil |
|
454 |
) |
|
455 |
) |
|
456 |
#(#MenuItem |
|
457 |
#label: '-' |
|
458 |
) |
|
459 |
#(#MenuItem |
|
460 |
#label: 'Remove...' |
|
461 |
#translateLabel: true |
|
462 |
#value: #fileRemove |
|
463 |
#enabled: #hasSelection |
|
464 |
) |
|
465 |
#(#MenuItem |
|
466 |
#label: 'Rename...' |
|
467 |
#translateLabel: true |
|
468 |
#value: #fileRename |
|
469 |
#enabled: #hasSelection |
|
470 |
) |
|
471 |
#(#MenuItem |
|
472 |
#label: '-' |
|
473 |
) |
|
474 |
#(#MenuItem |
|
475 |
#label: 'New Directory...' |
|
476 |
#translateLabel: true |
|
477 |
#value: #newDirectory |
|
478 |
) |
|
479 |
#(#MenuItem |
|
480 |
#label: 'New File...' |
|
481 |
#translateLabel: true |
|
482 |
#value: #newFile |
|
483 |
) |
|
484 |
#(#MenuItem |
|
485 |
#label: '-' |
|
486 |
) |
|
487 |
#(#MenuItem |
|
488 |
#label: 'Update' |
|
489 |
#translateLabel: true |
|
490 |
#value: #updateCurrentDirectory |
|
491 |
) |
|
492 |
) nil |
|
493 |
nil |
|
1834 | 494 |
) |
495 |
||
1874 | 496 |
"Modified: / 7.9.1998 / 15:14:15 / cg" |
1834 | 497 |
! |
498 |
||
499 |
menuSpec |
|
500 |
"This resource specification was automatically generated |
|
501 |
by the MenuEditor of ST/X." |
|
502 |
||
503 |
"Do not manually edit this!! If it is corrupted, |
|
504 |
the MenuEditor may not be able to read the specification." |
|
505 |
||
506 |
" |
|
507 |
MenuEditor new openOnClass:FileBrowser andSelector:#menuSpec |
|
508 |
(Menu new fromLiteralArrayEncoding:(FileBrowser menuSpec)) startUp |
|
509 |
" |
|
510 |
||
511 |
<resource: #menu> |
|
512 |
||
513 |
^ |
|
514 |
||
515 |
#(#Menu |
|
516 |
||
1874 | 517 |
#( |
518 |
#(#MenuItem |
|
519 |
#label: 'About' |
|
520 |
#translateLabel: true |
|
521 |
#labelImage: #(#ResourceRetriever #ToolApplicationModel #menuIcon) |
|
522 |
#submenu: |
|
523 |
#(#Menu |
|
1834 | 524 |
|
1874 | 525 |
#( |
526 |
#(#MenuItem |
|
527 |
#label: 'About Smalltalk/X...' |
|
528 |
#translateLabel: true |
|
529 |
#value: #showAboutSTX |
|
530 |
) |
|
531 |
#(#MenuItem |
|
532 |
#label: '-' |
|
533 |
) |
|
534 |
#(#MenuItem |
|
535 |
#label: 'About FileBrowser...' |
|
536 |
#translateLabel: true |
|
537 |
#value: #openAboutThisApplication |
|
538 |
) |
|
539 |
) nil |
|
540 |
nil |
|
541 |
) |
|
542 |
) |
|
543 |
#(#MenuItem |
|
544 |
#label: 'File' |
|
545 |
#translateLabel: true |
|
546 |
#submenu: |
|
547 |
#(#Menu |
|
1834 | 548 |
|
1874 | 549 |
#( |
550 |
#(#MenuItem |
|
551 |
#label: 'Open' |
|
552 |
#translateLabel: true |
|
553 |
#value: #menuOpen |
|
554 |
#enabled: #hasSelection |
|
555 |
) |
|
556 |
#(#MenuItem |
|
557 |
#label: 'FileIn' |
|
558 |
#translateLabel: true |
|
559 |
#value: #fileFileIn |
|
560 |
#enabled: #hasSelection |
|
561 |
) |
|
562 |
#(#MenuItem |
|
563 |
#label: '-' |
|
564 |
) |
|
565 |
#(#MenuItem |
|
566 |
#label: 'New' |
|
567 |
#translateLabel: true |
|
568 |
#submenu: |
|
569 |
#(#Menu |
|
1834 | 570 |
|
1874 | 571 |
#( |
572 |
#(#MenuItem |
|
573 |
#label: 'Directory...' |
|
574 |
#translateLabel: true |
|
575 |
#value: #newDirectory |
|
576 |
) |
|
577 |
#(#MenuItem |
|
578 |
#label: 'File...' |
|
579 |
#translateLabel: true |
|
580 |
#value: #newFile |
|
581 |
) |
|
582 |
#(#MenuItem |
|
583 |
#label: 'Hard Link...' |
|
584 |
#translateLabel: true |
|
585 |
#isVisible: #systemIsUnix |
|
586 |
#value: #newHardLink |
|
587 |
) |
|
588 |
#(#MenuItem |
|
589 |
#label: 'Symbolic Link...' |
|
590 |
#translateLabel: true |
|
591 |
#isVisible: #systemIsUnix |
|
592 |
#value: #newSoftLink |
|
593 |
) |
|
594 |
) nil |
|
595 |
nil |
|
596 |
) |
|
597 |
) |
|
598 |
#(#MenuItem |
|
599 |
#label: 'Remove' |
|
600 |
#translateLabel: true |
|
601 |
#value: #fileRemove |
|
602 |
#enabled: #hasSelection |
|
603 |
) |
|
604 |
#(#MenuItem |
|
605 |
#label: 'Rename' |
|
606 |
#translateLabel: true |
|
607 |
#value: #fileRename |
|
608 |
#enabled: #hasSelection |
|
609 |
) |
|
610 |
#(#MenuItem |
|
611 |
#label: 'Properties...' |
|
612 |
#translateLabel: true |
|
613 |
#value: #fileGetLongInfo |
|
614 |
#enabled: #hasSelection |
|
615 |
) |
|
616 |
#(#MenuItem |
|
617 |
#label: '-' |
|
1893
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
618 |
#isVisible: #javaSupportLoaded |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
619 |
) |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
620 |
#(#MenuItem |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
621 |
#label: 'Add to Java ClassPath' |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
622 |
#translateLabel: true |
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
623 |
#isVisible: #javaSupportLoaded |
1893
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
624 |
#value: #fileAddToJavaClassPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
625 |
#enabled: #canAddToClassPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
626 |
) |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
627 |
#(#MenuItem |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
628 |
#label: 'Remove from Java ClassPath' |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
629 |
#translateLabel: true |
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
630 |
#isVisible: #javaSupportLoaded |
1893
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
631 |
#value: #fileRemoveFromJavaClassPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
632 |
#enabled: #canRemoveToClassPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
633 |
) |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
634 |
#(#MenuItem |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
635 |
#label: '-' |
1874 | 636 |
) |
637 |
#(#MenuItem |
|
638 |
#label: 'Spawn' |
|
639 |
#translateLabel: true |
|
640 |
#value: #fileSpawn |
|
641 |
) |
|
642 |
#(#MenuItem |
|
643 |
#label: '-' |
|
644 |
) |
|
645 |
#(#MenuItem |
|
646 |
#label: 'Exit' |
|
647 |
#translateLabel: true |
|
648 |
#value: #menuExit |
|
649 |
) |
|
650 |
) nil |
|
651 |
nil |
|
652 |
) |
|
653 |
) |
|
654 |
#(#MenuItem |
|
655 |
#label: 'Directory' |
|
656 |
#translateLabel: true |
|
657 |
#submenuChannel: #directoryMenuSpec |
|
658 |
) |
|
659 |
#(#MenuItem |
|
660 |
#label: 'Edit' |
|
661 |
#translateLabel: true |
|
662 |
#submenu: |
|
663 |
#(#Menu |
|
1834 | 664 |
|
1874 | 665 |
#( |
666 |
#(#MenuItem |
|
667 |
#label: 'Get Contents' |
|
668 |
#translateLabel: true |
|
669 |
#value: #fileGet |
|
670 |
#enabled: #hasSelection |
|
671 |
) |
|
672 |
#(#MenuItem |
|
673 |
#label: 'Insert Contents' |
|
674 |
#translateLabel: true |
|
675 |
#value: #fileInsert |
|
676 |
#enabled: #hasSelection |
|
677 |
) |
|
678 |
#(#MenuItem |
|
679 |
#label: '-' |
|
680 |
) |
|
681 |
#(#MenuItem |
|
682 |
#label: 'Copy File List' |
|
683 |
#translateLabel: true |
|
684 |
#value: #copyFileList |
|
685 |
) |
|
1920
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
686 |
#(#MenuItem |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
687 |
#label: 'Copy Selected Filename' |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
688 |
#translateLabel: true |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
689 |
#value: #copySelectedFileName |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
690 |
) |
1874 | 691 |
) nil |
692 |
nil |
|
693 |
) |
|
694 |
) |
|
695 |
#(#MenuItem |
|
696 |
#label: 'View' |
|
697 |
#translateLabel: true |
|
698 |
#submenu: |
|
699 |
#(#Menu |
|
1834 | 700 |
|
1874 | 701 |
#( |
702 |
#(#MenuItem |
|
703 |
#label: 'Details' |
|
704 |
#translateLabel: true |
|
705 |
#indication: #showingDetails |
|
706 |
) |
|
707 |
#(#MenuItem |
|
708 |
#label: 'Show Hidden Files' |
|
709 |
#translateLabel: true |
|
710 |
#indication: #showingHiddenFiles |
|
711 |
) |
|
712 |
#(#MenuItem |
|
713 |
#label: '-' |
|
714 |
) |
|
715 |
#(#MenuItem |
|
716 |
#label: 'Sort By Name' |
|
717 |
#translateLabel: true |
|
718 |
#choice: #sortByWhat |
|
719 |
#choiceValue: #name |
|
720 |
) |
|
721 |
#(#MenuItem |
|
722 |
#label: 'Sort By Type' |
|
723 |
#translateLabel: true |
|
724 |
#choice: #sortByWhat |
|
725 |
#choiceValue: #type |
|
726 |
) |
|
727 |
#(#MenuItem |
|
728 |
#label: 'Sort By Time' |
|
729 |
#translateLabel: true |
|
730 |
#choice: #sortByWhat |
|
731 |
#choiceValue: #time |
|
732 |
) |
|
733 |
#(#MenuItem |
|
734 |
#label: 'Ignore Case' |
|
735 |
#translateLabel: true |
|
736 |
#enabled: #sortByName |
|
737 |
#indication: #sortCaseless |
|
738 |
) |
|
739 |
#(#MenuItem |
|
740 |
#label: '-' |
|
741 |
) |
|
742 |
#(#MenuItem |
|
743 |
#label: 'Encoding...' |
|
744 |
#translateLabel: true |
|
745 |
#value: #fileEncoding |
|
746 |
) |
|
747 |
#(#MenuItem |
|
748 |
#label: '-' |
|
749 |
) |
|
750 |
#(#MenuItem |
|
751 |
#label: 'Update' |
|
752 |
#translateLabel: true |
|
753 |
#value: #updateCurrentDirectory |
|
754 |
) |
|
755 |
) nil |
|
756 |
nil |
|
757 |
) |
|
758 |
) |
|
759 |
#(#MenuItem |
|
760 |
#label: 'Tools' |
|
761 |
#translateLabel: true |
|
762 |
#submenu: |
|
763 |
#(#Menu |
|
1834 | 764 |
|
1874 | 765 |
#( |
766 |
#(#MenuItem |
|
767 |
#label: 'Unix Command' |
|
768 |
#translateLabel: true |
|
769 |
#isVisible: #systemIsUnix |
|
770 |
#value: #menuOSCommand |
|
771 |
) |
|
772 |
#(#MenuItem |
|
773 |
#label: 'DOS Command' |
|
774 |
#translateLabel: true |
|
775 |
#isVisible: #systemIsDOS |
|
776 |
#value: #menuOSCommand |
|
777 |
) |
|
778 |
#(#MenuItem |
|
779 |
#label: 'VMS Command' |
|
780 |
#translateLabel: true |
|
781 |
#isVisible: #systemIsVMS |
|
782 |
#value: #menuOSCommand |
|
783 |
) |
|
784 |
#(#MenuItem |
|
785 |
#label: '-' |
|
786 |
) |
|
787 |
#(#MenuItem |
|
788 |
#label: 'Changes Browser' |
|
789 |
#translateLabel: true |
|
790 |
#value: #openChangesBrowser |
|
791 |
#enabled: #hasSelection |
|
792 |
) |
|
793 |
#(#MenuItem |
|
794 |
#label: 'Editor' |
|
795 |
#translateLabel: true |
|
796 |
#value: #openEditor |
|
797 |
#enabled: #hasSelection |
|
798 |
) |
|
799 |
#(#MenuItem |
|
800 |
#label: 'HTML Reader' |
|
801 |
#translateLabel: true |
|
802 |
#value: #openHTMLReader |
|
803 |
#enabled: #hasSelection |
|
804 |
) |
|
805 |
#(#MenuItem |
|
806 |
#label: 'Image Inspector' |
|
807 |
#translateLabel: true |
|
808 |
#value: #openImageInspector |
|
809 |
#enabled: #hasSelection |
|
810 |
) |
|
811 |
#(#MenuItem |
|
812 |
#label: 'Image Editor' |
|
813 |
#translateLabel: true |
|
814 |
#value: #openImageEditor |
|
815 |
#enabled: #hasSelection |
|
816 |
) |
|
817 |
#(#MenuItem |
|
818 |
#label: 'ZipFile Tool' |
|
819 |
#translateLabel: true |
|
820 |
#value: #openZipTool |
|
821 |
#enabled: #hasZipFileSelected |
|
822 |
) |
|
823 |
#(#MenuItem |
|
824 |
#label: 'File Differences...' |
|
825 |
#translateLabel: true |
|
826 |
#value: #openDiffView |
|
827 |
) |
|
828 |
#(#MenuItem |
|
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
829 |
#label: 'Find Duplicate Files' |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
830 |
#translateLabel: true |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
831 |
#value: #fileFindDuplicates |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
832 |
) |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
833 |
#(#MenuItem |
1874 | 834 |
#label: 'Hex Dump' |
835 |
#translateLabel: true |
|
836 |
#value: #fileHexDump |
|
837 |
) |
|
838 |
#(#MenuItem |
|
839 |
#label: 'Shell Terminal' |
|
840 |
#translateLabel: true |
|
841 |
#isVisible: #systemIsUnix |
|
842 |
#value: #openTerminal |
|
843 |
#enabled: #systemIsUnix |
|
844 |
) |
|
845 |
) nil |
|
846 |
nil |
|
847 |
) |
|
848 |
) |
|
849 |
#(#MenuItem |
|
850 |
#label: 'Help' |
|
851 |
#translateLabel: true |
|
852 |
#startGroup: #right |
|
853 |
#submenu: |
|
854 |
#(#Menu |
|
1834 | 855 |
|
1874 | 856 |
#( |
857 |
#(#MenuItem |
|
858 |
#label: 'FileBrowser Documentation' |
|
859 |
#translateLabel: true |
|
860 |
#value: #openHTMLDocument: |
|
861 |
#argument: 'tools/fbrowser/TOP.html' |
|
862 |
) |
|
863 |
) nil |
|
864 |
nil |
|
865 |
) |
|
866 |
) |
|
867 |
) nil |
|
868 |
nil |
|
1834 | 869 |
) |
870 |
||
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
871 |
"Modified: / 3.10.1998 / 18:04:14 / cg" |
1834 | 872 |
! ! |
873 |
||
874 |
!FileBrowser methodsFor:'aspects'! |
|
875 |
||
1893
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
876 |
canAddToClassPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
877 |
^ [ |f| |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
878 |
|
1894
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
879 |
(Java isNil or:[Java isLoaded not]) ifTrue:[ |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
880 |
false |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
881 |
] ifFalse:[ |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
882 |
f := self getSelectedFileName. |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
883 |
f notNil ifTrue:[ |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
884 |
f := currentDirectory asFilename construct:f |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
885 |
]. |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
886 |
f notNil |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
887 |
and:[(Java classPath includes:f pathName) not |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
888 |
and:[f isDirectory |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
889 |
or:[(f hasSuffix:'jar') |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
890 |
or:[(f hasSuffix:'zip')]]]]. |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
891 |
] |
1893
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
892 |
] |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
893 |
|
1894
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
894 |
"Modified: / 22.9.1998 / 16:56:40 / cg" |
1893
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
895 |
! |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
896 |
|
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
897 |
canRemoveToClassPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
898 |
^ [ |f| |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
899 |
|
1894
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
900 |
(Java isNil or:[Java isLoaded not]) ifTrue:[ |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
901 |
false |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
902 |
] ifFalse:[ |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
903 |
f := self getSelectedFileName. |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
904 |
f notNil ifTrue:[ |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
905 |
f := currentDirectory asFilename construct:f |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
906 |
]. |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
907 |
f notNil |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
908 |
and:[(Java classPath includes:f pathName) |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
909 |
and:[f isDirectory |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
910 |
or:[(f hasSuffix:'jar') |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
911 |
or:[(f hasSuffix:'zip')]]]] |
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
912 |
] |
1893
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
913 |
] |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
914 |
|
1894
b7b2f4b09bf0
oops - check if Java isLoaded.
Claus Gittinger <cg@exept.de>
parents:
1893
diff
changeset
|
915 |
"Modified: / 22.9.1998 / 16:57:16 / cg" |
1893
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
916 |
! |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
917 |
|
1834 | 918 |
currentDirectoryIsNotTop |
919 |
^ [currentDirectory notNil and:[currentDirectory isRootDirectory not]] |
|
920 |
||
921 |
"Modified: / 4.8.1998 / 14:10:57 / cg" |
|
922 |
"Created: / 14.8.1998 / 12:07:10 / cg" |
|
923 |
! |
|
924 |
||
925 |
hasSelection |
|
926 |
^ [fileListView selection size > 0] |
|
927 |
||
928 |
"Created: / 4.8.1998 / 14:10:31 / cg" |
|
929 |
"Modified: / 4.8.1998 / 14:10:57 / cg" |
|
930 |
! |
|
931 |
||
1835 | 932 |
hasVisitHistory |
933 |
^ [DirectoryHistory size > 0] |
|
934 |
||
935 |
"Created: / 14.8.1998 / 19:17:02 / cg" |
|
936 |
"Modified: / 14.8.1998 / 19:17:17 / cg" |
|
937 |
! |
|
938 |
||
1853 | 939 |
hasZipFileSelected |
940 |
^ [|sel fn| |
|
1854 | 941 |
|
1868 | 942 |
sel := fileListView selectionValue. |
943 |
sel size == 1 |
|
944 |
and:[ ((fn := self getSelectedFileName asFilename) hasSuffix:'zip') |
|
945 |
or:[fn hasSuffix:'jar']] |
|
1853 | 946 |
] |
947 |
||
948 |
"Created: / 26.8.1998 / 16:15:26 / cg" |
|
1854 | 949 |
"Modified: / 26.8.1998 / 16:33:05 / cg" |
1853 | 950 |
! |
951 |
||
1893
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
952 |
javaSupportLoaded |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
953 |
^ [ JavaClassReader notNil |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
954 |
and:[JavaClassReader isLoaded]] |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
955 |
|
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
956 |
"Created: / 9.11.1998 / 05:33:17 / cg" |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
957 |
! |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
958 |
|
1834 | 959 |
showingDetails |
960 |
^ showingDetails |
|
961 |
||
962 |
"Created: / 14.8.1998 / 14:15:15 / cg" |
|
963 |
! |
|
964 |
||
965 |
showingHiddenFiles |
|
966 |
^ showingHiddenFiles |
|
967 |
||
968 |
"Created: / 14.8.1998 / 14:15:44 / cg" |
|
969 |
! |
|
970 |
||
971 |
sortByWhat |
|
972 |
^ sortByWhat |
|
973 |
||
974 |
"Created: / 14.8.1998 / 15:55:18 / cg" |
|
975 |
"Modified: / 14.8.1998 / 15:56:08 / cg" |
|
976 |
! |
|
977 |
||
978 |
sortCaseless |
|
979 |
^ sortCaseless |
|
980 |
||
981 |
"Created: / 14.8.1998 / 14:21:21 / cg" |
|
982 |
! |
|
983 |
||
984 |
systemIsDOS |
|
985 |
^ OperatingSystem isMSDOSlike |
|
986 |
||
987 |
"Created: / 4.8.1998 / 13:37:28 / cg" |
|
988 |
! |
|
989 |
||
990 |
systemIsUnix |
|
991 |
^ OperatingSystem isUNIXlike |
|
992 |
||
993 |
"Created: / 4.8.1998 / 13:37:13 / cg" |
|
994 |
! |
|
995 |
||
996 |
systemIsVMS |
|
997 |
^ OperatingSystem isVMSlike |
|
998 |
||
999 |
"Created: / 4.8.1998 / 13:37:37 / cg" |
|
1000 |
! ! |
|
1001 |
||
1119 | 1002 |
!FileBrowser methodsFor:'drag & drop'! |
172 | 1003 |
|
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
1004 |
canDrop:aCollectionOfDropObjects |
1119 | 1005 |
"I accept fileObjects only" |
1006 |
||
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
1007 |
aCollectionOfDropObjects do:[:aDropObject | |
1317 | 1008 |
aDropObject isFileObject ifFalse:[ |
1009 |
aDropObject isTextObject ifFalse:[^ false]. |
|
1010 |
] |
|
1122
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
1011 |
]. |
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
1012 |
^ true |
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
1013 |
|
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
1014 |
"Modified: 11.4.1997 / 12:41:59 / cg" |
1118 | 1015 |
! |
1016 |
||
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
1017 |
drop:aCollectionOfDropObjects at:aPoint |
1122
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
1018 |
"handle drops" |
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
1019 |
|
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
1020 |
aCollectionOfDropObjects do:[:aDropObject | |
1317 | 1021 |
self dropSingleObject:aDropObject at:aPoint |
1132
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
1022 |
] |
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
1023 |
|
bd2eda432e1d
drop arg is always a collection
Claus Gittinger <cg@exept.de>
parents:
1124
diff
changeset
|
1024 |
"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
|
1025 |
! |
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
1026 |
|
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
1027 |
dropSingleObject:someObject at:aPoint |
1119 | 1028 |
"handle drops; if its a directory, change to it. |
1124 | 1029 |
If its a file, change to its directory and select the file. |
1030 |
If its text, paste it into the codeView." |
|
1119 | 1031 |
|
1122
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
1032 |
|newDir newFile| |
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
1033 |
|
1124 | 1034 |
someObject isFileObject ifTrue:[ |
1317 | 1035 |
someObject isDirectory ifTrue:[ |
1036 |
newDir := someObject theObject pathName. |
|
1037 |
] ifFalse:[ |
|
1038 |
newDir := someObject theObject directoryName. |
|
1039 |
newFile := someObject theObject baseName. |
|
1040 |
]. |
|
1041 |
||
1042 |
newDir notNil ifTrue:[ |
|
1043 |
newDir ~= currentDirectory pathName ifTrue:[ |
|
1044 |
self changeDirectoryTo:newDir. |
|
1045 |
] |
|
1046 |
]. |
|
1047 |
newFile notNil ifTrue:[ |
|
1048 |
newFile ~= currentFileName ifTrue:[ |
|
1049 |
fileListView selection:(fileList indexOf:newFile). |
|
1050 |
self doFileGet:false. |
|
1051 |
] |
|
1052 |
]. |
|
1053 |
^ self |
|
1122
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
1054 |
]. |
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
1055 |
|
1124 | 1056 |
someObject isTextObject ifTrue:[ |
1317 | 1057 |
subView paste:someObject theObject. |
1058 |
^ self |
|
1118 | 1059 |
]. |
1124 | 1060 |
|
1061 |
"Modified: 6.4.1997 / 14:46:44 / cg" |
|
1119 | 1062 |
! ! |
1063 |
||
1064 |
!FileBrowser methodsFor:'events'! |
|
1118 | 1065 |
|
1010 | 1066 |
handlesKeyPress:key inView:view |
1067 |
"this method is reached via delegation: are we prepared to handle |
|
1068 |
a keyPress in some other view ?" |
|
1069 |
||
1396 | 1070 |
<resource: #keyboard (#GotoLine #InspectIt #CmdI #Cmdu #DoIt #Delete #BackSpace #Accept #CmdF #CmdD)> |
1010 | 1071 |
|
1072 |
view == fileListView ifTrue:[ |
|
1418 | 1073 |
(key == #Delete |
1074 |
or:[key == #BackSpace |
|
1075 |
or:[key == #Accept |
|
1076 |
or:[key == #CmdI |
|
1077 |
or:[key == #CmdF |
|
1078 |
or:[key == #CmdD |
|
1079 |
or:[key == #Cmdu |
|
1080 |
or:[key == #InspectIt |
|
1081 |
or:[key == #GotoLine |
|
1082 |
or:[key == #DoIt]]]]]]]]]) ifTrue:[^ true]. |
|
1010 | 1083 |
]. |
1084 |
^ false |
|
1085 |
||
1396 | 1086 |
"Created: / 28.1.1997 / 14:03:20 / stefan" |
1087 |
"Modified: / 20.6.1997 / 16:35:01 / cg" |
|
1088 |
"Modified: / 16.1.1998 / 16:50:39 / stefan" |
|
1010 | 1089 |
! |
1090 |
||
1091 |
keyPress:key x:x y:y view:view |
|
1092 |
"this method is reached via delegation from the fileListView" |
|
1093 |
||
1094 |
<resource: #keyboard (#GotoLine #InspectIt #CmdI #Cmdu #DoIt #Delete #BackSpace #Accept)> |
|
1095 |
||
1096 |
(key == #Delete or:[key == #BackSpace]) ifTrue:[ |
|
1418 | 1097 |
self fileRemove. |
1098 |
^ self |
|
1010 | 1099 |
]. |
1100 |
(key == #Accept) ifTrue:[ |
|
1418 | 1101 |
self fileFileIn. |
1102 |
^ self |
|
1010 | 1103 |
]. |
1104 |
(key == #GotoLine) ifTrue:[ |
|
1418 | 1105 |
self fileGet. |
1106 |
^ self |
|
1010 | 1107 |
]. |
1108 |
(key == #DoIt) ifTrue:[ |
|
1418 | 1109 |
self fileExecute. |
1110 |
^ self |
|
1010 | 1111 |
]. |
1112 |
(key == #InspectIt) ifTrue:[ |
|
1418 | 1113 |
self fileGetInfo. |
1114 |
^ self |
|
1010 | 1115 |
]. |
1116 |
(key == #CmdI) ifTrue:[ |
|
1418 | 1117 |
self fileGetLongInfo. |
1118 |
^ self |
|
1010 | 1119 |
]. |
1120 |
(key == #Cmdu) ifTrue:[ |
|
1418 | 1121 |
self updateCurrentDirectory. |
1122 |
^ self |
|
1396 | 1123 |
]. |
1124 |
(key == #CmdF) ifTrue:[ |
|
1418 | 1125 |
self newFile. |
1126 |
^ self |
|
1396 | 1127 |
]. |
1128 |
(key == #CmdD) ifTrue:[ |
|
1418 | 1129 |
self newDirectory. |
1130 |
^ self |
|
1010 | 1131 |
]. |
1132 |
fileListView keyPress:key x:x y:y |
|
1133 |
||
1396 | 1134 |
"Created: / 28.1.1997 / 14:03:56 / stefan" |
1135 |
"Modified: / 20.6.1997 / 16:35:08 / cg" |
|
1136 |
"Modified: / 16.1.1998 / 16:51:38 / stefan" |
|
1010 | 1137 |
! |
1138 |
||
172 | 1139 |
mapped |
1140 |
super mapped. |
|
1141 |
" |
|
1142 |
whant to know about changed history |
|
1143 |
" |
|
1144 |
self updateCurrentDirectory |
|
1145 |
! |
|
1146 |
||
1147 |
visibilityChange:how |
|
1148 |
|wasVisible| |
|
1149 |
||
1150 |
wasVisible := shown. |
|
1151 |
super visibilityChange:how. |
|
1152 |
(wasVisible not and:[shown]) ifTrue:[ |
|
1868 | 1153 |
" |
1154 |
start checking again |
|
1155 |
" |
|
1156 |
Processor removeTimedBlock:checkBlock. |
|
1157 |
Processor addTimedBlock:checkBlock afterSeconds:checkDelta. |
|
172 | 1158 |
] |
1481 | 1159 |
|
1160 |
"Modified: / 18.2.1998 / 17:57:44 / cg" |
|
172 | 1161 |
! ! |
1162 |
||
1163 |
!FileBrowser methodsFor:'fileList user interaction'! |
|
1164 |
||
1165 |
changeDisplayMode |
|
1166 |
"toggle from long to short listing (and vice-versa)" |
|
1167 |
||
1834 | 1168 |
showingDetails value:(showingDetails value not). |
1169 |
"/ showLongList := showLongList not. |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
1170 |
self showOrHideTabView. |
172 | 1171 |
self updateCurrentDirectory |
747 | 1172 |
|
1834 | 1173 |
"Modified: / 4.8.1998 / 13:43:54 / cg" |
172 | 1174 |
! |
1175 |
||
1176 |
changeDotFileVisibility |
|
1177 |
"turn on/off visibility of files whose name starts with '.'" |
|
1178 |
||
1834 | 1179 |
showingHiddenFiles value:(showingHiddenFiles value not). |
1180 |
"/ showDotFiles := showDotFiles not. |
|
172 | 1181 |
self updateCurrentDirectory |
1834 | 1182 |
|
1183 |
"Modified: / 4.8.1998 / 13:45:46 / cg" |
|
1184 |
! |
|
1185 |
||
1186 |
detailsSettingChanged |
|
1187 |
"invoked, when detail (i.e. long / short) listing flag changed" |
|
1188 |
||
1189 |
self showOrHideTabView. |
|
1190 |
self updateCurrentDirectory |
|
1191 |
||
1192 |
"Modified: / 4.8.1998 / 13:43:54 / cg" |
|
1193 |
"Created: / 14.8.1998 / 14:17:49 / cg" |
|
172 | 1194 |
! |
1195 |
||
1327 | 1196 |
fileDoubleClick:lineNr |
1197 |
"double click on a file - get its contents" |
|
1198 |
||
1199 |
self fileSelect:lineNr. |
|
1200 |
self fileGet:true |
|
1201 |
! |
|
1202 |
||
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1203 |
fileEncoding |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1204 |
"open a dialog to allow change of the files character encoding. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1205 |
Files are converted to internal encoding when read, and converted back |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1206 |
to this encoding when saved. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1207 |
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
|
1208 |
the internal encoding (which is iso8859). |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1209 |
Notice: currently, not too many encodings are supported by the system." |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1210 |
|
495
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
1211 |
|dialog list descr encodings encodingNames idx| |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1212 |
|
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1213 |
list := SelectionInList new. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1214 |
|
495
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
1215 |
descr := CharacterArray supportedExternalEncodings. |
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
1216 |
encodings := descr at:2. |
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
1217 |
encodingNames := descr at:1. |
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
1218 |
|
6d6a6b8feb2b
ask characterArray for encodings
Claus Gittinger <cg@exept.de>
parents:
488
diff
changeset
|
1219 |
list list:encodingNames. |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1220 |
list selectionIndex:(encodings indexOf:fileEncoding ifAbsent:1). |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1221 |
|
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1222 |
dialog := Dialog new. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1223 |
|
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1224 |
dialog addTextLabel:(resources string:'ENCODING_MSG') withCRs. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1225 |
dialog addVerticalSpace. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1226 |
dialog addListBoxOn:list withNumberOfLines:5. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1227 |
|
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1228 |
dialog addAbortButton; addOkButton. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1229 |
dialog open. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1230 |
|
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1231 |
dialog accepted ifTrue:[ |
1317 | 1232 |
idx := list selectionIndex. |
1233 |
fileEncoding := encodings at:idx. |
|
1234 |
subView externalEncoding:fileEncoding. |
|
1235 |
||
1236 |
self validateFontEncodingFor:fileEncoding ask:true. |
|
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1237 |
]. |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1238 |
|
1219 | 1239 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1240 |
! |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1241 |
|
172 | 1242 |
fileExecute |
1243 |
"if text was modified show a queryBox, |
|
1244 |
otherwise pop up execute box immediately" |
|
1245 |
||
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1246 |
|action sel fileName| |
172 | 1247 |
|
1248 |
" |
|
1249 |
this replaces everything by the commands output ... |
|
1250 |
" |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
1251 |
action := [:command | |
1317 | 1252 |
self class addToCommandHistory:command for:fileName. |
1253 |
self doExecuteCommand:command replace:true |
|
1254 |
]. |
|
172 | 1255 |
|
1256 |
(self askIfModified:'contents has not been saved.\\Modifications will be lost when command is executed.' |
|
1317 | 1257 |
yesButton:'execute') ifFalse:[^ self]. |
172 | 1258 |
|
1259 |
"/ " |
|
1260 |
"/ this inserts the commands output ... |
|
1261 |
"/ " |
|
1262 |
"/ action := [:command| self doExecuteCommand:command replace:false]. |
|
1263 |
"/ |
|
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1264 |
|
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1265 |
sel := fileListView selection. |
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1266 |
sel size == 1 ifTrue:[ |
1317 | 1267 |
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
|
1268 |
]. |
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
1269 |
self askForCommandFor:fileName thenDo:action |
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
1270 |
|
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
1271 |
"Modified: 14.11.1996 / 14:59:34 / cg" |
172 | 1272 |
! |
1273 |
||
1274 |
fileFileIn |
|
1275 |
"fileIn the selected file(s)" |
|
1276 |
||
1277 |
self fileFileInLazy:false |
|
1278 |
! |
|
1279 |
||
1280 |
fileFileInLazy |
|
1281 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
1282 |
||
1283 |
self fileFileInLazy:true |
|
1284 |
! |
|
1285 |
||
1286 |
fileFileInLazy:lazy |
|
1287 |
"fileIn the selected file(s)" |
|
1288 |
||
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
1289 |
|aStream path oldPath wasLazy bos prevCurrentFileName| |
172 | 1290 |
|
1291 |
self selectedFilesDo:[:fileName | |
|
1868 | 1292 |
path := currentDirectory filenameFor:fileName. |
1293 |
path type == #regular ifTrue:[ |
|
1294 |
prevCurrentFileName := currentFileInFileName. |
|
1295 |
currentFileInFileName := fileName. |
|
1296 |
||
1297 |
(ObjectFileLoader notNil |
|
1298 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
|
1299 |
Object abortSignal catch:[ |
|
1300 |
|p| |
|
1301 |
||
1302 |
"/ |
|
1303 |
"/ look if already loaded ... then unload first |
|
1304 |
"/ |
|
1305 |
p := path pathName. |
|
1306 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
1307 |
(Dialog confirm:(resources |
|
1308 |
string:'%1 is already loaded; load anyway ?' |
|
1309 |
with:p)) ifFalse:[ |
|
1310 |
^ self |
|
1311 |
]. |
|
1312 |
Transcript showCR:'unloading old ' , p , ' ...'. |
|
1313 |
ObjectFileLoader unloadObjectFile:p. |
|
1314 |
]. |
|
1315 |
||
1316 |
Transcript showCR:'loading ' , p , ' ...'. |
|
1317 |
ObjectFileLoader loadObjectFile:p. |
|
1318 |
Class addInfoRecord:('fileIn ' , fileName) |
|
1319 |
] |
|
1320 |
] ifFalse:[ |
|
1321 |
(path hasSuffix:'cls') ifTrue:[ |
|
1322 |
aStream := path readStream. |
|
1323 |
aStream notNil ifTrue:[ |
|
1324 |
bos := BinaryObjectStorage onOld:aStream. |
|
1325 |
Class nameSpaceQuerySignal |
|
1326 |
answer:Smalltalk |
|
1327 |
do:[ |
|
1328 |
bos next. |
|
1329 |
]. |
|
1330 |
bos close |
|
1331 |
] |
|
1332 |
] ifFalse:[ |
|
1333 |
((path hasSuffix:'class') |
|
1334 |
or:[(path hasSuffix:'cla')]) ifTrue:[ |
|
1335 |
JavaClassReader notNil ifTrue:[ |
|
1336 |
JavaClassReader loadFile:(path pathName) |
|
1337 |
] |
|
1338 |
] ifFalse:[ |
|
1339 |
aStream := path readStream. |
|
1340 |
aStream notNil ifTrue:[ |
|
1341 |
[ |
|
1342 |
Class withoutUpdatingChangesDo:[ |
|
1343 |
oldPath := Smalltalk systemPath. |
|
1344 |
Smalltalk systemPath:(oldPath copy addFirst:currentDirectory pathName; yourself). |
|
1345 |
wasLazy := Compiler compileLazy:lazy. |
|
1346 |
aStream fileIn. |
|
1347 |
]. |
|
1348 |
Class addInfoRecord:('fileIn ' , fileName) |
|
1349 |
] valueNowOrOnUnwindDo:[ |
|
1350 |
Compiler compileLazy:wasLazy. |
|
1351 |
Smalltalk systemPath:oldPath. |
|
1352 |
aStream close |
|
1353 |
] |
|
1354 |
] |
|
1355 |
] |
|
1356 |
] |
|
1357 |
] |
|
1358 |
]. |
|
1359 |
currentFileInFileName := prevCurrentFileName |
|
172 | 1360 |
] |
1361 |
||
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
1362 |
"Modified: / 19.9.1997 / 23:42:22 / stefan" |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
1363 |
"Modified: / 18.6.1998 / 15:30:38 / cg" |
172 | 1364 |
! |
1365 |
||
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1366 |
fileFindDuplicates |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1367 |
"scan directory for duplicate files" |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1368 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1369 |
|fileNames dir infoDir filesBySize |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1370 |
result info| |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1371 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1372 |
(self askIfModified:'contents has not been saved.\\Modifications will be lost when you proceed.' |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1373 |
yesButton:'proceed') ifFalse:[^ self]. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1374 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1375 |
self withWaitCursorDo:[ |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1376 |
result := Dictionary new. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1377 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1378 |
dir := currentDirectory asFilename. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1379 |
fileNames := dir directoryContents. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1380 |
fileNames := fileNames collect:[:fn | dir construct:fn]. |
1912 | 1381 |
fileNames := fileNames select:[:fn | fn isDirectory not]. |
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1382 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1383 |
infoDir := Dictionary new. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1384 |
fileNames do:[:fn | |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1385 |
infoDir at:fn put:(fn info) |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1386 |
]. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1387 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1388 |
"/ for each, get the files size. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1389 |
"/ in a first pass, look for files of the same size and |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1390 |
"/ compare them ... |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1391 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1392 |
filesBySize := Dictionary new. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1393 |
infoDir keysAndValuesDo:[:fn :info | |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1394 |
|sz entry| |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1395 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1396 |
sz := info size. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1397 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1398 |
entry add:fn. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1399 |
]. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1400 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1401 |
"/ any of same size ? |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1402 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1403 |
filesBySize do:[:entry | |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1404 |
|files| |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1405 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1406 |
entry size > 1 ifTrue:[ |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1407 |
files := entry asArray. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1408 |
1 to:files size-1 do:[:idx1 | |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1409 |
idx1+1 to:files size do:[:idx2 | |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1410 |
|fn1 fn2| |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1411 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1412 |
fn1 := files at:idx1. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1413 |
fn2 := files at:idx2. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1414 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1415 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1416 |
"/ compare the files |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1417 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1418 |
(fn1 binaryContentsOfEntireFile = fn2 binaryContentsOfEntireFile) ifTrue:[ |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1419 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1420 |
result at:fn1 put:fn2. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1421 |
] |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1422 |
] |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1423 |
] |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1424 |
] |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1425 |
] |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1426 |
]. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1427 |
|
1912 | 1428 |
result := result associations. |
1429 |
result := result collect:[:assoc | |
|
1430 |
|f1 f2| |
|
1431 |
||
1432 |
f1 := assoc key baseName. |
|
1433 |
f2 := assoc value baseName. |
|
1434 |
f1 < f2 ifTrue:[ |
|
1435 |
f2 -> f1 |
|
1436 |
] ifFalse:[ |
|
1437 |
f1 -> f2 |
|
1438 |
] |
|
1439 |
]. |
|
1440 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
1441 |
||
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1442 |
info := OrderedCollection new. |
1912 | 1443 |
result do:[:assoc | |
1444 |
info add:(assoc key , ' same as ' , assoc value) |
|
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1445 |
]. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1446 |
info isEmpty ifTrue:[ |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1447 |
info := 'No duplicate files found.' |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1448 |
]. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1449 |
]. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1450 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1451 |
subView contents:info |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1452 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1453 |
"Created: / 3.10.1998 / 17:59:00 / cg" |
1912 | 1454 |
"Modified: / 3.10.1998 / 19:29:19 / cg" |
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1455 |
! |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
1456 |
|
172 | 1457 |
fileGet |
1458 |
"get contents of selected file into subView. |
|
1459 |
If text was modified show a queryBox, |
|
1460 |
otherwise get it immediately" |
|
1461 |
||
633
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
1462 |
self fileGet:false |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
1463 |
|
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
1464 |
"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
|
1465 |
! |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
1466 |
|
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
1467 |
fileGet:viaDoubleClick |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
1468 |
"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
|
1469 |
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
|
1470 |
otherwise get it immediately" |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
1471 |
|
172 | 1472 |
|fileName msg label| |
1473 |
||
1110
9ec4692e9cda
dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents:
1104
diff
changeset
|
1474 |
(subView modified not or:[subView contentsWasSaved]) ifTrue:[ |
1329 | 1475 |
self doFileGet:viaDoubleClick. |
1476 |
^ self |
|
1110
9ec4692e9cda
dont decode string, if the encoding is already iso8859
Claus Gittinger <cg@exept.de>
parents:
1104
diff
changeset
|
1477 |
]. |
172 | 1478 |
fileName := self getSelectedFileName. |
1479 |
fileName notNil ifTrue:[ |
|
1329 | 1480 |
(currentDirectory filenameFor:fileName) isDirectory ifTrue:[ |
1481 |
msg := 'contents has not been saved.\\Modifications will be lost when directory is changed.'. |
|
1482 |
label := 'change'. |
|
1483 |
] ifFalse:[ |
|
1484 |
msg := 'contents has not been saved.\\Modifications will be lost when new file is read.'. |
|
1485 |
label := 'get'. |
|
1486 |
]. |
|
1487 |
(self ask:(resources at:msg) yesButton:label) ifTrue:[ |
|
1488 |
subView modified:false. |
|
1489 |
self doFileGet:viaDoubleClick |
|
1490 |
] |
|
172 | 1491 |
] |
633
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
1492 |
|
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
1493 |
"Created: 19.6.1996 / 09:38:35 / cg" |
1162 | 1494 |
"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
|
1495 |
"Modified: 18.9.1997 / 16:27:34 / stefan" |
172 | 1496 |
! |
1497 |
||
1498 |
fileGetInfo |
|
1499 |
"show short file (stat)-info" |
|
1500 |
||
1501 |
self fileGetInfo:false |
|
1502 |
! |
|
1503 |
||
1504 |
fileGetInfo:longInfo |
|
1505 |
"get info on selected file - show it in a box" |
|
1506 |
||
1672
9df905f8bfa3
update fileInfo while showing infoBox
Claus Gittinger <cg@exept.de>
parents:
1628
diff
changeset
|
1507 |
|string box updater| |
172 | 1508 |
|
1509 |
string := self getFileInfoString:longInfo. |
|
1510 |
string notNil ifTrue:[ |
|
1868 | 1511 |
box := InfoBox title:string. |
1512 |
updater := [ |
|
1513 |
[true] whileTrue:[ |
|
1514 |
Delay waitForSeconds:2. |
|
1515 |
string := self getFileInfoString:longInfo. |
|
1516 |
box title:string |
|
1517 |
] |
|
1518 |
] fork. |
|
1519 |
||
1520 |
box showAtPointer. |
|
1521 |
updater terminate. |
|
1522 |
box destroy |
|
172 | 1523 |
] |
1524 |
! |
|
1525 |
||
1526 |
fileGetLongInfo |
|
1527 |
"show long stat (file)-info" |
|
1528 |
||
1529 |
self fileGetInfo:true |
|
1530 |
! |
|
1531 |
||
1874 | 1532 |
fileHexDump |
1533 |
"show a hex dump (similar to od -x) |
|
1534 |
Only needed with non-Unix systems." |
|
1535 |
||
1536 |
self withReadCursorDo:[ |
|
1537 |
|fileName f stream data offs |
|
1538 |
addrDigits col line asciiLine lines| |
|
1539 |
||
1540 |
fileName := self getSelectedFileName. |
|
1541 |
fileName notNil ifTrue:[ |
|
1542 |
f := currentDirectory construct:fileName. |
|
1543 |
f isDirectory ifTrue:[ |
|
1544 |
^ self warn:(resources string:'%1 is a directory.' with:fileName). |
|
1545 |
]. |
|
1546 |
f exists ifFalse:[ |
|
1547 |
self warn:(resources string:'oops, ''%1'' is gone or unreadable.' with:fileName). |
|
1548 |
^ self |
|
1549 |
]. |
|
1550 |
f isReadable ifFalse:[ |
|
1551 |
self warn:(resources string:'''%1'' is unreadable.' with:fileName). |
|
1552 |
^ self |
|
1553 |
]. |
|
1554 |
stream := f readStream binary. |
|
1555 |
data := stream contents. |
|
1556 |
stream close. |
|
1557 |
||
1558 |
subView list:nil. |
|
1559 |
col := 1. |
|
1560 |
offs := 0. |
|
1561 |
lines := StringCollection new. |
|
1562 |
||
1563 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
1564 |
||
1565 |
line := (offs hexPrintString:addrDigits) , ': '. |
|
1566 |
asciiLine := ''. |
|
1567 |
||
1568 |
data do:[:byte | |
|
1569 |
line := line , (byte hexPrintString:2). |
|
1570 |
(byte between:32 and:127) ifTrue:[ |
|
1571 |
asciiLine := asciiLine copyWith:(Character value:byte) |
|
1572 |
] ifFalse:[ |
|
1573 |
asciiLine := asciiLine , '.' |
|
1574 |
]. |
|
1575 |
||
1576 |
offs := offs + 1. |
|
1577 |
col := col + 1. |
|
1578 |
col > 16 ifTrue:[ |
|
1579 |
lines add:(line , ' ' , asciiLine). |
|
1580 |
(offs bitAnd:16rFF) == 0 ifTrue:[ |
|
1581 |
lines add:nil |
|
1582 |
]. |
|
1583 |
line := (offs hexPrintString:addrDigits) , ': '. |
|
1584 |
asciiLine := ''. |
|
1585 |
col := 1. |
|
1586 |
] ifFalse:[ |
|
1587 |
line := line , ' ' |
|
1588 |
] |
|
1589 |
]. |
|
1590 |
line := line paddedTo:(3*16 + addrDigits + 1). |
|
1591 |
lines add:(line , ' ' , asciiLine). |
|
1592 |
self show:lines. |
|
1593 |
] |
|
1594 |
] |
|
1595 |
||
1596 |
"Modified: / 7.9.1998 / 15:37:47 / cg" |
|
1597 |
! |
|
1598 |
||
172 | 1599 |
fileInsert |
1162 | 1600 |
"insert contents of file at the cursor position" |
172 | 1601 |
|
1602 |
|fileName| |
|
1603 |
||
1604 |
fileName := self getSelectedFileName. |
|
1605 |
fileName notNil ifTrue:[ |
|
1317 | 1606 |
self showFile:fileName insert:true encoding:fileEncoding |
172 | 1607 |
] |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
1608 |
|
1162 | 1609 |
"Modified: 23.4.1997 / 13:06:06 / cg" |
172 | 1610 |
! |
1611 |
||
1612 |
fileListMenu |
|
1613 |
"return the menu to show in the fileList" |
|
1614 |
||
1235
13610578a5d2
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
1615 |
<resource: #programMenu> |
1040 | 1616 |
|
1834 | 1617 |
|m| |
1618 |
||
1619 |
m := self class menuPopUp. |
|
1620 |
m := m decodeAsLiteralArray. |
|
1621 |
m receiver:self. |
|
1622 |
^ m. |
|
1623 |
||
1624 |
"Modified: / 14.8.1998 / 14:09:12 / cg" |
|
1625 |
! |
|
1626 |
||
1627 |
fileListMenu_old |
|
1628 |
"return the menu to show in the fileList" |
|
1629 |
||
1630 |
<resource: #programMenu> |
|
1631 |
||
1736
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
1632 |
|items m sel ns subMenu subItems| |
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
1633 |
|
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
1634 |
items := #( |
1868 | 1635 |
('spawn' fileSpawn ) |
1636 |
('-' nil ) |
|
1637 |
('get contents' fileGet GotoLine) |
|
1638 |
('insert contents' fileInsert ) |
|
1639 |
('show info' fileGetInfo InspectIt) |
|
1640 |
('show full info' fileGetLongInfo CmdI) |
|
1641 |
). |
|
1193
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
1642 |
|
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
1643 |
((ns := Project current defaultNameSpace) notNil |
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
1644 |
and:[ns ~~ Smalltalk]) ifTrue:[ |
1868 | 1645 |
items := items copyWith:(Array |
1646 |
with:(resources string:'fileIn (into ''%1'')' with:(Project current defaultNameSpace name)) |
|
1647 |
with:#fileFileIn |
|
1648 |
with:#Accept) |
|
1736
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
1649 |
|
1193
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
1650 |
] ifFalse:[ |
1868 | 1651 |
items := items copyWith:#( 'fileIn' #fileFileIn #Accept) |
1193
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
1652 |
]. |
568b858d94ce
show current namespace in menus fileIn item
Claus Gittinger <cg@exept.de>
parents:
1189
diff
changeset
|
1653 |
|
1736
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
1654 |
items := items , #( |
1868 | 1655 |
('-' ) |
1656 |
('update' updateCurrentDirectory Cmdu) |
|
1657 |
('-' ) |
|
1658 |
('execute unix command ...' fileExecute DoIt) |
|
1659 |
('st/x tools' stxTools ) |
|
1660 |
('-' ) |
|
1661 |
('remove' fileRemove Delete) |
|
1662 |
('rename ...' fileRename ) |
|
1663 |
('-' ) |
|
1664 |
('display long list' changeDisplayMode ) |
|
1665 |
('show all files' changeDotFileVisibility ) |
|
1666 |
('encoding ...' fileEncoding ) |
|
1667 |
('-' ) |
|
1668 |
('create directory ...' newDirectory CmdD) |
|
1669 |
('create file ...' newFile CmdF) |
|
1670 |
). |
|
172 | 1671 |
|
1672 |
m := PopUpMenu |
|
1868 | 1673 |
itemList:items |
1674 |
resources:resources. |
|
172 | 1675 |
|
1834 | 1676 |
showingHiddenFiles value "showDotFiles" ifTrue:[ |
1868 | 1677 |
m labelAt:#changeDotFileVisibility put:(resources string:'hide hidden files') |
172 | 1678 |
]. |
1834 | 1679 |
showingDetails value "showLongList" ifTrue:[ |
1868 | 1680 |
m labelAt:#changeDisplayMode put:(resources string:'display short list') |
172 | 1681 |
]. |
1682 |
||
1736
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
1683 |
items := #( |
1868 | 1684 |
('Changes browser' openChangesBrowser ) |
1685 |
('Editor' openEditor ) |
|
1686 |
('HTML reader' openHTMLReader ) |
|
1687 |
('Image inspect' openImageInspector ) |
|
1688 |
('show file differences' openDiffView ) |
|
1689 |
). |
|
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
1690 |
|
1751 | 1691 |
OperatingSystem isUNIXlike ifTrue:[ |
1868 | 1692 |
items := items , #( ('terminal' openTerminal )). |
1751 | 1693 |
]. |
1694 |
||
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
1695 |
JavaInterpreter notNil ifTrue:[ |
1868 | 1696 |
items := items , #( ('Java Applet Viewer' openAppletViewer)). |
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
1697 |
]. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
1698 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
1699 |
m subMenuAt:#stxTools |
1868 | 1700 |
put:(PopUpMenu |
1701 |
itemList:items |
|
1702 |
resources:resources). |
|
1736
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
1703 |
|
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
1704 |
((sel := fileListView selection) isNil |
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
1705 |
or:[sel isEmpty]) ifTrue:[ |
1868 | 1706 |
m disableAll:#(fileGet fileInsert |
1707 |
fileGetInfo fileGetLongInfo |
|
1708 |
fileFileIn fileFileInLazy |
|
1709 |
fileRemove fileRename). |
|
1710 |
(m subMenuAt:#stxTools) |
|
1711 |
disableAll:#(openChangesBrowser openEditor openHTMLReader openImageInspector) |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
1712 |
] ifFalse:[ |
1868 | 1713 |
fileListView selection size > 1 ifTrue:[ |
1714 |
m disableAll:#( fileGet fileInsert fileGetInfo fileGetLongInfo fileRename ) |
|
1715 |
] |
|
172 | 1716 |
]. |
1717 |
||
1718 |
^m |
|
252 | 1719 |
|
1396 | 1720 |
"Modified: / 16.1.1998 / 16:42:59 / stefan" |
1834 | 1721 |
"Modified: / 4.8.1998 / 13:45:56 / cg" |
1722 |
"Created: / 13.8.1998 / 20:51:38 / cg" |
|
172 | 1723 |
! |
1724 |
||
1725 |
filePrint |
|
1162 | 1726 |
"send a files contents to the printer (not in the menu)" |
1727 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1728 |
|fileName path inStream printStream line| |
172 | 1729 |
|
294 | 1730 |
self withWaitCursorDo:[ |
1329 | 1731 |
fileName := self getSelectedFileName. |
1732 |
fileName notNil ifTrue:[ |
|
1733 |
path := currentDirectory filenameFor:fileName. |
|
1734 |
(path type == #regular) ifTrue:[ |
|
1735 |
inStream := path readStream. |
|
1736 |
inStream isNil ifFalse:[ |
|
1737 |
printStream := PrinterStream new. |
|
1738 |
printStream notNil ifTrue:[ |
|
1739 |
[inStream atEnd] whileFalse:[ |
|
1740 |
line := inStream nextLine. |
|
1741 |
printStream nextPutLine:line. |
|
1742 |
]. |
|
1743 |
printStream close |
|
1744 |
]. |
|
1745 |
inStream close |
|
1746 |
] |
|
1747 |
] |
|
1748 |
]. |
|
1749 |
0 "compiler hint" |
|
172 | 1750 |
] |
294 | 1751 |
|
1162 | 1752 |
"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
|
1753 |
"Modified: 18.9.1997 / 16:29:17 / stefan" |
172 | 1754 |
! |
1755 |
||
1756 |
fileRemove |
|
1757 |
"remove the selected file(s). |
|
1758 |
Query if user really wants to remove the file. |
|
1759 |
- should be enhanced, to look for a ~/.trash directory |
|
1760 |
and move files there if it exists (without asking in this case)." |
|
1761 |
||
1762 |
|sel q| |
|
1763 |
||
1764 |
sel := fileListView selection. |
|
1765 |
sel notNil ifTrue:[ |
|
1901
94c5ad84d0e3
if shift is pressed, dont ask for remove-confirmation.
Claus Gittinger <cg@exept.de>
parents:
1894
diff
changeset
|
1766 |
sel size > 1 ifTrue:[ |
94c5ad84d0e3
if shift is pressed, dont ask for remove-confirmation.
Claus Gittinger <cg@exept.de>
parents:
1894
diff
changeset
|
1767 |
q := resources string:'remove selected files ?' |
94c5ad84d0e3
if shift is pressed, dont ask for remove-confirmation.
Claus Gittinger <cg@exept.de>
parents:
1894
diff
changeset
|
1768 |
] ifFalse:[ |
94c5ad84d0e3
if shift is pressed, dont ask for remove-confirmation.
Claus Gittinger <cg@exept.de>
parents:
1894
diff
changeset
|
1769 |
q := resources string:'remove ''%1'' ?' with:(fileList at:sel first) |
94c5ad84d0e3
if shift is pressed, dont ask for remove-confirmation.
Claus Gittinger <cg@exept.de>
parents:
1894
diff
changeset
|
1770 |
]. |
94c5ad84d0e3
if shift is pressed, dont ask for remove-confirmation.
Claus Gittinger <cg@exept.de>
parents:
1894
diff
changeset
|
1771 |
(self sensor shiftDown |
94c5ad84d0e3
if shift is pressed, dont ask for remove-confirmation.
Claus Gittinger <cg@exept.de>
parents:
1894
diff
changeset
|
1772 |
or:[self ask:q yesButton:'remove']) ifTrue:[ |
94c5ad84d0e3
if shift is pressed, dont ask for remove-confirmation.
Claus Gittinger <cg@exept.de>
parents:
1894
diff
changeset
|
1773 |
self doRemove |
94c5ad84d0e3
if shift is pressed, dont ask for remove-confirmation.
Claus Gittinger <cg@exept.de>
parents:
1894
diff
changeset
|
1774 |
] |
172 | 1775 |
] |
1776 |
! |
|
1777 |
||
1778 |
fileRename |
|
1779 |
"rename the selected file(s)" |
|
1780 |
||
1781 |
|queryBox| |
|
1782 |
||
1783 |
queryBox := FilenameEnterBox new. |
|
1784 |
queryBox okText:(resources at:'rename'). |
|
1785 |
self selectedFilesDo:[:oldName | |
|
1317 | 1786 |
queryBox title:(resources string:'rename ''%1'' to:' with:oldName). |
1787 |
queryBox initialText:oldName. |
|
1788 |
queryBox action:[:newName | self doRename:oldName to:newName]. |
|
1789 |
queryBox showAtPointer |
|
172 | 1790 |
] |
1791 |
! |
|
1792 |
||
1793 |
fileSelect:lineNr |
|
1794 |
"selected a file - do nothing here" |
|
1162 | 1795 |
|
172 | 1796 |
^ self |
1162 | 1797 |
|
1798 |
"Modified: 23.4.1997 / 13:04:55 / cg" |
|
172 | 1799 |
! |
1800 |
||
1801 |
fileSpawn |
|
1802 |
"start another FileBrowser on the selected directory or |
|
1803 |
on the same directory if none is selected." |
|
1804 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1805 |
|any path| |
172 | 1806 |
|
1807 |
any := false. |
|
1808 |
self selectedFilesDo:[:fileName | |
|
1329 | 1809 |
path := currentDirectory filenameFor:fileName. |
1810 |
path isDirectory ifTrue:[ |
|
1811 |
self class openOn:(path pathName). |
|
1812 |
any := true |
|
1813 |
] |
|
172 | 1814 |
]. |
1815 |
any ifFalse:[ |
|
1329 | 1816 |
self class openOn:currentDirectory pathName |
172 | 1817 |
] |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1818 |
|
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
1819 |
"Modified: 18.9.1997 / 16:32:39 / stefan" |
172 | 1820 |
! |
1821 |
||
1853 | 1822 |
loadImageAndPerform:aSelector |
1823 |
|img path| |
|
1824 |
||
1825 |
self selectedFilesDo:[:fileName | |
|
1868 | 1826 |
path := currentDirectory filenameFor:fileName. |
1827 |
path isDirectory ifFalse:[ |
|
1828 |
img := Image fromFile:(path pathName). |
|
1829 |
img notNil ifTrue:[ |
|
1830 |
img perform:aSelector |
|
1831 |
] ifFalse:[ |
|
1832 |
self warn:'unknown format: ' , fileName |
|
1833 |
] |
|
1834 |
] |
|
1853 | 1835 |
]. |
1836 |
||
1837 |
"Modified: / 17.9.1995 / 17:41:24 / claus" |
|
1838 |
"Modified: / 18.9.1997 / 17:05:04 / stefan" |
|
1839 |
"Created: / 26.8.1998 / 16:20:18 / cg" |
|
1840 |
! |
|
1841 |
||
172 | 1842 |
newDirectory |
1843 |
"ask for and create a new directory" |
|
1844 |
||
1845 |
|queryBox| |
|
1846 |
||
1847 |
queryBox := FilenameEnterBox |
|
1317 | 1848 |
title:(resources at:'create new directory:') withCRs |
1849 |
okText:(resources at:'create') |
|
1850 |
action:[:newName | self doCreateDirectory:newName]. |
|
172 | 1851 |
queryBox showAtPointer |
1162 | 1852 |
|
1853 |
"Modified: 23.4.1997 / 13:04:27 / cg" |
|
172 | 1854 |
! |
1855 |
||
1856 |
newFile |
|
1857 |
"ask for and create a new file" |
|
1858 |
||
1859 |
|sel queryBox| |
|
1860 |
||
1861 |
queryBox := FilenameEnterBox |
|
1418 | 1862 |
title:(resources at:'create new file:') withCRs |
1863 |
okText:(resources at:'create') |
|
1864 |
action:[:newName | newName isEmpty ifFalse:[self doCreateFile:newName]]. |
|
172 | 1865 |
sel := subView selection. |
1866 |
sel notNil ifTrue:[ |
|
1418 | 1867 |
queryBox initialText:(sel asString) |
172 | 1868 |
]. |
1869 |
queryBox showAtPointer |
|
381 | 1870 |
|
1396 | 1871 |
"Modified: / 23.4.1997 / 13:04:38 / cg" |
1872 |
"Modified: / 16.1.1998 / 16:54:00 / stefan" |
|
172 | 1873 |
! |
1874 |
||
1834 | 1875 |
newHardLink |
1876 |
"ask for and create a hard link (unix only)" |
|
1877 |
||
1878 |
|sel box orgName1 name1 name2 f1 f2 f d err nm here l1 if1 if2| |
|
1879 |
||
1880 |
sel := self getSelectedFileName. |
|
1881 |
||
1882 |
orgName1 := ''. |
|
1883 |
(sel size > 0) ifTrue:[ |
|
1868 | 1884 |
(currentDirectory construct:sel) isDirectory ifFalse:[ |
1885 |
orgName1 := sel |
|
1886 |
] |
|
1834 | 1887 |
]. |
1888 |
||
1889 |
name1 := orgName1 asValue. |
|
1890 |
name2 := '' asValue. |
|
1891 |
||
1892 |
box := DialogBox new. |
|
1893 |
(box addTextLabel:'Create hard link from:') adjust:#left. |
|
1894 |
if1 := box addFilenameInputFieldOn:name1 in:here tabable:true. |
|
1895 |
(box addTextLabel:'to:') adjust:#left. |
|
1896 |
if2 := box addFilenameInputFieldOn:name2 in:here tabable:true. |
|
1897 |
||
1898 |
box addAbortButton; addOkButton. |
|
1899 |
||
1900 |
orgName1 size > 0 ifTrue:[ |
|
1868 | 1901 |
box focusOnField:if2. |
1834 | 1902 |
]. |
1903 |
box showAtPointer. |
|
1904 |
||
1905 |
box accepted ifTrue:[ |
|
1868 | 1906 |
name1 := name1 value. |
1907 |
(name1 size == 0) ifTrue:[ |
|
1908 |
err := 'no name entered'. |
|
1909 |
] ifFalse:[ |
|
1910 |
f1 := name1 asFilename. |
|
1911 |
name2 := name2 value. |
|
1912 |
(name2 size == 0) ifTrue:[ |
|
1913 |
err := 'no name entered'. |
|
1914 |
] ifFalse:[ |
|
1915 |
f2 := name2 asFilename. |
|
1916 |
f2 exists ifTrue:[ |
|
1917 |
err := '''%2'' already exists'. |
|
1918 |
] ifFalse:[ |
|
1919 |
f1 exists ifFalse:[ |
|
1920 |
err := '''%1'' does not exist'. |
|
1921 |
] ifTrue:[ |
|
1922 |
f1 isDirectory ifTrue:[ |
|
1923 |
err := '''%1'' is a directory'. |
|
1924 |
] ifFalse:[ |
|
1925 |
ErrorSignal handle:[:ex | |
|
1926 |
err := ex errorString |
|
1927 |
] do:[ |
|
1928 |
OperatingSystem createHardLinkFrom:name1 to:name2 |
|
1929 |
] |
|
1930 |
] |
|
1931 |
] |
|
1932 |
] |
|
1933 |
] |
|
1934 |
]. |
|
1935 |
||
1936 |
err notNil ifTrue:[ |
|
1937 |
self warn:(resources string:err with:(name1 ? '') asText allBold with:(name2 ? '') asText allBold). |
|
1938 |
^ self |
|
1939 |
]. |
|
1834 | 1940 |
]. |
1941 |
||
1942 |
"Modified: / 13.8.1998 / 21:47:01 / cg" |
|
1943 |
! |
|
1944 |
||
1945 |
newSoftLink |
|
1946 |
"ask for and create a soft link (unix only)" |
|
1947 |
||
1948 |
|sel box orgName1 name1 name2 f1 f2 f d err nm here l1 if1 if2| |
|
1949 |
||
1950 |
sel := self getSelectedFileName. |
|
1951 |
||
1952 |
orgName1 := ''. |
|
1953 |
(sel size > 0) ifTrue:[ |
|
1868 | 1954 |
orgName1 := sel |
1834 | 1955 |
]. |
1956 |
||
1957 |
name1 := orgName1 asValue. |
|
1958 |
name2 := '' asValue. |
|
1959 |
||
1960 |
box := DialogBox new. |
|
1961 |
(box addTextLabel:'Create symbolic link to:') adjust:#left. |
|
1962 |
if1 := box addFilenameInputFieldOn:name1 in:here tabable:true. |
|
1963 |
(box addTextLabel:'as:') adjust:#left. |
|
1964 |
if2 := box addFilenameInputFieldOn:name2 in:here tabable:true. |
|
1965 |
||
1966 |
box addAbortButton; addOkButton. |
|
1967 |
||
1968 |
orgName1 size > 0 ifTrue:[ |
|
1868 | 1969 |
box focusOnField:if2. |
1834 | 1970 |
]. |
1971 |
box showAtPointer. |
|
1972 |
||
1973 |
box accepted ifTrue:[ |
|
1868 | 1974 |
name1 := name1 value. |
1975 |
(name1 size == 0) ifTrue:[ |
|
1976 |
err := 'no name entered'. |
|
1977 |
] ifFalse:[ |
|
1978 |
f1 := name1 asFilename. |
|
1979 |
name2 := name2 value. |
|
1980 |
(name2 size == 0) ifTrue:[ |
|
1981 |
err := 'no name entered'. |
|
1982 |
] ifFalse:[ |
|
1983 |
f2 := name2 asFilename. |
|
1984 |
f2 exists ifTrue:[ |
|
1985 |
err := '''%2'' already exists'. |
|
1986 |
] ifFalse:[ |
|
1987 |
f1 exists ifFalse:[ |
|
1988 |
err := '''%1'' does not exist (link created anyway)'. |
|
1989 |
]. |
|
1990 |
ErrorSignal handle:[:ex | |
|
1991 |
err := ex errorString |
|
1992 |
] do:[ |
|
1993 |
OperatingSystem createSymbolicLinkFrom:name1 to:name2 |
|
1994 |
] |
|
1995 |
] |
|
1996 |
] |
|
1997 |
]. |
|
1998 |
||
1999 |
err notNil ifTrue:[ |
|
2000 |
self warn:(resources string:err with:(name1 ? '') asText allBold with:(name2 ? '') asText allBold). |
|
2001 |
^ self |
|
2002 |
]. |
|
1834 | 2003 |
]. |
2004 |
||
2005 |
"Modified: / 13.8.1998 / 21:26:59 / cg" |
|
2006 |
"Created: / 13.8.1998 / 21:47:14 / cg" |
|
2007 |
! |
|
2008 |
||
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2009 |
openAppletViewer |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2010 |
|numItems| |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2011 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2012 |
(numItems := fileListView selection size) > 2 ifTrue:[ |
1329 | 2013 |
(self |
2014 |
confirm:(resources string:'open for each of the %1 items ?' |
|
2015 |
with:numItems)) ifFalse:[^ self]. |
|
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2016 |
]. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2017 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2018 |
JavaInterpreter releaseAllJavaResources. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2019 |
Java markAllClassesUninitialized. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2020 |
Java initAllStaticFields. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2021 |
Java initAllClasses. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2022 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2023 |
self selectedFilesDo:[:fileName | |
1329 | 2024 |
|p path| |
2025 |
||
2026 |
path := currentDirectory filenameFor:fileName. |
|
2027 |
path isDirectory ifFalse:[ |
|
2028 |
p := Java |
|
2029 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
2030 |
argumentString:path pathName. |
|
2031 |
p resume. |
|
2032 |
] |
|
1286
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2033 |
]. |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2034 |
|
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2035 |
"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
|
2036 |
"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
|
2037 |
! |
2a464093d865
added 'open applet viewer' to ST/X tools menu
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
2038 |
|
172 | 2039 |
openChangesBrowser |
2040 |
"open a change browser on the selected file(s)" |
|
2041 |
||
2042 |
self openTool:ChangesBrowser |
|
2043 |
! |
|
2044 |
||
252 | 2045 |
openDiffView |
2046 |
"open a diff-view" |
|
2047 |
||
1736
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2048 |
|sel box orgName1 name1 name2 text1 text2 f d err nm here l1| |
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2049 |
|
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2050 |
sel := self getSelectedFileName. |
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2051 |
|
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2052 |
orgName1 := ''. |
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2053 |
(sel size > 0 |
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2054 |
and:[lastFileDiffDirectory notNil |
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2055 |
and:[lastFileDiffDirectory asFilename isDirectory]]) ifTrue:[ |
1868 | 2056 |
f := lastFileDiffDirectory asFilename construct:sel. |
2057 |
(f exists |
|
2058 |
and:[f isReadable]) ifTrue:[ |
|
2059 |
orgName1 := f name |
|
2060 |
] |
|
1736
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2061 |
]. |
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2062 |
|
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2063 |
name1 := orgName1 asValue. |
252 | 2064 |
name2 := self getSelectedFileName asValue. |
2065 |
here := currentDirectory pathName. |
|
2066 |
||
2067 |
box := DialogBox new. |
|
1852 | 2068 |
(box addTextLabel:'show difference between:\\file1 (empty for views contents):' withCRs) adjust:#left. |
252 | 2069 |
box addFilenameInputFieldOn:name1 in:here tabable:true. |
1852 | 2070 |
(box addTextLabel:'and file2:') adjust:#left. |
252 | 2071 |
box addFilenameInputFieldOn:name2 in:here tabable:true. |
2072 |
||
2073 |
box addAbortButton; addOkButton. |
|
2074 |
||
2075 |
box showAtPointer. |
|
2076 |
||
2077 |
box accepted ifTrue:[ |
|
1868 | 2078 |
name1 := name1 value. |
2079 |
(name1 isNil or:[name1 isEmpty]) ifTrue:[ |
|
2080 |
text1 := subView contents. |
|
2081 |
name1 := nil. |
|
2082 |
l1 := 'browser contents' |
|
2083 |
] ifFalse:[ |
|
2084 |
name1 := currentDirectory filenameFor:name1. |
|
2085 |
name1 isReadable ifFalse:[ |
|
2086 |
nm := name1. |
|
2087 |
name1 exists ifFalse:[ |
|
2088 |
err := '%1 does not exist'. |
|
2089 |
] ifTrue:[ |
|
2090 |
err := '%1 is not readable' |
|
2091 |
]. |
|
2092 |
]. |
|
2093 |
l1 := name1 pathName |
|
2094 |
]. |
|
2095 |
||
2096 |
name2 := currentDirectory filenameFor:name2 value. |
|
2097 |
err isNil ifTrue:[ |
|
2098 |
name2 isReadable ifFalse:[ |
|
2099 |
nm := name2. |
|
2100 |
name2 exists ifFalse:[ |
|
2101 |
err := '%1 does not exist'. |
|
2102 |
] ifTrue:[ |
|
2103 |
err := '%1 is not readable' |
|
2104 |
]. |
|
2105 |
]. |
|
2106 |
]. |
|
2107 |
err notNil ifTrue:[ |
|
2108 |
self warn:(resources string:err with:nm pathName). |
|
2109 |
^ self |
|
2110 |
]. |
|
2111 |
||
2112 |
self withWaitCursorDo:[ |
|
2113 |
(name1 notNil and:[name1 name ~= orgName1]) ifTrue:[ |
|
2114 |
lastFileDiffDirectory := name1 directoryName |
|
2115 |
]. |
|
2116 |
name1 notNil ifTrue:[ |
|
2117 |
text1 := name1 contents. |
|
2118 |
]. |
|
2119 |
text2 := name2 contents. |
|
2120 |
text1 = text2 ifTrue:[ |
|
2121 |
self information:'same contents' |
|
2122 |
] ifFalse:[ |
|
2123 |
d := DiffTextView |
|
2124 |
openOn:text1 label:l1 |
|
2125 |
and:text2 label:name2 pathName. |
|
2126 |
d label:'file differences'. |
|
2127 |
] |
|
2128 |
] |
|
252 | 2129 |
]. |
2130 |
||
1735
57ebbb06fcd7
only show an infoBox, if files have the same contents
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
2131 |
"Created: / 7.12.1995 / 20:33:58 / cg" |
57ebbb06fcd7
only show an infoBox, if files have the same contents
Claus Gittinger <cg@exept.de>
parents:
1732
diff
changeset
|
2132 |
"Modified: / 18.9.1997 / 17:31:46 / stefan" |
1852 | 2133 |
"Modified: / 25.8.1998 / 21:11:46 / cg" |
267 | 2134 |
! |
2135 |
||
2136 |
openEditor |
|
2137 |
self openTool:EditTextView |
|
2138 |
! |
|
2139 |
||
2140 |
openHTMLReader |
|
1874 | 2141 |
self openTool:HTMLDocumentView ignoreDirectories:false |
2142 |
||
2143 |
"Modified: / 7.9.1998 / 21:31:58 / cg" |
|
267 | 2144 |
! |
2145 |
||
1834 | 2146 |
openImageEditor |
1874 | 2147 |
[self loadImageAndPerform:#edit] fork |
1834 | 2148 |
|
2149 |
"Modified: / 17.9.1995 / 17:41:24 / claus" |
|
2150 |
"Modified: / 18.9.1997 / 17:05:04 / stefan" |
|
2151 |
"Created: / 13.8.1998 / 22:07:09 / cg" |
|
1874 | 2152 |
"Modified: / 7.9.1998 / 21:31:41 / cg" |
1834 | 2153 |
! |
2154 |
||
267 | 2155 |
openImageInspector |
1874 | 2156 |
[self loadImageAndPerform:#inspect] fork |
1853 | 2157 |
|
2158 |
"Modified: / 17.9.1995 / 17:41:24 / claus" |
|
2159 |
"Modified: / 18.9.1997 / 17:05:04 / stefan" |
|
1874 | 2160 |
"Modified: / 7.9.1998 / 21:31:30 / cg" |
267 | 2161 |
! |
2162 |
||
1731 | 2163 |
openTerminal |
1732 | 2164 |
VT100TerminalView openShellIn:currentDirectory |
1731 | 2165 |
|
2166 |
"Created: / 20.7.1998 / 18:18:15 / cg" |
|
1732 | 2167 |
"Modified: / 20.7.1998 / 18:32:28 / cg" |
1731 | 2168 |
! |
2169 |
||
267 | 2170 |
openTool:aToolClass |
2171 |
"open a tool on the selected file(s)" |
|
2172 |
||
1874 | 2173 |
self openTool:aToolClass ignoreDirectories:true |
2174 |
||
2175 |
"Modified: / 7.9.1998 / 19:32:10 / cg" |
|
2176 |
! |
|
2177 |
||
2178 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
2179 |
"open a tool on the selected file(s)" |
|
2180 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2181 |
|numItems path| |
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
2182 |
|
1883 | 2183 |
aToolClass isNil ifTrue:[ |
2184 |
^ self warn:'Sorry, that tool seems to be not available'. |
|
2185 |
]. |
|
2186 |
||
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
2187 |
(numItems := fileListView selection size) > 2 ifTrue:[ |
1874 | 2188 |
(self |
2189 |
confirm:(resources string:'open for each of the %1 items ?' |
|
2190 |
with:numItems)) ifFalse:[^ self]. |
|
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
2191 |
]. |
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
2192 |
|
267 | 2193 |
self selectedFilesDo:[:fileName | |
1874 | 2194 |
path := currentDirectory filenameFor:fileName. |
2195 |
(ignoreDirs not |
|
2196 |
or:[path isDirectory not]) ifTrue:[ |
|
2197 |
aToolClass openOn:(path pathName). |
|
2198 |
] |
|
267 | 2199 |
]. |
865
48395e8ecca9
remember executeCommand actions in history as well.
Claus Gittinger <cg@exept.de>
parents:
851
diff
changeset
|
2200 |
|
1874 | 2201 |
"Modified: / 18.9.1997 / 17:06:18 / stefan" |
2202 |
"Created: / 7.9.1998 / 19:31:49 / cg" |
|
1883 | 2203 |
"Modified: / 10.9.1998 / 13:58:23 / cg" |
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
2204 |
! |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
2205 |
|
1853 | 2206 |
openZipTool |
2207 |
self openTool:ZipTool |
|
2208 |
||
2209 |
"Created: / 26.8.1998 / 16:20:55 / cg" |
|
2210 |
! |
|
2211 |
||
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
2212 |
showOrHideTabView |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
2213 |
"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
|
2214 |
|
1834 | 2215 |
showingDetails value "showLongList" ifTrue:[ |
1868 | 2216 |
tabRulerView isNil ifTrue:[ |
2217 |
self createTabRulerIn:scrollView superView. |
|
2218 |
]. |
|
2219 |
tabRulerView beVisible. |
|
1758 | 2220 |
|
1868 | 2221 |
false "self is3D" ifTrue:[ |
2222 |
scrollView topInset:(tabRulerView superView height). |
|
2223 |
tabRulerView superView leftInset:(fileListView originRelativeTo:scrollView) x. |
|
2224 |
] ifFalse:[ |
|
2225 |
scrollView topInset:(tabRulerView height). |
|
2226 |
tabRulerView leftInset:(fileListView originRelativeTo:scrollView) x. |
|
2227 |
]. |
|
2228 |
tabRulerView hiddenTabs:#(1). |
|
2229 |
tabRulerView fixedTabs:#(1). |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
2230 |
] ifFalse:[ |
1868 | 2231 |
tabRulerView notNil ifTrue:[ |
2232 |
tabRulerView beInvisible. |
|
2233 |
]. |
|
2234 |
scrollView topInset:0 |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
2235 |
]. |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
2236 |
tabSpec := nil. |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
2237 |
|
1758 | 2238 |
"Created: / 19.4.1997 / 09:50:02 / cg" |
1834 | 2239 |
"Modified: / 4.8.1998 / 13:44:14 / cg" |
172 | 2240 |
! ! |
2241 |
||
2242 |
!FileBrowser methodsFor:'help '! |
|
2243 |
||
2244 |
helpTextFor:aComponent |
|
2245 |
|s| |
|
2246 |
||
2247 |
aComponent == subView ifTrue:[ |
|
1317 | 2248 |
s := 'HELP_SUBVIEW' |
172 | 2249 |
]. |
2250 |
aComponent == fileListView ifTrue:[ |
|
1317 | 2251 |
s := 'HELP_FILELIST' |
172 | 2252 |
]. |
2253 |
aComponent == filterField ifTrue:[ |
|
1317 | 2254 |
s := 'HELP_FILTER' |
172 | 2255 |
]. |
2256 |
aComponent == labelView ifTrue:[ |
|
1317 | 2257 |
s := 'HELP_PATHFIELD' |
172 | 2258 |
]. |
2259 |
aComponent == commandView ifTrue:[ |
|
1317 | 2260 |
s := 'HELP_COMMANDVIEW' |
172 | 2261 |
]. |
2262 |
s notNil ifTrue:[ |
|
1317 | 2263 |
^ resources string:s |
172 | 2264 |
]. |
2265 |
^ nil |
|
2266 |
! ! |
|
2267 |
||
36 | 2268 |
!FileBrowser methodsFor:'initialization'! |
2269 |
||
1758 | 2270 |
createTabRulerIn:topFrame |
2271 |
|v| |
|
2272 |
||
2273 |
false "self is3D" ifTrue:[ |
|
1868 | 2274 |
v := View in:topFrame. |
2275 |
v level:-1. |
|
2276 |
tabRulerView := TabSpecRuler in:v. |
|
2277 |
tabRulerView level:1. |
|
2278 |
v origin:(0.0@0.0) corner:(1.0@10). |
|
2279 |
tabRulerView origin:(0.0@0.0) corner:(1.0@1.0). |
|
1758 | 2280 |
] ifFalse:[ |
1868 | 2281 |
tabRulerView := TabSpecRuler in:topFrame. |
2282 |
tabRulerView origin:(0.0@0.0) corner:(1.0@10). |
|
1758 | 2283 |
]. |
2284 |
tabRulerView borderWidth:0. |
|
2285 |
tabRulerView synchronousOperation:true. |
|
2286 |
||
2287 |
"Created: / 27.7.1998 / 20:23:10 / cg" |
|
2288 |
"Modified: / 27.7.1998 / 20:30:10 / cg" |
|
2289 |
! |
|
2290 |
||
172 | 2291 |
currentDirectory:aDirectoryPath |
2292 |
"set the directory to be browsed" |
|
2293 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2294 |
currentDirectory := aDirectoryPath asFilename. |
172 | 2295 |
self changed:#path. |
1327 | 2296 |
|
172 | 2297 |
" |
2298 |
tell my subview (whatever that is) to start its file-dialog |
|
2299 |
(i.e. save-as etc.) in that directory |
|
2300 |
" |
|
2301 |
(subView respondsTo:#directoryForFileDialog:) ifTrue:[ |
|
1329 | 2302 |
subView directoryForFileDialog:currentDirectory |
172 | 2303 |
] |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2304 |
|
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2305 |
"Modified: 16.9.1997 / 14:56:17 / stefan" |
1327 | 2306 |
"Modified: 21.9.1997 / 11:28:49 / cg" |
172 | 2307 |
! |
2308 |
||
2309 |
focusSequence |
|
2310 |
"return the sequence in which ALT-CursorRight steps focus" |
|
2311 |
||
2312 |
|fs| |
|
2313 |
||
2314 |
fs := Array |
|
1418 | 2315 |
with:labelView |
1317 | 2316 |
with:filterField |
2317 |
with:fileListView |
|
2318 |
with:subView. |
|
172 | 2319 |
|
2320 |
commandView notNil ifTrue:[ |
|
1317 | 2321 |
fs := fs copyWith:commandView |
172 | 2322 |
]. |
2323 |
^fs |
|
2324 |
! |
|
2325 |
||
2326 |
initEvents |
|
2327 |
super initEvents. |
|
2328 |
self enableEvent:#visibilityChange. |
|
2329 |
! |
|
2330 |
||
36 | 2331 |
initialize |
1102 | 2332 |
|frame spacing halfSpacing v topFrame labelFrame filterModel |
1834 | 2333 |
buttonPanel img mH menuPanel| |
36 | 2334 |
|
2335 |
super initialize. |
|
2336 |
||
819
b78a26650047
initialize fileEncoding to #iso8859
Claus Gittinger <cg@exept.de>
parents:
807
diff
changeset
|
2337 |
fileEncoding := #iso8859. "/ native ST/X encoding |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
2338 |
|
52 | 2339 |
"if true, will replace leading spaces by tabs on |
2340 |
file write. If false, they will be written as spaces |
|
2341 |
" |
|
2342 |
compressTabs := resources at:'COMPRESS_TABS' default:true. |
|
2343 |
||
2344 |
" |
|
2345 |
showing long or short by default |
|
2346 |
" |
|
1834 | 2347 |
"/ showLongList := resources at:'LONG_LIST' default:false. |
2348 |
showingDetails := (resources at:'LONG_LIST' default:false) asValue. |
|
2349 |
showingDetails onChangeSend:#detailsSettingChanged to:self. |
|
52 | 2350 |
|
2351 |
" |
|
2352 |
show hidden files or not ? |
|
2353 |
" |
|
1834 | 2354 |
"/ showDotFiles := resources at:'SHOW_DOT_FILES' default:false. |
2355 |
showingHiddenFiles := (resources at:'SHOW_DOT_FILES' default:false) asValue. |
|
2356 |
showingHiddenFiles onChangeSend:#updateCurrentDirectory to:self. |
|
2357 |
||
2358 |
sortByWhat := #name asValue. |
|
2359 |
sortByWhat onChangeSend:#sortChanged to:self. |
|
2360 |
||
2361 |
sortCaseless := (Filename isCaseSensitive not) asValue. |
|
2362 |
sortCaseless onChangeSend:#updateCurrentDirectory to:self. |
|
52 | 2363 |
|
45 | 2364 |
lockUpdate := false. |
2365 |
||
132 | 2366 |
CommandHistory isNil ifTrue:[ |
1879 | 2367 |
CommandHistory := OrderedCollection new. |
2368 |
CommandHistorySize := 50 |
|
132 | 2369 |
]. |
36 | 2370 |
DirectoryHistory isNil ifTrue:[ |
1879 | 2371 |
DirectoryHistory := OrderedCollection new. |
2372 |
DirectoryHistoryWhere := OrderedCollection new. |
|
2373 |
HistorySize := 15. |
|
36 | 2374 |
]. |
132 | 2375 |
commandIndex := 0. |
36 | 2376 |
|
1784
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
2377 |
icons := Dictionary new. |
1495 | 2378 |
|
2379 |
Icons isNil ifTrue:[ |
|
1879 | 2380 |
self class initializeIcons |
1495 | 2381 |
]. |
2382 |
||
36 | 2383 |
myName := (resources string:self class name). |
2384 |
self label:myName. |
|
45 | 2385 |
|
1834 | 2386 |
menuPanel := MenuPanel in:self. |
1835 | 2387 |
menuPanel level:1. |
1834 | 2388 |
menuPanel verticalLayout:false. |
2389 |
menuPanel receiver:self. |
|
2390 |
menuPanel menu:(self pullDownMenu). |
|
2391 |
mH := menuPanel preferredExtent y. |
|
1846
6b66290db627
geometry fixes for win95 style
Claus Gittinger <cg@exept.de>
parents:
1845
diff
changeset
|
2392 |
menuPanel origin:(0.0 @ 0.0) corner:(1.0 @ (mH)). |
1834 | 2393 |
|
93 | 2394 |
labelFrame := View |
1879 | 2395 |
origin:(0.0 @ mH) |
2396 |
corner:(1.0 @ (font height * 1.8 + mH) rounded) |
|
2397 |
in:self. |
|
52 | 2398 |
|
1846
6b66290db627
geometry fixes for win95 style
Claus Gittinger <cg@exept.de>
parents:
1845
diff
changeset
|
2399 |
(styleSheet name = #st80 or:[styleSheet name == #win95]) ifTrue:[ |
1879 | 2400 |
labelFrame level:1. |
2401 |
"/ labelFrame rightInset:-1. |
|
45 | 2402 |
]. |
36 | 2403 |
|
2404 |
spacing := ViewSpacing. |
|
2405 |
halfSpacing := spacing // 2. |
|
2406 |
||
1100
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
2407 |
" |
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
2408 |
checkBlock is executed by the Processor every checkDelta seconds. |
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
2409 |
We use #pushEvent: to perform the directory update |
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
2410 |
in our windowgroups process. |
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
2411 |
" |
d9382b49c62d
Use #pushEvent: for timer handling.
Stefan Vogel <sv@exept.de>
parents:
1091
diff
changeset
|
2412 |
checkBlock := [self pushEvent:#checkIfDirectoryHasChanged]. |
45 | 2413 |
checkDelta := resources at:'CHECK_DELTA' default:10. |
36 | 2414 |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
2415 |
currentDirectory := Filename currentDirectory. |
36 | 2416 |
|
344
3f881dbee13a
use a model for the filter field
Claus Gittinger <cg@exept.de>
parents:
333
diff
changeset
|
2417 |
filterModel := '*' asValue. |
45 | 2418 |
filterField := EditField in:labelFrame. |
1071 | 2419 |
filterField |
1879 | 2420 |
origin:[((width // 4 * 3) + halfSpacing) @ (halfSpacing)] |
2421 |
corner:(1.0 @ (filterField heightIncludingBorder + halfSpacing) ). |
|
1846
6b66290db627
geometry fixes for win95 style
Claus Gittinger <cg@exept.de>
parents:
1845
diff
changeset
|
2422 |
filterField rightInset:(ViewSpacing - halfSpacing). |
344
3f881dbee13a
use a model for the filter field
Claus Gittinger <cg@exept.de>
parents:
333
diff
changeset
|
2423 |
filterField model:filterModel. |
45 | 2424 |
|
1846
6b66290db627
geometry fixes for win95 style
Claus Gittinger <cg@exept.de>
parents:
1845
diff
changeset
|
2425 |
labelFrame corner:(1.0 @ (mH + ViewSpacing + filterField height + halfSpacing)). |
6b66290db627
geometry fixes for win95 style
Claus Gittinger <cg@exept.de>
parents:
1845
diff
changeset
|
2426 |
|
36 | 2427 |
self initializeFilterPattern. |
344
3f881dbee13a
use a model for the filter field
Claus Gittinger <cg@exept.de>
parents:
333
diff
changeset
|
2428 |
filterModel onChangeSend:#filterPatternChanged to:self. |
3f881dbee13a
use a model for the filter field
Claus Gittinger <cg@exept.de>
parents:
333
diff
changeset
|
2429 |
"/ filterField leaveAction:[:key | fileListView scrollToTop. self updateCurrentDirectory]. |
36 | 2430 |
|
1327 | 2431 |
"/ labelView := Label in:labelFrame. |
2432 |
"/ labelView origin:(halfSpacing @ halfSpacing) |
|
2433 |
"/ extent:[((width // 4 * 3) - spacing - borderWidth) |
|
2434 |
"/ @ |
|
2435 |
"/ (filterField heightIncludingBorder) |
|
2436 |
"/ "(font height + font descent)" |
|
2437 |
"/ ]. |
|
2438 |
"/ labelView adjust:#right. |
|
2439 |
"/ labelView borderWidth:0. |
|
2440 |
"/ labelView model:self; menu:#labelMenu; aspect:#path; labelMessage:#path. |
|
2441 |
"/ labelFrame model:self; menu:#labelMenu. |
|
2442 |
||
2443 |
labelView := FilenameEditField in:labelFrame. |
|
2444 |
labelView |
|
1879 | 2445 |
origin:(halfSpacing @ (halfSpacing)) |
2446 |
extent:[((width // 4 * 3) - spacing - borderWidth) |
|
2447 |
@ |
|
2448 |
(filterField heightIncludingBorder) |
|
2449 |
"(font height + font descent)" |
|
2450 |
]. |
|
1834 | 2451 |
labelView menu:#labelMenu; |
1879 | 2452 |
aspect:#path; changeMessage:#pathChanged:. |
1327 | 2453 |
labelView model:self. |
2454 |
labelView backgroundColor:(labelFrame viewBackground). |
|
73 | 2455 |
labelFrame model:self; menu:#labelMenu. |
1329 | 2456 |
labelView cursorType:#solidCaret; cursorTypeNoFocus:#none. |
2457 |
labelView level:0. |
|
2458 |
labelView borderWidth:0. |
|
2459 |
||
2460 |
killButton := Button label:(resources string:'kill') in:self. |
|
2461 |
"/ killButton origin:(halfSpacing @ halfSpacing) |
|
2462 |
"/ extent:(killButton width @ filterField height). |
|
2463 |
killButton origin:(halfSpacing @ 1.0). |
|
2464 |
killButton topInset:(killButton height negated). |
|
2465 |
killButton beInvisible. |
|
2466 |
||
2467 |
pauseToggle := Toggle label:(resources string:'pause') in:self. |
|
2468 |
"/ pauseToggle origin:((killButton corner x + 50) @ halfSpacing) |
|
2469 |
"/ extent:(pauseToggle width @ filterField height). |
|
2470 |
pauseToggle origin:((killButton corner x + ViewSpacing + 20) @ 1.0). |
|
2471 |
pauseToggle topInset:(pauseToggle height negated). |
|
2472 |
pauseToggle beInvisible. |
|
36 | 2473 |
|
132 | 2474 |
self initializeCommandViewIn:self. |
2475 |
||
2476 |
"/ frame := VariableVerticalPanel |
|
2477 |
"/ origin:[frame borderWidth negated |
|
2478 |
"/ @ |
|
2479 |
"/ labelFrame height |
|
2480 |
"/ "/ (labelView height + labelView origin y + spacing) |
|
2481 |
"/ ] |
|
2482 |
"/ corner:(1.0 @ 1.0) |
|
2483 |
"/ in:self. |
|
2484 |
||
1834 | 2485 |
frame := VariableVerticalPanel origin:0.0@mH corner:1.0@1.0 in:self. |
132 | 2486 |
frame topInset:labelFrame height. |
2487 |
commandView notNil ifTrue:[ |
|
1879 | 2488 |
frame bottomInset:(commandView height + spacing + spacing) |
132 | 2489 |
]. |
36 | 2490 |
|
1102 | 2491 |
topFrame := View in:frame. |
36 | 2492 |
topFrame origin:(0.0 @ 0.0) corner:(1.0 @ 0.3). |
2493 |
||
1758 | 2494 |
false ifTrue:[ |
2495 |
self createTabRulerIn:topFrame. |
|
2496 |
]. |
|
1102 | 2497 |
|
2498 |
scrollView := ScrollableView in:topFrame. |
|
2499 |
scrollView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
2500 |
||
2501 |
fileListView := SelectionInListView new. |
|
2502 |
scrollView scrolledView:fileListView. |
|
36 | 2503 |
fileListView action:[:lineNr | self fileSelect:lineNr]. |
1326 | 2504 |
fileListView doubleClickAction:[:lineNr | self fileDoubleClick:lineNr]. |
36 | 2505 |
fileListView multipleSelectOk:true. |
1010 | 2506 |
fileListView delegate:self. |
98 | 2507 |
fileListView menuHolder:self; menuPerformer:self; menuMessage:#fileListMenu. |
1122
970fc7e88639
support drag out of my list.
Claus Gittinger <cg@exept.de>
parents:
1120
diff
changeset
|
2508 |
fileListView allowDrag:true. |
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
2509 |
fileListView dragObjectConverter:[:obj | |
1879 | 2510 |
|dir nm path idx| |
2511 |
||
2512 |
nm := obj theObject asString. |
|
2513 |
idx := fileListView list indexOf:nm. |
|
2514 |
idx == 0 ifTrue:[ |
|
2515 |
"/ cannot happen ... |
|
2516 |
nil |
|
2517 |
] ifFalse:[ |
|
2518 |
nm := fileList at:idx. |
|
2519 |
dir := currentDirectory pathName asFilename. |
|
2520 |
path := dir constructString:nm. |
|
2521 |
DropObject newFile:path. |
|
2522 |
] |
|
2523 |
]. |
|
1158
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2524 |
|
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2525 |
"/ sigh - must be delayed - origin is not yet fixe |
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2526 |
"/ tabRulerView leftInset:(fileListView originRelativeTo:scrollView) x. |
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2527 |
"/ self showOrHideTabView. |
1102 | 2528 |
|
36 | 2529 |
v := self initializeSubViewIn:frame. |
132 | 2530 |
|
36 | 2531 |
v origin:(0.0 @ 0.3) corner:(1.0 @ 1.0). |
2532 |
subView := v scrolledView. |
|
2533 |
(subView respondsTo:#directoryForFileDialog:) ifTrue:[ |
|
1879 | 2534 |
subView directoryForFileDialog:currentDirectory |
36 | 2535 |
]. |
2536 |
||
1329 | 2537 |
"/ buttonPanel := HorizontalPanelView in:self. |
2538 |
"/ buttonPanel horizontalLayout:#leftSpace. |
|
2539 |
"/ buttonPanel verticalSpace:0. |
|
2540 |
"/ "/ buttonPanel verticalLayout:#top. |
|
2541 |
"/ buttonPanel borderWidth:0. |
|
2542 |
"/ |
|
2543 |
"/ buttonPanel |
|
2544 |
"/ origin:(0.5 @ halfSpacing) |
|
2545 |
"/ extent:[((width // 4) - spacing - borderWidth) |
|
2546 |
"/ @ |
|
2547 |
"/ (buttonPanel preferredExtent y max:(labelView height)) |
|
2548 |
"/ ]. |
|
2549 |
"/ "/ buttonPanel level:-1. |
|
2550 |
"/ |
|
2551 |
"/ upButton := Button in:buttonPanel. |
|
2552 |
"/ img := Image fromFile:'bitmaps/xpmBitmaps/document_images/tiny_yellow_dir_up.xpm'. |
|
2553 |
"/ upButton label:(img ? 'up'). |
|
2554 |
"/ upButton action:[self changeToParentDirectory]. |
|
1328 | 2555 |
|
36 | 2556 |
ObjectMemory addDependent:self. |
132 | 2557 |
|
1758 | 2558 |
"Modified: / 6.9.1995 / 20:26:06 / claus" |
2559 |
"Modified: / 16.9.1997 / 14:52:46 / stefan" |
|
1879 | 2560 |
"Modified: / 30.8.1998 / 23:03:23 / cg" |
36 | 2561 |
! |
2562 |
||
132 | 2563 |
initializeCommandViewIn:frame |
2564 |
"set up the command view - can be redefined in subclasses as empty, |
|
2565 |
if no commandView is wanted" |
|
2566 |
||
2567 |
||
2568 |
commandView := EditField origin:0.0@1.0 corner:1.0@1.0 in:frame. |
|
1303 | 2569 |
commandView allInset:ViewSpacing//2. |
132 | 2570 |
commandView topInset:(commandView preferredExtent y negated - ViewSpacing). |
2571 |
||
133 | 2572 |
"/ commandView contents:'** no commands which require input here **'. |
132 | 2573 |
|
142 | 2574 |
commandView entryCompletionBlock:[:contents | |
1329 | 2575 |
|newString| |
2576 |
||
2577 |
newString := Filename |
|
2578 |
filenameCompletionFor:contents |
|
2579 |
directory:currentDirectory |
|
2580 |
directoriesOnly:false |
|
2581 |
filesOnly:false |
|
2582 |
ifMultiple:[:dir | commandView flash.]. |
|
2583 |
commandView contents:newString. |
|
2584 |
commandView cursorToEndOfLine. |
|
132 | 2585 |
]. |
2586 |
commandView leaveAction:[:key | |
|
1329 | 2587 |
|cmd nCmd empty| |
2588 |
||
2589 |
(key == #CursorDown |
|
2590 |
or:[key == #CursorUp]) ifTrue:[ |
|
2591 |
nCmd := CommandHistory size. |
|
2592 |
nCmd == 0 ifTrue:[ |
|
2593 |
empty := true |
|
2594 |
] ifFalse:[ |
|
2595 |
key == #CursorUp ifTrue:[ |
|
2596 |
commandIndex == nCmd ifTrue:[ |
|
2597 |
commandView flash. |
|
2598 |
]. |
|
2599 |
commandIndex := (commandIndex + 1) min:nCmd |
|
2600 |
] ifFalse:[ |
|
2601 |
commandIndex == 1 ifTrue:[ |
|
2602 |
commandView flash. |
|
2603 |
empty := true. |
|
2604 |
]. |
|
2605 |
commandIndex := (commandIndex - 1) max:1. |
|
2606 |
]. |
|
2607 |
]. |
|
2608 |
empty == true ifTrue:[ |
|
2609 |
commandView contents:nil |
|
2610 |
] ifFalse:[ |
|
2611 |
commandView contents:(CommandHistory at:commandIndex). |
|
2612 |
] |
|
2613 |
]. |
|
2614 |
key == #Return ifTrue:[ |
|
2615 |
cmd := commandView contents. |
|
2616 |
||
2617 |
subView insertLine:( |
|
2618 |
Text string:('>> ' , cmd) |
|
2619 |
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
|
2620 |
"/ ColoredListEntry string:('>> ' , cmd) color:Color blue |
1329 | 2621 |
) |
2622 |
before:(subView cursorLine). |
|
2623 |
subView cursorDown:1. |
|
133 | 2624 |
|
2625 |
"/ subView insertStringAtCursor:cmd. |
|
2626 |
"/ subView insertCharAtCursor:(Character cr). |
|
132 | 2627 |
|
1329 | 2628 |
(cmd notNil and:[cmd notEmpty]) ifTrue:[ |
2629 |
self class addToCommandHistory:cmd for:nil. |
|
2630 |
self doExecuteCommand:cmd replace:false. |
|
2631 |
commandView contents:nil. |
|
2632 |
commandIndex := 0 |
|
2633 |
] |
|
2634 |
] |
|
132 | 2635 |
]. |
2636 |
||
133 | 2637 |
"Modified: 7.9.1995 / 15:48:45 / claus" |
1303 | 2638 |
"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
|
2639 |
"Modified: 18.9.1997 / 16:55:01 / stefan" |
132 | 2640 |
! |
2641 |
||
172 | 2642 |
initializeFilterPattern |
2643 |
"set an initial matchpattern - can be redefined in subclasses" |
|
2644 |
||
344
3f881dbee13a
use a model for the filter field
Claus Gittinger <cg@exept.de>
parents:
333
diff
changeset
|
2645 |
filterField model value:'*' |
172 | 2646 |
! |
2647 |
||
2648 |
initializeSubViewIn:frame |
|
2649 |
"set up the contents view - can be redefined in subclasses for |
|
2650 |
different view types (SoundFileBrowser/ImageBrowsers etc.)" |
|
2651 |
||
2652 |
^ HVScrollableView for:CodeView miniScrollerH:true miniScrollerV:false in:frame. |
|
1158
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2653 |
! |
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2654 |
|
1247 | 2655 |
postRealize |
2656 |
super postRealize. |
|
1158
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2657 |
self showOrHideTabView. |
ea2cd788ef59
delay tabView origin setting
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2658 |
|
1247 | 2659 |
"Created: 24.7.1997 / 18:13:46 / cg" |
172 | 2660 |
! ! |
2661 |
||
1834 | 2662 |
!FileBrowser methodsFor:'menu actions'! |
2663 |
||
1837 | 2664 |
copyFileList |
2665 |
"copy fileList to the clipBoard" |
|
2666 |
||
2667 |
self setTextSelection:(fileListView list |
|
1868 | 2668 |
collect:[:l | |ll| |
2669 |
ll := l string withoutSeparators. |
|
2670 |
(ll endsWith:' ...') ifTrue:[ |
|
2671 |
ll copyWithoutLast:4 |
|
2672 |
] ifFalse:[ |
|
2673 |
ll |
|
2674 |
] |
|
2675 |
]) |
|
2676 |
asStringCollection asString. |
|
1837 | 2677 |
|
2678 |
"Modified: / 17.8.1998 / 10:13:10 / cg" |
|
2679 |
! |
|
2680 |
||
1920
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2681 |
copySelectedFileName |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2682 |
"copy the selected filename to the clipBoard (for easy paste)" |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2683 |
|
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2684 |
|sel fileName| |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2685 |
|
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2686 |
sel := fileListView selection. |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2687 |
sel size == 1 ifTrue:[ |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2688 |
fileName := fileList at:sel first. |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2689 |
self setTextSelection:fileName |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2690 |
]. |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2691 |
! |
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
2692 |
|
1834 | 2693 |
menuExit |
2694 |
self closeRequest |
|
2695 |
||
2696 |
"Created: / 4.8.1998 / 13:41:38 / cg" |
|
2697 |
! |
|
2698 |
||
2699 |
menuOSCommand |
|
2700 |
self fileExecute |
|
2701 |
||
2702 |
"Created: / 4.8.1998 / 14:06:54 / cg" |
|
2703 |
! |
|
2704 |
||
2705 |
menuOpen |
|
2706 |
"same as a double-click" |
|
2707 |
||
2708 |
"Modified: / 4.8.1998 / 13:42:14 / cg" |
|
2709 |
! |
|
2710 |
||
2711 |
menuShowFileBrowserDocumentation |
|
2712 |
||
2713 |
"Created: / 4.8.1998 / 14:03:57 / cg" |
|
2714 |
! |
|
2715 |
||
2716 |
openAboutThisApplication |
|
2717 |
"opens an about box for this application." |
|
2718 |
||
2719 |
|rev box myClass clsRev image msg| |
|
2720 |
||
2721 |
rev := ''. |
|
2722 |
myClass := self class. |
|
2723 |
||
2724 |
(clsRev := myClass revision) notNil ifTrue: [rev := ' (rev: ', clsRev printString, ')']. |
|
2725 |
||
2726 |
msg := '\' withCRs , myClass name asBoldText, rev. |
|
2727 |
||
2728 |
AboutBox isNil ifTrue:[ |
|
1868 | 2729 |
"/ this handles bad installations of ST/X, |
2730 |
"/ where the AboutBox is missing. |
|
2731 |
"/ (May vanish in the future) |
|
2732 |
^ self information:msg |
|
1834 | 2733 |
]. |
2734 |
||
2735 |
box := AboutBox title:msg. |
|
2736 |
||
2737 |
image := self class defaultIcon. |
|
2738 |
image notNil ifTrue:[ |
|
1868 | 2739 |
box image:image |
1834 | 2740 |
]. |
2741 |
box label:'About This Application'. |
|
2742 |
box autoHideAfter:10 with:[]. |
|
2743 |
box showAtPointer. |
|
2744 |
||
2745 |
"Modified: / 14.8.1998 / 13:20:24 / cg" |
|
2746 |
! |
|
2747 |
||
2748 |
openHTMLDocument:relativeDocPath |
|
2749 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
2750 |
||
2751 |
"Created: / 4.8.1998 / 14:06:10 / cg" |
|
2752 |
! |
|
2753 |
||
2754 |
pullDownMenu |
|
2755 |
"return the top (pullDown) menu" |
|
2756 |
||
2757 |
<resource: #programMenu> |
|
2758 |
||
2759 |
|m| |
|
2760 |
||
2761 |
m := self class menuSpec. |
|
2762 |
m := m decodeAsLiteralArray. |
|
2763 |
m receiver:self. |
|
2764 |
^ m. |
|
2765 |
||
2766 |
"Modified: / 14.8.1998 / 14:09:12 / cg" |
|
2767 |
"Created: / 14.8.1998 / 14:14:16 / cg" |
|
2768 |
! |
|
2769 |
||
2770 |
showAboutSTX |
|
2771 |
ToolApplicationModel openAboutSTX |
|
2772 |
||
2773 |
"Created: / 14.8.1998 / 13:18:41 / cg" |
|
2774 |
! |
|
2775 |
||
2776 |
sortChanged |
|
2777 |
Transcript show:'fBrowser:'; showCR:sortByWhat value. |
|
2778 |
self updateCurrentDirectory |
|
2779 |
||
2780 |
"Created: / 14.8.1998 / 16:17:20 / cg" |
|
2781 |
"Modified: / 14.8.1998 / 16:44:00 / cg" |
|
2782 |
! ! |
|
2783 |
||
172 | 2784 |
!FileBrowser methodsFor:'misc user interaction'! |
2785 |
||
1786 | 2786 |
closeRequest |
2787 |
"exit FileBrowser" |
|
2788 |
||
2789 |
(self askIfModified:'contents has not been saved.\\Modifications will be lost when FileBrowser is closed.' |
|
1868 | 2790 |
yesButton:'close') |
1786 | 2791 |
ifTrue:[ |
1868 | 2792 |
"/ self windowGroup closeDownViews. |
2793 |
super closeRequest |
|
1786 | 2794 |
] |
2795 |
||
2796 |
"Created: / 3.8.1998 / 19:55:06 / cg" |
|
1834 | 2797 |
"Modified: / 4.8.1998 / 18:21:03 / cg" |
1786 | 2798 |
! |
2799 |
||
172 | 2800 |
destroy |
2801 |
"destroy view and boxes" |
|
2802 |
||
2803 |
ObjectMemory removeDependent:self. |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
2804 |
self stopUpdateProcess. |
172 | 2805 |
checkBlock := nil. |
2806 |
super destroy |
|
1145
0464625bbdbb
read directory in a subprocess.
Claus Gittinger <cg@exept.de>
parents:
1144
diff
changeset
|
2807 |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
2808 |
"Modified: 19.4.1997 / 13:51:48 / cg" |
172 | 2809 |
! |
2810 |
||
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2811 |
discardChangesDialog |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2812 |
"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
|
2813 |
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
|
2814 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2815 |
^ self askIfModified:'contents has not been saved.\\Modifications will be lost when directory is changed.' |
1393 | 2816 |
yesButton:'change' |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2817 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2818 |
"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
|
2819 |
! |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2820 |
|
346 | 2821 |
filterPatternChanged |
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
2822 |
fileListView scrollToTop. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
2823 |
fileListView deselect. |
346 | 2824 |
self updateCurrentDirectory |
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
2825 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
2826 |
"Modified: / 3.10.1998 / 18:23:34 / cg" |
346 | 2827 |
! |
2828 |
||
172 | 2829 |
update:what with:someArgument from:changedObject |
2830 |
realized ifFalse:[^ self]. |
|
36 | 2831 |
|
172 | 2832 |
(what == #aboutToExit) ifTrue:[ |
1317 | 2833 |
"system wants to shut down this |
2834 |
- if text was modified, pop up, and ask user and save if requested." |
|
2835 |
||
2836 |
(subView modified and:[subView contentsWasSaved not]) ifTrue:[ |
|
2837 |
self raiseDeiconified. |
|
2838 |
||
2839 |
(self |
|
2840 |
ask:(resources at:'FileBrowser:\\contents has not been saved.\\Save before exiting ?') |
|
2841 |
yesButton:'save' |
|
2842 |
noButton:'don''t save') |
|
2843 |
ifTrue:[ |
|
2844 |
subView acceptAction notNil ifTrue:[ |
|
2845 |
subView accept |
|
2846 |
] ifFalse:[ |
|
2847 |
subView save |
|
2848 |
] |
|
2849 |
] |
|
2850 |
]. |
|
2851 |
^ self |
|
172 | 2852 |
]. |
2853 |
changedObject == tabSpec ifTrue:[ |
|
1317 | 2854 |
fileListView invalidate |
172 | 2855 |
]. |
380 | 2856 |
|
585
be0241bf7268
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
564
diff
changeset
|
2857 |
"Modified: 29.5.1996 / 16:13:43 / cg" |
172 | 2858 |
! ! |
2859 |
||
2860 |
!FileBrowser methodsFor:'pathField user interaction'! |
|
2861 |
||
1271 | 2862 |
addDirToJavaClassPath |
2863 |
"add the current path to javas classPath |
|
2864 |
(only available with ST/J System" |
|
2865 |
||
2866 |
Java addToClassPath:currentDirectory pathName |
|
2867 |
||
2868 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
2869 |
"Created: 1.8.1997 / 21:25:22 / cg" |
|
2870 |
! |
|
2871 |
||
1272 | 2872 |
addDirToJavaSourcePath |
2873 |
"add the current path to javas sourcePath |
|
2874 |
(only available with ST/J System" |
|
2875 |
||
2876 |
Java addToSourcePath:currentDirectory pathName |
|
2877 |
||
2878 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
2879 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
2880 |
! |
|
2881 |
||
172 | 2882 |
changeCurrentDirectory |
2883 |
"if text was modified show a queryBox, |
|
1329 | 2884 |
otherwise ask for & change to that directory" |
172 | 2885 |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2886 |
self discardChangesDialog ifTrue:[ |
1393 | 2887 |
self queryForDirectoryToChange |
36 | 2888 |
] |
1329 | 2889 |
|
2890 |
"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
|
2891 |
"Modified: 2.10.1997 / 14:09:02 / stefan" |
36 | 2892 |
! |
2893 |
||
172 | 2894 |
changeDirectoryTo:aDirectoryName |
2895 |
"sent from label menu to change back to a previous directory" |
|
132 | 2896 |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2897 |
self discardChangesDialog ifTrue:[ |
1868 | 2898 |
self doChangeCurrentDirectoryTo:aDirectoryName updateHistory:true "/false. |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2899 |
]. |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2900 |
|
1737 | 2901 |
"Modified: / 2.10.1997 / 14:09:24 / stefan" |
2902 |
"Modified: / 21.7.1998 / 16:38:03 / cg" |
|
172 | 2903 |
! |
2904 |
||
1329 | 2905 |
changeToDefaultDirectory |
2906 |
"if text was modified show a queryBox, |
|
2907 |
otherwise change immediately to the default directory" |
|
2908 |
||
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2909 |
self discardChangesDialog ifTrue:[ |
1393 | 2910 |
self doChangeToDefaultDirectory |
1329 | 2911 |
] |
2912 |
||
2913 |
"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
|
2914 |
"Modified: 2.10.1997 / 14:09:33 / stefan" |
1329 | 2915 |
! |
2916 |
||
172 | 2917 |
changeToHomeDirectory |
2918 |
"if text was modified show a queryBox, |
|
1329 | 2919 |
otherwise change immediately to the home directory" |
132 | 2920 |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2921 |
self discardChangesDialog ifTrue:[ |
1393 | 2922 |
self doChangeToHomeDirectory |
172 | 2923 |
] |
1329 | 2924 |
|
2925 |
"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
|
2926 |
"Modified: 2.10.1997 / 14:09:42 / stefan" |
172 | 2927 |
! |
45 | 2928 |
|
172 | 2929 |
changeToParentDirectory |
2930 |
"if text was modified show a queryBox, |
|
1329 | 2931 |
otherwise change immediately to the parent directory" |
45 | 2932 |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
2933 |
self discardChangesDialog ifTrue:[ |
1393 | 2934 |
self doChangeToParentDirectory |
36 | 2935 |
] |
1329 | 2936 |
|
2937 |
"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
|
2938 |
"Modified: 2.10.1997 / 14:09:55 / stefan" |
98 | 2939 |
! |
2940 |
||
172 | 2941 |
copyPath |
2942 |
"copy current path into cut & paste buffer" |
|
2943 |
||
873 | 2944 |
self setTextSelection:currentDirectory pathName |
2945 |
||
2946 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
172 | 2947 |
! |
2948 |
||
1893
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2949 |
fileAddToJavaClassPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2950 |
"add the current path to javas classPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2951 |
(only available with ST/J System" |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2952 |
|
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2953 |
|f| |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2954 |
|
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2955 |
f := self getSelectedFileName. |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2956 |
f isNil ifTrue:[ |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2957 |
^ self addDirToJavaClassPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2958 |
]. |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2959 |
f := currentDirectory asFilename construct:f. |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2960 |
Java addToClassPath:(f pathName) |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2961 |
|
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2962 |
"Created: / 9.11.1998 / 05:41:34 / cg" |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2963 |
"Modified: / 9.11.1998 / 05:56:00 / cg" |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2964 |
! |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2965 |
|
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2966 |
fileRemoveFromJavaClassPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2967 |
"remove the current path from javas classPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2968 |
(only available with ST/J System" |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2969 |
|
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2970 |
|f| |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2971 |
|
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2972 |
f := self getSelectedFileName. |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2973 |
f isNil ifTrue:[ |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2974 |
^ self removeDirToJavaClassPath |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2975 |
]. |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2976 |
f := currentDirectory asFilename construct:f. |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2977 |
Java removeFromClassPath:(f pathName) |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2978 |
|
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2979 |
"Created: / 9.11.1998 / 05:42:05 / cg" |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2980 |
"Modified: / 9.11.1998 / 05:56:14 / cg" |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2981 |
! |
1d91f4092152
added addToJava/removeFromJava classPath.
Claus Gittinger <cg@exept.de>
parents:
1883
diff
changeset
|
2982 |
|
172 | 2983 |
labelMenu |
1040 | 2984 |
"return the popUpMenu for the path label" |
2985 |
||
1235
13610578a5d2
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2986 |
<resource: #programMenu> |
1040 | 2987 |
|
1834 | 2988 |
^ self class directoryMenuSpec. |
2989 |
||
2990 |
"Modified: / 14.8.1998 / 12:11:16 / cg" |
|
2991 |
! |
|
2992 |
||
2993 |
labelMenu_old |
|
2994 |
"return the popUpMenu for the path label" |
|
2995 |
||
2996 |
<resource: #programMenu> |
|
2997 |
||
1737 | 2998 |
|items menu currentIndex| |
1736
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
2999 |
|
36cab4d1d655
remember last directory in show-diff-text;
Claus Gittinger <cg@exept.de>
parents:
1735
diff
changeset
|
3000 |
items := #( |
1868 | 3001 |
('copy path' copyPath ) |
3002 |
('-' ) |
|
3003 |
('up' changeToParentDirectory ) |
|
3004 |
('back' changeToPreviousDirectory ) |
|
3005 |
('change to home-directory' changeToHomeDirectory ) |
|
3006 |
('change to default-directory' changeToDefaultDirectory ) |
|
3007 |
('change directory ...' changeCurrentDirectory ) |
|
3008 |
). |
|
1400 | 3009 |
|
3010 |
(JavaClassReader notNil and:[JavaClassReader isLoaded]) ifTrue:[ |
|
1868 | 3011 |
items := items , #( |
3012 |
( '-') |
|
3013 |
( 'add to JavaClassPath' addDirToJavaClassPath) |
|
3014 |
( 'add to JavaSourcePath' addDirToJavaSourcePath) |
|
3015 |
( 'remove from JavaClassPath' removeDirFromJavaClassPath) |
|
3016 |
( 'remove from JavaSourcePath' removeDirFromJavaSourcePath) |
|
3017 |
). |
|
1271 | 3018 |
]. |
3019 |
||
172 | 3020 |
DirectoryHistory size > 0 ifTrue:[ |
1868 | 3021 |
items := items copyWith:#('-'). |
3022 |
items := items , |
|
3023 |
(DirectoryHistory |
|
3024 |
collect:[:dirName | |
|
3025 |
Array |
|
3026 |
with:dirName |
|
3027 |
with:#changeDirectoryTo: |
|
3028 |
with:nil |
|
3029 |
with:dirName |
|
3030 |
] |
|
3031 |
). |
|
3032 |
currentIndex := items findFirst:[:i | (i at:1) = currentDirectory pathName]. |
|
3033 |
currentIndex == 0 ifTrue:[currentIndex := nil]. |
|
123 | 3034 |
]. |
172 | 3035 |
|
3036 |
menu := PopUpMenu |
|
1868 | 3037 |
itemList:items |
3038 |
resources:resources. |
|
172 | 3039 |
|
3040 |
previousDirectory isNil ifTrue:[ |
|
1868 | 3041 |
menu disable:#changeToPreviousDirectory. |
132 | 3042 |
]. |
1737 | 3043 |
currentIndex notNil ifTrue:[ |
1868 | 3044 |
menu disable:currentIndex |
1737 | 3045 |
]. |
1400 | 3046 |
(JavaClassReader notNil and:[JavaClassReader isLoaded]) ifTrue:[ |
1868 | 3047 |
(Java classPath includes:currentDirectory pathName) ifTrue:[ |
3048 |
menu disable:#addDirToJavaClassPath |
|
3049 |
] ifFalse:[ |
|
3050 |
menu disable:#removeDirFromJavaClassPath |
|
3051 |
]. |
|
3052 |
(Java sourcePath includes:currentDirectory pathName) ifTrue:[ |
|
3053 |
menu disable:#addDirToJavaSourcePath |
|
3054 |
] ifFalse:[ |
|
3055 |
menu disable:#removeDirFromJavaSourcePath |
|
3056 |
]. |
|
1393 | 3057 |
]. |
172 | 3058 |
^menu. |
1040 | 3059 |
|
1737 | 3060 |
"Modified: / 21.7.1998 / 16:43:25 / cg" |
1834 | 3061 |
"Created: / 14.8.1998 / 12:10:02 / cg" |
172 | 3062 |
! |
3063 |
||
1327 | 3064 |
pathChanged:newPath |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
3065 |
"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
|
3066 |
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
|
3067 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
3068 |
|f name idx| |
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
3069 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
3070 |
self discardChangesDialog ifTrue:[ |
1393 | 3071 |
f := newPath asFilename. |
3072 |
(f isDirectory) ifTrue:[ |
|
3073 |
self changeDirectoryTo:newPath |
|
3074 |
] ifFalse:[ |
|
3075 |
self changeDirectoryTo:(f directoryName). |
|
3076 |
self changed:#path. |
|
3077 |
name := f baseName. |
|
3078 |
idx := fileList indexOf:name. |
|
3079 |
fileListView selection:idx. |
|
3080 |
self fileSelect:name. |
|
3081 |
self fileGet:true. |
|
3082 |
]. |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
3083 |
] ifFalse:[ |
1393 | 3084 |
self changed:#path. |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
3085 |
]. |
1327 | 3086 |
|
3087 |
"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
|
3088 |
"Modified: 7.10.1997 / 14:10:39 / stefan" |
1327 | 3089 |
! |
3090 |
||
172 | 3091 |
queryForDirectoryToChange |
3092 |
"query for new directory" |
|
123 | 3093 |
|
1168
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
3094 |
|queryBox dirName| |
98 | 3095 |
|
172 | 3096 |
queryBox := FilenameEnterBox |
1317 | 3097 |
title:(resources at:'change directory to:') withCRs |
3098 |
okText:(resources at:'change') |
|
3099 |
action:[:newName | dirName := newName]. |
|
172 | 3100 |
"/ queryBox initialText:''. |
1168
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
3101 |
queryBox showAtPointer. |
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
3102 |
queryBox destroy. |
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
3103 |
self doChangeCurrentDirectoryTo:dirName updateHistory:true. |
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
3104 |
|
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
3105 |
"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
|
3106 |
"Modified: 28.4.1997 / 22:30:40 / dq" |
1271 | 3107 |
! |
3108 |
||
3109 |
removeDirFromJavaClassPath |
|
3110 |
"remove the current path from javas classPath |
|
3111 |
(only available with ST/J System" |
|
3112 |
||
3113 |
Java removeFromClassPath:currentDirectory pathName |
|
3114 |
||
3115 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
3116 |
"Created: 1.8.1997 / 21:25:36 / cg" |
|
1272 | 3117 |
! |
3118 |
||
3119 |
removeDirFromJavaSourcePath |
|
3120 |
"remove the current path from javas sourcePath |
|
3121 |
(only available with ST/J System" |
|
3122 |
||
3123 |
Java removeFromSourcePath:currentDirectory pathName |
|
3124 |
||
3125 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
3126 |
"Created: 2.8.1997 / 14:11:41 / cg" |
|
36 | 3127 |
! ! |
3128 |
||
3129 |
!FileBrowser methodsFor:'private'! |
|
3130 |
||
172 | 3131 |
ask:question yesButton:yesButtonText |
3132 |
"common method to ask a yes/no question; return true or false" |
|
36 | 3133 |
|
172 | 3134 |
^ self ask:question yesButton:yesButtonText noButton:'cancel' |
3135 |
! |
|
93 | 3136 |
|
172 | 3137 |
ask:question yesButton:yesButtonText noButton:noButtonText |
36 | 3138 |
"common method to ask a yes/no question" |
3139 |
||
380 | 3140 |
^ Dialog |
1317 | 3141 |
confirm:question withCRs |
3142 |
yesLabel:(resources at:yesButtonText) |
|
3143 |
noLabel:(resources at:noButtonText) |
|
37 | 3144 |
|
380 | 3145 |
"Modified: 21.2.1996 / 01:19:21 / cg" |
36 | 3146 |
! |
3147 |
||
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
3148 |
askForCommandFor:fileName thenDo:aBlock |
172 | 3149 |
"setup and launch a querybox to ask for unix command. |
3150 |
Then evaluate aBlock passing the command-string as argument." |
|
93 | 3151 |
|
1834 | 3152 |
|box osName| |
3153 |
||
3154 |
osName := OperatingSystem platformName. |
|
93 | 3155 |
|
172 | 3156 |
box := FilenameEnterBox |
1868 | 3157 |
title:(resources string:'execute %1 command:' with:osName) |
3158 |
okText:(resources string:'execute') |
|
3159 |
action:aBlock. |
|
79 | 3160 |
|
172 | 3161 |
fileName notNil ifTrue:[ |
1868 | 3162 |
self initialCommandFor:fileName into:box. |
172 | 3163 |
]. |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3164 |
box directory:currentDirectory. |
1142
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
3165 |
box showAtPointer. |
9066d7d02a3a
remember last executed command per suffix; offer this as default.
Claus Gittinger <cg@exept.de>
parents:
1141
diff
changeset
|
3166 |
box destroy. |
36 | 3167 |
|
1834 | 3168 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
3169 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
3170 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
36 | 3171 |
! |
3172 |
||
98 | 3173 |
askIfModified:question yesButton:yesButtonText |
3174 |
"tell user, that code has been modified - let her confirm" |
|
3175 |
||
3176 |
(subView modified not or:[subView contentsWasSaved]) ifTrue:[ |
|
1393 | 3177 |
^ true |
98 | 3178 |
]. |
1340 | 3179 |
(self ask:(resources string:question) yesButton:yesButtonText) ifTrue:[ |
1393 | 3180 |
"/ reset modified flag so question is asked only once |
3181 |
subView modified:false. |
|
3182 |
^ true |
|
1340 | 3183 |
]. |
3184 |
^ false |
|
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
3185 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
3186 |
"Modified: 2.10.1997 / 14:23:47 / stefan" |
98 | 3187 |
! |
3188 |
||
1162 | 3189 |
getSelectedFileName |
3190 |
"returns the currently selected file; shows an error if |
|
3191 |
multiple files are selected" |
|
3192 |
||
3193 |
|sel| |
|
3194 |
||
3195 |
sel := fileListView selection. |
|
3196 |
(sel size > 1) ifTrue:[ |
|
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
3197 |
self onlyOneSelection |
1162 | 3198 |
] ifFalse:[ |
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
3199 |
sel notNil ifTrue:[ |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
3200 |
^ fileList at:sel first ifAbsent:nil |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
3201 |
] |
1162 | 3202 |
]. |
3203 |
^ nil |
|
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
3204 |
|
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
3205 |
"Modified: / 3.10.1998 / 18:21:23 / cg" |
1162 | 3206 |
! |
3207 |
||
3208 |
onlyOneSelection |
|
3209 |
"show a warning, that only one file must be selected for |
|
3210 |
this operation" |
|
3211 |
||
3212 |
self warn:'exactly one file must be selected !!' |
|
3213 |
! |
|
3214 |
||
3215 |
selectedFilesDo:aBlock |
|
3216 |
"evaluate aBlock on all selected files; |
|
3217 |
show a wait cursor while doing this" |
|
3218 |
||
3219 |
|sel| |
|
3220 |
||
3221 |
sel := fileListView selection. |
|
3222 |
sel notNil ifTrue:[ |
|
1903 | 3223 |
self withWaitCursorDo:[ |
3224 |
sel do:[:aSelectionIndex | |nm| |
|
3225 |
nm := fileList at:aSelectionIndex ifAbsent:nil. |
|
3226 |
nm notNil ifTrue:[ |
|
3227 |
aBlock value:nm |
|
3228 |
] |
|
3229 |
] |
|
3230 |
] |
|
1162 | 3231 |
] |
3232 |
||
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
3233 |
"Modified: / 18.6.1998 / 15:29:06 / cg" |
1162 | 3234 |
! |
3235 |
||
3236 |
show:something |
|
3237 |
"show something in subview and undef acceptAction" |
|
3238 |
||
3239 |
subView contents:something. |
|
3240 |
subView acceptAction:nil. |
|
3241 |
subView modified:false. |
|
3242 |
currentFileName := nil |
|
3243 |
! |
|
3244 |
||
3245 |
showAlert:aString with:anErrorString |
|
3246 |
"show an alertbox, displaying the last Unix-error" |
|
3247 |
||
3248 |
|msg| |
|
3249 |
||
3250 |
anErrorString isNil ifTrue:[ |
|
1317 | 3251 |
msg := aString |
1162 | 3252 |
] ifFalse:[ |
1317 | 3253 |
msg := aString , '\\(' , anErrorString , ')' |
1162 | 3254 |
]. |
3255 |
self warn:msg withCRs |
|
3256 |
! |
|
3257 |
||
3258 |
withoutHiddenFiles:aCollection |
|
3259 |
"remove hidden files (i.e. those that start with '.') from |
|
3260 |
the list in aCollection" |
|
3261 |
||
3262 |
|newCollection| |
|
3263 |
||
3264 |
newCollection := aCollection species new. |
|
3265 |
aCollection do:[:fname | |
|
1868 | 3266 |
|ignore| |
3267 |
||
3268 |
ignore := false. |
|
3269 |
||
3270 |
((fname startsWith:'.') and:[fname ~= '..']) ifTrue:[ |
|
3271 |
showingHiddenFiles value "showDotFiles" ifFalse:[ |
|
3272 |
ignore := true |
|
3273 |
] |
|
3274 |
]. |
|
3275 |
ignore ifFalse:[ |
|
3276 |
newCollection add:fname |
|
3277 |
] |
|
1162 | 3278 |
]. |
3279 |
^ newCollection |
|
3280 |
||
1834 | 3281 |
"Modified: / 4.8.1998 / 13:46:27 / cg" |
1162 | 3282 |
! ! |
3283 |
||
3284 |
!FileBrowser methodsFor:'private - actions & command execution'! |
|
3285 |
||
3286 |
binaryFileAction:aFilename |
|
3287 |
"for some binary files, if double clicked, we can do some useful |
|
3288 |
action ..." |
|
3289 |
||
1330 | 3290 |
(currentDirectory construct:aFilename) isExecutableProgram ifTrue:[ |
1329 | 3291 |
(OperatingSystem executeCommand:'cd ', currentDirectory pathName, '; ',aFilename) |
3292 |
ifTrue:[^true]. |
|
1162 | 3293 |
]. |
3294 |
^ self imageAction:aFilename |
|
3295 |
||
3296 |
"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
|
3297 |
"Modified: 18.9.1997 / 17:18:04 / stefan" |
1162 | 3298 |
! |
3299 |
||
1358 | 3300 |
doExecuteCommand:commandArg replace:replace |
1162 | 3301 |
"execute a unix command inserting the output of the command. |
3302 |
If replace is true, all text is replaced by the commands output; |
|
3303 |
otherwise, its inserted as selected text at the cursor position." |
|
3304 |
||
1493 | 3305 |
|command stream line lnr myProcess myPriority startLine startCol stopSignal |
3306 |
pauseSignal access stillReplacing pauseHolder lowerFrameView| |
|
1162 | 3307 |
|
1358 | 3308 |
command := commandArg asString. |
3309 |
||
1162 | 3310 |
access := Semaphore forMutualExclusion name:'accessLock'. |
3311 |
stopSignal := Signal new. |
|
1335
4f8ee6e1d8e1
Use signal instead polling for pauseButton in #doExecuteCommand:replace:.
Stefan Vogel <sv@exept.de>
parents:
1334
diff
changeset
|
3312 |
pauseSignal := Signal new. |
1162 | 3313 |
|
3314 |
" |
|
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3315 |
The following is tricky: |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3316 |
the pauseToggle & killButton will |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3317 |
be handled by their own windowGroup process. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3318 |
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
|
3319 |
I myself am reading the commands output. |
1162 | 3320 |
" |
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3321 |
|
1329 | 3322 |
commandView beInvisible. |
3323 |
||
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3324 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3325 |
must take kill & pauseButtons out of my group |
1162 | 3326 |
" |
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3327 |
killButton windowGroup:nil. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3328 |
pauseToggle windowGroup:nil. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3329 |
|
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3330 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3331 |
bring them to front, and turn hidden-mode off |
1162 | 3332 |
" |
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3333 |
killButton raise; beVisible. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3334 |
pauseToggle raise; beVisible. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3335 |
|
1162 | 3336 |
" |
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3337 |
kill will make me raise the stopSignal when pressed |
1162 | 3338 |
" |
3339 |
killButton |
|
1912 | 3340 |
action:[ |
3341 |
stream notNil ifTrue:[ |
|
3342 |
access critical:[ |
|
3343 |
myProcess interruptWith:[stopSignal raiseRequest]. |
|
3344 |
] |
|
3345 |
] |
|
3346 |
]. |
|
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3347 |
|
1162 | 3348 |
" |
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3349 |
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
|
3350 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3351 |
pauseHolder := false asValue. |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3352 |
pauseToggle model:pauseHolder. |
1335
4f8ee6e1d8e1
Use signal instead polling for pauseButton in #doExecuteCommand:replace:.
Stefan Vogel <sv@exept.de>
parents:
1334
diff
changeset
|
3353 |
pauseToggle pressAction:[ |
1912 | 3354 |
stream notNil ifTrue:[ |
3355 |
access critical:[ |
|
3356 |
myProcess interruptWith:[pauseSignal raiseRequest]. |
|
3357 |
] |
|
3358 |
] |
|
1335
4f8ee6e1d8e1
Use signal instead polling for pauseButton in #doExecuteCommand:replace:.
Stefan Vogel <sv@exept.de>
parents:
1334
diff
changeset
|
3359 |
]. |
4f8ee6e1d8e1
Use signal instead polling for pauseButton in #doExecuteCommand:replace:.
Stefan Vogel <sv@exept.de>
parents:
1334
diff
changeset
|
3360 |
|
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3361 |
|
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3362 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3363 |
start kill button under its own windowgroup |
1162 | 3364 |
" |
3365 |
killButton openAutonomous. |
|
1298
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3366 |
killButton windowGroup process processGroupId:(Processor activeProcess id). |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3367 |
|
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3368 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3369 |
and add the pauseToggle to its windowGroup |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3370 |
" |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3371 |
pauseToggle windowGroup:(killButton windowGroup). |
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3372 |
|
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3373 |
|
4ce2a9cd693a
allow command-output reading to be paused.
Claus Gittinger <cg@exept.de>
parents:
1287
diff
changeset
|
3374 |
lowerFrameView := subView superView. |
1162 | 3375 |
|
3376 |
" |
|
3377 |
go fork a pipe and read it |
|
3378 |
" |
|
3379 |
self label:(myName , ': executing ' , (command copyTo:(20 min:command size)) , ' ...'). |
|
3380 |
[ |
|
3381 |
self withWaitCursorDo:[ |
|
1912 | 3382 |
stopSignal catch:[ |
3383 |
pauseSignal handle:[:ex| |
|
3384 |
|noPauseSema| |
|
3385 |
||
3386 |
"/ |
|
3387 |
"/ allow interaction with |
|
3388 |
"/ the codeView via the other windowGroup |
|
3389 |
"/ |
|
3390 |
lowerFrameView windowGroup:(killButton windowGroup). |
|
3391 |
||
3392 |
"/ |
|
3393 |
"/ wait for pause to be turned off |
|
3394 |
"/ |
|
3395 |
noPauseSema := Semaphore new. |
|
3396 |
pauseHolder onChangeSend:#signal to:noPauseSema. |
|
3397 |
noPauseSema wait. |
|
3398 |
||
3399 |
"/ |
|
3400 |
"/ no interaction with the codeView ... |
|
3401 |
"/ |
|
3402 |
lowerFrameView windowGroup:(self windowGroup). |
|
3403 |
ex proceed. |
|
3404 |
] do:[ |
|
3405 |
startLine := subView cursorLine. |
|
3406 |
startCol := subView cursorCol. |
|
3407 |
||
3408 |
" |
|
3409 |
this can be a time consuming operation; therefore lower my priority |
|
3410 |
" |
|
3411 |
"/ myProcess := Processor activeProcess. |
|
3412 |
"/ myPriority := myProcess priority. |
|
3413 |
"/ myProcess priority:(Processor userBackgroundPriority). |
|
3414 |
||
3415 |
stream := PipeStream |
|
3416 |
readingFrom:command |
|
3417 |
errorDisposition:#inline |
|
3418 |
inDirectory:currentDirectory. |
|
3419 |
stream notNil ifTrue:[ |
|
3420 |
[ |
|
3421 |
|codeView lines noPauseSema enc| |
|
3422 |
||
3423 |
enc := fileEncoding. |
|
3424 |
enc == #iso8859 ifTrue:[ |
|
3425 |
enc := nil |
|
3426 |
]. |
|
3427 |
||
3428 |
stream buffered:true. |
|
3429 |
codeView := subView. |
|
3430 |
codeView unselect. |
|
3431 |
||
3432 |
replace ifTrue:[ |
|
3433 |
codeView list:nil. |
|
3434 |
lnr := 1. |
|
3435 |
]. |
|
3436 |
||
3437 |
stillReplacing := replace. |
|
3438 |
||
3439 |
[stream readWait. stream atEnd] whileFalse:[ |
|
3440 |
" |
|
3441 |
data available; read up to 100 lines |
|
3442 |
and insert as a single junk. This speeds up |
|
3443 |
display of long output (less line-scrolling). |
|
3444 |
" |
|
3445 |
lines := OrderedCollection new:100. |
|
3446 |
||
3447 |
[ |
|
3448 |
line := stream nextLine. |
|
3449 |
line notNil ifTrue:[ |
|
3450 |
enc notNil ifTrue:[ |
|
3451 |
line := line decodeFrom:enc |
|
3452 |
]. |
|
3453 |
lines add:line |
|
3454 |
]. |
|
3455 |
] doWhile:[ |
|
3456 |
stream canReadWithoutBlocking |
|
3457 |
and:[stream atEnd not |
|
3458 |
and:[lines size < 100]] |
|
3459 |
]. |
|
3460 |
||
3461 |
" |
|
3462 |
need this critical section; otherwise, |
|
3463 |
we could get the signal while waiting for |
|
3464 |
an expose event ... |
|
3465 |
" |
|
3466 |
access critical:[ |
|
3467 |
lines size > 0 ifTrue:[ |
|
3468 |
stillReplacing ifTrue:[ |
|
3469 |
lines do:[:line | |
|
3470 |
codeView at:lnr put:line withTabsExpanded. |
|
3471 |
codeView cursorToBottom; cursorDown:1. |
|
3472 |
lnr := lnr + 1. |
|
3473 |
lnr > codeView list size ifTrue:[ |
|
3474 |
stillReplacing := false |
|
3475 |
] |
|
3476 |
]. |
|
3477 |
] ifFalse:[ |
|
3478 |
codeView insertLines:lines before:codeView cursorLine. |
|
3479 |
codeView cursorDown:lines size. |
|
3480 |
] |
|
3481 |
]. |
|
3482 |
]. |
|
3483 |
||
3484 |
" |
|
3485 |
give others running at same prio a chance too |
|
3486 |
(especially other FileBrowsers doing the same) |
|
3487 |
" |
|
3488 |
Processor yield |
|
3489 |
]. |
|
3490 |
] valueNowOrOnUnwindDo:[ |
|
3491 |
stream shutDown "close". stream := nil. |
|
3492 |
]. |
|
3493 |
||
3494 |
"/ |
|
3495 |
"/ the command could have changed the directory |
|
3496 |
"/ |
|
3497 |
self updateCurrentDirectoryIfChanged |
|
3498 |
]. |
|
3499 |
replace ifTrue:[ |
|
3500 |
subView modified:false. |
|
3501 |
]. |
|
3502 |
] |
|
3503 |
] |
|
1162 | 3504 |
] |
3505 |
] valueNowOrOnUnwindDo:[ |
|
1912 | 3506 |
|wg| |
3507 |
||
3508 |
self label:myName; iconLabel:myName. |
|
3509 |
"/ myProcess notNil ifTrue:[myProcess priority:myPriority]. |
|
3510 |
||
3511 |
" |
|
3512 |
hide the button, and make sure it will stay |
|
3513 |
hidden when we are realized again |
|
3514 |
" |
|
3515 |
killButton beInvisible. |
|
3516 |
pauseToggle beInvisible. |
|
3517 |
||
3518 |
commandView beVisible. |
|
3519 |
||
3520 |
" |
|
3521 |
remove the killButton from its group |
|
3522 |
(otherwise, it will be destroyed when we shut down the group) |
|
3523 |
" |
|
3524 |
wg := killButton windowGroup. |
|
3525 |
killButton windowGroup:nil. |
|
3526 |
pauseToggle windowGroup:nil. |
|
3527 |
||
3528 |
" |
|
3529 |
shut down the kill buttons windowgroup |
|
3530 |
" |
|
3531 |
wg notNil ifTrue:[ |
|
3532 |
wg process terminate. |
|
3533 |
]. |
|
3534 |
" |
|
3535 |
clear its action (actually not needed, but |
|
3536 |
releases reference to thisContext earlier) |
|
3537 |
" |
|
3538 |
killButton action:nil. |
|
3539 |
pauseToggle pressAction:nil. |
|
3540 |
"/ |
|
3541 |
"/ allow interaction with the codeView |
|
3542 |
"/ (bring it back into my group) |
|
3543 |
"/ |
|
3544 |
lowerFrameView windowGroup:(self windowGroup). |
|
1162 | 3545 |
]. |
3546 |
||
3547 |
currentFileName isNil ifTrue:[ |
|
1912 | 3548 |
subView modified:false. |
1162 | 3549 |
]. |
3550 |
||
3551 |
subView size > 10000 ifTrue:[ |
|
1912 | 3552 |
self warn:'text quite large now - please cut off some lines' |
1162 | 3553 |
] |
3554 |
||
1358 | 3555 |
"Modified: / 21.9.1995 / 11:18:46 / claus" |
1508
66bca43c9654
Use #raiseRequest when exception handler does #proceed
Stefan Vogel <sv@exept.de>
parents:
1507
diff
changeset
|
3556 |
"Modified: / 6.3.1998 / 17:32:03 / stefan" |
1912 | 3557 |
"Modified: / 3.10.1998 / 18:30:29 / cg" |
1162 | 3558 |
! |
3559 |
||
3560 |
imageAction:aFilename |
|
3561 |
"for some image files, if double clicked, we can do some useful |
|
3562 |
action ..." |
|
3563 |
||
3564 |
|img| |
|
3565 |
||
3566 |
(Image isImageFileSuffix:(aFilename asFilename suffix)) |
|
3567 |
ifTrue:[ |
|
1418 | 3568 |
img := Image fromFile:(currentDirectory construct:aFilename). |
3569 |
img notNil ifTrue:[ |
|
3570 |
ImageEditor openOnImage:img. |
|
1410 | 3571 |
"/ img inspect. |
1418 | 3572 |
^ true |
3573 |
] |
|
1162 | 3574 |
]. |
3575 |
^ false |
|
3576 |
||
3577 |
"Created: 19.6.1996 / 09:43:50 / cg" |
|
3578 |
"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
|
3579 |
"Modified: 18.9.1997 / 16:35:48 / stefan" |
1410 | 3580 |
|
3581 |
||
1162 | 3582 |
! |
3583 |
||
3584 |
initialCommandFor:fileName into:aBox |
|
3585 |
"set a useful initial command for execute box." |
|
3586 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3587 |
|cmd select path suffix| |
1162 | 3588 |
|
3589 |
"/ XXX should be changed to take stuff from a config file |
|
3590 |
"/ XXX or from resources. |
|
3591 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3592 |
path := currentDirectory filenameFor:fileName. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3593 |
(path type == #regular) ifTrue:[ |
1868 | 3594 |
path isExecutableProgram ifTrue:[ |
3595 |
aBox initialText:(fileName , ' <arguments>'). |
|
3596 |
^ self |
|
3597 |
]. |
|
3598 |
||
3599 |
select := true. |
|
3600 |
||
3601 |
"some heuristics - my personal preferences ... |
|
3602 |
(actually this should come from a configfile)" |
|
3603 |
||
3604 |
(fileName endsWith:'akefile') ifTrue:[ |
|
3605 |
aBox initialText:'make target' selectFrom:6 to:11. |
|
3606 |
^ self |
|
3607 |
]. |
|
3608 |
||
3609 |
suffix := path suffix. |
|
3610 |
(suffix = 'C') ifTrue:[ |
|
3611 |
cmd := 'g++ -c %1'. |
|
3612 |
select := 6. |
|
3613 |
] ifFalse:[ |
|
3614 |
suffix := suffix asLowercase. |
|
3615 |
(suffix = 'taz') ifTrue:[ |
|
3616 |
aBox initialText:'zcat %1 | tar tvf -'. |
|
3617 |
select := false. |
|
3618 |
]. |
|
3619 |
(suffix = 'tar') ifTrue:[ |
|
3620 |
cmd := 'tar tvf %1'. |
|
3621 |
select := 7. |
|
3622 |
]. |
|
3623 |
(suffix = 'zoo') ifTrue:[ |
|
3624 |
cmd := 'zoo -list %1'. |
|
3625 |
select := 9. |
|
3626 |
]. |
|
3627 |
(suffix = 'zip') ifTrue:[ |
|
3628 |
cmd := 'unzip -l %1'. |
|
3629 |
select := 8. |
|
3630 |
]. |
|
3631 |
(suffix = 'jar') ifTrue:[ |
|
3632 |
cmd := 'unzip -l %1'. |
|
3633 |
select := 8. |
|
3634 |
]. |
|
3635 |
(suffix = 'z') ifTrue:[ |
|
3636 |
(fileName endsWith:'tar.z') ifTrue:[ |
|
3637 |
cmd := 'zcat %1 | tar tvf -'. |
|
3638 |
select := false. |
|
3639 |
] ifFalse:[ |
|
3640 |
cmd := 'uncompress %1' |
|
3641 |
]. |
|
3642 |
]. |
|
3643 |
(suffix = 'gz') ifTrue:[ |
|
3644 |
(fileName endsWith:'tar.gz') ifTrue:[ |
|
3645 |
cmd := ('gunzip < %1 | tar tvf -' ). |
|
3646 |
select := false. |
|
3647 |
] ifFalse:[ |
|
3648 |
cmd := 'gunzip %1'. |
|
3649 |
]. |
|
3650 |
]. |
|
3651 |
(suffix = 'tgz') ifTrue:[ |
|
3652 |
cmd := ('gunzip < %1 | tar tvf -' ). |
|
3653 |
select := false. |
|
3654 |
]. |
|
3655 |
(suffix = 'html') ifTrue:[ |
|
3656 |
cmd := 'netscape %1' |
|
3657 |
]. |
|
3658 |
(suffix = 'htm') ifTrue:[ |
|
3659 |
cmd := 'netscape %1' |
|
3660 |
]. |
|
3661 |
(suffix = 'uue') ifTrue:[ |
|
3662 |
cmd := 'uudecode %1' |
|
3663 |
]. |
|
3664 |
(suffix = 'c') ifTrue:[ |
|
3665 |
cmd := 'cc -c %1'. |
|
3666 |
select := 5. |
|
3667 |
]. |
|
3668 |
(suffix = 'cc') ifTrue:[ |
|
3669 |
cmd := 'g++ -c %1'. |
|
3670 |
select := 6. |
|
3671 |
]. |
|
3672 |
(suffix = 'xbm') ifTrue:[ |
|
3673 |
cmd := 'bitmap %1' |
|
3674 |
]. |
|
3675 |
(suffix = 'ps') ifTrue:[ |
|
3676 |
cmd := 'ghostview %1' |
|
3677 |
]. |
|
3678 |
((suffix = '1') or:[suffix = 'man']) ifTrue:[ |
|
3679 |
cmd := 'nroff -man %1'. |
|
3680 |
select := 10. |
|
3681 |
]. |
|
3682 |
]. |
|
3683 |
||
3684 |
cmd isNil ifTrue:[ |
|
3685 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
3686 |
cmd := '<cmd>' |
|
3687 |
] ifFalse:[ |
|
3688 |
cmd := DefaultCommandPerSuffix |
|
3689 |
at:suffix |
|
3690 |
ifAbsent:'<cmd>'. |
|
3691 |
]. |
|
3692 |
cmd := cmd , ' %1'. |
|
3693 |
]. |
|
3694 |
||
3695 |
cmd := cmd bindWith:fileName. |
|
3696 |
select == false ifTrue:[ |
|
3697 |
aBox initialText:cmd |
|
3698 |
] ifFalse:[ |
|
3699 |
select isInteger ifFalse:[ |
|
3700 |
select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1. |
|
3701 |
]. |
|
3702 |
aBox initialText:cmd selectFrom:1 to:select |
|
3703 |
] |
|
1162 | 3704 |
] |
3705 |
||
1542 | 3706 |
"Modified: / 24.9.1997 / 16:34:52 / stefan" |
3707 |
"Modified: / 9.4.1998 / 17:15:57 / cg" |
|
1162 | 3708 |
! |
3709 |
||
3710 |
nonBinaryFileAction:aFilename |
|
3711 |
"for some nonBinary files, if double clicked, we can do some useful |
|
3712 |
action ..." |
|
3713 |
||
1493 | 3714 |
|fullPath| |
1162 | 3715 |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3716 |
fullPath := currentDirectory filenameFor:aFilename. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3717 |
((fullPath hasSuffix:'htm') or:[fullPath hasSuffix:'html']) ifTrue:[ |
1329 | 3718 |
HTMLDocumentView openOn:fullPath pathName. |
3719 |
^ true |
|
1162 | 3720 |
]. |
3721 |
||
3722 |
OperatingSystem isUNIXlike ifTrue:[ |
|
1329 | 3723 |
(#('.man' '.1' '.2' '.3') findFirst:[:suff | fullPath hasSuffix:suff]) ~~ 0 |
3724 |
ifTrue:[ |
|
3725 |
HTMLDocumentView openFullOnText:(HTMLDocGenerator manPageForFile:fullPath pathName). |
|
3726 |
^ true |
|
3727 |
] |
|
1162 | 3728 |
]. |
3729 |
^ self imageAction:aFilename |
|
3730 |
||
3731 |
"Created: 19.6.1996 / 09:36:38 / cg" |
|
3732 |
"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
|
3733 |
"Modified: 18.9.1997 / 16:58:40 / stefan" |
1162 | 3734 |
! ! |
3735 |
||
3736 |
!FileBrowser methodsFor:'private - directory stuff'! |
|
3737 |
||
1371
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3738 |
addToHistory:path |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3739 |
|pos idx| |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3740 |
|
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3741 |
(DirectoryHistory includes:path) ifFalse:[ |
1393 | 3742 |
DirectoryHistory size >= HistorySize ifTrue:[ |
3743 |
DirectoryHistory removeLast. |
|
3744 |
DirectoryHistoryWhere removeLast |
|
3745 |
] |
|
1371
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3746 |
] ifTrue:[ |
1393 | 3747 |
"already been there before; move the entry to |
3748 |
the beginning, so it will fall out later." |
|
3749 |
||
3750 |
idx := DirectoryHistory indexOf:path. |
|
3751 |
DirectoryHistory removeIndex:idx. |
|
3752 |
pos := DirectoryHistoryWhere at:idx. |
|
3753 |
DirectoryHistoryWhere removeIndex:idx. |
|
1371
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3754 |
]. |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3755 |
DirectoryHistory addFirst:path. |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3756 |
DirectoryHistoryWhere addFirst:pos. |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3757 |
|
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3758 |
"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
|
3759 |
! |
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3760 |
|
172 | 3761 |
changeToPreviousDirectory |
3762 |
"if text was modified show a queryBox, |
|
3763 |
otherwise change immediately to previous directory." |
|
93 | 3764 |
|
172 | 3765 |
previousDirectory isNil ifTrue:[^ self]. |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
3766 |
self discardChangesDialog ifTrue:[ |
1393 | 3767 |
self doChangeCurrentDirectoryTo:previousDirectory updateHistory:false |
172 | 3768 |
] |
1339
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
3769 |
|
4b712d8c1738
Allow regular filenames to be entered in pathField.
Stefan Vogel <sv@exept.de>
parents:
1336
diff
changeset
|
3770 |
"Modified: 2.10.1997 / 14:13:40 / stefan" |
36 | 3771 |
! |
3772 |
||
98 | 3773 |
checkIfDirectoryHasChanged |
3774 |
"every checkDelta secs, check if directoy has changed and update the list if so. |
|
3775 |
Also, we check if the file shown has been touched in the meanwhile (for example, |
|
3776 |
from another browser) and say 'outdated' in the label if so. |
|
3777 |
This avoids confusion if the same file is being edited by two browsers. (or other editors). |
|
3778 |
If the text shown in the codeView has been edited, 'modified' is shown. |
|
3779 |
" |
|
3780 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3781 |
|oldSelection nOld newState msg newLabel t| |
98 | 3782 |
|
3783 |
shown ifTrue:[ |
|
1868 | 3784 |
currentDirectory notNil ifTrue:[ |
3785 |
lockUpdate ifTrue:[ |
|
3786 |
Processor removeTimedBlock:checkBlock. |
|
3787 |
Processor addTimedBlock:checkBlock afterSeconds:checkDelta. |
|
3788 |
^ self |
|
3789 |
]. |
|
3790 |
||
3791 |
subView modified ifTrue:[ |
|
3792 |
newState := ' (modified)' |
|
3793 |
]. |
|
3794 |
||
3795 |
(currentDirectory isReadable) ifTrue:[ |
|
3796 |
Processor removeTimedBlock:checkBlock. |
|
3797 |
||
3798 |
t := currentDirectory modificationTime. |
|
3799 |
(t notNil and:[t > timeOfLastCheck]) ifTrue:[ |
|
3800 |
nOld := fileListView numberOfSelections. |
|
3801 |
oldSelection := fileListView selectionValue. |
|
3802 |
self updateCurrentDirectory. |
|
3803 |
nOld ~~ 0 ifTrue:[ |
|
3804 |
nOld > 1 ifTrue:[ |
|
3805 |
oldSelection do:[:element | |
|
3806 |
fileListView addElementToSelection:element |
|
3807 |
] |
|
3808 |
] ifFalse:[ |
|
3809 |
fileListView selectElementWithoutScroll:oldSelection |
|
3810 |
] |
|
3811 |
]. |
|
3812 |
] ifFalse:[ |
|
3813 |
Processor addTimedBlock:checkBlock afterSeconds:checkDelta |
|
3814 |
]. |
|
3815 |
||
3816 |
currentFileName notNil ifTrue:[ |
|
3817 |
|f| |
|
3818 |
f := currentDirectory construct:currentFileName. |
|
3819 |
f exists ifFalse:[ |
|
3820 |
newState := ' (removed)'. |
|
3821 |
] ifTrue:[ |
|
3822 |
f modificationTime > timeOfFileRead ifTrue:[ |
|
3823 |
newState := ' (outdated)'. |
|
3824 |
subView modified ifTrue:[ |
|
3825 |
newState := ' (modified & outdated)' |
|
3826 |
] |
|
3827 |
]. |
|
3828 |
]. |
|
3829 |
]. |
|
3830 |
] ifFalse:[ |
|
3831 |
" |
|
3832 |
if the directory has been deleted, or is not readable ... |
|
3833 |
" |
|
3834 |
(currentDirectory exists) ifFalse:[ |
|
3835 |
msg := 'FileBrowser:\\directory %1 is gone ?!!?' |
|
3836 |
] ifTrue:[ |
|
3837 |
msg := 'FileBrowser:\\directory %1 is no longer readable ?!!?' |
|
3838 |
]. |
|
3839 |
self warn:(resources string:msg with:currentDirectory pathName) withCRs. |
|
3840 |
||
3841 |
fileListView contents:nil. |
|
3842 |
newLabel := myName , ': directory is gone !!'. |
|
3843 |
"/ Processor addTimedBlock:checkBlock afterSeconds:checkDelta |
|
3844 |
]. |
|
3845 |
||
3846 |
newState notNil ifTrue:[ |
|
3847 |
newLabel := myName. |
|
3848 |
currentFileName notNil ifTrue:[ |
|
3849 |
newLabel := newLabel , ': ' , currentFileName |
|
3850 |
]. |
|
3851 |
newLabel := newLabel , newState. |
|
3852 |
]. |
|
3853 |
newLabel notNil ifTrue:[ |
|
3854 |
self label:newLabel. |
|
3855 |
] |
|
3856 |
] |
|
98 | 3857 |
] |
1168
b157f3712548
care for nil returns from userName/groupName * time queries
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
3858 |
|
1380
547d31bfa12c
warning string fixed when directory vanishes
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
3859 |
"Modified: / 28.4.1997 / 22:31:02 / dq" |
547d31bfa12c
warning string fixed when directory vanishes
Claus Gittinger <cg@exept.de>
parents:
1374
diff
changeset
|
3860 |
"Modified: / 16.9.1997 / 15:17:15 / stefan" |
1481 | 3861 |
"Modified: / 18.2.1998 / 17:57:49 / cg" |
98 | 3862 |
! |
3863 |
||
172 | 3864 |
doChangeCurrentDirectoryTo:fileName updateHistory:updateHistory |
3865 |
"verify argument is name of a readable & executable directory |
|
3866 |
and if so, go there" |
|
3867 |
||
1317 | 3868 |
|msg path idx f| |
172 | 3869 |
|
3870 |
self label:myName; iconLabel:myName. |
|
3871 |
fileName notNil ifTrue:[ |
|
1393 | 3872 |
f := (currentDirectory filenameFor:fileName) asAbsoluteFilename. |
3873 |
(f isDirectory) ifTrue:[ |
|
3874 |
(f isReadable) ifTrue:[ |
|
3875 |
(f isExecutable) ifTrue:[ |
|
3876 |
path := currentDirectory pathName. |
|
3877 |
previousDirectory := path. |
|
3878 |
||
3879 |
" |
|
3880 |
remember where we are positioned in the fileList |
|
3881 |
(in case we want to return) |
|
3882 |
" |
|
3883 |
idx := DirectoryHistory indexOf:path. |
|
3884 |
idx ~~ 0 ifTrue:[ |
|
3885 |
DirectoryHistoryWhere at:idx put:fileListView firstLineShown |
|
3886 |
]. |
|
3887 |
||
3888 |
updateHistory ifTrue:[ |
|
3889 |
self addToHistory:path. |
|
3890 |
]. |
|
3891 |
||
3892 |
self setCurrentDirectory:(f pathName). |
|
3893 |
||
3894 |
"/ fetch the new path. |
|
3895 |
path := currentDirectory pathName. |
|
3896 |
||
3897 |
" |
|
3898 |
if we have already been there, look for the |
|
3899 |
position offset, and scroll the fileList |
|
3900 |
" |
|
3901 |
idx := DirectoryHistory indexOf:path. |
|
3902 |
idx ~~ 0 ifTrue:[ |
|
3903 |
|pos| |
|
3904 |
||
3905 |
pos := DirectoryHistoryWhere at:idx. |
|
3906 |
pos notNil ifTrue:[ |
|
3907 |
fileListView scrollToLine:pos. |
|
3908 |
] |
|
3909 |
]. |
|
3910 |
||
3911 |
updateHistory ifTrue:[ |
|
3912 |
self addToHistory:path. |
|
3913 |
]. |
|
3914 |
||
3915 |
^ self |
|
3916 |
]. |
|
3917 |
msg := 'cannot change directory to ''%1'' !!' |
|
3918 |
] ifFalse:[ |
|
3919 |
msg := 'cannot read directory ''%1'' !!' |
|
3920 |
] |
|
3921 |
] ifFalse:[ |
|
1859 | 3922 |
OperatingSystem isVMSlike ifTrue:[ |
1393 | 3923 |
"/ cannot tell if it exists or is simply invisible ... |
3924 |
msg := '''%1'' is not a directory or unreadable !!' |
|
3925 |
] ifFalse:[ |
|
3926 |
msg := '''%1'' is not a directory !!' |
|
3927 |
] |
|
3928 |
]. |
|
3929 |
self showAlert:(resources string:msg with:fileName) with:nil |
|
172 | 3930 |
] |
1166
0029f77ccea7
when updating the directoryList,
Claus Gittinger <cg@exept.de>
parents:
1162
diff
changeset
|
3931 |
|
1371
a80db8d0e311
remember directory in history when entering (not when leaving)
Claus Gittinger <cg@exept.de>
parents:
1358
diff
changeset
|
3932 |
"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
|
3933 |
"Modified: / 8.11.1997 / 17:17:17 / cg" |
1329 | 3934 |
! |
3935 |
||
3936 |
doChangeToDefaultDirectory |
|
3937 |
"go to parent directory" |
|
3938 |
||
3939 |
self doChangeCurrentDirectoryTo:(Filename currentDirectory pathName) updateHistory:true |
|
3940 |
||
3941 |
"Created: 21.9.1997 / 23:45:59 / cg" |
|
172 | 3942 |
! |
3943 |
||
3944 |
doChangeToHomeDirectory |
|
3945 |
"go to home directory" |
|
3946 |
||
3947 |
self doChangeCurrentDirectoryTo:(OperatingSystem getHomeDirectory) updateHistory:true |
|
3948 |
! |
|
3949 |
||
3950 |
doChangeToParentDirectory |
|
1317 | 3951 |
"go to parent directory" |
36 | 3952 |
|
172 | 3953 |
self doChangeCurrentDirectoryTo:'..' updateHistory:true |
3954 |
! |
|
3955 |
||
3956 |
doCreateDirectory:newName |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3957 |
|f| |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3958 |
|
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3959 |
f := currentDirectory filenameFor:newName. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3960 |
f exists ifTrue:[ |
1329 | 3961 |
self warn:'%1 already exists.' with:newName. |
3962 |
^ self |
|
172 | 3963 |
]. |
3964 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3965 |
f makeDirectory ifTrue:[ |
1329 | 3966 |
self updateCurrentDirectoryIfChanged |
172 | 3967 |
] ifFalse:[ |
1329 | 3968 |
self showAlert:(resources string:'cannot create directory ''%1'' !!' with:newName) |
3969 |
with:(OperatingSystem lastErrorString) |
|
172 | 3970 |
] |
1157
667a57034e40
only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
3971 |
|
667a57034e40
only update if the directory did change (after execute command)
Claus Gittinger <cg@exept.de>
parents:
1156
diff
changeset
|
3972 |
"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
|
3973 |
"Modified: 18.9.1997 / 17:21:25 / stefan" |
172 | 3974 |
! |
3975 |
||
1162 | 3976 |
setCurrentDirectory:aPathName |
3977 |
"setup for another directory" |
|
3978 |
||
3979 |
|newDirectory| |
|
3980 |
||
3981 |
aPathName isEmpty ifTrue:[^ self]. |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3982 |
newDirectory := currentDirectory filenameFor:aPathName. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
3983 |
newDirectory isDirectory ifTrue:[ |
1329 | 3984 |
self currentDirectory:newDirectory. |
3985 |
currentFileName notNil ifTrue:[ |
|
3986 |
fileListView contents:nil. |
|
3987 |
currentFileName := nil. |
|
3988 |
] ifFalse:[ |
|
3989 |
fileListView setSelection:nil. |
|
3990 |
fileListView scrollToTop. |
|
3991 |
]. |
|
3992 |
self updateCurrentDirectory. |
|
3993 |
self showInfo. |
|
172 | 3994 |
] |
294 | 3995 |
|
1162 | 3996 |
"Modified: 21.9.1995 / 11:22:45 / claus" |
3997 |
"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
|
3998 |
"Modified: 18.9.1997 / 17:08:07 / stefan" |
912
dae70963b64c
define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents:
874
diff
changeset
|
3999 |
! |
dae70963b64c
define language specific commentStrings
Claus Gittinger <cg@exept.de>
parents:
874
diff
changeset
|
4000 |
|
1162 | 4001 |
updateCurrentDirectoryIfChanged |
1837 | 4002 |
|t| |
4003 |
||
4004 |
((t := currentDirectory modificationTime) isNil |
|
4005 |
or:[t > timeOfLastCheck]) ifTrue:[ |
|
1868 | 4006 |
self updateCurrentDirectory |
1162 | 4007 |
] |
4008 |
||
1837 | 4009 |
"Modified: / 16.9.1997 / 15:35:52 / stefan" |
4010 |
"Modified: / 17.8.1998 / 10:13:00 / cg" |
|
1162 | 4011 |
! ! |
4012 |
||
4013 |
!FileBrowser methodsFor:'private - encoding'! |
|
172 | 4014 |
|
395 | 4015 |
guessEncodingFrom:aBuffer |
988 | 4016 |
"look for a string |
1317 | 4017 |
encoding #name |
988 | 4018 |
or: |
1317 | 4019 |
encoding: name |
1209 | 4020 |
within the given buffer |
4021 |
(which is usually the first few bytes of a textFile). |
|
4022 |
If thats not found, use heuristics (in CharacterArray) to guess." |
|
988 | 4023 |
|
395 | 4024 |
|n "{Class: SmallInteger }" |
1209 | 4025 |
binary idx s w enc| |
395 | 4026 |
|
4027 |
binary := false. |
|
4028 |
n := aBuffer size. |
|
4029 |
||
1223 | 4030 |
(idx := aBuffer findString:'charset=') ~~ 0 ifTrue:[ |
1317 | 4031 |
s := ReadStream on:aBuffer. |
4032 |
s position:idx + 8. |
|
4033 |
s skipSeparators. |
|
4034 |
w := s upToSeparator. |
|
4035 |
w notNil ifTrue:[ |
|
4036 |
(idx := w indexOf:$") ~~ 0 ifTrue:[ |
|
4037 |
w := w copyTo:idx-1 |
|
4038 |
]. |
|
4039 |
^ w asSymbol |
|
4040 |
]. |
|
1223 | 4041 |
]. |
807 | 4042 |
(idx := aBuffer findString:'encoding') ~~ 0 ifTrue:[ |
1317 | 4043 |
s := ReadStream on:aBuffer. |
4044 |
s position:idx + 8. |
|
4045 |
s skipSeparators. |
|
4046 |
s peek == $: ifTrue:[ |
|
4047 |
s next. |
|
4048 |
s skipSeparators. |
|
4049 |
]. |
|
4050 |
||
4051 |
s peek == $# ifTrue:[ |
|
4052 |
s next. |
|
4053 |
s skipSeparators. |
|
4054 |
]. |
|
4055 |
w := s upToSeparator. |
|
4056 |
w notNil ifTrue:[ |
|
4057 |
^ w asSymbol |
|
4058 |
]. |
|
807 | 4059 |
]. |
4060 |
||
395 | 4061 |
1 to:n do:[:i | |
1317 | 4062 |
(aBuffer at:i) isPrintable ifFalse:[binary := true]. |
395 | 4063 |
]. |
807 | 4064 |
|
395 | 4065 |
binary ifTrue:[ |
1317 | 4066 |
"/ look for JIS7 / EUC encoding |
4067 |
||
4068 |
enc := CharacterArray guessEncodingFrom:aBuffer. |
|
4069 |
enc notNil ifTrue:[ |
|
4070 |
^ enc |
|
4071 |
]. |
|
4072 |
||
4073 |
"/ if the encoding has been set to any non iso setting, |
|
4074 |
"/ assume its what we defined ... |
|
4075 |
||
4076 |
(('iso*' match:fileEncoding) or:['ascii*' match:fileEncoding]) ifTrue:[ |
|
4077 |
^ #binary |
|
4078 |
]. |
|
4079 |
^ fileEncoding ? #binary |
|
395 | 4080 |
]. |
4081 |
^ #ascii |
|
4082 |
||
4083 |
"Created: 26.2.1996 / 17:43:08 / cg" |
|
1223 | 4084 |
"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
|
4085 |
! |
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4086 |
|
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4087 |
preferredFontEncodingFor:fileEncoding |
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4088 |
"given a file encoding, return corresponding preferred fontEncoding |
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4089 |
match pattern" |
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4090 |
|
1223 | 4091 |
|fe| |
4092 |
||
4093 |
fe := MIMETypes fontForCharset:fileEncoding. |
|
4094 |
fe notNil ifTrue:[^ fe]. |
|
1221 | 4095 |
^ 'iso8859*' |
1214
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4096 |
|
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4097 |
"Created: 28.6.1997 / 20:47:35 / cg" |
1223 | 4098 |
"Modified: 1.7.1997 / 00:04:56 / cg" |
395 | 4099 |
! |
4100 |
||
1140 | 4101 |
validateFontEncodingFor:newEncoding ask:ask |
4102 |
"if required, query user if he/she wants to change to another font, |
|
4103 |
which is able to display text encoded as specified by newEncoding" |
|
4104 |
||
1214
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4105 |
|fontsEncoding msg filter f defaultFont pref| |
1140 | 4106 |
|
4107 |
fontsEncoding := subView font encoding. |
|
4108 |
||
1221 | 4109 |
pref := self preferredFontEncodingFor:newEncoding. |
4110 |
||
4111 |
(pref match:fontsEncoding) ifTrue:[ |
|
1317 | 4112 |
^ self |
1140 | 4113 |
]. |
1221 | 4114 |
"/ stupid ... |
4115 |
pref = 'ascii*' ifTrue:[ |
|
1317 | 4116 |
(fontsEncoding match:'iso8859*') ifTrue:[ |
4117 |
^ self |
|
4118 |
] |
|
1140 | 4119 |
]. |
4120 |
||
1221 | 4121 |
filter := [:f | |coding| |
1317 | 4122 |
(coding := f encoding) notNil |
4123 |
and:[pref match:coding]]. |
|
1221 | 4124 |
|
4125 |
defaultFont := TextView defaultFont onDevice:device. |
|
4126 |
(pref match:(defaultFont encoding)) ifFalse:[ |
|
1317 | 4127 |
defaultFont := nil. |
1140 | 4128 |
]. |
4129 |
||
1221 | 4130 |
defaultFont isNil ifTrue:[ |
1317 | 4131 |
(pref = 'ascii*' |
4132 |
or:[pref = 'iso8859*']) ifTrue:[ |
|
4133 |
defaultFont := FontDescription family:'courier' face:'medium' style:'roman' size:12 |
|
4134 |
] |
|
1221 | 4135 |
]. |
4136 |
||
4137 |
defaultFont isNil ifTrue:[ |
|
1317 | 4138 |
defaultFont := device |
4139 |
listOfAvailableFonts |
|
4140 |
detect:[:f | filter value:f] |
|
4141 |
ifNone:nil. |
|
4142 |
defaultFont isNil ifTrue:[ |
|
4143 |
||
4144 |
"/ flush list, and refetch font list |
|
4145 |
"/ (in case someone just changed the font path ...) |
|
4146 |
||
4147 |
device flushListOfAvailableFonts. |
|
4148 |
defaultFont := device |
|
4149 |
listOfAvailableFonts |
|
4150 |
detect:[:f | filter value:f] |
|
4151 |
ifNone:nil. |
|
4152 |
]. |
|
4153 |
||
4154 |
defaultFont isNil ifTrue:[ |
|
4155 |
self warn:'your display does not seem to provide any ' , newEncoding , '-encoded font.'. |
|
4156 |
^ self. |
|
4157 |
] |
|
1221 | 4158 |
]. |
4159 |
||
4160 |
msg := 'switch to a %1 encoded font ?'. |
|
4161 |
(ask not or:[self confirm:(resources string:msg with:pref) withCRs]) |
|
4162 |
ifTrue:[ |
|
1317 | 4163 |
self withWaitCursorDo:[ |
4164 |
f := FontPanel |
|
4165 |
fontFromUserInitial:defaultFont |
|
4166 |
title:(resources string:'font selection') |
|
4167 |
filter:filter. |
|
4168 |
f notNil ifTrue:[ |
|
4169 |
subView font:f |
|
4170 |
] |
|
4171 |
] |
|
1140 | 4172 |
] |
4173 |
||
4174 |
"Created: 26.10.1996 / 12:06:54 / cg" |
|
1221 | 4175 |
"Modified: 30.6.1997 / 17:46:46 / cg" |
1162 | 4176 |
! ! |
4177 |
||
4178 |
!FileBrowser methodsFor:'private - file stuff'! |
|
4179 |
||
4180 |
doCreateFile:newName |
|
4181 |
"create an empty file" |
|
4182 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4183 |
|aStream f| |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4184 |
|
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4185 |
f := currentDirectory filenameFor:newName. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4186 |
f exists ifTrue:[ |
1329 | 4187 |
(self |
4188 |
ask:(resources string:'%1 already exists\\truncate ?' with:newName) |
|
4189 |
yesButton:'truncate' |
|
4190 |
) ifFalse:[^ self]. |
|
1162 | 4191 |
]. |
4192 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4193 |
FileStream openErrorSignal handle:[:ex| |
1329 | 4194 |
^ self showAlert:(resources string:'cannot create file ''%1'' !!' with:newName) |
4195 |
with:(FileStream lastErrorString) |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4196 |
] do:[ |
1329 | 4197 |
aStream := f newReadWriteStream. |
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4198 |
]. |
1162 | 4199 |
aStream notNil ifTrue:[ |
1329 | 4200 |
aStream close. |
4201 |
self updateCurrentDirectoryIfChanged |
|
1162 | 4202 |
] ifFalse:[ |
1329 | 4203 |
self showAlert:(resources string:'cannot create file ''%1'' !!' with:newName) |
4204 |
with:(FileStream lastErrorString) |
|
1162 | 4205 |
] |
4206 |
||
4207 |
"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
|
4208 |
"Modified: 18.9.1997 / 17:21:45 / stefan" |
1140 | 4209 |
! |
4210 |
||
1162 | 4211 |
doFileGet:viaDoubleClick |
4212 |
"get selected file - show contents in subView. |
|
4213 |
This is invoked either by the 'get file' menu item, or via double click. |
|
4214 |
When invoked via the menu (viaDoubleClick argument is false), |
|
4215 |
the automatic file action is not performed - instead, the file is always |
|
4216 |
shown in the codeView (if possible). |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4217 |
This distinction was done to allow xpm or xbm files (which have an automatic |
1162 | 4218 |
action) to be edited." |
4219 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4220 |
|fileName iconLbl winLbl f| |
1162 | 4221 |
|
4222 |
self withReadCursorDo:[ |
|
1329 | 4223 |
fileName := self getSelectedFileName. |
4224 |
fileName notNil ifTrue:[ |
|
4225 |
f := currentDirectory construct:fileName. |
|
4226 |
f isDirectory ifTrue:[ |
|
4227 |
self doChangeCurrentDirectoryTo:fileName updateHistory:true. |
|
4228 |
winLbl := myName. |
|
4229 |
iconLbl := myName |
|
4230 |
] ifFalse:[ |
|
4231 |
f exists ifFalse:[ |
|
4232 |
self warn:(resources string:'oops, ''%1'' is gone or unreadable.' with:fileName). |
|
4233 |
^ self |
|
4234 |
]. |
|
4235 |
timeOfFileRead := f modificationTime. |
|
4236 |
self showFile:fileName insert:false encoding:fileEncoding doubleClick:viaDoubleClick. |
|
4237 |
currentFileName := fileName. |
|
4238 |
||
4239 |
self fileTypeSpecificActions. |
|
4240 |
||
4241 |
subView acceptAction:[:theCode | |
|
4242 |
self withCursor:(Cursor write) do:[ |
|
4243 |
self writeFile:fileName text:theCode encoding:fileEncoding. |
|
4244 |
timeOfFileRead := f modificationTime. |
|
4245 |
self label:myName , ': ' , currentFileName |
|
4246 |
] |
|
4247 |
]. |
|
4248 |
||
4249 |
winLbl := myName , ': ' , fileName. |
|
4250 |
f isWritable ifFalse:[ |
|
4251 |
winLbl := winLbl , ' (readonly)' |
|
4252 |
]. |
|
4253 |
iconLbl := fileName |
|
4254 |
]. |
|
4255 |
self label:winLbl. |
|
4256 |
self iconLabel:iconLbl. |
|
4257 |
] |
|
1162 | 4258 |
] |
4259 |
||
4260 |
"Created: 19.6.1996 / 09:39:07 / cg" |
|
4261 |
"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
|
4262 |
"Modified: 18.9.1997 / 17:35:31 / stefan" |
1162 | 4263 |
! |
4264 |
||
4265 |
doRemove |
|
4266 |
"remove the selected file(s) - no questions asked" |
|
4267 |
||
1493 | 4268 |
|msg idx needUpdate toRemove updateRunning f| |
1162 | 4269 |
|
4270 |
updateRunning := listUpdateProcess notNil. |
|
4271 |
self stopUpdateProcess. |
|
4272 |
toRemove := OrderedCollection new. |
|
4273 |
||
4274 |
"/ |
|
4275 |
"/ did the directory change in the meanwhile ? |
|
4276 |
"/ |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4277 |
needUpdate := (currentDirectory modificationTime > timeOfLastCheck). |
1162 | 4278 |
|
4279 |
lockUpdate := true. |
|
4280 |
[ |
|
1868 | 4281 |
self selectedFilesDo:[:fileName | |
4282 |
|contents| |
|
4283 |
||
4284 |
f := currentDirectory construct:fileName. |
|
4285 |
OperatingSystem accessDeniedErrorSignal handle:[:ex| |
|
4286 |
"was not able to remove it" |
|
4287 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
4288 |
self showAlert:msg with:(OperatingSystem lastErrorString) |
|
4289 |
] do:[ |
|
4290 |
(f isSymbolicLink not and:[f isDirectory]) ifTrue:[ |
|
4291 |
contents := f directoryContents. |
|
4292 |
contents isEmpty ifTrue:[ |
|
4293 |
f remove |
|
4294 |
] ifFalse:[ |
|
4295 |
(self |
|
4296 |
ask:(resources string:'directory ''%1'' is not empty\remove anyway ?' with:fileName) |
|
4297 |
yesButton:'remove') |
|
4298 |
ifFalse:[ |
|
4299 |
^ self |
|
4300 |
]. |
|
4301 |
f recursiveRemove |
|
4302 |
]. |
|
4303 |
] ifFalse:[ |
|
4304 |
f remove. |
|
4305 |
]. |
|
1162 | 4306 |
" |
1868 | 4307 |
self show:nil |
1162 | 4308 |
" |
1868 | 4309 |
idx := fileList indexOf:fileName. |
4310 |
idx ~~ 0 ifTrue:[ |
|
4311 |
toRemove add:idx. |
|
4312 |
] |
|
4313 |
]. |
|
4314 |
]. |
|
1162 | 4315 |
] valueNowOrOnUnwindDo:[ |
1868 | 4316 |
lockUpdate := false. |
4317 |
fileListView setSelection:nil. |
|
4318 |
||
4319 |
"/ |
|
4320 |
"/ remove reverse - otherwise indices are wrong |
|
4321 |
"/ |
|
4322 |
toRemove sort. |
|
4323 |
toRemove reverseDo:[:idx | |
|
4324 |
fileList removeIndex:idx. |
|
4325 |
fileListView removeIndex:idx. |
|
4326 |
]. |
|
4327 |
||
4328 |
updateRunning ifTrue:[ |
|
4329 |
self updateCurrentDirectory |
|
4330 |
] ifFalse:[ |
|
4331 |
" |
|
4332 |
install a new check after some time |
|
4333 |
" |
|
4334 |
needUpdate ifFalse:[timeOfLastCheck := AbsoluteTime now]. |
|
4335 |
Processor removeTimedBlock:checkBlock. |
|
4336 |
Processor addTimedBlock:checkBlock afterSeconds:checkDelta. |
|
4337 |
] |
|
1162 | 4338 |
] |
4339 |
||
1374
b3a1e95a6220
Do not ask for nonempty directory if remove target is a symlink
Stefan Vogel <sv@exept.de>
parents:
1371
diff
changeset
|
4340 |
"Modified: / 20.11.1997 / 17:39:14 / stefan" |
1481 | 4341 |
"Modified: / 18.2.1998 / 17:57:25 / cg" |
1162 | 4342 |
! |
4343 |
||
4344 |
doRename:oldName to:newName |
|
1331
73e712c85588
Handle errors when renaming files.
Stefan Vogel <sv@exept.de>
parents:
1330
diff
changeset
|
4345 |
"rename a file (or directory)" |
1162 | 4346 |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4347 |
|old new| |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4348 |
|
1162 | 4349 |
(oldName notNil and:[newName notNil]) ifTrue:[ |
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4350 |
(oldName isBlank or:[newName isBlank]) ifFalse:[ |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4351 |
old := currentDirectory filenameFor:oldName. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4352 |
new := currentDirectory filenameFor:newName. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4353 |
OperatingSystem errorSignal handle:[:ex| |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4354 |
self showAlert:(resources string:'cannot rename file ''%1'' to %2 !!' |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4355 |
with:oldName with:newName) |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4356 |
with:(OperatingSystem lastErrorString) |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4357 |
] do:[ |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4358 |
new exists ifTrue:[ |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4359 |
(self confirm:(resources string:'''%1'' already exists - rename (i.e. overwrite) anyway ?' with:new baseName asText allBold)) |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4360 |
ifFalse:[ |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4361 |
^ self |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4362 |
] |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4363 |
]. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4364 |
old renameTo:new. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4365 |
]. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4366 |
self updateCurrentDirectoryIfChanged. |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4367 |
] |
1162 | 4368 |
] |
4369 |
||
1911
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4370 |
"Modified: / 24.9.1997 / 09:20:00 / stefan" |
6d1b77eda98f
check for existing target when renaming files;
Claus Gittinger <cg@exept.de>
parents:
1903
diff
changeset
|
4371 |
"Modified: / 3.10.1998 / 18:19:27 / cg" |
1162 | 4372 |
! ! |
4373 |
||
4374 |
!FileBrowser methodsFor:'private - file type & info'! |
|
4375 |
||
4376 |
fileCommentStrings |
|
4377 |
"return a useful comment definition; based upon the fileName for now" |
|
4378 |
||
4379 |
"/ for now, |
|
4380 |
"/ define comment strings, by heuristics; |
|
4381 |
"/ (should look for some mode= or similar string |
|
4382 |
"/ found in the file itself - like emacs does it) |
|
4383 |
||
4384 |
(currentFileName = 'Make.proto' |
|
4385 |
or:[currentFileName = 'Makefile' |
|
4386 |
or:[currentFileName = 'makefile']]) ifTrue:[ |
|
1317 | 4387 |
^ #('#' (nil nil)). |
1162 | 4388 |
]. |
4389 |
((currentFileName endsWith:'.c') |
|
4390 |
or:[(currentFileName endsWith:'.C')]) ifTrue:[ |
|
1317 | 4391 |
^ #(nil ('/*' '*/')). |
1162 | 4392 |
]. |
4393 |
((currentFileName endsWith:'.cc') |
|
4394 |
or:[(currentFileName endsWith:'.CC')]) ifTrue:[ |
|
1317 | 4395 |
^ #('//' ('/*' '*/')). |
1162 | 4396 |
]. |
4397 |
(currentFileName endsWith:'.java') ifTrue:[ |
|
1317 | 4398 |
^ #('//' (nil nil)). |
1162 | 4399 |
]. |
4400 |
||
4401 |
"/ smalltalk comments |
|
4402 |
||
4403 |
^ #('"/' ('"' '"')). |
|
4404 |
||
4405 |
"Created: 7.1.1997 / 20:30:00 / cg" |
|
4406 |
"Modified: 23.4.1997 / 13:11:49 / cg" |
|
4407 |
! |
|
4408 |
||
4409 |
fileTypeSpecificActions |
|
4410 |
"any special fileTypeSpecific actions are done here, |
|
4411 |
when a new file is selected" |
|
4412 |
||
4413 |
|commentStrings| |
|
4414 |
||
4415 |
commentStrings := self fileCommentStrings. |
|
4416 |
commentStrings notNil ifTrue:[ |
|
1317 | 4417 |
subView |
4418 |
commentStrings:#('#' (nil nil)). |
|
1162 | 4419 |
]. |
4420 |
||
4421 |
"Modified: 7.1.1997 / 20:30:54 / cg" |
|
4422 |
! |
|
4423 |
||
4424 |
getFileInfoString:longInfo |
|
4425 |
"get stat info on selected file - return a string which can be |
|
4426 |
shown in a box" |
|
4427 |
||
4428 |
|fileName f fullPath text info fileOutput type modeBits modeString s ts| |
|
4429 |
||
4430 |
fileName := self getSelectedFileName. |
|
4431 |
fileName isNil ifTrue:[^ nil]. |
|
4432 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4433 |
f := currentDirectory construct:fileName. |
1162 | 4434 |
info := f info. |
4435 |
||
4436 |
info isNil ifTrue:[ |
|
1329 | 4437 |
self showAlert:(resources string:'cannot get info of ''%1'' !!' with:fileName) |
4438 |
with:(OperatingSystem lastErrorString). |
|
4439 |
^ nil |
|
1162 | 4440 |
]. |
4441 |
||
4442 |
text := StringCollection new. |
|
4443 |
f isSymbolicLink ifTrue:[ |
|
1329 | 4444 |
text add:(resources string:'symbolic link to: %1' with:(f linkInfo path)) |
1162 | 4445 |
]. |
4446 |
||
4447 |
type := info type. |
|
4448 |
(longInfo and:[type == #regular]) ifTrue:[ |
|
1329 | 4449 |
fullPath := currentDirectory pathName asFilename constructString:fileName. |
4450 |
fileOutput := fullPath asFilename fileType. |
|
1162 | 4451 |
]. |
4452 |
||
4453 |
s := (resources at:'type: '). |
|
4454 |
fileOutput isNil ifTrue:[ |
|
1329 | 4455 |
s := s , type asString |
1162 | 4456 |
] ifFalse:[ |
1329 | 4457 |
s := s , 'regular (' , fileOutput , ')' |
1162 | 4458 |
]. |
4459 |
text add:s. |
|
4460 |
text add:(resources string:'size: %1' with:(info size) printString). |
|
4461 |
||
4462 |
modeBits := info mode. |
|
4463 |
modeString := self getModeString:modeBits. |
|
4464 |
longInfo ifTrue:[ |
|
1329 | 4465 |
text add:(resources string:'access: %1 (%2)' |
4466 |
with:modeString |
|
4467 |
with:(modeBits printStringRadix:8)) |
|
1162 | 4468 |
] ifFalse:[ |
1329 | 4469 |
text add:(resources string:'access: %1' with:modeString) |
1162 | 4470 |
]. |
4471 |
text add:(resources string:'owner: %1' |
|
1329 | 4472 |
with:(OperatingSystem getUserNameFromID:(info uid))). |
1162 | 4473 |
longInfo ifTrue:[ |
1329 | 4474 |
text add:(resources string:'group: %1' |
4475 |
with:(OperatingSystem getGroupNameFromID:(info gid))). |
|
4476 |
||
4477 |
ts := info accessed. |
|
4478 |
text add:(resources string:'last access: %1 %2' |
|
4479 |
with:(ts asTime printString) |
|
4480 |
with:(ts asDate printString)). |
|
4481 |
||
4482 |
ts := info modified. |
|
4483 |
text add:(resources string:'last modification: %1 %2' |
|
4484 |
with:(ts asTime printString) |
|
4485 |
with:(ts asDate printString)). |
|
1162 | 4486 |
]. |
4487 |
^ text asString |
|
4488 |
||
4489 |
"Modified: 8.9.1995 / 11:59:28 / claus" |
|
4490 |
"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
|
4491 |
"Modified: 18.9.1997 / 16:34:31 / stefan" |
1162 | 4492 |
! |
4493 |
||
4494 |
getInfoFile |
|
4495 |
"get filename of a description-file (.dir.info, README etc.); |
|
4496 |
This file is automatically shown when a directory is enterred. |
|
4497 |
You can add more names below if you like." |
|
4498 |
||
4499 |
#( |
|
4500 |
'.dir.info' |
|
4501 |
'README' |
|
4502 |
'ReadMe' |
|
4503 |
'Readme' |
|
4504 |
'readme' |
|
4505 |
'read.me' |
|
4506 |
'Read.me' |
|
4507 |
'READ.ME' |
|
1272 | 4508 |
'README.TXT' |
4509 |
'readme.txt' |
|
4510 |
'Readme.txt' |
|
1307 | 4511 |
'Info.txt' |
4512 |
'info.txt' |
|
4513 |
'INFO.TXT' |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4514 |
) do:[:f | |
1329 | 4515 |
|n| |
4516 |
n := currentDirectory construct:f. |
|
4517 |
(n isReadable and:[n isDirectory not]) ifTrue:[ |
|
4518 |
^ f. |
|
4519 |
] |
|
1140 | 4520 |
]. |
1162 | 4521 |
^ nil |
4522 |
||
1272 | 4523 |
"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
|
4524 |
"Modified: 16.9.1997 / 15:26:53 / stefan" |
1162 | 4525 |
! |
4526 |
||
4527 |
getModeString:modeBits |
|
4528 |
"convert file-mode bits into a more user-friendly string. |
|
4529 |
This is wrong here - should be moved into OperatingSystem." |
|
4530 |
||
4531 |
^ self getModeString:modeBits |
|
1317 | 4532 |
with:#( 'owner:' $r $w $x |
4533 |
' group:' $r $w $x |
|
4534 |
' others:' $r $w $x ) |
|
1140 | 4535 |
! |
4536 |
||
1162 | 4537 |
getModeString:modeBits with:texts |
4538 |
"convert file-mode bits into a more user-friendly string. |
|
4539 |
This is wrong here - should be moved into OperatingSystem." |
|
4540 |
||
4541 |
|bits modeString| |
|
4542 |
||
4543 |
bits := modeBits bitAnd:8r777. |
|
4544 |
modeString := ''. |
|
4545 |
||
4546 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
4547 |
with: texts do:[:bitMask :access | |
|
1317 | 4548 |
|ch| |
4549 |
||
4550 |
bitMask isNil ifTrue:[ |
|
4551 |
modeString := modeString , (resources string:access) |
|
4552 |
] ifFalse:[ |
|
4553 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
4554 |
ch := $- |
|
4555 |
] ifFalse:[ |
|
4556 |
ch := access |
|
4557 |
]. |
|
4558 |
modeString := modeString copyWith:ch |
|
4559 |
] |
|
633
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
4560 |
]. |
1162 | 4561 |
^ modeString |
4562 |
! |
|
4563 |
||
4564 |
showInfo |
|
4565 |
"show directory info when dir has changed" |
|
4566 |
||
4567 |
|info txt| |
|
4568 |
||
4569 |
info := self getInfoFile. |
|
4570 |
info notNil ifTrue:[ |
|
1317 | 4571 |
txt := self readFile:info |
1162 | 4572 |
]. |
4573 |
self show:txt. |
|
4574 |
! |
|
4575 |
||
4576 |
sizePrintString:size |
|
4577 |
"helper for update-directory to return a string with a files size. |
|
4578 |
This one gives the size in byte, Kb or Mb depending on size. |
|
4579 |
If you dont like this, just uncomment the first statement below." |
|
4580 |
||
4581 |
|unitString n| |
|
4582 |
||
4583 |
" |
|
4584 |
^ size printString. |
|
4585 |
" |
|
4586 |
unitString := ''. |
|
4587 |
size < (500 * 1024) ifTrue:[ |
|
1317 | 4588 |
size < 1024 ifTrue:[ |
4589 |
n := size |
|
4590 |
] ifFalse:[ |
|
4591 |
n := (size * 10 // 1024 / 10.0). |
|
4592 |
unitString := ' Kb' |
|
4593 |
] |
|
1162 | 4594 |
] ifFalse:[ |
1317 | 4595 |
n := (size * 10 // 1024 // 1024 / 10.0). |
4596 |
unitString := ' Mb' |
|
1162 | 4597 |
]. |
4598 |
^ (n printStringLeftPaddedTo:5) , unitString. |
|
4599 |
! ! |
|
4600 |
||
4601 |
!FileBrowser methodsFor:'private - file-I/O'! |
|
4602 |
||
4603 |
readFile:fileName |
|
4604 |
"read in the file, answer its contents as StringCollection" |
|
4605 |
||
4606 |
^ self readFile:fileName lineDelimiter:Character cr encoding:nil |
|
4607 |
||
4608 |
"Modified: 22.2.1996 / 14:57:08 / cg" |
|
4609 |
! |
|
4610 |
||
4611 |
readFile:fileName lineDelimiter:aCharacter encoding:encoding |
|
4612 |
"read in the file, return its contents as StringCollection. |
|
4613 |
The files lines are delimited by aCharacter. |
|
4614 |
If encoding is nonNil, the file is assumed to be coded according to |
|
4615 |
that symbol, and #decodeString: should be able to convert it." |
|
4616 |
||
4617 |
|stream text msg sz| |
|
4618 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4619 |
stream := (currentDirectory construct:fileName) readStream. |
1162 | 4620 |
stream isNil ifTrue:[ |
1329 | 4621 |
msg := (resources string:'cannot read file ''%1'' !!' with:fileName). |
4622 |
self showAlert:msg with:(FileStream lastErrorString). |
|
4623 |
^ nil |
|
1162 | 4624 |
]. |
4625 |
||
4626 |
" |
|
4627 |
for very big files, give ObjectMemory a hint, to preallocate more |
|
4628 |
" |
|
1311 | 4629 |
(sz := stream fileSize) > 1000000 ifTrue:[ |
1329 | 4630 |
Processor activeProcess withPriority:Processor userBackgroundPriority do:[ |
4631 |
ObjectMemory announceSpaceNeed:(sz + (sz // 5)) "/ add 20% for tab expansion |
|
4632 |
]. |
|
1162 | 4633 |
]. |
4634 |
||
4635 |
text := self readStream:stream lineDelimiter:aCharacter encoding:encoding. |
|
4636 |
stream close. |
|
4637 |
^ text |
|
4638 |
||
4639 |
"Created: 22.2.1996 / 14:56:48 / cg" |
|
4640 |
"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
|
4641 |
"Modified: 18.9.1997 / 17:06:54 / stefan" |
1162 | 4642 |
! |
4643 |
||
4644 |
readStream:aStream |
|
4645 |
"read in from aStream, answer its contents as StringCollection" |
|
4646 |
||
4647 |
^ self readStream:aStream lineDelimiter:Character cr encoding:nil |
|
4648 |
||
4649 |
"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
|
4650 |
! |
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
4651 |
|
1162 | 4652 |
readStream:aStream lineDelimiter:aCharacter encoding:encoding |
4653 |
"read from aStream, answer its contents as StringCollection. |
|
4654 |
The files lines are delimited by aCharacter. |
|
4655 |
If encoding is nonNil, the file is assumed to be coded according to |
|
4656 |
that symbol, and #decodeString: should be able to convert it." |
|
4657 |
||
4658 |
|text line enc| |
|
4659 |
||
4660 |
text := StringCollection new. |
|
4661 |
||
4662 |
enc := encoding. |
|
4663 |
enc == #iso8859 ifTrue:[ |
|
1317 | 4664 |
enc := nil |
1162 | 4665 |
]. |
4666 |
||
4667 |
aCharacter == Character cr ifTrue:[ |
|
1317 | 4668 |
[aStream atEnd] whileFalse:[ |
4669 |
line := aStream nextLine withTabsExpanded. |
|
4670 |
enc notNil ifTrue:[ |
|
4671 |
line := line decodeFrom:enc |
|
4672 |
]. |
|
4673 |
text add:line |
|
4674 |
]. |
|
1162 | 4675 |
] ifFalse:[ |
1317 | 4676 |
[aStream atEnd] whileFalse:[ |
4677 |
line := (aStream upTo:aCharacter) withTabsExpanded. |
|
4678 |
enc notNil ifTrue:[ |
|
4679 |
line := line decodeFrom:enc |
|
4680 |
]. |
|
4681 |
text add:line |
|
4682 |
]. |
|
633
4630175ed31e
double click on .htm / .html files open a viewer;
Claus Gittinger <cg@exept.de>
parents:
585
diff
changeset
|
4683 |
]. |
1162 | 4684 |
^ text |
4685 |
||
4686 |
"Created: 22.2.1996 / 14:58:25 / cg" |
|
4687 |
"Modified: 2.4.1997 / 21:31:36 / cg" |
|
4688 |
! |
|
4689 |
||
4690 |
showFile:fileName |
|
4691 |
"show contents of fileName in subView" |
|
4692 |
||
1689 | 4693 |
fileListView selection:(fileList indexOf:fileName). |
4694 |
self fileGet |
|
4695 |
||
4696 |
"Modified: / 17.6.1998 / 11:26:13 / cg" |
|
1162 | 4697 |
! |
4698 |
||
4699 |
showFile:fileName insert:insert encoding:encoding |
|
4700 |
"show/insert contents of fileName in subView" |
|
4701 |
||
4702 |
^ self |
|
1317 | 4703 |
showFile:fileName insert:insert encoding:encoding doubleClick:false |
1162 | 4704 |
|
4705 |
"Modified: 19.6.1996 / 09:40:19 / cg" |
|
4706 |
! |
|
4707 |
||
4708 |
showFile:fileName insert:insert encoding:encoding doubleClick:viaDoubleClick |
|
4709 |
"show/insert contents of fileName in subView" |
|
4710 |
||
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4711 |
|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
|
4712 |
fontsEncoding pref failWarning| |
1162 | 4713 |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4714 |
path := currentDirectory filenameFor:fileName. |
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4715 |
(path type == #regular) ifFalse:[ |
1329 | 4716 |
"asked for a non-file - ignore it ..." |
4717 |
path exists ifFalse:[ |
|
4718 |
msg := '''%1'' does not exist !!'. |
|
4719 |
] ifTrue:[ |
|
4720 |
msg := '''%1'' is not a regular file !!'. |
|
4721 |
]. |
|
4722 |
self warn:(resources string:msg with:fileName). |
|
4723 |
^ self |
|
1162 | 4724 |
]. |
4725 |
||
4726 |
"/ |
|
4727 |
"/ check if file is a text file |
|
4728 |
"/ |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4729 |
s := path readStream. |
1162 | 4730 |
s isNil ifTrue:[ |
1329 | 4731 |
self showAlert:(resources string:'cannot read file ''%1'' !!' with:fileName) |
4732 |
with:(FileStream lastErrorString). |
|
4733 |
^ nil |
|
1162 | 4734 |
]. |
4735 |
||
1222
f2952fc3ced9
look at more when guessing the encoding
Claus Gittinger <cg@exept.de>
parents:
1221
diff
changeset
|
4736 |
buffer := String new:4096. |
f2952fc3ced9
look at more when guessing the encoding
Claus Gittinger <cg@exept.de>
parents:
1221
diff
changeset
|
4737 |
n := s nextBytes:4096 into:buffer. |
1162 | 4738 |
s close. |
4739 |
||
4740 |
enc := encoding. |
|
4741 |
ok := true. |
|
4742 |
guess := self guessEncodingFrom:buffer. |
|
4743 |
||
4744 |
guess == #binary ifTrue:[ |
|
1329 | 4745 |
ok := false. |
4746 |
viaDoubleClick ifTrue:[ |
|
4747 |
(self binaryFileAction:fileName) ifTrue:[^ self]. |
|
4748 |
]. |
|
4749 |
(self confirm:(resources string:'''%1'' seems to be a binary file - show anyway ?' with:fileName)) |
|
4750 |
ifFalse:[^ self] |
|
1162 | 4751 |
] ifFalse:[ |
1329 | 4752 |
viaDoubleClick ifTrue:[ |
4753 |
(self nonBinaryFileAction:fileName) ifTrue:[^ self]. |
|
4754 |
]. |
|
4755 |
||
4756 |
fontsEncoding := subView font encoding. |
|
4757 |
pref := self preferredFontEncodingFor:guess. |
|
4758 |
||
4759 |
ok := pref match:fontsEncoding. |
|
4760 |
ok ifFalse:[ |
|
4761 |
pref = 'iso8859*' ifTrue:[ |
|
4762 |
ok := 'ascii*' match:fontsEncoding |
|
4763 |
] |
|
4764 |
]. |
|
4765 |
ok ifTrue:[ |
|
4766 |
fileEncoding := guess. |
|
4767 |
enc := guess. |
|
4768 |
] ifFalse:[ |
|
4769 |
action := Dialog choose:(resources string:'''%1'' seems to require a %2 font.' with:fileName with:pref) |
|
4770 |
labels:(resources array:#('cancel' 'show' 'change font')) |
|
4771 |
values:#(nil #show #encoding) |
|
4772 |
default:#encoding. |
|
4773 |
action isNil ifTrue:[^ self]. |
|
4774 |
action == #encoding ifTrue:[ |
|
4775 |
fileEncoding := guess asSymbol. |
|
4776 |
subView externalEncoding:fileEncoding. |
|
4777 |
self validateFontEncodingFor:fileEncoding ask:false. |
|
4778 |
] ifFalse:[ |
|
4779 |
self information:(resources string:'Individual characters may be invisible/wrong in this font.') |
|
4780 |
]. |
|
4781 |
enc := fileEncoding. |
|
4782 |
]. |
|
1162 | 4783 |
]. |
4784 |
||
4785 |
convert := false. |
|
1329 | 4786 |
"/ ok ifTrue:[ |
4787 |
"/ "/ |
|
4788 |
"/ "/ check if line delimiter is a cr |
|
4789 |
"/ "/ |
|
4790 |
"/ i := buffer indexOf:Character cr. |
|
4791 |
"/ i == 0 ifTrue:[ |
|
4792 |
"/ "/ |
|
4793 |
"/ "/ no newline found - try cr |
|
4794 |
"/ "/ |
|
4795 |
"/ i := buffer indexOf:(Character value:13). |
|
4796 |
"/ i ~~ 0 ifTrue:[ |
|
4797 |
"/ convert := self confirm:(resources string:'''%1'' seems to have CR as line delimiter - convert to NL ?' with:fileName). |
|
4798 |
"/ ] |
|
4799 |
"/ ] |
|
4800 |
"/ ]. |
|
1162 | 4801 |
|
4802 |
insert ifFalse:[ |
|
1329 | 4803 |
"/ release old text first |
4804 |
"/ - we might need the memory in case of huge files |
|
4805 |
"/ (helps if you have a 4Mb file in the view, |
|
4806 |
"/ and click on another biggy) |
|
4807 |
||
4808 |
subView contents:nil. |
|
1162 | 4809 |
]. |
4810 |
||
4811 |
convert ifTrue:[ |
|
1329 | 4812 |
eol := Character value:13 |
1162 | 4813 |
] ifFalse:[ |
1329 | 4814 |
eol := Character cr |
1162 | 4815 |
]. |
1212 | 4816 |
|
1214
02d5bbd925dd
allow decoding errors to be ignored
Claus Gittinger <cg@exept.de>
parents:
1212
diff
changeset
|
4817 |
failWarning := false. |
1212 | 4818 |
CharacterArray decodingFailedSignal handle:[:ex | |
1329 | 4819 |
|errStr| |
4820 |
||
4821 |
failWarning ifFalse:[ |
|
4822 |
errStr := resources string:ex errorString. |
|
4823 |
(self confirm:(resources |
|
4824 |
string:'An error occurred while decoding:\%1\\The file has either a different encoding or is corrupted.\\Continue ?' |
|
4825 |
with:errStr) withCRs) |
|
4826 |
ifFalse:[ |
|
4827 |
^ self |
|
4828 |
]. |
|
4829 |
failWarning := true. |
|
4830 |
]. |
|
4831 |
ex proceed. |
|
1212 | 4832 |
] do:[ |
1329 | 4833 |
text := self readFile:fileName lineDelimiter:eol encoding:enc. |
1212 | 4834 |
]. |
1162 | 4835 |
|
4836 |
insert ifFalse:[ |
|
1329 | 4837 |
self show:text |
1162 | 4838 |
] ifTrue:[ |
1329 | 4839 |
subView insertSelectedStringAtCursor:text asString |
1162 | 4840 |
]. |
4841 |
||
4842 |
"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
|
4843 |
"Modified: 18.9.1997 / 17:10:20 / stefan" |
1329 | 4844 |
"Modified: 22.9.1997 / 10:02:38 / cg" |
1162 | 4845 |
! |
4846 |
||
4847 |
writeFile:fileName text:someText encoding:encoding |
|
1353 | 4848 |
|stream errReason msg startNr nLines string| |
4849 |
||
4850 |
errReason := ''. |
|
4851 |
FileStream streamErrorSignal handle:[:ex | |
|
1393 | 4852 |
errReason := ex errorString. |
4853 |
ex return. |
|
1353 | 4854 |
] do:[ |
1393 | 4855 |
stream := (currentDirectory filenameFor:fileName) writeStream. |
1353 | 4856 |
]. |
1162 | 4857 |
stream isNil ifTrue:[ |
1393 | 4858 |
msg := (resources string:'cannot write file ''%1'' !!' with:fileName). |
4859 |
self showAlert:msg with:errReason. |
|
4860 |
^ self. |
|
1353 | 4861 |
]. |
4862 |
||
4863 |
someText isString ifTrue:[ |
|
1393 | 4864 |
stream nextPutAll:someText. |
1162 | 4865 |
] ifFalse:[ |
1393 | 4866 |
"/ |
4867 |
"/ on some systems, writing linewise is very slow (via NFS) |
|
4868 |
"/ therefore we convert to a string and write it in chunks. |
|
4869 |
"/ To avoid creating huge strings, we do it in blocks of 1000 lines. |
|
4870 |
"/ |
|
4871 |
startNr := 1. |
|
4872 |
nLines := someText size. |
|
4873 |
[startNr <= nLines] whileTrue:[ |
|
4874 |
string := someText asStringWithCRsFrom:startNr |
|
4875 |
to:((startNr + 1000) min:nLines) |
|
4876 |
compressTabs:compressTabs. |
|
4877 |
encoding notNil ifTrue:[ |
|
4878 |
string := string encodeInto:encoding |
|
4879 |
]. |
|
4880 |
stream nextPutAll:string. |
|
4881 |
startNr := startNr + 1000 + 1. |
|
4882 |
]. |
|
1353 | 4883 |
]. |
4884 |
||
4885 |
stream close. |
|
4886 |
subView modified:false |
|
1162 | 4887 |
|
4888 |
"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
|
4889 |
"Modified: 18.9.1997 / 17:12:44 / stefan" |
1353 | 4890 |
"Modified: 22.10.1997 / 12:34:38 / cg" |
1140 | 4891 |
! ! |
4892 |
||
4893 |
!FileBrowser methodsFor:'private - presentation'! |
|
4894 |
||
4895 |
defineTabulatorsForLongList |
|
4896 |
"define the tabs for the long list" |
|
4897 |
||
4898 |
tabSpec := TabulatorSpecification new. |
|
4899 |
tabSpec unit:#inch. |
|
4900 |
"/ tabSpec positions:#(0 0.25 2.3 4.3 5.3 6.0 6.5). |
|
4901 |
tabSpec widths: #(0.25 2 2.0 1 0.5 0.5 1"any"). |
|
4902 |
" icon name mode owner group size type" |
|
4903 |
tabSpec align: #(#left #left #left #right #right #decimal #left). |
|
4904 |
tabSpec addDependent:self. |
|
4905 |
||
4906 |
tabRulerView tabulatorSpecification:tabSpec. |
|
4907 |
||
4908 |
"Modified: 17.4.1997 / 02:56:07 / cg" |
|
172 | 4909 |
! |
4910 |
||
1140 | 4911 |
defineTabulatorsForShortList |
4912 |
"define the tabs for the short list" |
|
4913 |
||
4914 |
tabSpec := TabulatorSpecification new. |
|
4915 |
tabSpec unit:#inch. |
|
4916 |
"/ tabSpec positions:#(0 0.25 ). |
|
4917 |
tabSpec widths: #(0.25 2 ). |
|
4918 |
" icon name" |
|
4919 |
tabSpec align: #(#left #left). |
|
4920 |
tabSpec addDependent:self. |
|
4921 |
||
1758 | 4922 |
tabRulerView notNil ifTrue:[ |
4923 |
tabRulerView tabulatorSpecification:tabSpec. |
|
4924 |
]. |
|
4925 |
||
4926 |
"Created: / 17.4.1997 / 02:51:41 / cg" |
|
4927 |
"Modified: / 27.7.1998 / 20:23:34 / cg" |
|
1140 | 4928 |
! |
4929 |
||
4930 |
iconForFile:aFilenameString |
|
1147 | 4931 |
"given a fileName, return an appropriate icon" |
4932 |
||
1784
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
4933 |
|f icn key key2 suff mimeType| |
1140 | 4934 |
|
1324
9f016fbbae01
Use Filename instead of obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
1320
diff
changeset
|
4935 |
f := currentDirectory construct:aFilenameString. |
1140 | 4936 |
f isDirectory ifTrue:[ |
1868 | 4937 |
f isSymbolicLink ifTrue:[ |
4938 |
key := #directoryLink |
|
4939 |
] ifFalse:[ |
|
4940 |
key := #directory. |
|
4941 |
(f isReadable not or:[f isExecutable not]) ifTrue:[ |
|
4942 |
key := #directoryLocked |
|
4943 |
]. |
|
4944 |
] |
|
1147 | 4945 |
] ifFalse:[ |
1868 | 4946 |
f isSymbolicLink ifTrue:[ |
4947 |
f isReadable not ifTrue:[ |
|
4948 |
key := #fileLocked |
|
4949 |
] ifFalse:[ |
|
4950 |
key := #fileLink |
|
4951 |
] |
|
4952 |
] ifFalse:[ |
|
4953 |
key := key2 := #file. |
|
4954 |
f isExecutableProgram ifTrue:[ |
|
4955 |
key := key2 := #executableFile |
|
4956 |
]. |
|
4957 |
(f isReadable not) ifTrue:[ |
|
4958 |
key := #fileLocked |
|
4959 |
] ifFalse:[ |
|
4960 |
suff := f suffix. |
|
4961 |
mimeType := MIMETypes mimeTypeForSuffix:suff. |
|
4962 |
mimeType notNil ifTrue:[ |
|
4963 |
(mimeType startsWith:'image/') ifTrue:[ |
|
4964 |
key := #imageFile |
|
4965 |
] ifFalse:[ |
|
4966 |
(mimeType startsWith:'text/') ifTrue:[ |
|
4967 |
key := #textFile |
|
4968 |
] |
|
4969 |
] |
|
4970 |
]. |
|
4971 |
]. |
|
4972 |
]. |
|
1141 | 4973 |
]. |
1147 | 4974 |
|
1784
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
4975 |
"/ local (device) icons |
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
4976 |
icons notNil ifTrue:[ |
1868 | 4977 |
mimeType notNil ifTrue:[ |
4978 |
icn := icons at:mimeType ifAbsent:nil. |
|
4979 |
icn notNil ifTrue:[^ icn]. |
|
4980 |
]. |
|
4981 |
icn := icons at:key ifAbsent:nil. |
|
4982 |
icn notNil ifTrue:[^ icn]. |
|
1141 | 4983 |
]. |
1495 | 4984 |
|
1784
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
4985 |
"/ global icons |
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
4986 |
|
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
4987 |
Icons notNil ifTrue:[ |
1868 | 4988 |
mimeType notNil ifTrue:[ |
4989 |
icn := Icons at:mimeType ifAbsent:nil. |
|
4990 |
]. |
|
4991 |
icn notNil ifTrue:[ |
|
4992 |
key := mimeType |
|
4993 |
] ifFalse:[ |
|
4994 |
icn := Icons at:key ifAbsent:nil. |
|
4995 |
]. |
|
1784
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
4996 |
]. |
1495 | 4997 |
|
1253 | 4998 |
icn isNil ifTrue:[ |
1868 | 4999 |
( (key := key2) isNil |
5000 |
or:[(icn := icons at:key ifAbsent:nil) notNil |
|
5001 |
or:[(icn := Icons at:key ifAbsent:nil) isNil]] |
|
5002 |
) ifTrue:[ |
|
5003 |
^ icn |
|
5004 |
] |
|
1253 | 5005 |
]. |
1495 | 5006 |
|
1784
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
5007 |
"/ remember device icon |
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
5008 |
icn := icn copy onDevice:device. |
1495 | 5009 |
icn clearMaskedPixels. |
5010 |
icons at:key put:icn. |
|
1239
e58e2cb6639a
allow specification of icons from resource file.
Claus Gittinger <cg@exept.de>
parents:
1235
diff
changeset
|
5011 |
^ icn |
1141 | 5012 |
|
1746
68a187e3f30f
another icon for executable files.
Claus Gittinger <cg@exept.de>
parents:
1737
diff
changeset
|
5013 |
"Modified: / 18.9.1997 / 16:35:28 / stefan" |
1784
329e3a904236
ask MIMETypes when mapping suffixes to icons.
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
5014 |
"Modified: / 1.8.1998 / 17:42:37 / cg" |
36 | 5015 |
! |
5016 |
||
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
5017 |
stopUpdateProcess |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
5018 |
Processor removeTimedBlock:checkBlock. |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
5019 |
listUpdateProcess notNil ifTrue:[ |
1317 | 5020 |
listUpdateProcess terminate. |
5021 |
listUpdateProcess := nil. |
|
1156
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
5022 |
]. |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
5023 |
|
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
5024 |
"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
|
5025 |
! |
f3df28086973
dont do a full update when removing files
Claus Gittinger <cg@exept.de>
parents:
1154
diff
changeset
|
5026 |
|
36 | 5027 |
updateCurrentDirectory |
5028 |
"update listView with directory contents" |
|
5029 |
||
49 | 5030 |
"the code below may look somewhat complex - |
5031 |
it reads the directory first for the names, |
|
1151
194b10bad6da
great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents:
1147
diff
changeset
|
5032 |
then (in followup sweeps over the files) gets the |
194b10bad6da
great asynchronous list update;
Claus Gittinger <cg@exept.de>
parents:
1147
diff
changeset
|
5033 |
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
|
5034 |
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
|
5035 |
(i.e. stat-calls) may take long - especially on NFS-mounted directories. |
49 | 5036 |
The file reading is done at lower priority, to let user continue |
5037 |
his work in other views. However, to be fair to other fileBrowser, |
|
5038 |
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
|
5039 |
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
|
5040 |
Therefore, browsers which read short directories will finish first. |
49 | 5041 |
ST/X users love this behavior ;-) |
5042 |
" |
|
5043 |
||
294 | 5044 |
self withReadCursorDo:[ |
1868 | 5045 |
|files matchPattern list passDone f| |
5046 |
||
5047 |
self stopUpdateProcess. |
|
5048 |
||
5049 |
timeOfLastCheck := AbsoluteTime now. |
|
5050 |
||
5051 |
files := currentDirectory asFilename fullDirectoryContents. |
|
1329 | 5052 |
|
5053 |
"/ (files includes:(Filename parentDirectoryName)) ifTrue:[ |
|
5054 |
"/ upButton enable. |
|
5055 |
"/ ] ifFalse:[ |
|
5056 |
"/ upButton disable. |
|
5057 |
"/ ]. |
|
5058 |
||
1868 | 5059 |
"/ show files which are either directories |
5060 |
"/ or match the current pattern |
|
5061 |
||
5062 |
matchPattern := filterField contents. |
|
5063 |
(matchPattern notNil and:[ |
|
5064 |
matchPattern isEmpty not and:[ |
|
5065 |
matchPattern ~= '*']]) ifTrue:[ |
|
5066 |
files := files select:[:aName | |
|
5067 |
((currentDirectory construct:aName) isDirectory) |
|
5068 |
or:[matchPattern compoundMatch:aName] |
|
5069 |
]. |
|
5070 |
]. |
|
5071 |
||
5072 |
files size == 0 ifTrue:[ |
|
5073 |
self information:('directory ', currentDirectory pathName, ' vanished'). |
|
5074 |
^ self |
|
5075 |
]. |
|
5076 |
(sortByWhat value == #name) ifTrue:[ |
|
5077 |
sortCaseless value == true ifTrue:[ |
|
5078 |
files sort:[:a :b | a asLowercase < b asLowercase] |
|
5079 |
] ifFalse:[ |
|
5080 |
files sort. |
|
5081 |
] |
|
5082 |
] ifFalse:[ |
|
5083 |
(sortByWhat value == #time) ifTrue:[ |
|
5084 |
files sort:[:a :b | |f1 f2 t1 t2| |
|
5085 |
f1 := (currentDirectory construct:a). |
|
5086 |
f2 := (currentDirectory construct:b). |
|
5087 |
t1 := f1 isSymbolicLink |
|
5088 |
ifFalse:[f1 modificationTime] |
|
5089 |
ifTrue:[f1 linkInfo modified]. |
|
5090 |
t2 := f2 isSymbolicLink |
|
5091 |
ifFalse:[f2 modificationTime] |
|
5092 |
ifTrue:[f2 linkInfo modified]. |
|
5093 |
t1 := t1 ? (AbsoluteTime now). |
|
5094 |
t2 := t2 ? (AbsoluteTime now). |
|
5095 |
t1 > t2 |
|
5096 |
] |
|
5097 |
] ifFalse:[ |
|
5098 |
(sortByWhat value == #type) ifTrue:[ |
|
5099 |
files sort:[:a :b | |f1 f2 t1 t2 suff1 suff2| |
|
5100 |
f1 := (currentDirectory construct:a). |
|
5101 |
f2 := (currentDirectory construct:b). |
|
5102 |
t1 := f1 type ? #xbadLink. |
|
5103 |
t2 := f2 type ? #xbadLink. |
|
5104 |
t1 = t2 ifTrue:[ |
|
5105 |
suff1 := f1 suffix. |
|
5106 |
suff2 := f2 suffix. |
|
5107 |
suff1 = suff2 ifTrue:[ |
|
5108 |
sortCaseless value == true ifTrue:[ |
|
5109 |
a asLowercase < b asLowercase |
|
5110 |
] ifFalse:[ |
|
5111 |
a < b |
|
5112 |
] |
|
5113 |
] ifFalse:[ |
|
5114 |
suff1 asLowercase < suff2 asLowercase |
|
5115 |
] |
|
5116 |
] ifFalse:[ |
|
5117 |
t1 < t2 |
|
5118 |
] |
|
5119 |
] |
|
5120 |
] |
|
5121 |
] |
|
5122 |
]. |
|
5123 |
||
5124 |
files := self withoutHiddenFiles:files. |
|
5125 |
fileList := files copy. |
|
5126 |
||
5127 |
tabSpec isNil ifTrue:[ |
|
5128 |
showingDetails value "showLongList" ifTrue:[ |
|
5129 |
self defineTabulatorsForLongList |
|
5130 |
] ifFalse:[ |
|
5131 |
self defineTabulatorsForShortList |
|
5132 |
]. |
|
5133 |
]. |
|
5134 |
||
5135 |
"/ |
|
5136 |
"/ first show all the names - this can be done fast ... |
|
5137 |
"/ |
|
5138 |
list := files collect:[:fileName | |
|
5139 |
|entry| |
|
5140 |
||
5141 |
entry := MultiColListEntry new. |
|
5142 |
entry tabulatorSpecification:tabSpec. |
|
5143 |
entry colAt:1 put:nil. |
|
5144 |
entry colAt:2 put:fileName. |
|
5145 |
]. |
|
5146 |
||
5147 |
fileListView setList:list expandTabs:false. |
|
5148 |
passDone := Array new:list size withAll:0. |
|
5149 |
||
5150 |
" |
|
5151 |
this is a time consuming operation (especially, if reading an |
|
5152 |
NFS-mounted directory); therefore, start a low prio process, |
|
5153 |
which fills in the remaining fields in the fileList ... |
|
5154 |
" |
|
5155 |
||
5156 |
listUpdateProcess := [ |
|
5157 |
|prevUid prevGid fileNameString nameString groupString |
|
5158 |
modeString info line len |
|
5159 |
anyImages lineIndex aFileName |
|
5160 |
entry typ f p typeString done endIndex |
|
5161 |
state stopAtEnd nextState img prevFirstLine prevLastLine |
|
5162 |
numVisible dirSuffix| |
|
5163 |
||
5164 |
dirSuffix := Filename directorySuffix. |
|
5165 |
dirSuffix size > 0 ifTrue:[ |
|
5166 |
dirSuffix := '.' , dirSuffix asLowercase. |
|
5167 |
]. |
|
5168 |
||
5169 |
"/ |
|
5170 |
"/ then walk over the files, adding more info |
|
5171 |
"/ (since we have to stat each file, this may take a while longer) |
|
5172 |
"/ Visible items are always filled first. |
|
5173 |
||
5174 |
"/ |
|
5175 |
"/ the state machine |
|
5176 |
"/ |
|
5177 |
nextState := IdentityDictionary new. |
|
5178 |
showingDetails value "showLongList" ifTrue:[ |
|
5179 |
nextState add:(#visibleIcons -> #visibleAttributes). |
|
5180 |
nextState add:(#visibleAttributes -> #visibleTypes). |
|
5181 |
nextState add:(#visibleTypes -> #visibleImages). |
|
5182 |
nextState add:(#visibleImages -> #nextPageIcons). |
|
5183 |
||
5184 |
nextState add:(#nextPageIcons -> #nextPageAttributes). |
|
5185 |
nextState add:(#nextPageAttributes -> #nextPageTypes). |
|
5186 |
nextState add:(#nextPageTypes -> #nextPageImages). |
|
5187 |
nextState add:(#nextPageImages -> #previousPageIcons). |
|
5188 |
||
5189 |
nextState add:(#previousPageIcons -> #previousPageAttributes). |
|
5190 |
nextState add:(#previousPageAttributes -> #previousPageTypes). |
|
5191 |
nextState add:(#previousPageTypes -> #previousPageImages). |
|
5192 |
nextState add:(#previousPageImages -> #remainingIcons). |
|
5193 |
||
5194 |
nextState add:(#remainingIcons -> #remainingAttributes). |
|
5195 |
nextState add:(#remainingAttributes -> #remainingTypes). |
|
5196 |
nextState add:(#remainingTypes -> #remainingImages). |
|
5197 |
nextState add:(#remainingImages -> nil). |
|
5198 |
] ifFalse:[ |
|
5199 |
nextState add:(#visibleIcons -> #nextPageIcons). |
|
5200 |
nextState add:(#nextPageIcons -> #previousPageIcons). |
|
5201 |
nextState add:(#previousPageIcons -> #remainingIcons). |
|
5202 |
nextState add:(#remainingIcons -> nil). |
|
5203 |
]. |
|
5204 |
||
5205 |
anyImages := false. |
|
5206 |
||
5207 |
lineIndex := prevFirstLine := fileListView firstLineShown. |
|
5208 |
endIndex := prevLastLine := fileListView lastLineShown. |
|
5209 |
endIndex := endIndex min:(files size). |
|
5210 |
state := #visibleIcons. |
|
5211 |
||
5212 |
done := false. |
|
5213 |
[done] whileFalse:[ |
|
5214 |
"/ |
|
5215 |
"/ if multiple FileBrowsers are reading, let others |
|
5216 |
"/ make some progress too |
|
5217 |
"/ |
|
5218 |
Processor yield. |
|
5219 |
||
5220 |
"/ |
|
5221 |
"/ could be destroyed in the meanwhile ... |
|
5222 |
"/ |
|
5223 |
realized ifFalse:[ |
|
5224 |
listUpdateProcess := nil. |
|
5225 |
Processor activeProcess terminate |
|
5226 |
]. |
|
5227 |
||
5228 |
((prevFirstLine ~~ fileListView firstLineShown) |
|
5229 |
or:[prevLastLine ~~ fileListView lastLineShown]) ifTrue:[ |
|
5230 |
"/ start all over again |
|
5231 |
lineIndex := prevFirstLine := fileListView firstLineShown. |
|
5232 |
endIndex := prevLastLine := fileListView lastLineShown. |
|
5233 |
endIndex := endIndex min:(files size). |
|
5234 |
state := #visibleIcons. |
|
5235 |
]. |
|
5236 |
||
5237 |
(lineIndex between:1 and:(files size)) ifTrue:[ |
|
5238 |
||
5239 |
"/ |
|
5240 |
"/ expand the next entry ... |
|
5241 |
"/ |
|
5242 |
aFileName := files at:lineIndex. |
|
5243 |
entry := fileListView at:lineIndex. |
|
5244 |
f := currentDirectory construct:aFileName. |
|
5245 |
||
5246 |
(state endsWith:'Icons') ifTrue:[ |
|
5247 |
"/ |
|
5248 |
"/ pass 1 - icons |
|
5249 |
"/ |
|
5250 |
(passDone at:lineIndex) < 1 ifTrue:[ |
|
5251 |
(f isDirectory |
|
5252 |
and:[(aFileName ~= '..') and:[aFileName ~= '.']] |
|
5253 |
) ifTrue:[ |
|
5254 |
||
5255 |
"/ the following suffix cutOff is not really required, |
|
5256 |
"/ but makes the list look better on VMS ... |
|
5257 |
fileNameString := aFileName. |
|
5258 |
dirSuffix notNil ifTrue:[ |
|
5259 |
(aFileName asLowercase endsWith:dirSuffix) ifTrue:[ |
|
5260 |
fileNameString := aFileName copyWithoutLast:(dirSuffix size). |
|
5261 |
] |
|
5262 |
]. |
|
5263 |
fileNameString := fileNameString , ' ...' |
|
5264 |
] ifFalse:[ |
|
5265 |
fileNameString := aFileName. |
|
5266 |
OperatingSystem isVMSlike ifTrue:[ |
|
5267 |
(aFileName endsWith:'.') ifTrue:[ |
|
5268 |
aFileName ~= '..' ifTrue:[ |
|
5269 |
fileNameString := aFileName copyWithoutLast:1 |
|
5270 |
] |
|
5271 |
] |
|
5272 |
] |
|
5273 |
]. |
|
5274 |
||
5275 |
showingDetails value "showLongList" ifTrue:[ |
|
5276 |
len := fileNameString size. |
|
5277 |
(len > 20) ifTrue:[ |
|
5278 |
fileNameString := (fileNameString contractTo:20) |
|
5279 |
]. |
|
5280 |
]. |
|
5281 |
||
5282 |
entry colAt:1 put:(self iconForFile:aFileName). |
|
5283 |
entry colAt:2 put:fileNameString. |
|
5284 |
||
5285 |
"/fileListView at:lineIndex put:entry. |
|
5286 |
fileListView withoutRedrawAt:lineIndex put:entry. |
|
5287 |
fileListView invalidateLine:lineIndex. |
|
5288 |
||
5289 |
anyImages ifFalse:[ |
|
5290 |
(Image isImageFileSuffix:(aFileName asFilename suffix)) |
|
5291 |
ifTrue:[ |
|
5292 |
anyImages := true |
|
5293 |
] |
|
5294 |
]. |
|
5295 |
passDone at:lineIndex put:1 |
|
5296 |
] |
|
5297 |
]. |
|
5298 |
||
5299 |
(state endsWith:'Attributes') ifTrue:[ |
|
5300 |
"/ |
|
5301 |
"/ pass 2 - everything except fileType (which takes very long) |
|
5302 |
"/ |
|
5303 |
(passDone at:lineIndex) < 2 ifTrue:[ |
|
5304 |
info := f info. |
|
5305 |
info isNil ifTrue:[ |
|
5306 |
"not accessable - usually a symlink, |
|
5307 |
to a nonexisting/nonreadable file |
|
5308 |
" |
|
5309 |
f isSymbolicLink ifTrue:[ |
|
5310 |
p := f linkInfo path. |
|
5311 |
typeString := 'broken symbolic link to ' , p |
|
5312 |
] ifFalse:[ |
|
5313 |
typeString := 'unknown' |
|
5314 |
]. |
|
5315 |
] ifFalse:[ |
|
5316 |
typ := (info type). |
|
5317 |
||
5318 |
modeString := self getModeString:(info at:#mode) |
|
5319 |
with:#( '' $r $w $x |
|
5320 |
' ' $r $w $x |
|
5321 |
' ' $r $w $x ). |
|
5322 |
entry colAt:3 put:modeString. |
|
5323 |
||
5324 |
((info uid) ~~ prevUid) ifTrue:[ |
|
5325 |
prevUid := (info uid). |
|
5326 |
nameString := OperatingSystem getUserNameFromID:prevUid. |
|
5327 |
nameString := nameString contractTo:10. |
|
5328 |
nameString := nameString , (String new:(10 - nameString size)) |
|
5329 |
]. |
|
5330 |
nameString isNil ifTrue:[nameString := '???']. |
|
5331 |
entry colAt:4 put:nameString withoutSpaces. |
|
5332 |
||
5333 |
((info gid) ~~ prevGid) ifTrue:[ |
|
5334 |
prevGid := (info gid). |
|
5335 |
groupString := OperatingSystem getGroupNameFromID:prevGid. |
|
5336 |
groupString := groupString contractTo:10. |
|
5337 |
groupString := groupString , (String new:(10 - groupString size)) |
|
5338 |
]. |
|
5339 |
groupString isNil ifTrue:[groupString := '???']. |
|
5340 |
entry colAt:5 put:groupString withoutSpaces. |
|
5341 |
||
5342 |
(typ == #regular) ifTrue:[ |
|
5343 |
entry colAt:6 put:(self sizePrintString:(info size)). |
|
5344 |
]. |
|
5345 |
||
5346 |
f isSymbolicLink ifTrue:[ |
|
5347 |
p := f linkInfo path. |
|
5348 |
typeString := 'symbolic link to ' , p |
|
5349 |
] ifFalse:[ |
|
5350 |
typeString := typ asString |
|
5351 |
]. |
|
5352 |
]. |
|
5353 |
entry colAt:7 put:typeString. |
|
5354 |
||
5355 |
"/ fileListView at:lineIndex put:entry. |
|
5356 |
fileListView withoutRedrawAt:lineIndex put:entry. |
|
5357 |
fileListView invalidateLine:lineIndex. |
|
5358 |
passDone at:lineIndex put:2. |
|
5359 |
]. |
|
5360 |
]. |
|
5361 |
||
5362 |
(state endsWith:'Types') ifTrue:[ |
|
5363 |
"/ |
|
5364 |
"/ pass 3: add fileType |
|
5365 |
"/ |
|
5366 |
(passDone at:lineIndex) < 3 ifTrue:[ |
|
5367 |
info := f info. |
|
5368 |
info notNil ifTrue:[ |
|
5369 |
f isSymbolicLink ifFalse:[ |
|
5370 |
(Image isImageFileSuffix:(f suffix)) ifFalse:[ |
|
5371 |
typeString := f fileType. |
|
5372 |
||
5373 |
entry colAt:7 put:typeString. |
|
5374 |
"/ fileListView at:lineIndex put:entry |
|
5375 |
fileListView withoutRedrawAt:lineIndex put:entry. |
|
5376 |
fileListView invalidateLine:lineIndex. |
|
5377 |
]. |
|
5378 |
]. |
|
5379 |
]. |
|
5380 |
||
5381 |
passDone at:lineIndex put:3 |
|
5382 |
]. |
|
5383 |
]. |
|
5384 |
||
5385 |
(state endsWith:'Images') ifTrue:[ |
|
5386 |
"/ |
|
5387 |
"/ pass 4: read images |
|
5388 |
"/ |
|
5389 |
(passDone at:lineIndex) < 4 ifTrue:[ |
|
5390 |
(Image isImageFileSuffix:(f suffix)) ifTrue:[ |
|
5391 |
f isDirectory ifFalse:[ |
|
5392 |
img := Image fromFile:(f pathName). |
|
5393 |
img notNil ifTrue:[ |
|
5394 |
img := img magnifiedTo:16@16. |
|
5395 |
img := img on:self device. |
|
5396 |
entry colAt:7 put:img. |
|
5397 |
"/ fileListView at:lineIndex put:entry |
|
5398 |
fileListView withoutRedrawAt:lineIndex put:entry. |
|
5399 |
fileListView invalidateLine:lineIndex. |
|
5400 |
] |
|
5401 |
] |
|
5402 |
]. |
|
5403 |
passDone at:lineIndex put:4 |
|
5404 |
]. |
|
5405 |
]. |
|
5406 |
]. |
|
5407 |
||
5408 |
"/ |
|
5409 |
"/ advance to the next line |
|
5410 |
"/ |
|
5411 |
lineIndex := lineIndex + 1. |
|
5412 |
lineIndex > endIndex ifTrue:[ |
|
5413 |
"/ finished this round ... |
|
5414 |
"/ see what we are going for ... |
|
5415 |
numVisible := (fileListView lastLineShown - fileListView firstLineShown + 1). |
|
5416 |
||
5417 |
state := nextState at:state ifAbsent:nil. |
|
5418 |
||
5419 |
state isNil ifTrue:[ |
|
5420 |
done := true |
|
5421 |
] ifFalse:[ |
|
5422 |
(state startsWith:'visible') ifTrue:[ |
|
5423 |
lineIndex := fileListView firstLineShown. |
|
5424 |
endIndex := fileListView lastLineShown. |
|
5425 |
endIndex := endIndex min:(files size). |
|
5426 |
] ifFalse:[ |
|
5427 |
(state startsWith:'nextPage') ifTrue:[ |
|
5428 |
lineIndex := fileListView lastLineShown + 1. |
|
5429 |
endIndex := lineIndex + numVisible. |
|
5430 |
endIndex := endIndex min:(files size). |
|
5431 |
lineIndex := lineIndex min:(files size). |
|
5432 |
] ifFalse:[ |
|
5433 |
(state startsWith:'previousPage') ifTrue:[ |
|
5434 |
endIndex := fileListView firstLineShown - 1. |
|
5435 |
lineIndex := endIndex - numVisible. |
|
5436 |
lineIndex := lineIndex max:1. |
|
5437 |
endIndex := endIndex min:(files size). |
|
5438 |
endIndex := endIndex max:1. |
|
5439 |
] ifFalse:[ |
|
5440 |
"/ remaining |
|
5441 |
lineIndex := 1. |
|
5442 |
endIndex := files size. |
|
5443 |
] |
|
5444 |
] |
|
5445 |
] |
|
5446 |
] |
|
5447 |
] |
|
5448 |
]. |
|
5449 |
||
5450 |
listUpdateProcess := nil. |
|
5451 |
||
5452 |
] forkAt:(Processor activePriority - 1). |
|
5453 |
||
5454 |
" |
|
5455 |
install a new check after some time |
|
5456 |
" |
|
5457 |
Processor addTimedBlock:checkBlock afterSeconds:checkDelta |
|
36 | 5458 |
] |
142 | 5459 |
|
1487
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
5460 |
"Modified: / 21.9.1995 / 11:40:23 / claus" |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
5461 |
"Modified: / 28.4.1997 / 22:30:30 / dq" |
c8d32d8b039c
oops - dont sort a nil object
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
5462 |
"Modified: / 18.9.1997 / 18:28:30 / stefan" |
1834 | 5463 |
"Modified: / 14.8.1998 / 17:59:06 / cg" |
386
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
5464 |
! ! |
3fd24d9116b3
added encodings (experimental)
Claus Gittinger <cg@exept.de>
parents:
381
diff
changeset
|
5465 |
|
172 | 5466 |
!FileBrowser methodsFor:'queries'! |
73 | 5467 |
|
1700
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
5468 |
fileName |
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
5469 |
"return my current fileName - during fileIn, the file |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
5470 |
which is being loaded is returned. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
5471 |
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
|
5472 |
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
|
5473 |
|
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
5474 |
|f| |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
5475 |
|
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
5476 |
f := currentFileInFileName ? currentFileName. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
5477 |
f isNil ifTrue:[^ nil]. |
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
5478 |
^ self path asFilename construct:f |
1700
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
5479 |
|
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
5480 |
" |
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
5481 |
(FileBrowser openOnFileNamed:'Makefile') fileName |
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
5482 |
" |
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
5483 |
|
1702
962056a31c06
remember the current file during fileIn,
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
5484 |
"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
|
5485 |
! |
5067b3c4cafa
added access to fileName (kludge to fileIn RefactoryBrowser)
Claus Gittinger <cg@exept.de>
parents:
1689
diff
changeset
|
5486 |
|
172 | 5487 |
path |
5488 |
"return my currentDirectories pathName; |
|
1329 | 5489 |
sent from the pathField to aquire the pathname when I changed directory" |
5490 |
||
5491 |
"/ somewhat tricky: first ask it for the full pathName, |
|
5492 |
"/ then convert it to a directory name |
|
5493 |
"/ (which only makes a difference on VMS) |
|
5494 |
||
1828 | 5495 |
^ currentDirectory asFilename pathName "/ asFilename osNameForDirectory |
5496 |
||
5497 |
"Modified: / 12.8.1998 / 14:45:48 / cg" |
|
49 | 5498 |
! ! |
5499 |
||
763
94a8d188b52d
care for the nameSpace Query when loading binary classes
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
5500 |
!FileBrowser class methodsFor:'documentation'! |
203 | 5501 |
|
5502 |
version |
|
1920
adffddc8cfc2
added #copyFilename (to clipboard)
Claus Gittinger <cg@exept.de>
parents:
1912
diff
changeset
|
5503 |
^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.265 1998-10-09 14:18:26 cg Exp $' |
381 | 5504 |
! ! |