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