author | Claus Gittinger <cg@exept.de> |
Fri, 05 Aug 2005 11:34:33 +0200 | |
changeset 6373 | 16fb0a500e0d |
parent 6371 | b5dab61da244 |
child 6374 | f9bed8385350 |
permissions | -rw-r--r-- |
5140 | 1 |
" |
2 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
3892 | 13 |
"{ Package: 'stx:libtool' }" |
14 |
||
15 |
ApplicationModel subclass:#AbstractFileBrowser |
|
4959 | 16 |
instanceVariableNames:'aspects' |
17 |
classVariableNames:'DirectoryHistory RuntimeAspects DirectoryBookmarks |
|
18 |
LastEnforcedNameSpace CommandHistory DefaultCommandPerSuffix |
|
19 |
CommandHistorySize LastFileDiffFile DefaultFilters RootHolder |
|
5880 | 20 |
LastFileSelection LastMoveDestination LastScriptBlockString' |
4959 | 21 |
poolDictionaries:'' |
22 |
category:'Interface-Tools-File' |
|
3892 | 23 |
! |
24 |
||
25 |
AbstractFileBrowser class instanceVariableNames:'DisabledCursorImage EnabledCursorImage' |
|
26 |
||
27 |
" |
|
28 |
The following class instance variables are inherited by this class: |
|
29 |
||
4959 | 30 |
ApplicationModel - ClassResources |
31 |
Model - |
|
32 |
Object - |
|
3892 | 33 |
" |
34 |
! |
|
35 |
||
36 |
Object subclass:#Clipboard |
|
4959 | 37 |
instanceVariableNames:'method files' |
38 |
classVariableNames:'' |
|
39 |
poolDictionaries:'' |
|
40 |
privateIn:AbstractFileBrowser |
|
3892 | 41 |
! |
42 |
||
43 |
Object subclass:#CodeExecutionLock |
|
4959 | 44 |
instanceVariableNames:'locked' |
45 |
classVariableNames:'' |
|
46 |
poolDictionaries:'' |
|
47 |
privateIn:AbstractFileBrowser |
|
3892 | 48 |
! |
49 |
||
4366 | 50 |
List subclass:#DirectoryHistory |
4959 | 51 |
instanceVariableNames:'forwardList backList lastWasForwardPath lastBackPath lastAddPath |
6369 | 52 |
backForwardList backForwardIndex historySize' |
4959 | 53 |
classVariableNames:'HistorySize' |
54 |
poolDictionaries:'' |
|
55 |
privateIn:AbstractFileBrowser |
|
3952 | 56 |
! |
57 |
||
58 |
Object subclass:#DirectoryHistoryItem |
|
4959 | 59 |
instanceVariableNames:'path position' |
60 |
classVariableNames:'' |
|
61 |
poolDictionaries:'' |
|
62 |
privateIn:AbstractFileBrowser::DirectoryHistory |
|
3892 | 63 |
! |
64 |
||
65 |
OrderedSet subclass:#FilenameHistory |
|
4959 | 66 |
instanceVariableNames:'' |
67 |
classVariableNames:'' |
|
68 |
poolDictionaries:'' |
|
69 |
privateIn:AbstractFileBrowser |
|
3892 | 70 |
! |
71 |
||
72 |
Object subclass:#SaveAspectItem |
|
4959 | 73 |
instanceVariableNames:'value isHolder' |
74 |
classVariableNames:'' |
|
75 |
poolDictionaries:'' |
|
76 |
privateIn:AbstractFileBrowser |
|
3892 | 77 |
! |
78 |
||
5140 | 79 |
!AbstractFileBrowser class methodsFor:'documentation'! |
80 |
||
81 |
copyright |
|
82 |
" |
|
83 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
84 |
All Rights Reserved |
|
85 |
||
86 |
This software is furnished under a license and may be used |
|
87 |
only in accordance with the terms of that license and with the |
|
88 |
inclusion of the above copyright notice. This software may not |
|
89 |
be provided or otherwise made available to, or used by, any |
|
90 |
other person. No title to or ownership of the software is |
|
91 |
hereby transferred. |
|
92 |
" |
|
5967 | 93 |
! |
94 |
||
95 |
documentation |
|
96 |
" |
|
97 |
[Author:] |
|
98 |
Christian Penk |
|
99 |
" |
|
5140 | 100 |
! ! |
3892 | 101 |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
102 |
!AbstractFileBrowser class methodsFor:'accessing'! |
3952 | 103 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
104 |
currentSelection |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
105 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
106 |
LastFileSelection isNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
107 |
LastFileSelection := #(). |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
108 |
]. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
109 |
^ LastFileSelection |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
110 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
111 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
112 |
currentSelection:aFilenameCol |
5476 | 113 |
LastFileSelection := aFilenameCol collect:[:file | file asFilename] |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
114 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
115 |
|
3952 | 116 |
directoryHistory |
117 |
||
118 |
DirectoryHistory isNil ifTrue:[ |
|
4414 | 119 |
DirectoryHistory := self directoryHistoryClass new. |
3964 | 120 |
"/ DirectoryHistory inspect. |
3952 | 121 |
]. |
122 |
^ DirectoryHistory |
|
123 |
! |
|
124 |
||
125 |
resetClassVars |
|
126 |
DirectoryHistory := nil. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
127 |
LastFileSelection := nil. |
5936 | 128 |
|
129 |
" |
|
130 |
AbstractFileBrowser resetClassVars |
|
131 |
" |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
132 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
133 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
134 |
rootHolder |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
135 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
136 |
^ RootHolder |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
137 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
138 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
139 |
rootHolder:aRoot |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
140 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
141 |
RootHolder := aRoot |
3952 | 142 |
! ! |
143 |
||
4915 | 144 |
!AbstractFileBrowser class methodsFor:'accessing-bookmarks'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
145 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
146 |
addBookmark:aDirectoryPath |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
147 |
"add aDirectoryPath to the list of our known bookmarks. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
148 |
Do not add duplicates." |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
149 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
150 |
|bookmarks| |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
151 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
152 |
bookmarks := self directoryBookmarks. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
153 |
(bookmarks includes:aDirectoryPath) ifFalse:[ |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
154 |
bookmarks add:aDirectoryPath asFilename. |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
155 |
]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
156 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
157 |
|
4679 | 158 |
defaultBookMarksFileDirectory |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
159 |
^ Filename homeDirectory |
4679 | 160 |
! |
161 |
||
162 |
defaultBookMarksFilename |
|
163 |
^ '.fileBrowserBookmarks' |
|
164 |
! |
|
165 |
||
166 |
directoryBookmarks |
|
167 |
DirectoryBookmarks isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
168 |
self loadBookmarksFrom:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename). |
4679 | 169 |
|
170 |
DirectoryBookmarks isEmptyOrNil ifTrue:[ |
|
171 |
DirectoryBookmarks := OrderedCollection new. |
|
172 |
DirectoryBookmarks add:Filename homeDirectory asAbsoluteFilename. |
|
173 |
DirectoryBookmarks add:Filename currentDirectory asAbsoluteFilename. |
|
174 |
] |
|
175 |
]. |
|
176 |
^ DirectoryBookmarks |
|
177 |
||
178 |
" |
|
5438
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
179 |
DirectoryBookmarks := nil. |
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
180 |
self directoryBookmarks. |
4679 | 181 |
" |
182 |
! |
|
183 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
184 |
hasBookmarks |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
185 |
^ self directoryBookmarks notEmptyOrNil |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
186 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
187 |
|
4679 | 188 |
loadBookmarksFrom:aFileNameOrString |
189 |
|bookmarks s fileName| |
|
190 |
||
191 |
fileName := aFileNameOrString asFilename. |
|
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
192 |
[ |
5356
d08261ab1567
care for nonexisting bookmarks file in open
Claus Gittinger <cg@exept.de>
parents:
5334
diff
changeset
|
193 |
s := fileName readStream. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
194 |
] on:OpenError do:[:ex| |
4679 | 195 |
^ self. |
196 |
]. |
|
197 |
||
198 |
bookmarks := OrderedCollection new. |
|
199 |
[s atEnd] whileFalse:[ |
|
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
200 |
bookmarks add:(Base64Coder decode:s nextLine) asString. |
4679 | 201 |
]. |
202 |
s close. |
|
203 |
||
204 |
DirectoryBookmarks := OrderedCollection new. |
|
205 |
bookmarks do:[:eachPath | |
|
206 |
self addBookmark:eachPath asFilename |
|
207 |
]. |
|
208 |
! |
|
209 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
210 |
removeBookmark:aDirectoryPath |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
211 |
|bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
212 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
213 |
bookmarks := self directoryBookmarks. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
214 |
bookmarks isEmptyOrNil ifTrue:[ ^ self]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
215 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
216 |
bookmarks remove:aDirectoryPath ifAbsent:[]. |
4679 | 217 |
! |
218 |
||
219 |
saveBookmarks |
|
220 |
|fn| |
|
221 |
||
222 |
fn := Dialog |
|
223 |
requestFileName:'Save Bookmarks' |
|
224 |
default:(self defaultBookMarksFilename) |
|
225 |
fromDirectory:(self defaultBookMarksFileDirectory). |
|
226 |
fn isEmptyOrNil ifTrue:[^ self]. |
|
227 |
||
228 |
self saveBookmarksIn:fn |
|
229 |
! |
|
230 |
||
231 |
saveBookmarksIn:aFileNameOrString |
|
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
232 |
"save the bokmarks in aFileNameOrString. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
233 |
Use Base64 coding" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
234 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
235 |
|bookmarks bookmarkStream fileName coder| |
4679 | 236 |
|
237 |
bookmarks := self directoryBookmarks. |
|
238 |
||
239 |
fileName := aFileNameOrString asFilename. |
|
240 |
fileName exists ifTrue:[ |
|
241 |
fileName renameTo:(fileName withSuffix:'sav'). |
|
242 |
]. |
|
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
243 |
bookmarkStream := fileName writeStream. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
244 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
245 |
"save each bookmark in one line" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
246 |
coder := (Base64Coder on:bookmarkStream) lineLimit:nil. |
4679 | 247 |
bookmarks do:[:eachPath | |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
248 |
eachPath asFilename pathName acceptVisitor:coder. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
249 |
coder flush. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
250 |
bookmarkStream cr. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
251 |
]. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
252 |
bookmarkStream close. |
5960 | 253 |
! |
254 |
||
255 |
saveBookmarksInDefaultBookmarksFile |
|
256 |
self saveBookmarksIn:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename) |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
257 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
258 |
|
4915 | 259 |
!AbstractFileBrowser class methodsFor:'accessing-classes'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
260 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
261 |
directoryHistoryClass |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
262 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
263 |
^ AbstractFileBrowser::DirectoryHistory |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
264 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
265 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
266 |
filenameHistoryClass |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
267 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
268 |
^ FilenameHistory |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
269 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
270 |
|
3892 | 271 |
!AbstractFileBrowser class methodsFor:'defaults'! |
272 |
||
273 |
commandHistory |
|
274 |
||
275 |
CommandHistory isNil ifTrue:[ |
|
4414 | 276 |
CommandHistory := OrderedCollection new. |
3892 | 277 |
]. |
278 |
^ CommandHistory |
|
279 |
! |
|
280 |
||
281 |
commandHistorySize |
|
4190 | 282 |
"max no of entries in the HistoryList " |
6369 | 283 |
|
3892 | 284 |
CommandHistorySize isNil ifTrue:[ |
6369 | 285 |
CommandHistorySize := 150 |
3892 | 286 |
]. |
287 |
^ CommandHistorySize |
|
288 |
! |
|
289 |
||
290 |
defaultFilterList |
|
291 |
||
292 |
DefaultFilters isNil ifTrue:[ |
|
4414 | 293 |
DefaultFilters := #( '*' |
294 |
'*.st' |
|
295 |
'*.htm*' |
|
296 |
'*.txt' |
|
297 |
'*.gif' |
|
298 |
'*.xpm' |
|
299 |
'*.jpg' |
|
300 |
'*.[h,c]*' |
|
301 |
) |
|
3892 | 302 |
]. |
303 |
^ DefaultFilters. |
|
304 |
! |
|
305 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
306 |
initialCommandFor:fileName in:aDirectory intoBox:aBox |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
307 |
"set a useful initial command in an execute box." |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
308 |
|
4523 | 309 |
|mime cmd select path suffix baseName pathName| |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
310 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
311 |
path := aDirectory filenameFor:fileName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
312 |
baseName := path baseName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
313 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
314 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
315 |
mime := MIMETypes mimeTypeForSuffix:suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
316 |
"/ mime notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
317 |
"/ cmd := self initialCommandForMIME:mime file:path |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
318 |
"/ ]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
319 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
320 |
"/ XXX should be changed to take stuff from a config file |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
321 |
"/ XXX or from resources. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
322 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
323 |
(path type == #regular) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
324 |
path isExecutableProgram ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
325 |
aBox initialText:(path pathName , ' <arguments>'). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
326 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
327 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
328 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
329 |
select := true. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
330 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
331 |
"some heuristics - my personal preferences ... |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
332 |
(actually this should come from a configfile)" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
333 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
334 |
(baseName endsWith:'akefile') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
335 |
aBox initialText:'make target' selectFrom:6 to:11. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
336 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
337 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
338 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
339 |
cmd := MIMETypes defaultCommandPerMIME at:mime ifAbsent:nil. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
340 |
cmd notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
341 |
select := false |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
342 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
343 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
344 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
345 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
346 |
(suffix = 'C') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
347 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
348 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
349 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
350 |
suffix := suffix asLowercase. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
351 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
352 |
(suffix = 'taz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
353 |
aBox initialText:'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
354 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
355 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
356 |
(suffix = 'tar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
357 |
cmd := 'tar tvf %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
358 |
select := 7. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
359 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
360 |
(suffix = 'zoo') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
361 |
cmd := 'zoo -list %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
362 |
select := 9. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
363 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
364 |
(suffix = 'zip') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
365 |
cmd := 'unzip -l %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
366 |
select := 8. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
367 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
368 |
(suffix = 'jar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
369 |
cmd := 'unzip -l %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
370 |
select := 8. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
371 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
372 |
(suffix = 'z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
373 |
(baseName asLowercase endsWith:'tar.z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
374 |
cmd := 'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
375 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
376 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
377 |
cmd := 'uncompress %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
378 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
379 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
380 |
(suffix = 'gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
381 |
(baseName asLowercase endsWith:'tar.gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
382 |
cmd := ('gunzip < %1 | tar tvf -' ). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
383 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
384 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
385 |
cmd := 'gunzip %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
386 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
387 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
388 |
(suffix = 'html') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
389 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
390 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
391 |
(suffix = 'htm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
392 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
393 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
394 |
(suffix = 'uue') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
395 |
cmd := 'uudecode %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
396 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
397 |
(suffix = 'c') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
398 |
cmd := 'cc -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
399 |
select := 5. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
400 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
401 |
(suffix = 'cc') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
402 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
403 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
404 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
405 |
(suffix = 'xbm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
406 |
cmd := 'bitmap %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
407 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
408 |
(suffix = 'ps') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
409 |
cmd := 'ghostview %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
410 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
411 |
((suffix = '1') or:[suffix = 'man']) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
412 |
cmd := 'nroff -man %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
413 |
select := 10. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
414 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
415 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
416 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
417 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
418 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
419 |
DefaultCommandPerSuffix isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
420 |
cmd := '<cmd>' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
421 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
422 |
cmd := DefaultCommandPerSuffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
423 |
at:suffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
424 |
ifAbsent:'<cmd>'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
425 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
426 |
cmd := cmd , ' %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
427 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
428 |
|
4523 | 429 |
pathName := path pathName. |
430 |
OperatingSystem isUNIXlike ifTrue:[ |
|
431 |
pathName includesSeparator ifTrue:[ |
|
432 |
pathName := '"' , pathName , '"' |
|
433 |
] |
|
434 |
]. |
|
435 |
||
436 |
cmd := cmd bindWith:pathName. |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
437 |
select == false ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
438 |
aBox initialText:cmd |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
439 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
440 |
select class == Interval ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
441 |
aBox initialText:cmd selectFrom:select start to:select stop |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
442 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
443 |
select isInteger ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
444 |
select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
445 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
446 |
aBox initialText:cmd selectFrom:1 to:select |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
447 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
448 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
449 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
450 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
451 |
"Modified: / 24.9.1997 / 16:34:52 / stefan" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
452 |
"Modified: / 9.4.1998 / 17:15:57 / cg" |
3892 | 453 |
! |
454 |
||
5941 | 455 |
listOfRuntimeValuesToRemember |
456 |
" list of all aspects that will be remembered after closing a FileBrowserV2" |
|
457 |
||
458 |
^ #( |
|
459 |
"/ #filterModel |
|
460 |
#enableFileHistory |
|
461 |
#fileHistory |
|
462 |
#currentSortOrder |
|
463 |
#sortBlockProperty |
|
464 |
) |
|
3892 | 465 |
! |
466 |
||
467 |
resetAspects |
|
468 |
||
469 |
RuntimeAspects := nil. |
|
470 |
||
5941 | 471 |
" |
472 |
self resetAspects |
|
473 |
" |
|
3892 | 474 |
! |
475 |
||
476 |
runtimeAspects |
|
477 |
||
478 |
RuntimeAspects isNil ifTrue:[ |
|
4414 | 479 |
RuntimeAspects := Dictionary new. |
3892 | 480 |
]. |
481 |
^ RuntimeAspects |
|
482 |
! |
|
483 |
||
4201 | 484 |
userPreferencesAspectList |
485 |
||
486 |
" list of all aspects that will be saved with save settings |
|
487 |
that aspects will be image consistent if the settings are saved in Launcher |
|
488 |
dont forget to add a access methos in Userpreferences if you add a aspect here |
|
489 |
" |
|
490 |
||
491 |
^ #( |
|
492 |
#viewDirsInContentsBrowser |
|
493 |
#showDirectoryTree |
|
494 |
#showHiddenFiles |
|
495 |
#viewDescription |
|
496 |
#viewDetails |
|
497 |
#viewDirectoryDescription |
|
498 |
#viewFilesInDirectoryTree |
|
499 |
#viewGroup |
|
500 |
#viewOwner |
|
501 |
#viewPermissions |
|
502 |
#viewPreview |
|
503 |
#viewSize |
|
5312 | 504 |
#viewSizeInKiloBytes |
4974 | 505 |
#viewSizeInBytes |
4201 | 506 |
#viewTime |
507 |
#viewType |
|
508 |
#openMultipleApplicationsForType |
|
509 |
#filenameEntryFieldVisibleHolder |
|
510 |
#toolBarVisibleHolder |
|
511 |
#sortDirectoriesBeforeFiles |
|
512 |
#openAlwaysInTextEditor |
|
513 |
#sortCaseless |
|
514 |
) |
|
3892 | 515 |
! ! |
516 |
||
5398 | 517 |
!AbstractFileBrowser class methodsFor:'help specs'! |
518 |
||
6099 | 519 |
flyByHelpSpec |
520 |
<resource: #help> |
|
521 |
||
522 |
|spec hist resources| |
|
523 |
||
524 |
spec := super flyByHelpSpec addPairsFrom:#( |
|
525 |
||
6100 | 526 |
#closeTabButton |
527 |
'Close this Tab' |
|
528 |
||
6099 | 529 |
#addTerminal |
530 |
'Shell Terminal' |
|
531 |
||
532 |
#make |
|
533 |
'Make' |
|
534 |
||
535 |
#searchFile |
|
536 |
'Search a File' |
|
537 |
||
538 |
#directoryUp |
|
539 |
'Directory Up' |
|
540 |
||
541 |
#directoryBack |
|
542 |
'Directory Back' |
|
543 |
||
544 |
#directoryForward |
|
545 |
'Directory Forward' |
|
546 |
||
547 |
#directoryHistory |
|
548 |
'Directory' |
|
549 |
||
550 |
#copyFile |
|
6146 | 551 |
'Copy the Selected File(s)' |
6099 | 552 |
|
553 |
#cutFile |
|
6146 | 554 |
'Cut the Selected File(s)' |
6099 | 555 |
|
556 |
#editFile |
|
6146 | 557 |
'Edit the Selected File' |
6099 | 558 |
|
559 |
#fileHome |
|
560 |
'Goto Home Directory' |
|
561 |
||
562 |
#fileGotoDefault |
|
563 |
'Goto Default Directory (ST/X Start Directory)' |
|
564 |
||
565 |
#pasteFile |
|
566 |
'Paste File(s)' |
|
567 |
||
568 |
#deleteFile |
|
6146 | 569 |
'Delete the Selected File(s)' |
6099 | 570 |
|
571 |
#fileIn |
|
572 |
'File In' |
|
573 |
||
574 |
#fileHistory |
|
575 |
'File History' |
|
576 |
||
577 |
#fileGotoBookmark |
|
578 |
'Goto Bookmarked Directory' |
|
579 |
||
580 |
#hideToolBar |
|
581 |
'Hide Toolbar' |
|
582 |
||
583 |
#hideFilenameEntryField |
|
6307 | 584 |
'Hide Filename & Filter Fields' |
6099 | 585 |
|
586 |
#openChangeBrowser |
|
587 |
'Open a ChangeBrowser on File' |
|
588 |
||
589 |
#showFileDetails |
|
590 |
'Show File Details' |
|
591 |
||
592 |
#hideFileDetails |
|
593 |
'Hide File Details' |
|
594 |
||
595 |
#toggleDetails |
|
596 |
'Show/Hide File Details' |
|
597 |
||
598 |
#viewDetails |
|
599 |
'Show/Hide File Details' |
|
600 |
||
601 |
#selectDetails |
|
602 |
'Select File Details to be Shown' |
|
603 |
||
604 |
). |
|
605 |
||
606 |
hist := self directoryHistory. |
|
607 |
hist notNil ifTrue:[ |
|
608 |
resources := self classResources. |
|
609 |
hist canForward ifTrue:[ |
|
610 |
spec at:#directoryForward put:(resources string:'Forward to: %1' with:hist nextForwardItem). |
|
611 |
]. |
|
612 |
hist canBackward ifTrue:[ |
|
613 |
spec at:#directoryBack put:(resources string:'Back to: %1' with:hist nextBackwardItem). |
|
614 |
]. |
|
615 |
]. |
|
616 |
^ spec. |
|
617 |
||
618 |
" |
|
619 |
self flyByHelpSpec |
|
620 |
" |
|
621 |
||
622 |
"Modified: / 16-03-2004 / 15:24:18 / cg" |
|
623 |
! |
|
624 |
||
5398 | 625 |
helpSpec |
626 |
"This resource specification was automatically generated |
|
627 |
by the UIHelpTool of ST/X." |
|
628 |
||
629 |
"Do not manually edit this!! If it is corrupted, |
|
630 |
the UIHelpTool may not be able to read the specification." |
|
631 |
||
632 |
" |
|
633 |
UIHelpTool openOnClass:AbstractFileBrowser |
|
634 |
" |
|
635 |
||
636 |
<resource: #help> |
|
637 |
||
638 |
^ super helpSpec addPairsFrom:#( |
|
639 |
||
5737 | 640 |
#lockFileEncoding |
641 |
'Do not guess the encoding from the files contents.' |
|
642 |
||
5398 | 643 |
) |
644 |
! ! |
|
645 |
||
3892 | 646 |
!AbstractFileBrowser class methodsFor:'image'! |
647 |
||
6337 | 648 |
disabledCursorIcon |
649 |
"This resource specification was automatically generated |
|
650 |
by the ImageEditor of ST/X." |
|
651 |
||
652 |
"Do not manually edit this!! If it is corrupted, |
|
653 |
the ImageEditor may not be able to read the specification." |
|
654 |
||
655 |
" |
|
656 |
self disabledCursorImage inspect |
|
657 |
ImageEditor openOnClass:self andSelector:#disabledCursorImage |
|
658 |
Icon flushCachedIcons |
|
659 |
" |
|
660 |
||
661 |
<resource: #image> |
|
662 |
||
663 |
^Icon |
|
664 |
constantNamed:#'AbstractFileBrowser class disabledCursorImage' |
|
665 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
666 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@XF@@@H@P@@DOB@@BLLP@AA@"@@RHD @H1AD@BRHI@@$QBP@IBH$@BPQI@@"BLP@D QH@ADBB@@H0Q@@AC |
|
667 |
8 @@H@P@@A X@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
668 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@_>@@@O?0@@G?>@@C<O0@A?@>@@_8G @O?A<@C38O@@<_C0@OC8<@C0_O@@>C?0@G _8@A<C>@@O0_@@A? |
|
669 |
? @@O?0@@A?8@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
670 |
! |
|
671 |
||
4337
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
672 |
disabledCursorImage |
6337 | 673 |
"/ DisabledCursorImage isNil ifTrue:[ |
674 |
"/ DisabledCursorImage := self disabledCursorIcon. "/ Image fromFile:'xpmBitmaps/cursors/no_entry.xpm' |
|
675 |
"/ ]. |
|
3892 | 676 |
^ DisabledCursorImage |
677 |
! |
|
678 |
||
6337 | 679 |
enabledCursorIcon |
680 |
"This resource specification was automatically generated |
|
681 |
by the ImageEditor of ST/X." |
|
682 |
||
683 |
"Do not manually edit this!! If it is corrupted, |
|
684 |
the ImageEditor may not be able to read the specification." |
|
685 |
||
686 |
" |
|
687 |
self enabledCursorImage inspect |
|
688 |
ImageEditor openOnClass:self andSelector:#enabledCursorImage |
|
689 |
Icon flushCachedIcons |
|
690 |
" |
|
691 |
||
692 |
<resource: #image> |
|
693 |
||
694 |
^Icon |
|
695 |
constantNamed:#'AbstractFileBrowser class enabledCursorImage' |
|
696 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
697 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@@@@@?0_0@@@@@@C?A?@@@@@@@@AP@@@@T@@@@E@@@@A |
|
698 |
P@@@@T@@@@E@@@@AP@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
699 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@?8?0@O>O<@C?#?@@@G@@@@A0@@@@\@@@@G@@@@A |
|
700 |
0@@@@\@@@@G@@@@A0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
701 |
! |
|
702 |
||
4337
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
703 |
enabledCursorImage |
6337 | 704 |
"/ EnabledCursorImage isNil ifTrue:[ |
705 |
"/ EnabledCursorImage := self enabledCursorIcon. "/ Image fromFile:'xpmBitmaps/cursors/double_crossHair.xpm' |
|
706 |
"/ ]. |
|
3892 | 707 |
^ EnabledCursorImage |
708 |
! ! |
|
709 |
||
710 |
!AbstractFileBrowser class methodsFor:'image specs'! |
|
711 |
||
712 |
clearHistoryIcon |
|
6074 | 713 |
<resource: #programImage> |
714 |
||
3892 | 715 |
^ Icon deleteIcon |
716 |
! |
|
717 |
||
718 |
copyIcon |
|
719 |
<resource: #programImage> |
|
720 |
||
6093 | 721 |
^ ToolbarIconLibrary copyIcon |
3892 | 722 |
! |
723 |
||
724 |
cutIcon |
|
725 |
<resource: #programImage> |
|
726 |
||
727 |
^ ToolbarIconLibrary cut20x20Icon2 "cut28x28Icon" |
|
728 |
! |
|
729 |
||
730 |
deleteIcon |
|
731 |
<resource: #programImage> |
|
732 |
||
733 |
^ ToolbarIconLibrary erase20x20Icon "/ delete28x28Icon |
|
734 |
! |
|
735 |
||
6083 | 736 |
directoryUpIcon |
737 |
<resource: #programImage> |
|
738 |
||
739 |
^ ToolbarIconLibrary directoryUpIcon |
|
740 |
! |
|
741 |
||
3892 | 742 |
fileInIcon |
743 |
<resource: #programImage> |
|
744 |
||
6116 | 745 |
^ ToolbarIconLibrary fileInIcon |
3892 | 746 |
! |
747 |
||
6079 | 748 |
historyBackIcon |
749 |
<resource: #programImage> |
|
750 |
||
751 |
^ ToolbarIconLibrary historyBackIcon |
|
752 |
! |
|
753 |
||
754 |
historyForwardIcon |
|
755 |
<resource: #programImage> |
|
756 |
||
757 |
^ ToolbarIconLibrary historyForwardIcon |
|
758 |
! |
|
759 |
||
3892 | 760 |
homeIcon |
761 |
<resource: #programImage> |
|
762 |
||
6079 | 763 |
^ ToolbarIconLibrary homeIcon |
3892 | 764 |
! |
765 |
||
6074 | 766 |
homeIcon2 |
6079 | 767 |
<resource: #programImage> |
768 |
||
769 |
^ ToolbarIconLibrary homeIcon2 |
|
6074 | 770 |
! |
771 |
||
772 |
htmlReloadIcon |
|
773 |
<resource: #programImage> |
|
774 |
||
775 |
^ ToolbarIconLibrary reload22x22Icon |
|
776 |
! |
|
777 |
||
3892 | 778 |
leftDownIcon |
779 |
"This resource specification was automatically generated |
|
780 |
by the ImageEditor of ST/X." |
|
781 |
||
782 |
"Do not manually edit this!! If it is corrupted, |
|
783 |
the ImageEditor may not be able to read the specification." |
|
784 |
||
785 |
" |
|
786 |
self leftDownIcon inspect |
|
787 |
ImageEditor openOnClass:self andSelector:#leftDownIcon |
|
788 |
" |
|
789 |
||
790 |
<resource: #image> |
|
791 |
||
792 |
^Icon |
|
4414 | 793 |
constantNamed:#'AbstractFileBrowser class leftDownIcon' |
794 |
ifAbsentPut:[(Depth2Image new) width: 28; height: 28; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
3892 | 795 |
UUUUUUUUUUUPAUUUUUUUP@UUUUUUUPB!!UUUUUU@B*AUUUUU@B*(UUUUUPB** UUUUPB***AUUUTB***(EUUUB****%UUUR*****UUUUU@*%UUUUUUPJ)UUUU |
796 |
UUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*$@@@@AUPJ*****)UTB******UU@******%UPJ*****)UTAUUUU |
|
797 |
UUUU@@@@@@@AUUUUUUUUUP@a') ; colorMapFromArray:#[255 255 255 0 0 0 40 40 100 255 0 0]; mask:((Depth1Image new) width: 28; height: 28; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
798 |
@@@@@@@@@@@@ @@@@\@@@@O @@@G<@@@C? @@A?<@@@?? @@_?<@@G?? @@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C??? @???8@O? |
|
799 |
?>@C??? @???8@O??>@@@@@@@@@@@@@a') ; yourself); yourself] |
|
800 |
! |
|
801 |
||
802 |
menuHistoryList9x20Icon |
|
803 |
"This resource specification was automatically generated |
|
804 |
by the ImageEditor of ST/X." |
|
805 |
||
806 |
"Do not manually edit this!! If it is corrupted, |
|
807 |
the ImageEditor may not be able to read the specification." |
|
808 |
||
809 |
" |
|
810 |
self menuHistoryList9x20Icon inspect |
|
811 |
ImageEditor openOnClass:self andSelector:#menuHistoryList9x20Icon |
|
812 |
Icon flushCachedIcons |
|
813 |
" |
|
814 |
||
815 |
<resource: #image> |
|
816 |
||
817 |
^Icon |
|
4414 | 818 |
constantNamed:#'AbstractFileBrowser class menuHistoryList9x20Icon' |
819 |
ifAbsentPut:[(Depth1Image new) width: 9; height: 20; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a') ; colorMapFromArray:#[255 255 255 0 0 0]; mask:((Depth1Image new) width: 9; height: 20; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a') ; yourself); yourself] |
|
3892 | 820 |
! |
821 |
||
822 |
menuHistoryListIcon |
|
823 |
"This resource specification was automatically generated |
|
824 |
by the ImageEditor of ST/X." |
|
825 |
||
826 |
"Do not manually edit this!! If it is corrupted, |
|
827 |
the ImageEditor may not be able to read the specification." |
|
828 |
||
829 |
" |
|
830 |
self menuHistoryListIcon inspect |
|
831 |
ImageEditor openOnClass:self andSelector:#menuHistoryListIcon |
|
832 |
" |
|
833 |
||
834 |
<resource: #image> |
|
835 |
||
836 |
^Icon |
|
4414 | 837 |
constantNamed:#'AbstractFileBrowser class menuHistoryListIcon' |
838 |
ifAbsentPut:[(Depth1Image new) width: 12; height: 12; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??S?<O?0??C?<O?0??/?=_?0??C?<O?0') ; colorMapFromArray:#[255 255 255 0 0 0]; mask:((Depth1Image new) width: 12; height: 12; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@O@@<@C0A?8C?@G8@O@@X@@@A?8@@@') ; yourself); yourself] |
|
3892 | 839 |
! |
840 |
||
6087 | 841 |
newDirectoryIcon |
6074 | 842 |
<resource: #programImage> |
843 |
||
6087 | 844 |
^ ToolbarIconLibrary newDirectoryIcon |
3923 | 845 |
! |
846 |
||
6091 | 847 |
removeTabIcon |
848 |
<resource: #programImage> |
|
849 |
||
850 |
^ ToolbarIconLibrary removeTabIcon |
|
851 |
! |
|
852 |
||
3892 | 853 |
vt100Terminal |
854 |
<resource: #programImage> |
|
855 |
||
856 |
^ ToolbarIconLibrary shell20x20Icon |
|
857 |
! ! |
|
858 |
||
5528 | 859 |
!AbstractFileBrowser class methodsFor:'interface specs'! |
860 |
||
861 |
encodingDialogSpec |
|
862 |
"This resource specification was automatically generated |
|
863 |
by the UIPainter of ST/X." |
|
864 |
||
865 |
"Do not manually edit this!! If it is corrupted, |
|
866 |
the UIPainter may not be able to read the specification." |
|
867 |
||
868 |
" |
|
869 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#encodingDialogSpec |
|
870 |
AbstractFileBrowser new openInterface:#encodingDialogSpec |
|
871 |
" |
|
872 |
||
873 |
<resource: #canvas> |
|
874 |
||
875 |
^ |
|
876 |
#(FullSpec |
|
877 |
name: encodingDialogSpec |
|
878 |
window: |
|
879 |
(WindowSpec |
|
880 |
label: 'File Encoding' |
|
881 |
name: 'File Encoding' |
|
882 |
min: (Point 10 10) |
|
5626 | 883 |
bounds: (Rectangle 0 0 379 590) |
5528 | 884 |
) |
885 |
component: |
|
886 |
(SpecCollection |
|
887 |
collection: ( |
|
888 |
(LabelSpec |
|
6339 | 889 |
label: 'Select the External (File-) Encoding' |
6236 | 890 |
name: 'Label1' |
5528 | 891 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
892 |
translateLabel: true |
|
893 |
adjust: left |
|
894 |
) |
|
895 |
(DataSetSpec |
|
896 |
name: 'Table1' |
|
5737 | 897 |
layout: (LayoutFrame 0 0 30 0 0 1 -60 1) |
5528 | 898 |
model: selectedEncoding |
899 |
hasHorizontalScrollBar: true |
|
900 |
hasVerticalScrollBar: true |
|
901 |
dataList: encodingList |
|
902 |
has3Dsepartors: true |
|
903 |
has3Dseparators: true |
|
904 |
columns: |
|
905 |
(OrderedCollection |
|
906 |
||
907 |
(DataSetColumnSpec |
|
908 |
label: 'Encoding' |
|
909 |
translateLabel: true |
|
910 |
labelButtonType: Button |
|
911 |
model: at: |
|
912 |
canSelect: false |
|
913 |
isResizeable: false |
|
914 |
showRowSeparator: false |
|
915 |
showColSeparator: false |
|
916 |
) |
|
917 |
(DataSetColumnSpec |
|
918 |
label: 'Description' |
|
919 |
translateLabel: true |
|
920 |
labelButtonType: Button |
|
921 |
model: at: |
|
922 |
canSelect: false |
|
923 |
isResizeable: false |
|
924 |
showRowSeparator: false |
|
925 |
showColSeparator: false |
|
926 |
) |
|
927 |
) |
|
5626 | 928 |
doubleClickChannel: accept |
5528 | 929 |
) |
930 |
(HorizontalPanelViewSpec |
|
5737 | 931 |
name: 'ButtonPanel' |
5528 | 932 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
933 |
horizontalLayout: fitSpace |
|
934 |
verticalLayout: center |
|
935 |
horizontalSpace: 3 |
|
936 |
verticalSpace: 3 |
|
937 |
reverseOrderIfOKAtLeft: true |
|
938 |
component: |
|
939 |
(SpecCollection |
|
940 |
collection: ( |
|
941 |
(ActionButtonSpec |
|
942 |
label: 'Cancel' |
|
943 |
name: 'Button2' |
|
944 |
translateLabel: true |
|
945 |
model: cancel |
|
5737 | 946 |
extent: (Point 185 22) |
5528 | 947 |
) |
948 |
(ActionButtonSpec |
|
949 |
label: 'OK' |
|
950 |
name: 'Button1' |
|
951 |
translateLabel: true |
|
952 |
model: accept |
|
953 |
isDefault: true |
|
5737 | 954 |
extent: (Point 185 22) |
5528 | 955 |
) |
956 |
) |
|
957 |
||
958 |
) |
|
959 |
) |
|
5737 | 960 |
(CheckBoxSpec |
961 |
label: 'Lock Encoding' |
|
962 |
name: 'LockEncodingCheckBox' |
|
963 |
layout: (LayoutFrame 3 0 -60 1 217 0 -30 1) |
|
964 |
activeHelpKey: lockFileEncoding |
|
965 |
model: lockFileEncoding |
|
966 |
translateLabel: true |
|
967 |
) |
|
5528 | 968 |
) |
969 |
||
970 |
) |
|
971 |
) |
|
972 |
! ! |
|
973 |
||
3892 | 974 |
!AbstractFileBrowser class methodsFor:'menu specs'! |
975 |
||
976 |
baseBookmarksMenuSpec |
|
977 |
"This resource specification was automatically generated |
|
978 |
by the MenuEditor of ST/X." |
|
979 |
||
980 |
"Do not manually edit this!! If it is corrupted, |
|
981 |
the MenuEditor may not be able to read the specification." |
|
982 |
||
983 |
" |
|
984 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec |
|
985 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec)) startUp |
|
986 |
" |
|
987 |
||
988 |
<resource: #menu> |
|
989 |
||
990 |
^ |
|
991 |
#(#Menu |
|
4414 | 992 |
#( |
993 |
#(#MenuItem |
|
994 |
#label: 'Add Bookmark' |
|
995 |
#translateLabel: true |
|
996 |
#value: #addBookmark |
|
997 |
#enabled: #currentFilesHasDirectories |
|
998 |
) |
|
999 |
#(#MenuItem |
|
1000 |
#label: 'Remove Bookmark' |
|
1001 |
#translateLabel: true |
|
1002 |
#value: #removeBookmark |
|
1003 |
#enabled: #hasBookmarksToRemove |
|
1004 |
) |
|
4679 | 1005 |
#(#MenuItem |
1006 |
#label: 'Save Bookmarks In...' |
|
1007 |
#translateLabel: true |
|
1008 |
#value: #saveBookmarks |
|
1009 |
) |
|
4414 | 1010 |
) |
1011 |
nil |
|
1012 |
nil |
|
3892 | 1013 |
) |
1014 |
! |
|
1015 |
||
6102 | 1016 |
baseBookmarksMenuSpec2 |
1017 |
"This resource specification was automatically generated |
|
1018 |
by the MenuEditor of ST/X." |
|
1019 |
||
1020 |
"Do not manually edit this!! If it is corrupted, |
|
1021 |
the MenuEditor may not be able to read the specification." |
|
1022 |
||
1023 |
" |
|
1024 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec |
|
1025 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec)) startUp |
|
1026 |
" |
|
1027 |
||
1028 |
<resource: #menu> |
|
1029 |
||
1030 |
^ |
|
1031 |
#(#Menu |
|
1032 |
#( |
|
1033 |
#(#MenuItem |
|
1034 |
#label: 'Add Bookmark' |
|
1035 |
#translateLabel: true |
|
1036 |
#value: #addBookmark |
|
1037 |
#enabled: #currentFilesHasDirectories |
|
1038 |
) |
|
1039 |
) |
|
1040 |
nil |
|
1041 |
nil |
|
1042 |
) |
|
1043 |
! |
|
1044 |
||
4110 | 1045 |
browserMenu |
1046 |
"This resource specification was automatically generated |
|
1047 |
by the MenuEditor of ST/X." |
|
1048 |
||
1049 |
"Do not manually edit this!! If it is corrupted, |
|
1050 |
the MenuEditor may not be able to read the specification." |
|
1051 |
||
1052 |
" |
|
1053 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#browserMenu |
|
1054 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser browserMenu)) startUp |
|
1055 |
" |
|
1056 |
||
1057 |
<resource: #menu> |
|
1058 |
||
1059 |
^ |
|
5273 | 1060 |
#(Menu |
1061 |
( |
|
1062 |
(MenuItem |
|
1063 |
label: 'Spawn' |
|
1064 |
itemValue: doSpawn |
|
1065 |
translateLabel: true |
|
5962
ed6a7de8cc91
Add accelerators: Ctrl-t for new tab and Ctrl-n for new window
Stefan Vogel <sv@exept.de>
parents:
5961
diff
changeset
|
1066 |
shortcutKey: Ctrln |
4201 | 1067 |
) |
5273 | 1068 |
(MenuItem |
1069 |
label: '-' |
|
4201 | 1070 |
) |
5273 | 1071 |
(MenuItem |
6335 | 1072 |
label: 'Add Text Editor Page' |
5273 | 1073 |
itemValue: newTextEditor |
1074 |
translateLabel: true |
|
5963
57ae5e061db8
Accelerator Ctrl-t for new text editor
Stefan Vogel <sv@exept.de>
parents:
5962
diff
changeset
|
1075 |
shortcutKey: Ctrlt |
4392 | 1076 |
) |
5273 | 1077 |
(MenuItem |
6335 | 1078 |
label: 'Add Shell Terminal Page' |
5273 | 1079 |
itemValue: doAddTerminal |
1080 |
translateLabel: true |
|
4201 | 1081 |
) |
5273 | 1082 |
(MenuItem |
6335 | 1083 |
label: 'Add Search Page' |
5273 | 1084 |
itemValue: doOpenSearchFile |
1085 |
translateLabel: true |
|
4201 | 1086 |
) |
5273 | 1087 |
(MenuItem |
1088 |
label: '-' |
|
4201 | 1089 |
) |
5273 | 1090 |
(MenuItem |
1091 |
label: 'Settings...' |
|
1092 |
itemValue: doOpenSettings |
|
1093 |
translateLabel: true |
|
5104 | 1094 |
) |
5273 | 1095 |
(MenuItem |
5528 | 1096 |
label: 'Encoding...' |
1097 |
itemValue: fileEncodingDialog |
|
1098 |
translateLabel: true |
|
1099 |
) |
|
1100 |
(MenuItem |
|
5273 | 1101 |
label: '-' |
5104 | 1102 |
) |
5273 | 1103 |
(MenuItem |
1104 |
label: 'Exit' |
|
1105 |
itemValue: closeRequest |
|
1106 |
translateLabel: true |
|
4201 | 1107 |
) |
1108 |
) |
|
1109 |
nil |
|
1110 |
nil |
|
4110 | 1111 |
) |
5962
ed6a7de8cc91
Add accelerators: Ctrl-t for new tab and Ctrl-n for new window
Stefan Vogel <sv@exept.de>
parents:
5961
diff
changeset
|
1112 |
|
5963
57ae5e061db8
Accelerator Ctrl-t for new text editor
Stefan Vogel <sv@exept.de>
parents:
5962
diff
changeset
|
1113 |
"Modified: / 03-08-2004 / 19:46:50 / stefan" |
4110 | 1114 |
! |
1115 |
||
4107 | 1116 |
cvsMenu |
1117 |
"This resource specification was automatically generated |
|
1118 |
by the MenuEditor of ST/X." |
|
1119 |
||
1120 |
"Do not manually edit this!! If it is corrupted, |
|
1121 |
the MenuEditor may not be able to read the specification." |
|
1122 |
||
1123 |
" |
|
1124 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#cvsMenu |
|
1125 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser cvsMenu)) startUp |
|
1126 |
" |
|
1127 |
||
1128 |
<resource: #menu> |
|
1129 |
||
1130 |
^ |
|
1131 |
#(#Menu |
|
4414 | 1132 |
#( |
1133 |
#(#MenuItem |
|
1134 |
#label: 'Commit...' |
|
1135 |
#itemValue: #cvsCommit |
|
1136 |
#translateLabel: true |
|
1137 |
) |
|
1138 |
#(#MenuItem |
|
1139 |
#enabled: #canCvsAddAndCommit |
|
1140 |
#label: 'Add && Commit...' |
|
1141 |
#itemValue: #cvsAddAndCommit |
|
1142 |
#translateLabel: true |
|
1143 |
) |
|
1144 |
#(#MenuItem |
|
4849 | 1145 |
#enabled: #canCvsAddAndCommit |
1146 |
#label: 'Add as Binary && Commit...' |
|
1147 |
#itemValue: #cvsAddBinaryAndCommit |
|
1148 |
#translateLabel: true |
|
1149 |
) |
|
1150 |
#(#MenuItem |
|
4414 | 1151 |
#label: '-' |
1152 |
) |
|
1153 |
#(#MenuItem |
|
6316 | 1154 |
#enabled: #hasSelection |
1155 |
#label: 'Update selected Files/Directories' |
|
1156 |
#itemValue: #cvsUpdateSelection |
|
1157 |
#translateLabel: true |
|
1158 |
) |
|
1159 |
#(#MenuItem |
|
1160 |
#label: 'Update Directory Local' |
|
1161 |
#itemValue: #cvsUpdateAll |
|
1162 |
#translateLabel: true |
|
1163 |
) |
|
1164 |
#(#MenuItem |
|
1165 |
#label: 'Update Directory Recursive' |
|
1166 |
#itemValue: #cvsUpdateAllRecursive |
|
1167 |
#translateLabel: true |
|
1168 |
) |
|
1169 |
#(#MenuItem |
|
1170 |
#label: '-' |
|
1171 |
) |
|
1172 |
#(#MenuItem |
|
4414 | 1173 |
#enabled: #canRemoveCVSContainer |
1174 |
#label: 'Remove File && CVS Container...' |
|
1175 |
#itemValue: #cvsRemoveFileAndCVSContainer |
|
1176 |
#translateLabel: true |
|
1177 |
) |
|
1178 |
) |
|
1179 |
nil |
|
1180 |
nil |
|
4107 | 1181 |
) |
1182 |
! |
|
1183 |
||
3892 | 1184 |
directoryMenu |
1185 |
"This resource specification was automatically generated |
|
1186 |
by the MenuEditor of ST/X." |
|
1187 |
||
1188 |
"Do not manually edit this!! If it is corrupted, |
|
1189 |
the MenuEditor may not be able to read the specification." |
|
1190 |
||
1191 |
" |
|
1192 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#directoryMenu |
|
1193 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser directoryMenu)) startUp |
|
1194 |
" |
|
1195 |
||
1196 |
<resource: #menu> |
|
1197 |
||
1198 |
^ |
|
6220 | 1199 |
#(Menu |
1200 |
( |
|
1201 |
(MenuItem |
|
1202 |
label: 'Up' |
|
1203 |
itemValue: doGoDirectoryUp |
|
1204 |
translateLabel: true |
|
4414 | 1205 |
) |
6220 | 1206 |
(MenuItem |
1207 |
label: '-' |
|
4414 | 1208 |
) |
6220 | 1209 |
(MenuItem |
1210 |
activeHelpKey: directoryBack |
|
1211 |
enabled: enableBack |
|
1212 |
label: 'Back' |
|
1213 |
itemValue: doBack |
|
1214 |
translateLabel: true |
|
4414 | 1215 |
) |
6220 | 1216 |
(MenuItem |
1217 |
activeHelpKey: directoryBack |
|
1218 |
enabled: enableForward |
|
1219 |
label: 'Forward' |
|
1220 |
itemValue: doForward |
|
1221 |
translateLabel: true |
|
4414 | 1222 |
) |
6220 | 1223 |
(MenuItem |
1224 |
label: '-' |
|
4414 | 1225 |
) |
6220 | 1226 |
(MenuItem |
1227 |
label: 'Default Directory' |
|
1228 |
itemValue: doGotoDefaultDirectory |
|
1229 |
translateLabel: true |
|
4414 | 1230 |
) |
6220 | 1231 |
(MenuItem |
1232 |
label: 'Home Directory' |
|
1233 |
itemValue: doGotoHomeDirectory |
|
1234 |
translateLabel: true |
|
4414 | 1235 |
) |
6220 | 1236 |
(MenuItem |
1237 |
label: 'Bookmarks' |
|
1238 |
translateLabel: true |
|
1239 |
submenuChannel: bookmarksMenuSpec |
|
4414 | 1240 |
) |
6220 | 1241 |
(MenuItem |
1242 |
label: 'Visited Directories' |
|
1243 |
translateLabel: true |
|
1244 |
submenuChannel: visitedDirectoriesMenu |
|
4414 | 1245 |
) |
1246 |
) |
|
1247 |
nil |
|
1248 |
nil |
|
3892 | 1249 |
) |
1250 |
! |
|
1251 |
||
1252 |
editMenu |
|
1253 |
"This resource specification was automatically generated |
|
1254 |
by the MenuEditor of ST/X." |
|
1255 |
||
1256 |
"Do not manually edit this!! If it is corrupted, |
|
1257 |
the MenuEditor may not be able to read the specification." |
|
1258 |
||
1259 |
" |
|
1260 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#editMenu |
|
1261 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser editMenu)) startUp |
|
1262 |
" |
|
1263 |
||
1264 |
<resource: #menu> |
|
1265 |
||
1266 |
^ |
|
5888 | 1267 |
#(Menu |
1268 |
( |
|
1269 |
(MenuItem |
|
1270 |
enabled: hasFileSelection |
|
1271 |
label: 'Copy Selected Filenames to Clipboard' |
|
1272 |
itemValue: copySelectedFilenames |
|
1273 |
translateLabel: true |
|
4414 | 1274 |
) |
5888 | 1275 |
(MenuItem |
1276 |
enabled: fileListIsNotEmpty |
|
1277 |
label: 'Copy All Filenames to Clipboard' |
|
1278 |
itemValue: copyFileList |
|
1279 |
translateLabel: true |
|
4940
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
1280 |
) |
5888 | 1281 |
(MenuItem |
1282 |
label: '-' |
|
4940
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
1283 |
) |
5888 | 1284 |
(MenuItem |
1285 |
label: 'Settings...' |
|
1286 |
itemValue: openSettingsDialog |
|
1287 |
translateLabel: true |
|
4414 | 1288 |
) |
1289 |
) |
|
1290 |
nil |
|
1291 |
nil |
|
3892 | 1292 |
) |
1293 |
! |
|
1294 |
||
6099 | 1295 |
emptyMenuSpec |
1296 |
"This resource specification was automatically generated |
|
1297 |
by the MenuEditor of ST/X." |
|
1298 |
||
1299 |
"Do not manually edit this!! If it is corrupted, |
|
1300 |
the MenuEditor may not be able to read the specification." |
|
1301 |
||
1302 |
" |
|
1303 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#emptyMenuSpec |
|
1304 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser emptyMenuSpec)) startUp |
|
1305 |
" |
|
1306 |
||
1307 |
<resource: #menu> |
|
1308 |
||
1309 |
^ |
|
1310 |
#(#Menu |
|
1311 |
#( |
|
1312 |
) |
|
1313 |
nil |
|
1314 |
nil |
|
1315 |
) |
|
1316 |
! |
|
1317 |
||
3892 | 1318 |
fileMenu |
1319 |
"This resource specification was automatically generated |
|
1320 |
by the MenuEditor of ST/X." |
|
1321 |
||
1322 |
"Do not manually edit this!! If it is corrupted, |
|
1323 |
the MenuEditor may not be able to read the specification." |
|
1324 |
||
1325 |
" |
|
1326 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileMenu |
|
1327 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileMenu)) startUp |
|
1328 |
" |
|
1329 |
||
1330 |
<resource: #menu> |
|
1331 |
||
1332 |
^ |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1333 |
#(Menu |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1334 |
( |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1335 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1336 |
label: 'New' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1337 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1338 |
submenuChannel: newMenu |
5425 | 1339 |
keepLinkedMenu: true |
4414 | 1340 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1341 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1342 |
label: '-' |
4534 | 1343 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1344 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1345 |
enabled: hasSelection |
5945 | 1346 |
label: 'Cut' |
1347 |
itemValue: cutFiles |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1348 |
translateLabel: true |
4789
238d5e783f5c
editMenu was really a file menu
Claus Gittinger <cg@exept.de>
parents:
4785
diff
changeset
|
1349 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1350 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1351 |
enabled: hasSelection |
5945 | 1352 |
label: 'Copy' |
1353 |
itemValue: copyFiles |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1354 |
translateLabel: true |
4789
238d5e783f5c
editMenu was really a file menu
Claus Gittinger <cg@exept.de>
parents:
4785
diff
changeset
|
1355 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1356 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1357 |
enabled: canPaste |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1358 |
label: 'Paste' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1359 |
itemValue: pasteFiles |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1360 |
translateLabel: true |
4789
238d5e783f5c
editMenu was really a file menu
Claus Gittinger <cg@exept.de>
parents:
4785
diff
changeset
|
1361 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1362 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1363 |
enabled: hasSelection |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1364 |
label: 'Delete' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1365 |
itemValue: deleteFiles |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1366 |
translateLabel: true |
4789
238d5e783f5c
editMenu was really a file menu
Claus Gittinger <cg@exept.de>
parents:
4785
diff
changeset
|
1367 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1368 |
(MenuItem |
6169 | 1369 |
enabled: hasSelection |
1370 |
label: 'Erase' |
|
1371 |
itemValue: eraseFiles |
|
1372 |
translateLabel: true |
|
1373 |
) |
|
1374 |
(MenuItem |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1375 |
label: '-' |
4789
238d5e783f5c
editMenu was really a file menu
Claus Gittinger <cg@exept.de>
parents:
4785
diff
changeset
|
1376 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1377 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1378 |
enabled: hasSelection |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1379 |
label: 'Rename...' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1380 |
itemValue: renameSelection |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1381 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1382 |
shortcutKey: Replace |
4414 | 1383 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1384 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1385 |
enabled: hasSelection |
5634 | 1386 |
label: 'Move To...' |
6107 | 1387 |
itemValue: moveSelectionTo |
1388 |
translateLabel: true |
|
1389 |
) |
|
1390 |
(MenuItem |
|
1391 |
enabled: hasSelection |
|
1392 |
label: 'Copy To...' |
|
1393 |
itemValue: copySelectionTo |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1394 |
translateLabel: true |
4414 | 1395 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1396 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1397 |
enabled: hasSelection |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1398 |
label: 'Properties...' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1399 |
itemValue: doShowProperties |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1400 |
translateLabel: true |
4554 | 1401 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1402 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1403 |
label: '-' |
4531 | 1404 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1405 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1406 |
label: 'Operations' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1407 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1408 |
submenuChannel: fileOpMenu |
5425 | 1409 |
keepLinkedMenu: true |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1410 |
) |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1411 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1412 |
label: 'Edit' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1413 |
itemValue: doShowFileContents |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1414 |
translateLabel: true |
4414 | 1415 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1416 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1417 |
enabled: hasFileSelection |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1418 |
label: 'FileIn' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1419 |
itemValue: fileFileIn |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1420 |
translateLabel: true |
4414 | 1421 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1422 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1423 |
enabled: hasFileSelection |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1424 |
label: 'FileIn to Namespace...' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1425 |
itemValue: fileFileInToNameSpace |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1426 |
translateLabel: true |
4414 | 1427 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1428 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1429 |
label: '-' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1430 |
isVisible: javaSupportLoaded |
4414 | 1431 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1432 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1433 |
enabled: canAddToClassPath |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1434 |
label: 'Add to Java Class Path' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1435 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1436 |
isVisible: javaSupportLoaded |
4414 | 1437 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1438 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1439 |
enabled: canRemoveFromClassPath |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1440 |
label: 'Remove from Java Class Path' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1441 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1442 |
isVisible: javaSupportLoaded |
4414 | 1443 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1444 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1445 |
enabled: canAddToSourcePath |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1446 |
label: 'Add to Java Source Path' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1447 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1448 |
isVisible: javaSupportLoaded |
4414 | 1449 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1450 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1451 |
enabled: canRemoveFromSourcePath |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1452 |
label: 'Remove from Java Source Path' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1453 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1454 |
isVisible: javaSupportLoaded |
4414 | 1455 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1456 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1457 |
label: '-' |
5242
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
1458 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1459 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1460 |
enabled: enableFileHistory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1461 |
label: 'File History' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1462 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1463 |
submenuChannel: menuFileHistory |
5242
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
1464 |
) |
4414 | 1465 |
) |
1466 |
nil |
|
1467 |
nil |
|
3892 | 1468 |
) |
1469 |
! |
|
1470 |
||
4930 | 1471 |
fileOpMenu |
1472 |
"This resource specification was automatically generated |
|
1473 |
by the MenuEditor of ST/X." |
|
1474 |
||
1475 |
"Do not manually edit this!! If it is corrupted, |
|
1476 |
the MenuEditor may not be able to read the specification." |
|
1477 |
||
1478 |
" |
|
1479 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileOpMenu |
|
1480 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileOpMenu)) startUp |
|
1481 |
" |
|
1482 |
||
1483 |
<resource: #menu> |
|
1484 |
||
1485 |
^ |
|
1486 |
#(#Menu |
|
1487 |
#( |
|
1488 |
#(#MenuItem |
|
1489 |
#label: 'Split...' |
|
1490 |
#itemValue: #splitSelectedFiles |
|
1491 |
#translateLabel: true |
|
1492 |
) |
|
1493 |
#(#MenuItem |
|
1494 |
#label: 'Join...' |
|
1495 |
#itemValue: #joinSelectedFiles |
|
1496 |
#translateLabel: true |
|
1497 |
) |
|
1498 |
#(#MenuItem |
|
1499 |
#label: '-' |
|
1500 |
) |
|
1501 |
#(#MenuItem |
|
1502 |
#label: 'Rot13...' |
|
1503 |
#itemValue: #filterSelectedFiles: |
|
1504 |
#translateLabel: true |
|
1505 |
#argument: #rot13 |
|
1506 |
) |
|
1507 |
#(#MenuItem |
|
1508 |
#label: '-' |
|
1509 |
) |
|
1510 |
#(#MenuItem |
|
1511 |
#label: 'Truncate...' |
|
1512 |
#itemValue: #truncateSelectedFilesToZeroSize |
|
1513 |
#translateLabel: true |
|
1514 |
) |
|
1515 |
) |
|
1516 |
nil |
|
1517 |
nil |
|
1518 |
) |
|
1519 |
! |
|
1520 |
||
3892 | 1521 |
newMenu |
1522 |
"This resource specification was automatically generated |
|
1523 |
by the MenuEditor of ST/X." |
|
1524 |
||
1525 |
"Do not manually edit this!! If it is corrupted, |
|
1526 |
the MenuEditor may not be able to read the specification." |
|
1527 |
||
1528 |
" |
|
1529 |
MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#newMenu |
|
1530 |
(Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser newMenu)) startUp |
|
1531 |
" |
|
1532 |
||
1533 |
<resource: #menu> |
|
1534 |
||
1535 |
^ |
|
1536 |
#(#Menu |
|
4414 | 1537 |
#( |
1538 |
#(#MenuItem |
|
1539 |
#label: 'Directory...' |
|
1540 |
#translateLabel: true |
|
1541 |
#value: #newDirectory |
|
1542 |
) |
|
1543 |
#(#MenuItem |
|
1544 |
#label: 'File...' |
|
1545 |
#translateLabel: true |
|
1546 |
#value: #newFile |
|
1547 |
) |
|
1548 |
#(#MenuItem |
|
1549 |
#label: 'Hard Link...' |
|
1550 |
#translateLabel: true |
|
1551 |
#isVisible: #systemIsUnix |
|
1552 |
#value: #newHardLink |
|
1553 |
) |
|
1554 |
#(#MenuItem |
|
1555 |
#label: 'Symbolic Link...' |
|
1556 |
#translateLabel: true |
|
1557 |
#isVisible: #systemIsUnix |
|
1558 |
#value: #newSoftLink |
|
1559 |
) |
|
1560 |
) |
|
1561 |
nil |
|
1562 |
nil |
|
3892 | 1563 |
) |
3906 | 1564 |
! |
1565 |
||
4201 | 1566 |
showMenuSpec |
1567 |
"This resource specification was automatically generated |
|
1568 |
by the MenuEditor of ST/X." |
|
1569 |
||
1570 |
"Do not manually edit this!! If it is corrupted, |
|
1571 |
the MenuEditor may not be able to read the specification." |
|
1572 |
||
1573 |
" |
|
1574 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpec |
|
1575 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpec)) startUp |
|
1576 |
" |
|
1577 |
||
1578 |
<resource: #menu> |
|
1579 |
||
1580 |
^ |
|
1581 |
#(#Menu |
|
1582 |
#( |
|
1583 |
#(#MenuItem |
|
1584 |
#label: 'Hidden Files' |
|
1585 |
#translateLabel: true |
|
1586 |
#indication: #showHiddenFiles |
|
1587 |
) |
|
1588 |
#(#MenuItem |
|
1589 |
#label: '-' |
|
1590 |
) |
|
1591 |
#(#MenuItem |
|
1592 |
#label: 'Directory Tree' |
|
1593 |
#translateLabel: true |
|
1594 |
#indication: #showDirectoryTree |
|
1595 |
) |
|
1596 |
#(#MenuItem |
|
1597 |
#label: 'Regular Files in TreeView (Left)' |
|
1598 |
#translateLabel: true |
|
1599 |
#indication: #viewFilesInDirectoryTree |
|
1600 |
) |
|
1601 |
#(#MenuItem |
|
1602 |
#label: 'Directories in ContentsView (Right)' |
|
1603 |
#translateLabel: true |
|
1604 |
#indication: #viewDirsInContentsBrowser |
|
1605 |
) |
|
1606 |
#(#MenuItem |
|
1607 |
#enabled: #enableViewNoteBookApplication |
|
1608 |
#label: 'File Applications' |
|
1609 |
#translateLabel: true |
|
1610 |
#indication: #viewNoteBookApplicationHolder |
|
1611 |
) |
|
4554 | 1612 |
#(#MenuItem |
1613 |
#label: '-' |
|
1614 |
) |
|
1615 |
#(#MenuItem |
|
1616 |
#label: 'DiskUsage' |
|
1617 |
#translateLabel: true |
|
1618 |
#hideMenuOnActivated: false |
|
1619 |
#indication: #showDiskUsageHolder |
|
1620 |
) |
|
4201 | 1621 |
) |
1622 |
nil |
|
1623 |
nil |
|
1624 |
) |
|
1625 |
! |
|
1626 |
||
3906 | 1627 |
sortMenu |
1628 |
"This resource specification was automatically generated |
|
1629 |
by the MenuEditor of ST/X." |
|
1630 |
||
1631 |
"Do not manually edit this!! If it is corrupted, |
|
1632 |
the MenuEditor may not be able to read the specification." |
|
1633 |
||
1634 |
" |
|
3907 | 1635 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#sortMenu |
1636 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser sortMenu)) startUp |
|
3906 | 1637 |
" |
1638 |
||
1639 |
<resource: #menu> |
|
1640 |
||
1641 |
^ |
|
1642 |
#(#Menu |
|
4414 | 1643 |
#( |
1644 |
#(#MenuItem |
|
1645 |
#label: 'By Filename' |
|
1646 |
#translateLabel: true |
|
1647 |
#hideMenuOnActivated: false |
|
1648 |
#choice: #sortBlockProperty |
|
1649 |
#choiceValue: #baseName |
|
1650 |
) |
|
1651 |
#(#MenuItem |
|
5122 | 1652 |
#label: 'By Extension' |
4414 | 1653 |
#translateLabel: true |
1654 |
#hideMenuOnActivated: false |
|
1655 |
#choice: #sortBlockProperty |
|
1656 |
#choiceValue: #suffix |
|
1657 |
) |
|
1658 |
#(#MenuItem |
|
1659 |
#label: 'By Permissions' |
|
1660 |
#translateLabel: true |
|
1661 |
#hideMenuOnActivated: false |
|
1662 |
#choice: #sortBlockProperty |
|
1663 |
#choiceValue: #permissions |
|
1664 |
) |
|
1665 |
#(#MenuItem |
|
1666 |
#label: 'By Owner' |
|
1667 |
#translateLabel: true |
|
1668 |
#isVisible: #viewOwner |
|
1669 |
#hideMenuOnActivated: false |
|
1670 |
#choice: #sortBlockProperty |
|
1671 |
#choiceValue: #owner |
|
1672 |
) |
|
1673 |
#(#MenuItem |
|
1674 |
#label: 'By Group' |
|
1675 |
#translateLabel: true |
|
1676 |
#isVisible: #viewOwner |
|
1677 |
#hideMenuOnActivated: false |
|
1678 |
#choice: #sortBlockProperty |
|
1679 |
#choiceValue: #group |
|
1680 |
) |
|
1681 |
#(#MenuItem |
|
1682 |
#label: 'By Size' |
|
1683 |
#translateLabel: true |
|
1684 |
#hideMenuOnActivated: false |
|
1685 |
#choice: #sortBlockProperty |
|
1686 |
#choiceValue: #fileSize |
|
1687 |
) |
|
1688 |
#(#MenuItem |
|
1689 |
#label: 'By Date && Time' |
|
1690 |
#translateLabel: true |
|
1691 |
#hideMenuOnActivated: false |
|
1692 |
#choice: #sortBlockProperty |
|
1693 |
#choiceValue: #modificationTime |
|
1694 |
) |
|
1695 |
#(#MenuItem |
|
1696 |
#label: '-' |
|
1697 |
) |
|
1698 |
#(#MenuItem |
|
1699 |
#label: 'Ignore Case in Sort' |
|
1700 |
#translateLabel: true |
|
1701 |
#hideMenuOnActivated: false |
|
1702 |
#indication: #sortCaseless |
|
1703 |
) |
|
1704 |
#(#MenuItem |
|
1705 |
#label: 'Directories before Files' |
|
1706 |
#translateLabel: true |
|
1707 |
#hideMenuOnActivated: false |
|
1708 |
#indication: #sortDirectoriesBeforeFiles |
|
1709 |
) |
|
1710 |
) |
|
1711 |
nil |
|
1712 |
nil |
|
3906 | 1713 |
) |
4018 | 1714 |
! |
1715 |
||
4164
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1716 |
toolsMenuSpec |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1717 |
"This resource specification was automatically generated |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1718 |
by the MenuEditor of ST/X." |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1719 |
|
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1720 |
"Do not manually edit this!! If it is corrupted, |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1721 |
the MenuEditor may not be able to read the specification." |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1722 |
|
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1723 |
" |
4367 | 1724 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec |
1725 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp |
|
4164
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1726 |
" |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1727 |
|
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1728 |
<resource: #menu> |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1729 |
|
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1730 |
^ |
5830 | 1731 |
#(Menu |
1732 |
( |
|
1733 |
(MenuItem |
|
1734 |
label: 'Execute Command...' |
|
1735 |
itemValue: doExecuteCommand |
|
1736 |
translateLabel: true |
|
4230 | 1737 |
) |
5830 | 1738 |
(MenuItem |
5880 | 1739 |
label: 'Execute Script...' |
1740 |
itemValue: doExecuteScript |
|
1741 |
translateLabel: true |
|
1742 |
isVisible: true |
|
1743 |
) |
|
1744 |
(MenuItem |
|
5830 | 1745 |
enabled: canDoTerminal |
1746 |
label: 'Shell Terminal' |
|
1747 |
itemValue: openTerminal |
|
1748 |
translateLabel: true |
|
1749 |
isVisible: canDoTerminalAndSystemIsUnix |
|
4230 | 1750 |
) |
5830 | 1751 |
(MenuItem |
1752 |
enabled: canDoTerminal |
|
1753 |
label: 'DOS Terminal' |
|
1754 |
itemValue: openTerminal |
|
1755 |
translateLabel: true |
|
1756 |
isVisible: canDoTerminalAndSystemIsDOS |
|
4230 | 1757 |
) |
5830 | 1758 |
(MenuItem |
1759 |
label: '-' |
|
4230 | 1760 |
) |
5830 | 1761 |
(MenuItem |
1762 |
enabled: hasFileSelection |
|
1763 |
label: 'Changes Browser' |
|
1764 |
itemValue: openChangesBrowser |
|
1765 |
translateLabel: true |
|
4230 | 1766 |
) |
5830 | 1767 |
(MenuItem |
1768 |
enabled: hasFileSelection |
|
1769 |
label: 'ChangeSet Browser' |
|
1770 |
itemValue: openChangeSetBrowser |
|
1771 |
translateLabel: true |
|
1772 |
isVisible: false |
|
4230 | 1773 |
) |
5830 | 1774 |
(MenuItem |
6022 | 1775 |
enabled: hasFileSelection |
1776 |
label: 'Workspace' |
|
1777 |
itemValue: openWorkspace |
|
1778 |
translateLabel: true |
|
1779 |
) |
|
1780 |
(MenuItem |
|
5830 | 1781 |
enabled: hasSnapshotSelection |
1782 |
label: 'Snapshot Image Browser' |
|
1783 |
itemValue: openSnapshotImageBrowser |
|
1784 |
translateLabel: true |
|
4230 | 1785 |
) |
5830 | 1786 |
(MenuItem |
1787 |
enabled: canCreateNewProject |
|
1788 |
label: 'Create Smalltalk Project' |
|
1789 |
itemValue: createProjectAndOpenProjectBrowser |
|
1790 |
translateLabel: true |
|
4230 | 1791 |
) |
5830 | 1792 |
(MenuItem |
6022 | 1793 |
label: '-' |
1794 |
) |
|
1795 |
(MenuItem |
|
5830 | 1796 |
enabled: canReadAbbrevFile |
1797 |
label: 'Install Autoloaded' |
|
1798 |
itemValue: readAbbrevFile |
|
1799 |
translateLabel: true |
|
4230 | 1800 |
) |
5830 | 1801 |
(MenuItem |
1802 |
enabled: anySTFilesPresent |
|
5960 | 1803 |
label: 'Install All as Autoloaded' |
5830 | 1804 |
itemValue: installAllAsAutoloaded |
1805 |
translateLabel: true |
|
4230 | 1806 |
) |
5830 | 1807 |
(MenuItem |
1808 |
label: '-' |
|
4230 | 1809 |
) |
5830 | 1810 |
(MenuItem |
1811 |
label: 'File Utilities' |
|
1812 |
translateLabel: true |
|
1813 |
submenu: |
|
1814 |
(Menu |
|
1815 |
( |
|
1816 |
(MenuItem |
|
1817 |
enabled: hasFileSelection |
|
1818 |
label: 'Editor' |
|
1819 |
itemValue: openEditor |
|
1820 |
translateLabel: true |
|
4820 | 1821 |
) |
5830 | 1822 |
(MenuItem |
1823 |
enabled: hasFileSelection |
|
1824 |
label: 'HTML Reader' |
|
1825 |
itemValue: openHTMLReader |
|
1826 |
translateLabel: true |
|
4820 | 1827 |
) |
5830 | 1828 |
(MenuItem |
1829 |
enabled: hasFileSelection |
|
1830 |
label: 'Acroread (PDF Viewer)' |
|
1831 |
itemValue: openPDFViewer |
|
1832 |
translateLabel: true |
|
4820 | 1833 |
) |
5830 | 1834 |
(MenuItem |
1835 |
enabled: hasASN1AndSelection |
|
1836 |
label: 'ASN1 Browser' |
|
1837 |
itemValue: openASN1Browser |
|
1838 |
translateLabel: true |
|
1839 |
isVisible: hasASN1 |
|
4820 | 1840 |
) |
5830 | 1841 |
(MenuItem |
1842 |
enabled: hasCBrowser |
|
1843 |
label: 'C Browser' |
|
1844 |
itemValue: openCBrowser |
|
1845 |
translateLabel: true |
|
1846 |
isVisible: hasCBrowser |
|
4820 | 1847 |
) |
5830 | 1848 |
(MenuItem |
1849 |
enabled: hasJavaAndSelection |
|
1850 |
label: 'Applet Viewer' |
|
1851 |
itemValue: openAppletViewer |
|
1852 |
translateLabel: true |
|
1853 |
isVisible: hasJava |
|
4820 | 1854 |
) |
5830 | 1855 |
(MenuItem |
1856 |
enabled: hasMP3PlayerAndSelection |
|
1857 |
label: 'MP3 Player' |
|
1858 |
itemValue: openMP3Player |
|
1859 |
translateLabel: true |
|
1860 |
isVisible: hasMP3Player |
|
4820 | 1861 |
) |
5830 | 1862 |
(MenuItem |
1863 |
enabled: hasFileSelection |
|
1864 |
label: 'xv (Image Viewer)' |
|
1865 |
itemValue: openXV |
|
1866 |
translateLabel: true |
|
4950 | 1867 |
) |
5830 | 1868 |
(MenuItem |
1869 |
enabled: currentFilesAreInSameDirectory |
|
1870 |
label: 'Slide Show' |
|
1871 |
itemValue: openSlideShow |
|
1872 |
translateLabel: true |
|
1873 |
isVisible: hasSlideShow |
|
4820 | 1874 |
) |
5830 | 1875 |
(MenuItem |
1876 |
enabled: hasFileSelection |
|
1877 |
label: 'gv (Postscript Viewer)' |
|
1878 |
itemValue: openGV |
|
1879 |
translateLabel: true |
|
4957 | 1880 |
) |
5830 | 1881 |
(MenuItem |
1882 |
enabled: hasFileSelection |
|
1883 |
label: 'realplay (avi viewer)' |
|
1884 |
itemValue: openRP |
|
1885 |
translateLabel: true |
|
4958 | 1886 |
) |
4820 | 1887 |
) |
1888 |
nil |
|
1889 |
nil |
|
1890 |
) |
|
4230 | 1891 |
) |
5830 | 1892 |
(MenuItem |
1893 |
label: 'Image' |
|
1894 |
translateLabel: true |
|
1895 |
submenu: |
|
1896 |
(Menu |
|
1897 |
( |
|
1898 |
(MenuItem |
|
1899 |
enabled: hasFileSelection |
|
1900 |
label: 'Image Editor' |
|
1901 |
itemValue: openImageEditor |
|
1902 |
translateLabel: true |
|
4367 | 1903 |
) |
5830 | 1904 |
(MenuItem |
1905 |
enabled: hasFileSelection |
|
1906 |
label: 'Image Preview' |
|
1907 |
itemValue: openImagePreview |
|
1908 |
translateLabel: true |
|
4367 | 1909 |
) |
5830 | 1910 |
(MenuItem |
1911 |
enabled: hasFileSelection |
|
1912 |
label: 'Image Inspector' |
|
1913 |
itemValue: openImageInspector |
|
1914 |
translateLabel: true |
|
4531 | 1915 |
) |
5830 | 1916 |
(MenuItem |
1917 |
label: '-' |
|
4367 | 1918 |
) |
5830 | 1919 |
(MenuItem |
1920 |
enabled: hasFileSelection |
|
1921 |
label: 'Convert to GIF' |
|
1922 |
itemValue: convertImageToGIF |
|
1923 |
translateLabel: true |
|
4367 | 1924 |
) |
5830 | 1925 |
(MenuItem |
1926 |
enabled: hasFileSelection |
|
1927 |
label: 'Convert to PNG' |
|
1928 |
itemValue: convertImageToPNG |
|
1929 |
translateLabel: true |
|
4531 | 1930 |
) |
5830 | 1931 |
(MenuItem |
1932 |
enabled: hasFileSelection |
|
1933 |
label: 'Convert to XPM' |
|
1934 |
itemValue: convertImageToXPM |
|
1935 |
translateLabel: true |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
1936 |
) |
5830 | 1937 |
(MenuItem |
1938 |
enabled: hasFileSelection |
|
1939 |
label: 'Convert to JPG' |
|
1940 |
itemValue: convertImageToJPG |
|
1941 |
translateLabel: true |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
1942 |
) |
4367 | 1943 |
) |
1944 |
nil |
|
1945 |
nil |
|
1946 |
) |
|
4230 | 1947 |
) |
5830 | 1948 |
(MenuItem |
1949 |
enabled: hasZipFileSelected |
|
1950 |
label: 'ZipFile Tool' |
|
1951 |
itemValue: openZipTool |
|
1952 |
translateLabel: true |
|
4230 | 1953 |
) |
5830 | 1954 |
(MenuItem |
1955 |
label: 'Find' |
|
1956 |
translateLabel: true |
|
1957 |
submenu: |
|
1958 |
(Menu |
|
1959 |
( |
|
1960 |
(MenuItem |
|
1961 |
label: 'File...' |
|
1962 |
itemValue: fileFindFile |
|
1963 |
translateLabel: true |
|
4367 | 1964 |
) |
5830 | 1965 |
(MenuItem |
1966 |
label: 'Duplicate Files' |
|
1967 |
itemValue: fileFindDuplicates |
|
1968 |
translateLabel: true |
|
5082 | 1969 |
) |
5830 | 1970 |
(MenuItem |
1971 |
enabled: hasSelection |
|
1972 |
label: 'All Duplicate Files (Recursive)' |
|
1973 |
itemValue: fileFindAllDuplicates |
|
1974 |
translateLabel: true |
|
4367 | 1975 |
) |
1976 |
) |
|
1977 |
nil |
|
1978 |
nil |
|
1979 |
) |
|
4230 | 1980 |
) |
5830 | 1981 |
(MenuItem |
1982 |
enabled: hasSelection |
|
1983 |
label: 'File Differences' |
|
1984 |
itemValue: openDiffView |
|
1985 |
translateLabel: true |
|
1986 |
isVisible: hasTwoFilesSelectedHolder |
|
4230 | 1987 |
) |
5830 | 1988 |
(MenuItem |
1989 |
enabled: hasSelection |
|
1990 |
label: 'File Differences...' |
|
1991 |
itemValue: openDiffView |
|
1992 |
translateLabel: true |
|
1993 |
isVisible: hasNotTwoFilesSelectedHolder |
|
1994 |
) |
|
1995 |
(MenuItem |
|
1996 |
enabled: hasFileSelection |
|
1997 |
label: 'Hex Dump' |
|
1998 |
itemValue: fileHexDump |
|
1999 |
translateLabel: true |
|
4230 | 2000 |
) |
2001 |
) |
|
2002 |
nil |
|
2003 |
nil |
|
4164
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
2004 |
) |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
2005 |
! |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
2006 |
|
4018 | 2007 |
viewDetailsMenuSpec |
2008 |
"This resource specification was automatically generated |
|
2009 |
by the MenuEditor of ST/X." |
|
2010 |
||
2011 |
"Do not manually edit this!! If it is corrupted, |
|
2012 |
the MenuEditor may not be able to read the specification." |
|
2013 |
||
2014 |
" |
|
4648 | 2015 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#viewDetailsMenuSpec |
2016 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser viewDetailsMenuSpec)) startUp |
|
4018 | 2017 |
" |
2018 |
||
2019 |
<resource: #menu> |
|
2020 |
||
2021 |
^ |
|
2022 |
#(#Menu |
|
4414 | 2023 |
#( |
2024 |
#(#MenuItem |
|
2025 |
#label: '-' |
|
2026 |
) |
|
2027 |
#(#MenuItem |
|
2028 |
#label: 'Hidden Files' |
|
2029 |
#translateLabel: true |
|
2030 |
#indication: #showHiddenFiles |
|
2031 |
) |
|
2032 |
) |
|
2033 |
nil |
|
2034 |
nil |
|
4018 | 2035 |
) |
3892 | 2036 |
! ! |
2037 |
||
2038 |
!AbstractFileBrowser class methodsFor:'misc'! |
|
2039 |
||
2040 |
newLock |
|
2041 |
^ CodeExecutionLock new |
|
2042 |
! ! |
|
2043 |
||
5644
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2044 |
!AbstractFileBrowser class methodsFor:'resources'! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2045 |
|
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2046 |
classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2047 |
^ FileBrowser classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2048 |
! ! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2049 |
|
4610 | 2050 |
!AbstractFileBrowser class methodsFor:'utilities'! |
2051 |
||
2052 |
contentsOfFileAsHexDump:f |
|
2053 |
|resources fileName stream data offs |
|
2054 |
addrDigits col line lineStream asciiLineStream lines| |
|
2055 |
||
2056 |
resources := self classResources. |
|
2057 |
||
2058 |
fileName := f baseName. |
|
2059 |
f isDirectory ifTrue:[ |
|
2060 |
Dialog warn:(resources string:'%1 is a directory.' with:fileName). |
|
2061 |
^ nil |
|
2062 |
]. |
|
2063 |
f exists ifFalse:[ |
|
2064 |
Dialog warn:(resources string:'oops, ''%1'' is gone or unreadable.' with:fileName). |
|
2065 |
^ nil |
|
2066 |
]. |
|
2067 |
f isReadable ifFalse:[ |
|
2068 |
Dialog warn:(resources string:'''%1'' is unreadable.' with:fileName). |
|
2069 |
^ nil |
|
2070 |
]. |
|
2071 |
f fileSize > (512*1024) ifTrue:[ |
|
2072 |
(Dialog confirm:(resources |
|
5046 | 2073 |
string:'Warning: the file is big (%1b). Show anyway ?' |
4610 | 2074 |
with:(UnitConverter fileSizeStringFor:f fileSize))) |
2075 |
ifFalse:[ |
|
2076 |
^ nil |
|
2077 |
] |
|
2078 |
]. |
|
2079 |
||
2080 |
stream := f readStream binary. |
|
2081 |
data := stream contents. |
|
2082 |
stream close. |
|
2083 |
||
2084 |
col := 1. |
|
2085 |
offs := 0. |
|
2086 |
lines := StringCollection new. |
|
2087 |
||
2088 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
2089 |
||
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
2090 |
lineStream := String writeStream. |
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
2091 |
asciiLineStream := String writeStream. |
4610 | 2092 |
|
2093 |
lineStream nextPutAll:(offs hexPrintString:addrDigits). |
|
2094 |
lineStream nextPutAll:': '. |
|
2095 |
||
2096 |
data do:[:byte | |
|
2097 |
lineStream nextPutAll:(byte hexPrintString:2). |
|
2098 |
(byte between:32 and:127) ifTrue:[ |
|
2099 |
asciiLineStream nextPut:(Character value:byte) |
|
2100 |
] ifFalse:[ |
|
2101 |
asciiLineStream nextPut:$. |
|
2102 |
]. |
|
2103 |
||
2104 |
offs := offs + 1. |
|
2105 |
col := col + 1. |
|
2106 |
col > 16 ifTrue:[ |
|
2107 |
lineStream nextPutAll:' '. |
|
2108 |
lineStream nextPutAll:asciiLineStream contents. |
|
2109 |
lines add:(lineStream contents). |
|
2110 |
(offs bitAnd:16rFF) == 0 ifTrue:[ |
|
2111 |
lines add:nil |
|
2112 |
]. |
|
2113 |
lineStream reset. |
|
2114 |
asciiLineStream reset. |
|
2115 |
||
2116 |
lineStream nextPutAll:(offs hexPrintString:addrDigits). |
|
2117 |
lineStream nextPutAll:': '. |
|
2118 |
col := 1. |
|
2119 |
] ifFalse:[ |
|
2120 |
lineStream space |
|
2121 |
] |
|
2122 |
]. |
|
2123 |
line := lineStream contents paddedTo:(3*16 + addrDigits + 1). |
|
2124 |
lines add:(line , ' ' , asciiLineStream contents). |
|
2125 |
^ lines |
|
2126 |
! ! |
|
2127 |
||
3892 | 2128 |
!AbstractFileBrowser methodsFor:'actions'! |
2129 |
||
2130 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 2131 |
"setup and launch a querybox to ask for a unix command. |
3892 | 2132 |
Then evaluate aBlock passing the command-string as argument." |
2133 |
||
4523 | 2134 |
|box osName commandString| |
3892 | 2135 |
|
2136 |
osName := OperatingSystem platformName. |
|
2137 |
||
2138 |
box := FilenameEnterBox |
|
4414 | 2139 |
title:(resources string:'Execute %1 command:' with:osName) |
2140 |
okText:(resources string:'Execute') |
|
4523 | 2141 |
action:[:cmd | commandString := cmd]. |
3892 | 2142 |
|
2143 |
fileName notNil ifTrue:[ |
|
4414 | 2144 |
self initialCommandFor:fileName into:box. |
3892 | 2145 |
]. |
2146 |
box directory:(self getDirWithoutFileName:fileName). |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
2147 |
box show. |
3892 | 2148 |
box destroy. |
2149 |
||
4523 | 2150 |
commandString notNil ifTrue:[ |
2151 |
aBlock value:commandString |
|
2152 |
]. |
|
2153 |
||
3892 | 2154 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
2155 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
2156 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
2157 |
! |
|
2158 |
||
2159 |
changeFileBrowserTitleTo:aString |
|
4774 | 2160 |
self |
2161 |
applicationNamed:#FileBrowserV2 |
|
5009 | 2162 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 2163 |
! |
2164 |
||
2165 |
copyFileList |
|
4774 | 2166 |
"copy the fileList to the clipBoard" |
2167 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2168 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2169 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2170 |
fileList := self |
4774 | 2171 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 2172 |
ifPresentDo:[:app | app browserFileList]. |
2173 |
||
2174 |
fileList notNil ifTrue:[ |
|
2175 |
self copyFileListToClipBoard:fileList. |
|
2176 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2177 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2178 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2179 |
copyFileListToClipBoard:fileList |
4774 | 2180 |
"copy the itemList to the clipBoard" |
2181 |
||
2182 |
|stream| |
|
2183 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2184 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 2185 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2186 |
stream := String writeStream. |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2187 |
fileList size == 1 ifTrue:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2188 |
stream nextPutAll:(fileList first asString). |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2189 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2190 |
fileList do:[:fileName | |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2191 |
(fileName baseName ~= '..') ifTrue:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2192 |
stream nextPutLine:(fileName asString). |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2193 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2194 |
]. |
3892 | 2195 |
]. |
6034 | 2196 |
self window setClipboardText:stream contents. |
3892 | 2197 |
! |
2198 |
||
2199 |
copySelectedFilenames |
|
4774 | 2200 |
"copy the selected fileNames to the clipBoard" |
2201 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2202 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2203 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2204 |
fileList := self |
4774 | 2205 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 2206 |
ifPresentDo:[:appl | appl selectedFileNames]. |
2207 |
fileList notNil ifTrue:[ |
|
2208 |
self copyFileListToClipBoard:fileList. |
|
2209 |
]. |
|
3892 | 2210 |
! |
2211 |
||
2212 |
doAddTerminal |
|
5960 | 2213 |
|dir| |
2214 |
||
2215 |
dir := self currentDirectory. |
|
3892 | 2216 |
|
5960 | 2217 |
dir isNil ifTrue:[ |
4414 | 2218 |
dir := Filename homeDirectory |
3892 | 2219 |
]. |
4774 | 2220 |
|
5009 | 2221 |
self |
2222 |
applicationNamed:#FileApplicationNoteBook |
|
2223 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
3892 | 2224 |
! |
2225 |
||
2226 |
doOpenSearchFile |
|
5961 | 2227 |
|item file| |
2228 |
||
2229 |
file := self firstSelectedFileName. |
|
2230 |
file isNil ifTrue:[ |
|
2231 |
file := Filename homeDirectory asAbsoluteFilename. |
|
2232 |
]. |
|
2233 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 2234 |
self openSearchFileOn:item. |
2235 |
! |
|
2236 |
||
2237 |
doShowFileContents |
|
5009 | 2238 |
self |
2239 |
applicationNamed:#DirectoryContentsBrowser |
|
2240 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
2241 |
||
2242 |
^ nil |
|
3892 | 2243 |
! |
2244 |
||
2245 |
doShowProperties |
|
2246 |
||
2247 |
"show long stat (file)-info" |
|
2248 |
||
2249 |
self fileGetInfo:true |
|
2250 |
! |
|
2251 |
||
5528 | 2252 |
fileEncodingDialog |
2253 |
"open a dialog to allow change of the files character encoding. |
|
2254 |
Files are converted to internal encoding when read, and converted back |
|
2255 |
to this encoding when saved. |
|
2256 |
Notice: currently, not too many encodings are supported by the system." |
|
2257 |
||
2258 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
2259 |
||
2260 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
2261 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
2262 |
||
2263 |
bindings := IdentityDictionary new. |
|
2264 |
bindings at:#encodingList put:encodingDescr. |
|
2265 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 2266 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
2267 |
||
5528 | 2268 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
2269 |
ifTrue:[ |
|
2270 |
idx := (bindings at:#selectedEncoding) value. |
|
2271 |
selectedEncoding := encodings at:idx. |
|
2272 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 2273 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 2274 |
]. |
5737 | 2275 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 2276 |
]. |
2277 |
||
2278 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
2279 |
! |
|
2280 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2281 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
2282 |
"select only if the file is not already in the selection" |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2283 |
|
5959 | 2284 |
|currentFileNameHolder currentSel| |
2285 |
||
2286 |
currentFileNameHolder := self currentFileNameHolder. |
|
2287 |
||
2288 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
2289 |
(currentSel includes:aFilename) ifFalse:[ |
5959 | 2290 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
3964 | 2291 |
]. |
3892 | 2292 |
! |
2293 |
||
4392 | 2294 |
newTextEditor |
5009 | 2295 |
self |
2296 |
applicationNamed:#FileApplicationNoteBook |
|
2297 |
ifPresentDo:[:appl | ^ appl newTextEditor]. |
|
2298 |
||
2299 |
^ nil. |
|
2300 |
! |
|
2301 |
||
2302 |
openApplByFileItem:anItem |
|
5306 | 2303 |
^ self |
5009 | 2304 |
applicationNamed:#FileApplicationNoteBook |
5306 | 2305 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
3892 | 2306 |
! |
2307 |
||
4392 | 2308 |
openApplForFile:aFilename |
5306 | 2309 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 2310 |
! |
2311 |
||
3892 | 2312 |
openCommandResultApplication |
2313 |
||
5009 | 2314 |
self |
2315 |
applicationNamed:#FileApplicationNoteBook |
|
2316 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
2317 |
||
2318 |
^ nil |
|
3892 | 2319 |
! |
2320 |
||
5010 | 2321 |
openNewTextEditorOn:anItem |
5009 | 2322 |
self |
2323 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 2324 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 2325 |
|
2326 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
2327 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
2328 |
|
5010 | 2329 |
openSearchFileOn:anItem |
5009 | 2330 |
self |
2331 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 2332 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 2333 |
|
2334 |
^ nil. |
|
3892 | 2335 |
! |
2336 |
||
5162 | 2337 |
openTextEditorForFile:aFilename |
2338 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
2339 |
! |
|
2340 |
||
5010 | 2341 |
openTextEditorOn:anItem |
5009 | 2342 |
self |
2343 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 2344 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 2345 |
|
2346 |
^ nil. |
|
3892 | 2347 |
! |
2348 |
||
5010 | 2349 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 2350 |
self |
2351 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 2352 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 2353 |
|
2354 |
^ nil. |
|
4618 | 2355 |
! |
2356 |
||
5959 | 2357 |
setCurrentFileName:aFilename |
2358 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
2359 |
! |
|
2360 |
||
2361 |
setCurrentFileNames:aCollectionOfFilenames |
|
2362 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
2363 |
! |
|
2364 |
||
3892 | 2365 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
2366 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
2367 |
aColOfFiles notNil ifTrue:[ |
5959 | 2368 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
2369 |
]. |
3892 | 2370 |
! |
2371 |
||
2372 |
updateCurrentDirectory |
|
5739 | 2373 |
self updateCurrentDirectory:false |
2374 |
! |
|
2375 |
||
2376 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
2377 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
2378 |
|
5009 | 2379 |
self |
2380 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 2381 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 2382 |
self |
2383 |
applicationNamed:#DirectoryTreeBrowser |
|
2384 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 2385 |
! |
2386 |
||
5739 | 2387 |
updateCurrentDirectoryWithReread |
2388 |
self updateCurrentDirectory:true |
|
2389 |
! |
|
2390 |
||
4345 | 2391 |
withActivityIndicationDo:aBlock |
2392 |
||
2393 |
self activityVisibilityChannel value:true. |
|
2394 |
[ |
|
2395 |
aBlock value. |
|
2396 |
] ensure:[ |
|
2397 |
self activityVisibilityChannel value:false. |
|
2398 |
] |
|
3892 | 2399 |
! ! |
2400 |
||
2401 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
2402 |
||
2403 |
addBookmark |
|
2404 |
|directories| |
|
2405 |
||
2406 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
2407 |
directories := self currentDirectories value. |
|
4679 | 2408 |
self addBookmarks:directories. |
5960 | 2409 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 2410 |
! |
2411 |
||
2412 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
2413 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
2414 |
self class addBookmark:path |
3892 | 2415 |
]. |
2416 |
! |
|
2417 |
||
2418 |
hasBookmarks |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
2419 |
^ self class hasBookmarks |
3892 | 2420 |
! |
2421 |
||
2422 |
hasBookmarksToRemove |
|
2423 |
|bookmarks directories| |
|
2424 |
||
3982 | 2425 |
directories := self currentSelectedDirectories. |
3892 | 2426 |
bookmarks := self class directoryBookmarks. |
2427 |
^ (bookmarks size > 0 and:[directories notEmpty]) |
|
2428 |
! |
|
2429 |
||
2430 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
2431 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
2432 |
self class removeBookmark:dir |
3892 | 2433 |
]. |
4679 | 2434 |
! |
2435 |
||
2436 |
saveBookmarks |
|
2437 |
self class saveBookmarks |
|
3892 | 2438 |
! ! |
2439 |
||
2440 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
2441 |
||
2442 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 2443 |
|cmd suffix cmdHist historySize| |
3892 | 2444 |
|
2445 |
cmdHist := self class commandHistory. |
|
2446 |
(aCommandString notNil and:[aCommandString notEmpty]) ifTrue:[ |
|
4414 | 2447 |
cmdHist notNil ifTrue:[ |
2448 |
cmdHist addFirst:aCommandString. |
|
6369 | 2449 |
historySize := self class commandHistorySize. |
2450 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 2451 |
cmdHist removeLast |
2452 |
] |
|
2453 |
]. |
|
2454 |
aFilename notNil ifTrue:[ |
|
2455 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
2456 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
2457 |
DefaultCommandPerSuffix := Dictionary new. |
|
2458 |
]. |
|
2459 |
suffix := aFilename asFilename suffix. |
|
2460 |
suffix notNil ifTrue:[ |
|
2461 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
2462 |
] |
|
2463 |
] |
|
3892 | 2464 |
] |
2465 |
! |
|
2466 |
||
2467 |
doBack |
|
6286 | 2468 |
"go backward in the history" |
3892 | 2469 |
|
4022 | 2470 |
| fileName| |
2471 |
||
6369 | 2472 |
fileName := self directoryHistory goBackward. |
3892 | 2473 |
fileName notNil ifTrue:[ |
4347 | 2474 |
self gotoFile:(fileName asFilename). |
3892 | 2475 |
] |
2476 |
! |
|
2477 |
||
2478 |
doForward |
|
6286 | 2479 |
"go forward in the history" |
3892 | 2480 |
|
3964 | 2481 |
| fileName| |
2482 |
||
6369 | 2483 |
fileName := self directoryHistory goForward. |
3892 | 2484 |
fileName notNil ifTrue:[ |
4414 | 2485 |
self gotoFile:(fileName asFilename). |
4022 | 2486 |
] ifFalse:[ |
4414 | 2487 |
self enableForward value:false. |
4022 | 2488 |
|
2489 |
]. |
|
3892 | 2490 |
! ! |
2491 |
||
2492 |
!AbstractFileBrowser methodsFor:'applications'! |
|
2493 |
||
5009 | 2494 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
2495 |
|appl| |
|
2496 |
||
2497 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
2498 |
appl notNil ifTrue:[ |
|
2499 |
^ aBlock value:appl |
|
2500 |
]. |
|
2501 |
^ nil. |
|
2502 |
! |
|
2503 |
||
4004 | 2504 |
directoryContentsBrowser |
2505 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 2506 |
! ! |
2507 |
||
2508 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
2509 |
||
2510 |
applications |
|
2511 |
^ aspects at:#applications |
|
2512 |
! |
|
2513 |
||
2514 |
backgroundProcesses |
|
2515 |
||
2516 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
2517 |
! |
|
2518 |
||
4230 | 2519 |
canMake |
6095 | 2520 |
^ self aspectFor:#canMake ifAbsent:[ false asValue ]. |
4230 | 2521 |
! |
2522 |
||
3892 | 2523 |
currentDirectories |
2524 |
||
2525 |
" returns a Ordered Collection of all directories currently selected |
|
2526 |
if only a file is selected currentDirectories holds the directory of the file |
|
2527 |
" |
|
2528 |
||
2529 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
2530 |
! |
|
2531 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2532 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2533 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2534 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2535 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2536 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2537 |
directories := self currentDirectories value. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2538 |
(directories size ~= 1) ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2539 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2540 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2541 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2542 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2543 |
|
3892 | 2544 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2545 |
"return a ValueHolder with an OrderedCollection containing all selected files. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2546 |
If no file but a directory is selected it contains the directories |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2547 |
in contrast to currentDirectories which have only the directories" |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2548 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2549 |
^ self aspectFor:#currentFileNameHolder ifAbsent:[ |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2550 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2551 |
|
4692 | 2552 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2553 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2554 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2555 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2556 |
currentSel asValue |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2557 |
] notPresentDo:[:holder| |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2558 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2559 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2560 |
newFilenames := Set new. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2561 |
filenames do:[:eachFilename| |existingFilename| |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2562 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2563 |
existingFilename notNil ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2564 |
[existingFilename exists] whileFalse:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2565 |
existingFilename := existingFilename directory. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
2566 |
]. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2567 |
newFilenames add:existingFilename. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
2568 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2569 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2570 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2571 |
] |
3892 | 2572 |
! |
2573 |
||
5528 | 2574 |
defaultFileEncoding |
2575 |
^ #'iso8859-1' "/ #'utf-8' |
|
2576 |
! |
|
2577 |
||
3892 | 2578 |
enableDirectoryUp |
2579 |
||
2580 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[false asValue] |
|
2581 |
! |
|
2582 |
||
4593 | 2583 |
enableGotoDefault |
2584 |
||
2585 |
^ self aspectFor:#enableGotoDefault ifAbsent:[ true asValue ]. |
|
2586 |
! |
|
2587 |
||
3892 | 2588 |
enableHome |
2589 |
||
2590 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
2591 |
! |
|
2592 |
||
2593 |
enableViewNoteBookApplication |
|
2594 |
||
2595 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
2596 |
! |
|
2597 |
||
5528 | 2598 |
fileEncoding |
2599 |
^ self fileEncodingHolder value |
|
2600 |
! |
|
2601 |
||
2602 |
fileEncoding:newEncoding |
|
5533 | 2603 |
self fileEncodingHolder value:newEncoding. |
2604 |
||
2605 |
self |
|
2606 |
applicationNamed:#FileApplicationNoteBook |
|
2607 |
ifPresentDo:[:nb | |
|
2608 |
|appl| |
|
2609 |
||
2610 |
appl := nb selectedApplication. |
|
5535 | 2611 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 2612 |
appl fileEncoding:newEncoding |
2613 |
] |
|
2614 |
]. |
|
5528 | 2615 |
! |
2616 |
||
5737 | 2617 |
fileEncodingHolder |
2618 |
^ self |
|
2619 |
aspectFor:#fileEncodingHolder |
|
2620 |
ifAbsent:[ |
|
2621 |
self |
|
2622 |
applicationNamed:#FileApplicationNoteBook |
|
2623 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
2624 |
] |
|
2625 |
! |
|
2626 |
||
5961 | 2627 |
firstSelectedFileName |
2628 |
|files| |
|
2629 |
||
2630 |
files := self currentFileNameHolder value. |
|
2631 |
files notEmpty ifTrue:[ |
|
2632 |
^ files first |
|
2633 |
]. |
|
2634 |
^ nil |
|
2635 |
! |
|
2636 |
||
4618 | 2637 |
hasFileSelection |
2638 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
2639 |
! |
|
2640 |
||
5830 | 2641 |
hasNotTwoFilesSelectedHolder |
2642 |
^ self aspectFor:#hasNotTwoFilesSelectedHolder |
|
2643 |
ifAbsent:[ |
|
2644 |
BlockValue |
|
2645 |
with:[:m | self hasTwoFilesSelected not] |
|
2646 |
argument:self currentFileNameHolder |
|
2647 |
]. |
|
2648 |
! |
|
2649 |
||
3892 | 2650 |
hasSelection |
2651 |
||
2652 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
2653 |
! |
|
2654 |
||
4414 | 2655 |
hasTwoFilesSelectedHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2656 |
^ self aspectFor:#hasTwoFilesSelectedHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2657 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2658 |
BlockValue |
5830 | 2659 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2660 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2661 |
]. |
4414 | 2662 |
! |
2663 |
||
5737 | 2664 |
lockFileEncoding:aBoolean |
2665 |
self lockFileEncodingHolder value:aBoolean. |
|
2666 |
||
2667 |
self |
|
2668 |
applicationNamed:#FileApplicationNoteBook |
|
2669 |
ifPresentDo:[:nb | |
|
2670 |
|appl| |
|
2671 |
||
2672 |
appl := nb selectedApplication. |
|
2673 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
2674 |
appl lockFileEncoding:aBoolean |
|
2675 |
] |
|
2676 |
]. |
|
2677 |
! |
|
2678 |
||
2679 |
lockFileEncodingHolder |
|
2680 |
^ self |
|
2681 |
aspectFor:#lockFileEncodingHolder |
|
2682 |
ifAbsent:[ |
|
2683 |
self |
|
2684 |
applicationNamed:#FileApplicationNoteBook |
|
2685 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
2686 |
] |
|
2687 |
! |
|
2688 |
||
4523 | 2689 |
notify:aString |
2690 |
self notifyChannel value:aString |
|
2691 |
! |
|
2692 |
||
3892 | 2693 |
notifyChannel |
2694 |
||
2695 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 2696 |
! |
2697 |
||
2698 |
rootHolder |
|
2699 |
"holder, which keeps the rootHolder of the treeView |
|
2700 |
" |
|
2701 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
2702 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
2703 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
2704 |
]. |
3892 | 2705 |
! ! |
2706 |
||
2707 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
2708 |
||
2709 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 2710 |
"returns the model for an aspect; these are stored in a common dictionary" |
2711 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2712 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 2713 |
! |
2714 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2715 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 2716 |
"returns the model for an aspect; these are stored in a common dictionary" |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2717 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2718 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2719 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2720 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2721 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2722 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2723 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2724 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2725 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2726 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2727 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2728 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2729 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2730 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2731 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2732 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2733 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2734 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2735 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2736 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2737 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2738 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2739 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2740 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2741 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2742 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2743 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2744 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2745 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2746 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2747 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2748 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2749 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2750 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2751 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2752 |
aspectFor:something put:aValueHolder |
6284 | 2753 |
"stores the model for an aspect; these are stored in a common dictionary" |
2754 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2755 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2756 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2757 |
|
3892 | 2758 |
aspects |
6284 | 2759 |
"returns the common aspect dictionary" |
2760 |
||
3892 | 2761 |
^ aspects |
2762 |
! |
|
2763 |
||
2764 |
runtimeAspectValueFor:something |
|
2765 |
"returns the default aspect item from the class variable RuntimeAspects |
|
2766 |
" |
|
2767 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
2768 |
! |
|
2769 |
||
4201 | 2770 |
saveAspectValues |
2771 |
|saveAspects aspectValue| |
|
2772 |
||
2773 |
||
2774 |
saveAspects := self class userPreferencesAspectList. |
|
2775 |
saveAspects do:[ : aspectKey | |
|
2776 |
aspectValue := (self perform:aspectKey) value. |
|
2777 |
UserPreferences current perform:((aspectKey asString, ':') asSymbol) with:aspectValue. |
|
2778 |
]. |
|
2779 |
! |
|
2780 |
||
3892 | 2781 |
saveRuntimeAspectValues |
2782 |
|savedAspects dictionary value isHolder aspect| |
|
2783 |
||
5941 | 2784 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 2785 |
dictionary := Dictionary new. |
5941 | 2786 |
savedAspects do:[:aspectKey | |
4414 | 2787 |
aspect := self perform:aspectKey. |
2788 |
isHolder := aspect isValueModel. |
|
5941 | 2789 |
isHolder ifTrue:[ |
2790 |
value := aspect value |
|
2791 |
] ifFalse:[ |
|
2792 |
value := aspect |
|
2793 |
]. |
|
2794 |
dictionary at:aspectKey |
|
2795 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
2796 |
]. |
|
2797 |
RuntimeAspects := dictionary. |
|
3892 | 2798 |
! |
2799 |
||
4201 | 2800 |
userPreferencesAspectValueFor:something |
2801 |
"returns the default aspect from the Userpreferences |
|
3892 | 2802 |
" |
4201 | 2803 |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6236
diff
changeset
|
2804 |
(self class userPreferencesAspectList includes:something) ifFalse:[ ^ nil]. |
4201 | 2805 |
^ UserPreferences current perform:something. |
3892 | 2806 |
! ! |
2807 |
||
4011 | 2808 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
2809 |
||
4018 | 2810 |
filterBackgroundColor |
2811 |
||
2812 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
2813 |
! |
|
2814 |
||
4011 | 2815 |
filterBlockHolder |
2816 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2817 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 2818 |
! |
2819 |
||
2820 |
filterListModel |
|
2821 |
||
2822 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
2823 |
! |
|
2824 |
||
2825 |
filterModel |
|
5941 | 2826 |
|m| |
2827 |
||
2828 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
2829 |
^ m |
|
4011 | 2830 |
! |
2831 |
||
4018 | 2832 |
filterValueBox |
2833 |
||
2834 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
2835 |
! |
|
2836 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2837 |
makeFilterBlock |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2838 |
| filterString filterStrings filters showHidden yesOrNo filterBlock| |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2839 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2840 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2841 |
filterString = '' ifTrue:[filterString := '*']. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2842 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2843 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2844 |
filters := filterStrings |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2845 |
collect:[:eachPattern | |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2846 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2847 |
|pattern| |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2848 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2849 |
pattern := eachPattern withoutSeparators. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2850 |
yesOrNo := true. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2851 |
(pattern startsWith:'~') ifTrue:[ |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2852 |
yesOrNo := false. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2853 |
pattern := pattern copyFrom:2. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2854 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2855 |
yesOrNo ifTrue:[ |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2856 |
[:name | pattern match:name ] |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2857 |
] ifFalse:[ |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2858 |
[:name | (pattern match:name) not ] |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2859 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2860 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2861 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2862 |
filters size == 1 ifTrue:[ |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2863 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2864 |
] ifFalse:[ |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2865 |
filterBlock := [: name | filters contains:[:aFilter | aFilter value:name ]]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2866 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2867 |
|
4011 | 2868 |
showHidden := self showHiddenFiles value. |
2869 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2870 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2871 |
]. |
5870 | 2872 |
^ [: el | ((el asString startsWith:'.') not) and:[filterBlock value:el]]. |
4018 | 2873 |
! |
2874 |
||
2875 |
shownFiles |
|
2876 |
||
2877 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 2878 |
! ! |
2879 |
||
3892 | 2880 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
2881 |
||
2882 |
dirHistory |
|
6369 | 2883 |
"obsolete" |
2884 |
^ self directoryHistory |
|
2885 |
! |
|
2886 |
||
2887 |
directoryHistory |
|
3952 | 2888 |
^ self class directoryHistory |
3892 | 2889 |
! |
2890 |
||
2891 |
enableBack |
|
2892 |
||
2893 |
^ self aspectFor:#enableBack ifAbsent:[false asValue] |
|
2894 |
! |
|
2895 |
||
2896 |
enableFileHistory |
|
2897 |
||
2898 |
^ self aspectFor:#enableFileHistory ifAbsent:[false asValue] |
|
2899 |
! |
|
2900 |
||
2901 |
enableForward |
|
2902 |
||
2903 |
^ self aspectFor:#enableForward ifAbsent:[false asValue] |
|
2904 |
! |
|
2905 |
||
2906 |
fileHistory |
|
2907 |
||
2908 |
^ self aspectFor:#fileHistory ifAbsent:[FilenameHistory new] |
|
2909 |
! ! |
|
2910 |
||
2911 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
2912 |
||
4345 | 2913 |
activityVisibilityChannel |
6284 | 2914 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 2915 |
|
2916 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ false asValue ]. |
|
2917 |
! |
|
2918 |
||
4110 | 2919 |
openAlwaysInTextEditor |
4201 | 2920 |
" aspect for open every file in TextEditor dont use e.g. HtmlEditor for *.html'" |
4110 | 2921 |
|
2922 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
|
2923 |
! |
|
2924 |
||
3892 | 2925 |
openMultipleApplicationsForType |
2926 |
||
4201 | 2927 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
2928 |
open TextEditor " |
|
2929 |
||
3892 | 2930 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
2931 |
! |
|
2932 |
||
4201 | 2933 |
showDirectoryTree |
2934 |
||
2935 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 2936 |
! |
2937 |
||
4554 | 2938 |
showDiskUsageHolder |
2939 |
|holder| |
|
2940 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
2941 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 2942 |
holder addDependent:self. |
4554 | 2943 |
^ holder |
2944 |
! |
|
2945 |
||
3892 | 2946 |
showHiddenFiles |
2947 |
||
2948 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
|
2949 |
! |
|
2950 |
||
4648 | 2951 |
userContextAvailable |
2952 |
||
2953 |
" aspect for show group and user columns in contents view |
|
2954 |
windows provides no user context" |
|
2955 |
||
2956 |
^ OperatingSystem isMSWINDOWSlike not |
|
2957 |
! |
|
2958 |
||
3892 | 2959 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2960 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2961 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2962 |
^ self directoryContentsBrowser viewDescription |
3892 | 2963 |
! |
2964 |
||
2965 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2966 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 2967 |
" |
3892 | 2968 |
|
6121 | 2969 |
|directoryContentsBrowser| |
2970 |
||
2971 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
2972 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
2973 |
^ directoryContentsBrowser viewDetails |
|
3892 | 2974 |
! |
2975 |
||
2976 |
viewDirectoryDescription |
|
2977 |
||
4201 | 2978 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
2979 |
on change directory " |
|
2980 |
||
3892 | 2981 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
2982 |
! |
|
2983 |
||
4201 | 2984 |
viewDirsInContentsBrowser |
2985 |
||
2986 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
2987 |
! |
|
2988 |
||
5870 | 2989 |
viewFilesInContentsBrowser |
2990 |
||
2991 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
2992 |
! |
|
2993 |
||
3892 | 2994 |
viewFilesInDirectoryTree |
2995 |
||
4201 | 2996 |
" aspect for view files in tree view (not only directories) " |
2997 |
||
3892 | 2998 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
2999 |
! |
|
3000 |
||
3001 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3002 |
" aspect for show group information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3003 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3004 |
^ self directoryContentsBrowser viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3005 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3006 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3007 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3008 |
" aspect for show file-type icon in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3009 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3010 |
^ self directoryContentsBrowser viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3011 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3012 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3013 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3014 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3015 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3016 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 3017 |
! |
3018 |
||
3019 |
viewNoteBookApplicationHolder |
|
3020 |
||
3021 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
3022 |
! |
|
3023 |
||
3024 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3025 |
" aspect for show owner information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3026 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3027 |
^ self directoryContentsBrowser viewOwner |
3892 | 3028 |
! |
3029 |
||
3030 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3031 |
" aspect for show permission information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3032 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3033 |
^ self directoryContentsBrowser viewPermissions |
3892 | 3034 |
! |
3035 |
||
3036 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3037 |
" aspect for show image previev in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3038 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3039 |
^ self directoryContentsBrowser viewPreview |
3892 | 3040 |
! |
3041 |
||
3042 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3043 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3044 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3045 |
^ self directoryContentsBrowser viewSize |
3892 | 3046 |
! |
3047 |
||
4974 | 3048 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3049 |
" aspect for show size-in-bytes information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3050 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3051 |
^ self directoryContentsBrowser viewSizeInBytes |
4974 | 3052 |
! |
3053 |
||
5312 | 3054 |
viewSizeInKiloBytes |
3055 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
3056 |
||
3057 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
3058 |
! |
|
3059 |
||
3892 | 3060 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3061 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3062 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3063 |
^ self directoryContentsBrowser viewTime |
3892 | 3064 |
! |
3065 |
||
3066 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3067 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3068 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3069 |
^ self directoryContentsBrowser viewType |
3892 | 3070 |
! ! |
3071 |
||
3072 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
3073 |
||
3074 |
executeCommand:cmd |
|
3075 |
||
3076 |
self executeCommand:cmd inDirectory:nil |
|
3077 |
! |
|
3078 |
||
5880 | 3079 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 3080 |
| nameString executionBlock| |
3081 |
||
5880 | 3082 |
executionBlock := self getExecutionBlockForCommand:cmd inDirectory:aDirectoryOrNil. |
4516
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3083 |
nameString := 'Execute: ', cmd. |
3892 | 3084 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
3085 |
! |
|
3086 |
||
3087 |
getExecutionBlockForCommand:cmd |
|
3088 |
||
3089 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
3090 |
! |
|
3091 |
||
5880 | 3092 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
3093 |
| dir| |
|
3094 |
||
3095 |
dir := directoryOrNil. |
|
3096 |
directoryOrNil isNil ifTrue:[ |
|
3097 |
dir := self theSingleSelectedDirectoryOrNil. |
|
3098 |
dir isNil ifTrue:[ ^ self]. |
|
3892 | 3099 |
]. |
4523 | 3100 |
|
3101 |
^ [:stream| |
|
3102 |
stream notNil ifTrue:[ |
|
4414 | 3103 |
OperatingSystem |
3104 |
executeCommand:cmd |
|
3105 |
inputFrom:nil |
|
3106 |
outputTo:stream |
|
3107 |
errorTo:stream |
|
3108 |
inDirectory:dir |
|
3109 |
onError:[:status| false]. |
|
3110 |
] |
|
4523 | 3111 |
]. |
3892 | 3112 |
! |
3113 |
||
3114 |
killAllRunningBackgroundProcesses |
|
3115 |
||
3116 |
self backgroundProcesses do:[ : process | |
|
4523 | 3117 |
self notify:'kill ', process name. |
4414 | 3118 |
process terminate. |
3892 | 3119 |
]. |
3120 |
! |
|
3121 |
||
3122 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
3123 |
| stream process appl nameString| |
|
3124 |
||
3125 |
appl := self openCommandResultApplication. |
|
3126 |
stream := appl resultStream. |
|
3127 |
nameString := aString ? 'Execution Result'. |
|
3128 |
appl changeTabTo:nameString. |
|
4523 | 3129 |
|
4516
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3130 |
process := [ [aBlock value:stream] |
4891
5422df926e2d
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
4881
diff
changeset
|
3131 |
ensure:[ |
4516
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3132 |
self backgroundProcesses remove:process ifAbsent:[]. |
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3133 |
appl process value:nil. |
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3134 |
|
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3135 |
"/ close automatically, if there was no output. |
4571 | 3136 |
"/ appl resultStream contents isEmpty ifTrue:[ |
3137 |
"/ appl doClose. |
|
3138 |
"/ ] |
|
4516
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3139 |
] |
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3140 |
] newProcess. |
3892 | 3141 |
process priority:(Processor userBackgroundPriority). |
3142 |
process name:nameString. |
|
3143 |
self backgroundProcesses add:process. |
|
3144 |
appl process value:process. |
|
3145 |
process resume. |
|
3146 |
! ! |
|
3147 |
||
3148 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
3149 |
||
4915 | 3150 |
currentFileNameHolderChanged |
3151 |
"/ self currentFileNameHolderChangedForCommon |
|
3152 |
! |
|
3153 |
||
4577 | 3154 |
currentFileNameHolderChangedForCommon |
5476 | 3155 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3156 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3157 |
selection := self currentFileNameHolder value. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3158 |
self class currentSelection:selection. |
4734 | 3159 |
|
5476 | 3160 |
selectionNotEmpty := selection notEmpty. |
3161 |
self hasSelection value:selectionNotEmpty. |
|
3162 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
4734 | 3163 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3164 |
newDirectories := self directoriesForFiles:selection. |
4011 | 3165 |
oldDirectories := self currentDirectories value. |
3166 |
oldDirectories ~= newDirectories ifTrue:[ |
|
4347 | 3167 |
self currentDirectories value:newDirectories. |
3168 |
size := newDirectories size. |
|
4774 | 3169 |
rootInTreeView := self |
3170 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 3171 |
ifPresentDo:[:appl | appl rootHolder]. |
3172 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
3173 |
self enableDirectoryUp value:(((size == 1) and:[newDirectories first isRootDirectory not]) "or:[(rootInTreeView notNil and:[rootInTreeView value asFilename isRootDirectory not])]"). |
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
3174 |
|
4347 | 3175 |
newDirectories notEmpty ifTrue:[ |
6369 | 3176 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 3177 |
]. |
5074 | 3178 |
self enableHome value:((newDirectories includes:(Filename homeDirectory asAbsoluteFilename))not). |
3179 |
self enableGotoDefault value:((newDirectories includes:(Filename defaultDirectory asAbsoluteFilename))not). |
|
4011 | 3180 |
]. |
4022 | 3181 |
self enableForward value:self canForward. |
4734 | 3182 |
self enableBack value:self canBackward. |
6095 | 3183 |
|
3184 |
self updateCanMake. |
|
4011 | 3185 |
! |
3186 |
||
3187 |
filterModelChanged |
|
3188 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3189 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 3190 |
! |
3191 |
||
3892 | 3192 |
update:something with:aParameter from:changedObject |
3193 |
||
3194 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
3195 |
and the things that have to be done if it runs standalone " |
|
3196 |
||
3197 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 3198 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3199 |
^ self |
3892 | 3200 |
]. |
3989 | 3201 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3202 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3203 |
^ self |
3989 | 3204 |
]. |
4011 | 3205 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3206 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3207 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3208 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3209 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3210 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3211 |
^ self |
4004 | 3212 |
]. |
4781 | 3213 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 3214 |
self notify:nil. |
4781 | 3215 |
^ self |
3216 |
]. |
|
3989 | 3217 |
|
3892 | 3218 |
super update:something with:aParameter from:changedObject |
5543 | 3219 |
! |
3220 |
||
6095 | 3221 |
updateCanMake |
3222 |
|dir can| |
|
3223 |
||
3224 |
can := false. |
|
3225 |
dir := self currentDirectory. |
|
3226 |
dir notNil ifTrue:[ |
|
3227 |
can := (dir asFilename construct:'Makefile') exists. |
|
3228 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
3229 |
can ifFalse:[ |
|
3230 |
can := (self currentDirectory asFilename construct:'nt.mak') exists. |
|
3231 |
] |
|
3232 |
]. |
|
3233 |
]. |
|
3234 |
self canMake value:can. |
|
3235 |
! |
|
3236 |
||
5543 | 3237 |
updateListAfterDelete:colOfFiles |
3238 |
self updateCurrentDirectory |
|
3892 | 3239 |
! ! |
3240 |
||
3241 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
3242 |
||
3243 |
canPaste |
|
3244 |
||
3245 |
^ self aspectFor:#canPaste ifAbsent:[ false asValue ]. |
|
3246 |
! |
|
3247 |
||
3248 |
clipboard |
|
3249 |
||
3250 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
3251 |
! |
|
3252 |
||
3253 |
copyFilesToClipBoard:colOfFiles |
|
3254 |
self putInClipBoard:colOfFiles as:#copy. |
|
3255 |
! |
|
3256 |
||
3257 |
cutFilesToClipBoard:colOfFiles |
|
3258 |
"defete current selected files/directories |
|
3259 |
" |
|
3260 |
self putInClipBoard:colOfFiles as:#cut. |
|
3261 |
! |
|
3262 |
||
3263 |
emptyClipBoard |
|
3264 |
||
3265 |
self clipboard files:nil. |
|
3266 |
self canPaste value:false. |
|
3267 |
! |
|
3268 |
||
3269 |
putInClipBoard:colOfFiles as:aSymbol |
|
3270 |
| stream clp| |
|
3271 |
||
3272 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
3273 |
clp := self clipboard. |
|
3274 |
clp files:nil. |
|
3275 |
clp method:aSymbol. |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3276 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3277 |
stream := String writeStream. |
3892 | 3278 |
stream nextPutAll:aSymbol asString. |
3279 |
stream nextPutAll:' <'. |
|
3280 |
stream nextPutAll:colOfFiles first asString. |
|
3281 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 3282 |
stream nextPutAll:' ...'. |
3892 | 3283 |
]. |
3284 |
stream nextPutAll:'> to clipboard'. |
|
3285 |
||
4523 | 3286 |
self notify:stream contents. |
3892 | 3287 |
stream close. |
3288 |
clp files:colOfFiles. |
|
3289 |
self canPaste value:true. |
|
3290 |
! ! |
|
3291 |
||
3292 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
3293 |
||
3294 |
canDropFiles:dropedObjects for:filename |
|
6284 | 3295 |
|filenameDirString filenameDir| |
3892 | 3296 |
|
3297 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 3298 |
|
3892 | 3299 |
filenameDir := self getDirWithoutFileName:filename. |
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6236
diff
changeset
|
3300 |
filenameDir isWritable ifFalse:[^ false]. |
6284 | 3301 |
|
3892 | 3302 |
filenameDirString := filenameDir asString. |
4963
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
3303 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
3304 |
dropedObjects do:[:aDropObject | |
6284 | 3305 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
3306 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
3307 |
"/ |
|
3308 |
"/ dropFileName := aDropObject theObject. |
|
3309 |
"/ dropFileNameString := dropFileName asString. |
|
3310 |
"/ dropFileName isDirectory ifTrue:[ |
|
3311 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
3312 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
3313 |
"/ ^ false |
|
3314 |
"/ ] |
|
3315 |
"/ ] ifFalse:[ |
|
3316 |
"/ physicalPathName := dropFileName physicalPathName. |
|
3317 |
"/ (filenameDirString = dropFileName directory asString |
|
3318 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
3319 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
3320 |
"/ self notify:'Cannot drop a file into same directory'. |
|
3321 |
"/ ^ false |
|
3322 |
"/ ] |
|
3323 |
"/ ] |
|
3324 |
]. |
|
3325 |
self notify:nil. |
|
3326 |
^ true |
|
3327 |
! |
|
3328 |
||
3329 |
canDropObject:aDropObject into:aDirectory |
|
3330 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
3331 |
||
3332 |
dropFileName := aDropObject theObject. |
|
3333 |
dropFileNameString := dropFileName asString. |
|
3334 |
dropFileName isDirectory ifTrue:[ |
|
3335 |
filenameDirString := aDirectory asString. |
|
3336 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
3337 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
3338 |
^ false |
|
4414 | 3339 |
] |
6284 | 3340 |
] ifFalse:[ |
3341 |
physicalPathName := dropFileName physicalPathName. |
|
3342 |
(aDirectory = dropFileName directory |
|
3343 |
or:[ aDropObject isFileInArchive not |
|
3344 |
and:[physicalPathName notNil |
|
3345 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
3346 |
self notify:'Cannot drop a file into same directory'. |
|
3347 |
^ false |
|
3348 |
] |
|
3349 |
]. |
|
3350 |
^ true. |
|
3892 | 3351 |
! |
3352 |
||
3353 |
doStartDrag:aDropSource in:aView |
|
3354 |
"set the cursors before starting the drag & drop operation |
|
3355 |
" |
|
3356 |
|hdl| |
|
3357 |
||
3358 |
hdl := DragAndDropManager new. |
|
3359 |
||
4337
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
3360 |
hdl disabledCursor:self class disabledCursorImage. |
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
3361 |
hdl enabledCursor:self class enabledCursorImage. |
3892 | 3362 |
hdl alienCursor:nil. |
3363 |
||
4745 | 3364 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft. |
3365 |
||
3892 | 3366 |
! ! |
3367 |
||
3368 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
3369 |
||
3370 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 3371 |
"copy to" |
3372 |
||
3373 |
|copy msg| |
|
3892 | 3374 |
|
5961 | 3375 |
copy := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
3892 | 3376 |
copy result ifTrue:[ |
6190 | 3377 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 3378 |
] ifFalse:[ |
6190 | 3379 |
msg := copy errorString. |
3380 |
]. |
|
3381 |
self notify:msg. |
|
3892 | 3382 |
^ copy result |
3383 |
! |
|
3384 |
||
3385 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
3386 |
|copy| |
|
3387 |
||
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3388 |
self withWaitCursorDo:[ |
5961 | 3389 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3390 |
copy result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3391 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3392 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3393 |
self updateCurrentDirectory. |
3892 | 3394 |
]. |
6373 | 3395 |
^ copy collectionOfCopiedFiles |
3892 | 3396 |
! |
3397 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3398 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3399 |
|size stream msg answer file| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3400 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3401 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3402 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3403 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3404 |
"/ stream nextPutAll:'Copy or move'; cr; cr; nextPutAll:'file'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3405 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3406 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3407 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3408 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3409 |
"/ stream nextPutAll:aCollectionOfFiles first baseName asString allBold. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3410 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3411 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3412 |
"/ stream nextPutAll:aCollectionOfFiles last baseName asString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3413 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3414 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3415 |
"/ stream nextPutAll:aDestinationDirectory asFilename pathName allBold. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3416 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3417 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3418 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3419 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3420 |
stringWithCRs:'Copy or move\\%1:\ %2\to:\ %3 ?' |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3421 |
with:(file type == #regular ifTrue:'file' ifFalse:[file isDirectory ifTrue:'directory' ifFalse:'object']) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3422 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3423 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3424 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3425 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3426 |
stringWithCRs:'Copy or move\\ %1 objects\to:\ %2 ?' |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3427 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3428 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 3429 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3430 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3431 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3432 |
request:msg |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3433 |
label:'Move or Copy' |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
3434 |
image:(WarningBox iconBitmap) |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3435 |
buttonLabels:#('Cancel' 'Move' 'Copy' 'Copy As...') |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3436 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3437 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3438 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3439 |
^ answer. |
3892 | 3440 |
! |
3441 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3442 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 3443 |
"copy or move aColOfSourceFiles to aDirectory. |
3444 |
Asks the used if a move or a copy is wanted. |
|
3445 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
3446 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3447 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3448 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3449 |
answer := self copyOrMoveDialog:aColOfSourceFiles for:aDestinationDirectory. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3450 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3451 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3452 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3453 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3454 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3455 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3456 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3457 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3458 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3459 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3460 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3461 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 3462 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3463 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3464 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3465 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3466 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3467 |
|
4745 | 3468 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3469 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3470 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3471 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 3472 |
^ true. |
3892 | 3473 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3474 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3475 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 3476 |
^ true. |
3892 | 3477 |
]. |
4745 | 3478 |
^ false. |
3892 | 3479 |
! |
3480 |
||
6107 | 3481 |
copySelectionTo |
3482 |
"copy the selected file(s) to another directory" |
|
3483 |
||
6299 | 3484 |
|selectedFiles msg destination directory| |
3485 |
||
3486 |
selectedFiles := self currentFileNameHolder value copy. |
|
3487 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
|
3488 |
||
3489 |
msg := (selectedFiles size > 1) |
|
3490 |
ifTrue:[ 'Copy Selected Items To Directory:' ] |
|
3491 |
ifFalse:[ 'Copy "%1" To Directory:' ]. |
|
3492 |
||
3493 |
destination := Dialog |
|
3494 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first pathName) |
|
6107 | 3495 |
default:(LastMoveDestination ? self currentDirectory) |
3496 |
ok:'Copy' |
|
3497 |
abort:nil. |
|
6299 | 3498 |
destination isEmptyOrNil ifTrue:[^ self]. |
3499 |
destination := destination asFilename. |
|
3500 |
||
3501 |
destination isDirectory ifFalse:[ |
|
3502 |
selectedFiles size == 1 ifTrue:[ |
|
3503 |
directory := destination directory. |
|
3504 |
directory isDirectory ifTrue:[ |
|
3505 |
LastMoveDestination := directory. |
|
3506 |
self copyFile:selectedFiles first to:destination. |
|
3507 |
^ self. |
|
3508 |
] |
|
3509 |
] |
|
3510 |
]. |
|
3511 |
||
3512 |
LastMoveDestination := destination. |
|
3513 |
self copyFiles:selectedFiles to:destination |
|
6107 | 3514 |
! |
3515 |
||
3892 | 3516 |
deleteFile:aFile |
6373 | 3517 |
"delete the selected files/directories" |
3892 | 3518 |
|
3519 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
3520 |
! |
|
3521 |
||
3522 |
deleteFiles:colOfFiles |
|
6373 | 3523 |
"delete some files/directories" |
3524 |
||
5081 | 3525 |
^ self deleteFiles:colOfFiles confirm:true. |
3526 |
! |
|
3527 |
||
3528 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 3529 |
"delete some files/directories" |
3530 |
||
5673 | 3531 |
|delete result| |
3892 | 3532 |
|
5418 | 3533 |
self windowGroup withWaitCursorDo:[ |
5961 | 3534 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
5673 | 3535 |
result := delete result. |
3536 |
result notNil ifTrue:[ |
|
3537 |
result ifFalse:[ |
|
3538 |
self notify:delete errorString. |
|
5753 | 3539 |
] ifTrue:[ |
3540 |
self updateListAfterDelete:colOfFiles. |
|
3541 |
] |
|
4394 | 3542 |
]. |
5673 | 3543 |
]. |
3544 |
^ result. |
|
3892 | 3545 |
! |
3546 |
||
6169 | 3547 |
eraseFiles:colOfFiles |
6373 | 3548 |
"erase (clear and delete) some files/directories" |
3549 |
||
6169 | 3550 |
^ self eraseFiles:colOfFiles confirm:true. |
3551 |
! |
|
3552 |
||
3553 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 3554 |
"erase (clear and delete) some files/directories" |
3555 |
||
6169 | 3556 |
|delete result| |
3557 |
||
3558 |
self windowGroup withWaitCursorDo:[ |
|
3559 |
delete := FileOperation eraseFiles:colOfFiles confirm:confirm. |
|
3560 |
result := delete result. |
|
3561 |
result notNil ifTrue:[ |
|
3562 |
result ifFalse:[ |
|
3563 |
self notify:delete errorString. |
|
3564 |
] ifTrue:[ |
|
3565 |
self updateListAfterDelete:colOfFiles. |
|
3566 |
] |
|
3567 |
]. |
|
3568 |
]. |
|
3569 |
^ result. |
|
3570 |
! |
|
3571 |
||
3892 | 3572 |
moveFile:aSourceFile to:aDestFile |
6373 | 3573 |
"move a file/directory" |
3892 | 3574 |
|
3575 |
|move| |
|
3576 |
||
5961 | 3577 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 3578 |
move result ifTrue:[ |
4523 | 3579 |
self notify:('move ', aSourceFile asString, ' to ', aDestFile asString). |
3892 | 3580 |
] ifFalse:[ |
4523 | 3581 |
self notify:move errorString. |
3892 | 3582 |
]. |
3583 |
self updateCurrentDirectory. |
|
3584 |
^ move result |
|
3585 |
! |
|
3586 |
||
3587 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 3588 |
"move some files to aDirectory" |
3589 |
||
3892 | 3590 |
|move| |
3591 |
||
5419 | 3592 |
self windowGroup withWaitCursorDo:[ |
5961 | 3593 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3594 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3595 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3596 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3597 |
self updateCurrentDirectory. |
3892 | 3598 |
]. |
6373 | 3599 |
^ move collectionOfMovedFiles |
3892 | 3600 |
! |
3601 |
||
6107 | 3602 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3603 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3604 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3605 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3606 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3607 |
destinationDirectory := Dialog |
6352 | 3608 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items To:') |
5789 | 3609 |
default:(LastMoveDestination ? self currentDirectory) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3610 |
ok:'Move' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3611 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3612 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3613 |
|
5789 | 3614 |
LastMoveDestination := destinationDirectory. |
3615 |
self moveFiles:(self currentFileNameHolder value copy) to:destinationDirectory asFilename |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3616 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3617 |
|
3892 | 3618 |
newDirectory |
3619 |
"ask for and create a new directory" |
|
3620 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3621 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3622 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3623 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3624 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3625 |
self warn:'Select a single directory to create a directory'. |
4979
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3626 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3627 |
]. |
4521 | 3628 |
|
3629 |
"/ clever default if selection is an archive... |
|
4979
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3630 |
selectedFiles := self currentSelectedFiles. |
4521 | 3631 |
selectedFiles size == 1 ifTrue:[ |
3632 |
singleSelectedFile := selectedFiles first. |
|
3633 |
||
3634 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
3635 |
(mime notNil and:[mime isArchive]) ifTrue:[ |
|
3636 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
|
3637 |
||
3638 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
4982
c38742d99bfd
care for nil mime in newDirectory
Claus Gittinger <cg@exept.de>
parents:
4979
diff
changeset
|
3639 |
(mime notNil and:[mime isArchive]) ifTrue:[ |
4521 | 3640 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
3641 |
]. |
|
3642 |
]. |
|
3643 |
]. |
|
3644 |
||
5961 | 3645 |
|
4521 | 3646 |
defaultAnswer notNil ifTrue:[ |
5961 | 3647 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 3648 |
] ifFalse:[ |
5961 | 3649 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 3650 |
]. |
3651 |
createOp result ifFalse:[ ^ self]. |
|
3652 |
newFile := createOp createdFile. |
|
3892 | 3653 |
newFile notNil ifTrue:[ |
4414 | 3654 |
self updateCurrentDirectory. |
3892 | 3655 |
] |
3656 |
! |
|
3657 |
||
3658 |
newFile |
|
3659 |
"ask for and create a new file" |
|
3660 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3661 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3662 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3663 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3664 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3665 |
self warn:'Select a single directory to create a file.'. |
4979
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3666 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3667 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3668 |
|
3982 | 3669 |
curFile := self firstSelectedFile. |
3892 | 3670 |
curFile notNil ifTrue:[ |
4414 | 3671 |
file := curFile. |
3892 | 3672 |
] ifFalse:[ |
4414 | 3673 |
file := directory. |
3892 | 3674 |
]. |
5961 | 3675 |
create := FileOperation createFileIn:file. |
3892 | 3676 |
create result ifFalse:[ ^ self]. |
3677 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
3678 |
! |
|
3679 |
||
3680 |
newHardLink |
|
3681 |
"ask for and create a hard link (unix only)" |
|
3682 |
||
6151 | 3683 |
self newLink:#hard. |
3684 |
! |
|
3685 |
||
3686 |
newLink:typeOfLink |
|
3892 | 3687 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
3688 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3689 |
| sel dir create createdFile| |
3892 | 3690 |
|
3691 |
sel := self currentFileNameHolder value. |
|
4979
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3692 |
(sel size ~= 1) ifTrue:[ |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3693 |
self warn:'Select one directory to link'. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3694 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3695 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3696 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3697 |
|
6151 | 3698 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 3699 |
create result ifFalse:[ ^ self]. |
3700 |
createdFile := create createdFile. |
|
3701 |
createdFile notNil ifTrue:[ |
|
6151 | 3702 |
typeOfLink == #soft ifTrue:[ |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3703 |
self updateCurrentDirectory. |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3704 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3705 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3706 |
] |
3892 | 3707 |
]. |
3708 |
! |
|
3709 |
||
3710 |
newSoftLink |
|
3711 |
"ask for and create a soft link (unix only)" |
|
3712 |
||
6151 | 3713 |
self newLink:#soft. |
3892 | 3714 |
! |
3715 |
||
3716 |
pasteFiles |
|
6373 | 3717 |
"paste from clipBoard" |
3718 |
||
3719 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 3720 |
|
3721 |
files := self clipboard files. |
|
3722 |
(files isNil or:[files isEmpty]) ifTrue:[ ^ self ]. |
|
6373 | 3723 |
|
3724 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
3725 |
||
3892 | 3726 |
buffer := self clipboard copy. |
3982 | 3727 |
directories := self currentSelectedDirectories. |
5880 | 3728 |
directories size ~~ 1 ifTrue:[ |
4414 | 3729 |
|box dirStringCol| |
5880 | 3730 |
|
4414 | 3731 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
3732 |
box := ListSelectionBox new. |
|
6373 | 3733 |
box title:'Paste into which directory ?'. |
4414 | 3734 |
box list:dirStringCol. |
3735 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
3736 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
3737 |
box destroy. |
3892 | 3738 |
] ifFalse:[ |
5880 | 3739 |
destination := directories anElement. |
3892 | 3740 |
]. |
6373 | 3741 |
|
3742 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 3743 |
buffer files copy do:[:aFile| |
3744 |
aFile directory = destination ifTrue:[ |
|
3745 |
buffer files remove:aFile. |
|
3746 |
]. |
|
3747 |
]. |
|
3748 |
]. |
|
3749 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6373 | 3750 |
thisIsAFileMoveOperation ifTrue:[ |
5081 | 3751 |
self deleteFiles:copiedFiles confirm:false. |
3752 |
]. |
|
6373 | 3753 |
"/ select those pasted files. |
3754 |
self halt. |
|
3755 |
self currentFileNameHolder value:buffer files. |
|
3892 | 3756 |
! |
3757 |
||
3758 |
renameFile:aFile |
|
3759 |
"rename the selected file(s)" |
|
3760 |
||
3761 |
^ self renameFiles:(OrderedCollection with:aFile). |
|
3762 |
! |
|
3763 |
||
4230 | 3764 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 3765 |
"rename filename to newFileString" |
3766 |
||
3767 |
|rename| |
|
3768 |
||
5961 | 3769 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 3770 |
rename result ifTrue:[ |
4230 | 3771 |
aBoolean ifTrue:[ |
3772 |
self updateAndSelect:(rename renamedFiles). |
|
3773 |
]. |
|
3892 | 3774 |
] ifFalse:[ |
4523 | 3775 |
self notify:rename errorString. |
3892 | 3776 |
]. |
3777 |
^ rename result |
|
3778 |
! |
|
3779 |
||
3780 |
renameFiles:aColOfFiles |
|
6373 | 3781 |
"rename some file(s)" |
3892 | 3782 |
|
3783 |
|rename| |
|
3784 |
||
5961 | 3785 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 3786 |
rename result ifFalse:[ |
4523 | 3787 |
self notify:rename errorString |
3892 | 3788 |
] ifTrue:[ |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3789 |
self updateAndSelect:nil. "/ (rename renamedFiles) |
3892 | 3790 |
]. |
3791 |
^ rename result |
|
3792 |
! |
|
3793 |
||
3794 |
renameSelection |
|
3795 |
"rename the selected file(s)" |
|
3796 |
||
6346 | 3797 |
self renameFiles:(self currentFileNameHolder value copy) |
3892 | 3798 |
! ! |
3799 |
||
4080 | 3800 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 3801 |
|
3952 | 3802 |
bookmarksMenuSpec |
3803 |
<resource: #programMenu> |
|
3804 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3805 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3806 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3807 |
menu := self class baseBookmarksMenuSpec decodeAsLiteralArray. |
4080 | 3808 |
menu findGuiResourcesIn:self. |
3952 | 3809 |
menu receiver:self. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3810 |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3811 |
"/ add the bookmark items ... |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3812 |
bookmarks := self class directoryBookmarks. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3813 |
bookmarks notEmptyOrNil ifTrue:[ |
4414 | 3814 |
menu addItem:(MenuItem labeled:'-'). |
3815 |
bookmarks do:[:dirName | |
|
3816 |
menu addItem:((MenuItem label:dirName asString value:[ |
|
3817 |
(self currentDirectories value includes:dirName) ifFalse:[ |
|
5959 | 3818 |
self setCurrentFileName:dirName. |
4414 | 3819 |
]. |
3820 |
])). |
|
3821 |
]. |
|
3952 | 3822 |
]. |
3823 |
^ menu |
|
3824 |
||
3825 |
"Modified: / 17.8.1998 / 10:13:05 / cg" |
|
3826 |
! |
|
3827 |
||
4347 | 3828 |
canBackward |
3829 |
||
3830 |
||
6369 | 3831 |
^ self directoryHistory canBackward. |
3906 | 3832 |
! |
3833 |
||
3834 |
canForward |
|
3835 |
||
6369 | 3836 |
^ self directoryHistory canForward. |
3906 | 3837 |
! |
3838 |
||
6099 | 3839 |
gotoBookmarksMenuSpec |
3840 |
<resource: #programMenu> |
|
3841 |
||
3842 |
|menu bookmarks| |
|
3843 |
||
6102 | 3844 |
menu := self class baseBookmarksMenuSpec2 decodeAsLiteralArray. |
6099 | 3845 |
menu findGuiResourcesIn:self. |
3846 |
menu receiver:self. |
|
3847 |
||
3848 |
"/ add the bookmark items ... |
|
3849 |
bookmarks := self class directoryBookmarks. |
|
3850 |
bookmarks notEmptyOrNil ifTrue:[ |
|
6102 | 3851 |
menu addItem:(MenuItem labeled:'-'). |
6099 | 3852 |
bookmarks do:[:dirName | |
3853 |
menu addItem:((MenuItem label:dirName asString value:[ |
|
3854 |
(self currentDirectories value includes:dirName) ifFalse:[ |
|
3855 |
self setCurrentFileName:dirName. |
|
3856 |
]. |
|
3857 |
])). |
|
3858 |
]. |
|
3859 |
]. |
|
3860 |
^ menu |
|
3861 |
||
3862 |
"Modified: / 17.8.1998 / 10:13:05 / cg" |
|
3863 |
! |
|
3864 |
||
3892 | 3865 |
menuDirHistory:backOrForward |
3866 |
"initialize the directory menu |
|
3867 |
" |
|
3868 |
<resource: #programMenu > |
|
3869 |
||
3964 | 3870 |
|menu pathList currentSel currentPath| |
3892 | 3871 |
|
3872 |
menu := Menu new. |
|
3873 |
menu receiver:self. |
|
3874 |
||
6369 | 3875 |
self directoryHistory isEmpty ifTrue:[^ nil]. |
3892 | 3876 |
backOrForward == #back ifTrue:[ |
4347 | 3877 |
currentSel := self currentDirectories value. |
3878 |
currentSel size == 1 ifTrue:[ |
|
3879 |
currentPath := currentSel first asString. |
|
3880 |
] ifFalse:[ |
|
3881 |
currentPath := nil. |
|
3882 |
]. |
|
6369 | 3883 |
pathList := self directoryHistory getBackCollection. |
3892 | 3884 |
] ifFalse:[ |
6369 | 3885 |
pathList := self directoryHistory getForwardCollection. |
3892 | 3886 |
]. |
4022 | 3887 |
pathList isEmpty ifTrue:[ ^ nil]. |
6370 | 3888 |
pathList size > 30 ifTrue:[ |
3889 |
pathList := pathList copyTo:30 |
|
3890 |
]. |
|
3964 | 3891 |
pathList do:[:aPath| |
4347 | 3892 |
| menuItem | |
3893 |
menuItem := MenuItem new. |
|
3894 |
menuItem label:aPath. |
|
3895 |
menuItem value:[ |
|
5959 | 3896 |
self setCurrentFileName:(aPath asFilename). |
4347 | 3897 |
]. |
3898 |
menu addItem:menuItem. |
|
3952 | 3899 |
]. |
3892 | 3900 |
^ menu |
3901 |
! |
|
3902 |
||
3903 |
menuDirHistoryBack |
|
3904 |
"initialize the directory menu |
|
3905 |
" |
|
3906 |
<resource: #programMenu > |
|
3907 |
||
3908 |
^ self menuDirHistory:#back. |
|
3909 |
! |
|
3910 |
||
3911 |
menuDirHistoryForward |
|
3912 |
"initialize the directory menu |
|
3913 |
" |
|
3914 |
<resource: #programMenu > |
|
3915 |
||
3916 |
^ self menuDirHistory:#forward. |
|
3906 | 3917 |
! |
3918 |
||
3919 |
menuFileHistory |
|
3920 |
"initialize the file history menu |
|
3921 |
" |
|
3922 |
<resource: #programMenu > |
|
3923 |
||
3924 |
|menu hist text removeItem removeCol| |
|
3925 |
||
3926 |
menu := Menu new. |
|
4080 | 3927 |
menu findGuiResourcesIn:self. |
3906 | 3928 |
menu receiver:self. |
3929 |
||
3930 |
hist := self fileHistory. |
|
3931 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3932 |
|
3906 | 3933 |
removeCol := OrderedCollection new. |
3934 |
hist do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3935 |
aFileItem fileName exists ifTrue:[ |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3936 |
menu addItem:(MenuItem label: aFileItem fileName asString value:[ |
5959 | 3937 |
self setCurrentFileName:(aFileItem fileName). |
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3938 |
self openApplByFileItem:aFileItem |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3939 |
]). |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3940 |
] ifFalse:[ |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3941 |
removeCol add:aFileItem. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3942 |
] |
3906 | 3943 |
]. |
3944 |
"/ remove all not existing history entries |
|
3945 |
removeCol do:[ : el | |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3946 |
hist remove:el. |
3906 | 3947 |
]. |
4080 | 3948 |
removeItem := MenuItem new. |
3949 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3950 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3951 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 3952 |
removeItem label:text. |
3953 |
removeItem value:[ |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3954 |
self fileHistory removeAll. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3955 |
self enableFileHistory value:false. |
3906 | 3956 |
]. |
5977 | 3957 |
menu addSeparator. |
3906 | 3958 |
menu addItem:removeItem. |
3959 |
^ menu |
|
3952 | 3960 |
! |
3961 |
||
4080 | 3962 |
sortMenu |
3963 |
||
3964 |
<resource: #programMenu > |
|
3965 |
||
3966 |
|menu| |
|
3967 |
||
3968 |
menu := Menu new fromLiteralArrayEncoding:self class sortMenu. |
|
3969 |
menu ifNil:[ ^ nil ]. |
|
3970 |
menu findGuiResourcesIn:self. |
|
3971 |
menu receiver:self. |
|
3972 |
^ menu |
|
3973 |
! |
|
3974 |
||
3975 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3976 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3977 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3978 |
specHere := self class viewDetailsMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3979 |
itemsHere := specHere at:2. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3980 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3981 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3982 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3983 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3984 |
spec := specHere copy. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3985 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3986 |
^ spec |
4080 | 3987 |
! |
3988 |
||
3989 |
viewInContentsBrowserMenu |
|
5009 | 3990 |
self |
3991 |
applicationNamed:#DirectoryContentsBrowser |
|
3992 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
3993 |
||
3994 |
^ nil. |
|
4080 | 3995 |
! |
3996 |
||
3952 | 3997 |
visitedDirectoriesMenu |
3998 |
||
3999 |
<resource: #programMenu > |
|
4000 |
||
4001 |
|menu histCopy text removeItem| |
|
4002 |
||
4003 |
menu := Menu new. |
|
4004 |
menu receiver:self. |
|
4005 |
||
6369 | 4006 |
self directoryHistory isEmpty ifTrue:[^ nil]. |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
4007 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:(resources string:'Clear History'). |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
4008 |
text := (resources string:'Clear History'). |
3952 | 4009 |
removeItem := MenuItem new. |
4040 | 4010 |
removeItem translateLabel:true. |
3952 | 4011 |
removeItem label:text. |
4012 |
removeItem value:[ |
|
6369 | 4013 |
self directoryHistory removeAll. |
4347 | 4014 |
self enableForward value:self canForward. |
4015 |
self enableBack value:self canBackward. |
|
3952 | 4016 |
]. |
6369 | 4017 |
histCopy := self directoryHistory. |
3952 | 4018 |
histCopy do:[:aFile| |
4347 | 4019 |
menu addItem:(MenuItem label:aFile asString value:[ |
5959 | 4020 |
self setCurrentFileName:(aFile path asFilename). |
4347 | 4021 |
]). |
3952 | 4022 |
]. |
5977 | 4023 |
menu addSeparator. |
3952 | 4024 |
menu addItem:removeItem. |
4025 |
^ menu |
|
3892 | 4026 |
! ! |
4027 |
||
5880 | 4028 |
!AbstractFileBrowser methodsFor:'menu actions'! |
4029 |
||
4030 |
doCompareTwoFiles |
|
4031 |
self openDiffView. |
|
4032 |
! |
|
4033 |
||
4034 |
doGoDirectoryUp |
|
5960 | 4035 |
| upDir directory rootInTreeView| |
5880 | 4036 |
|
4037 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
4038 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 4039 |
directory := self currentDirectory. |
4040 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 4041 |
] ifFalse:[ |
4042 |
rootInTreeView := self |
|
4043 |
applicationNamed:#DirectoryTreeBrowser |
|
4044 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 4045 |
directory := rootInTreeView value asFilename. |
4046 |
]. |
|
4047 |
upDir := directory directory. |
|
5959 | 4048 |
self setCurrentFileName:upDir. |
5880 | 4049 |
! |
4050 |
||
4051 |
doGotoDefaultDirectory |
|
4052 |
self gotoFile:(Filename defaultDirectory). |
|
4053 |
! |
|
4054 |
||
4055 |
doGotoHomeDirectory |
|
4056 |
||
4057 |
| home | |
|
4058 |
||
4059 |
home := Filename homeDirectory. |
|
4060 |
self gotoFile:home. |
|
4061 |
! |
|
4062 |
||
4063 |
fileGetInfo:longInfo |
|
4064 |
"get info on selected file - show it in a box" |
|
4065 |
||
4066 |
|string box updater| |
|
4067 |
||
4068 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
4069 |
string notNil ifTrue:[ |
|
4070 |
box := InfoBox title:string. |
|
4071 |
updater := [ |
|
4072 |
[true] whileTrue:[ |
|
4073 |
Delay waitForSeconds:2. |
|
4074 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
4075 |
string isNil ifTrue:[ ^ self]. |
|
4076 |
box title:string |
|
4077 |
] |
|
4078 |
] fork. |
|
4079 |
box show. |
|
4080 |
updater terminate. |
|
4081 |
box destroy |
|
4082 |
] |
|
4083 |
! ! |
|
4084 |
||
4849 | 4085 |
!AbstractFileBrowser methodsFor:'menu actions-cvs'! |
3892 | 4086 |
|
4087 |
cvsAddAndCommit |
|
4849 | 4088 |
self cvsAddAndCommitAsBinary:false |
4089 |
! |
|
4090 |
||
4091 |
cvsAddAndCommitAsBinary:asBinary |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4092 |
|sel log logArg cmd dir executionBlock nameString| |
3892 | 4093 |
|
4094 |
log := Dialog |
|
4849 | 4095 |
requestText:(resources string:'Enter initial log message') |
4414 | 4096 |
lines:10 |
4097 |
columns:70 |
|
4098 |
initialAnswer:nil. |
|
3892 | 4099 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4100 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4101 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4102 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4103 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4104 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4105 |
|
3982 | 4106 |
sel := self currentSelectedFiles. |
3892 | 4107 |
executionBlock := [ : stream | |
4414 | 4108 |
log notNil ifTrue:[ |
4109 |
sel size > 0 ifTrue:[ |
|
4110 |
sel do:[:fn | |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4111 |
|
4414 | 4112 |
dir := self getDirWithoutFileName:fn. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4113 |
cmd := 'cvs add ',logArg,' ',fn baseName. |
6204 | 4114 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
4849 | 4115 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4116 |
cmd := ('cvs commit -l ',logArg,' ',fn baseName). |
6204 | 4117 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
4849 | 4118 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4119 |
asBinary ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4120 |
cmd := ('cvs admin -kb ' , fn baseName). |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4121 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4122 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4123 |
cmd := ('cvs upd ' , fn baseName). |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4124 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4125 |
]. |
4414 | 4126 |
] |
4127 |
] |
|
4128 |
] |
|
3892 | 4129 |
]. |
4107 | 4130 |
nameString := 'Command> cvs add and commit'. |
3892 | 4131 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4132 |
! |
|
4133 |
||
4849 | 4134 |
cvsAddBinaryAndCommit |
4135 |
self cvsAddAndCommitAsBinary:true |
|
4136 |
! |
|
4137 |
||
3892 | 4138 |
cvsCommit |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4139 |
|nSel log logArg msg cmd selectedFiles sel executionBlock nameString| |
3892 | 4140 |
|
3982 | 4141 |
selectedFiles:= self currentSelectedFiles. |
3892 | 4142 |
nSel := selectedFiles size. |
4143 |
||
4144 |
nSel == 1 ifTrue:[ |
|
4414 | 4145 |
msg := resources string:'enter log message for checkIn of ''%1''' with:(selectedFiles first baseName) |
3892 | 4146 |
] ifFalse:[ |
4414 | 4147 |
nSel > 1 ifTrue:[ |
4148 |
msg := resources string:'enter log message for %1 files to checkIn' with:nSel printString |
|
4149 |
] ifFalse:[ |
|
4150 |
msg := resources string:'enter log message for checkIn' |
|
4151 |
] |
|
3892 | 4152 |
]. |
4153 |
||
4154 |
log := Dialog |
|
4414 | 4155 |
requestText:msg |
4156 |
lines:10 |
|
4157 |
columns:70 |
|
4158 |
initialAnswer:nil. |
|
3892 | 4159 |
|
4663 | 4160 |
log isNil ifTrue:[^ self]. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4161 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4162 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4163 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4164 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4165 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4166 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4167 |
|
4663 | 4168 |
sel := self currentFileNameHolder value. |
4169 |
sel isEmpty ifTrue:[ ^ self ]. |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4170 |
executionBlock := [:stream | |
4663 | 4171 |
log notNil ifTrue:[ |
4172 |
sel size > 0 ifTrue:[ |
|
4173 |
sel do:[:fn | |
|
6204 | 4174 |
| dir | |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4175 |
|
4663 | 4176 |
dir := fn directory. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4177 |
cmd := 'cvs commit ',logArg,' ' , fn baseName. |
6204 | 4178 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
4663 | 4179 |
] |
4180 |
] |
|
4181 |
] |
|
4107 | 4182 |
]. |
4183 |
nameString := 'Command> cvs commit'. |
|
4184 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 4185 |
! |
4186 |
||
4187 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
|
4188 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
4189 |
||
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4190 |
|toRemove updateRunning executionBlock nameString| |
3892 | 4191 |
|
4192 |
updateRunning := self backgroundProcesses value notEmpty. |
|
4193 |
self killAllRunningBackgroundProcesses. |
|
4194 |
toRemove := OrderedCollection new. |
|
4195 |
||
4196 |
executionBlock := [ : stream | |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4197 |
|cmd logArg| |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4198 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4199 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4200 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4201 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4202 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4203 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4204 |
|
4414 | 4205 |
filesToRemove do:[:fileName | |
4206 |
OperatingSystem accessDeniedErrorSignal handle:[:ex| |
|
4207 |
"was not able to remove it" |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4208 |
| lastError msg | |
4414 | 4209 |
lastError := OperatingSystem lastErrorString. |
4210 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
4211 |
lastError isNil ifFalse:[ |
|
4212 |
msg := msg , '\\(' , lastError , ')' |
|
4213 |
]. |
|
4214 |
Dialog warn:msg withCRs |
|
4215 |
] do:[ |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6236
diff
changeset
|
4216 |
(fileName isSymbolicLink) ifFalse:[ |
4414 | 4217 |
fileName remove. |
4218 |
cmd := ('cvs remove -f ' , fileName baseName). |
|
6204 | 4219 |
(self getExecutionBlockForCommand:cmd) value:stream. |
4414 | 4220 |
] |
4221 |
]. |
|
4222 |
]. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4223 |
cmd := 'cvs commit -l ',logArg. |
6204 | 4224 |
(self getExecutionBlockForCommand:cmd) value:stream. |
3892 | 4225 |
]. |
4107 | 4226 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
3892 | 4227 |
filesToRemove size > 1 ifTrue:[ |
4414 | 4228 |
nameString := nameString, ' ...'. |
3892 | 4229 |
]. |
4230 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
4231 |
! |
|
4232 |
||
4233 |
cvsRemoveFileAndCVSContainer |
|
4234 |
|sel question aswer| |
|
4235 |
||
4294 | 4236 |
sel := self currentSelectedFiles copy. |
3892 | 4237 |
sel size > 0 ifTrue:[ |
4294 | 4238 |
sel size > 1 ifTrue:[ |
4239 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:(sel size) |
|
4240 |
] ifFalse:[ |
|
4241 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(sel first baseName allBold) |
|
4242 |
]. |
|
4243 |
||
4244 |
aswer := Dialog |
|
4245 |
confirm:question withCRs |
|
4246 |
yesLabel:(resources at:'Remove') |
|
4247 |
noLabel:(resources at:'Cancel'). |
|
4248 |
aswer ifTrue:[ |
|
4249 |
self withCursor:(Cursor wait) do:[ |
|
4250 |
self cvsRemoveAndRemoveFromCVS:sel |
|
4251 |
] |
|
4252 |
] |
|
3892 | 4253 |
] |
4254 |
! |
|
4255 |
||
4256 |
cvsUpdateAll |
|
4257 |
| cmd | |
|
4258 |
||
4259 |
cmd := 'cvs upd -l'. |
|
4260 |
self executeCommand:cmd. |
|
4261 |
! |
|
4262 |
||
4263 |
cvsUpdateAllRecursive |
|
4264 |
| cmd | |
|
4265 |
||
4266 |
cmd := 'cvs upd -d'. |
|
4267 |
self executeCommand:cmd. |
|
4268 |
! |
|
4269 |
||
4270 |
cvsUpdateSelection |
|
4271 |
| selectedFiles stream| |
|
4272 |
||
3982 | 4273 |
selectedFiles:= self currentSelectedFiles. |
3892 | 4274 |
stream := WriteStream on:''. |
4275 |
stream nextPutAll:'cvs upd '. |
|
4276 |
selectedFiles do:[: file | |
|
4414 | 4277 |
stream nextPutAll:file baseName. |
4278 |
stream space. |
|
3892 | 4279 |
]. |
4280 |
self executeCommand:stream contents. |
|
4281 |
stream close. |
|
4282 |
! ! |
|
4283 |
||
6169 | 4284 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
3892 | 4285 |
|
4453
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4286 |
copyFiles |
6169 | 4287 |
self |
4288 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
4453
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4289 |
! |
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4290 |
|
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4291 |
cutFiles |
6169 | 4292 |
self |
4293 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
4453
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4294 |
! |
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4295 |
|
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4296 |
deleteFiles |
6169 | 4297 |
self |
4298 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
4299 |
! |
|
4300 |
||
4301 |
eraseFiles |
|
4302 |
self |
|
4303 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
4940
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4304 |
! |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4305 |
|
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4306 |
openSettingsDialog |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4307 |
|dialog| |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4308 |
|
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4309 |
dialog := FileBrowserV2SettingsDialog new. |
5034 | 4310 |
dialog settingsDialog:self. |
4940
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4311 |
dialog allButOpen. |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4312 |
dialog doReload. |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4313 |
dialog openWindow |
6169 | 4314 |
! |
4315 |
||
4316 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
4317 |
|files dirs| |
|
4318 |
||
4319 |
files := self currentSelectedFiles. |
|
4320 |
files notEmpty ifTrue:[ |
|
4321 |
aBlock value:files. |
|
4322 |
] ifFalse:[ |
|
4323 |
dirs := self currentSelectedDirectories. |
|
4324 |
dirs notEmpty ifTrue:[ |
|
4325 |
aBlock value:dirs. |
|
4326 |
]. |
|
4327 |
]. |
|
3892 | 4328 |
! ! |
4329 |
||
4849 | 4330 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
4331 |
||
4332 |
openAboutThisApplication |
|
4333 |
"opens an about box for this application." |
|
4334 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4335 |
Dialog aboutClass:self class. |
4849 | 4336 |
! |
4337 |
||
4338 |
openHTMLDocument:relativeDocPath |
|
4339 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
4340 |
! ! |
|
4341 |
||
4342 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
|
3892 | 4343 |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4344 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4345 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4346 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4347 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4348 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4349 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4350 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4351 |
"/ q&d hack to get my images converted for old html-browsers... |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4352 |
"/ this should come from somewhere else (do we need an ImageConverter class ?). |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4353 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4354 |
conv := OrderedCollection new. |
4722 | 4355 |
conv add:('anytopnm %1 > %2' -> 'pnm'). |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4356 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4357 |
outSuffix = 'png' ifTrue:[ |
4722 | 4358 |
conv add:('pnmtopng %1 > %2' -> 'png'). |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4359 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4360 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4361 |
outSuffix = 'gif' ifTrue:[ |
4722 | 4362 |
conv add:('ppmquant 256 %1 | ppmtogif > %2' -> 'gif'). |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4363 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4364 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4365 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 4366 |
conv add:('ppmtoxpm %1 > %2' -> 'xpm'). |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4367 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4368 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4369 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 4370 |
conv add:('ppmtojpeg %1 > %2' -> 'jpg'). |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4371 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4372 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4373 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4374 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4375 |
|
4367 | 4376 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4377 |
self convertImageToSuffix:'gif' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4378 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4379 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4380 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4381 |
self convertImageToSuffix:'jpg' |
4531 | 4382 |
! |
4383 |
||
4384 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4385 |
self convertImageToSuffix:'png' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4386 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4387 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4388 |
convertImageToSuffix:outSuffix |
4922 | 4389 |
|image writer tempFileXPM chainOfConversions conversionStream skipSignal |
4390 |
inFile outFile eachConversionSuffixCommandPair doneWithThisFile |
|
5880 | 4391 |
eachConversionSuffix eachConversionCommand tempFileTemplate |
4392 |
filesToConvert| |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4393 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4394 |
"/ [ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4395 |
skipSignal := Signal new. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4396 |
|
4367 | 4397 |
self withActivityIndicationDo:[ |
5880 | 4398 |
filesToConvert := self currentFileNameHolder value copy. |
4399 |
filesToConvert do:[:fileName | |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4400 |
skipSignal handle:[:ex | ] |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4401 |
do:[ |
4722 | 4402 |
|answer| |
4403 |
||
4404 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4405 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4406 |
fileName isDirectory ifFalse:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4407 |
outFile := fileName withSuffix:outSuffix. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4408 |
outFile exists ifTrue:[ |
4722 | 4409 |
answer := Dialog |
4410 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
|
4411 |
default:false. |
|
4412 |
answer isNil ifTrue:[AbortSignal raise]. |
|
4413 |
answer ifFalse:[ |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4414 |
skipSignal raise. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4415 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4416 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4417 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4418 |
image := Image fromFile:fileName. |
4922 | 4419 |
image notNil ifTrue:[ |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4420 |
writer := MIMETypes imageReaderForSuffix:outSuffix. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4421 |
(writer notNil and:[writer canRepresent:image]) ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4422 |
writer save:image onFile:outFile. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4423 |
skipSignal raise. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4424 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4425 |
]. |
4922 | 4426 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4427 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4428 |
chainOfConversions isNil ifTrue:[ skipSignal raise ]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4429 |
conversionStream := chainOfConversions readStream. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4430 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4431 |
doneWithThisFile := false. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4432 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4433 |
tempFileTemplate := Filename newTemporary. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4434 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4435 |
inFile := fileName. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4436 |
eachConversionSuffixCommandPair := conversionStream next. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4437 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4438 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4439 |
eachConversionCommand == #readToXPM ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4440 |
image := Image fromFile:(inFile pathName). |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4441 |
image isNil ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4442 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4443 |
skipSignal raise. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4444 |
] ifFalse:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4445 |
tempFileXPM := tempFileTemplate withSuffix:'xpm'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4446 |
image saveOn:tempFileXPM using:XPMReader. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4447 |
inFile := tempFileXPM. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4448 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4449 |
eachConversionSuffixCommandPair := conversionStream next. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4450 |
]. |
4531 | 4451 |
|
4367 | 4452 |
[ |
5880 | 4453 |
|command errOutput errMsg| |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4454 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4455 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4456 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4457 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
4531 | 4458 |
|
4722 | 4459 |
self notify:(resources string:'Converting: %1 to %2...' with:fileName baseName with:eachConversionSuffix). |
4460 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4461 |
outFile := tempFileTemplate withSuffix:eachConversionSuffix. |
4722 | 4462 |
command := eachConversionCommand |
4463 |
bindWith:(inFile pathName) |
|
4464 |
with:(outFile pathName). |
|
4465 |
||
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
4466 |
errOutput := String writeStream. |
4922 | 4467 |
|
4722 | 4468 |
(OperatingSystem executeCommand:command errorTo:errOutput) |
4367 | 4469 |
ifFalse:[ |
5880 | 4470 |
errMsg := resources |
4722 | 4471 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
4472 |
with:inFile baseName allBold |
|
4473 |
with:eachConversionSuffix |
|
4474 |
with:eachConversionCommand allBold |
|
5880 | 4475 |
with:errOutput contents. |
4476 |
filesToConvert size == 1 ifTrue:[ |
|
4477 |
Dialog warn:errMsg |
|
4478 |
] ifFalse:[ |
|
4479 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
|
4480 |
^ self |
|
4481 |
] |
|
4482 |
]. |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4483 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4484 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4485 |
outFile delete. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4486 |
skipSignal raise |
4367 | 4487 |
]. |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4488 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
4531 | 4489 |
inFile := outFile. |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4490 |
eachConversionSuffixCommandPair := conversionStream next |
4367 | 4491 |
]. |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4492 |
] ifCurtailed:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4493 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
4531 | 4494 |
outFile delete. |
4495 |
]. |
|
4496 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4497 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
4531 | 4498 |
self updateAndSelect:nil. |
4367 | 4499 |
] |
4500 |
] |
|
4501 |
]. |
|
6190 | 4502 |
self notify:nil. |
4367 | 4503 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4504 |
"/ ] fork. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4505 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4506 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4507 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4508 |
self convertImageToSuffix:'xpm' |
4367 | 4509 |
! |
4510 |
||
3892 | 4511 |
createProjectAndOpenProjectBrowser |
4512 |
|nm f s directory| |
|
4513 |
||
4514 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 4515 |
directory := self currentDirectory. |
3892 | 4516 |
nm := directory baseName. |
4517 |
f := (directory construct:nm) withSuffix:'prj'. |
|
4518 |
f exists ifTrue:[ |
|
4414 | 4519 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
4520 |
^ self. |
|
3892 | 4521 |
]. |
4522 |
s := f writeStream. |
|
4523 |
s nextPutAll:' |
|
4524 |
name ''' , nm , ''' |
|
4525 |
type #classLibrary |
|
4526 |
package #''private:' , nm , ''' |
|
4527 |
prerequisites nil |
|
4528 |
||
4529 |
classes #( ) |
|
4530 |
'. |
|
4531 |
s close. |
|
4532 |
ProjectBrowser openOnFile:f. |
|
4533 |
! |
|
4534 |
||
5880 | 4535 |
doExecuteCommand |
4536 |
"execute an OperatingSystem-command" |
|
4537 |
||
4538 |
| action fileName| |
|
4539 |
||
4540 |
fileName := self firstSelectedFile. |
|
4541 |
action := [:command | |
|
4542 |
self addToCommandHistory:command for:fileName. |
|
4543 |
self executeCommand:command. |
|
4544 |
]. |
|
4545 |
self askForCommandFor:fileName thenDo:action |
|
4546 |
! |
|
4547 |
||
4548 |
doExecuteScript |
|
4549 |
"execute a smalltalk script" |
|
4550 |
||
4551 |
|textHolder dialog template dummyClass dummyInstance| |
|
4552 |
||
4553 |
template := |
|
4554 |
'"/ Smalltalk script: |
|
4555 |
||
4556 |
"/ the following variables are accessable: |
|
4557 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
|
4558 |
"/ selectedFiles (= ...) |
|
4559 |
"/ |
|
4560 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
4561 |
"/ |
|
4562 |
"/ Useful operations are: |
|
4563 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
4564 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
4565 |
"/ directory directory |
|
4566 |
"/ |
|
4567 |
"/ example: move all files which match a aarticular pattern to |
|
4568 |
"/ a separate directory: |
|
4569 |
"/ |
|
4570 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
4571 |
"/ |
|
4572 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
4573 |
"/ |
|
4574 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
4575 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
4576 |
"/ idx := eachBaseNameString indexOf:$_. |
|
4577 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
4578 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
4579 |
"/ newDir := directory construct:prefix. |
|
4580 |
"/ newDir exists ifFalse:[ |
|
4581 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
4582 |
"/ newDir makeDirectory. |
|
4583 |
"/ ]. |
|
4584 |
"/ ]. |
|
4585 |
"/ newDir exists ifTrue:[ |
|
4586 |
"/ oldFile := directory construct:eachBaseNameString. |
|
4587 |
"/ newFile := newDir construct:rest. |
|
4588 |
"/ oldFile moveTo:newFile |
|
4589 |
"/ ] |
|
4590 |
"/ ] |
|
4591 |
"/ ] |
|
4592 |
'. |
|
4593 |
||
4594 |
LastScriptBlockString isNil ifTrue:[ |
|
4595 |
LastScriptBlockString := template. |
|
4596 |
]. |
|
4597 |
||
4598 |
textHolder := ValueHolder new. |
|
4599 |
dialog := Dialog |
|
4600 |
forRequestText:(resources string:'Enter script') |
|
4601 |
editViewClass:CodeView |
|
4602 |
lines:25 |
|
4603 |
columns:70 |
|
4604 |
initialAnswer:LastScriptBlockString |
|
4605 |
model:textHolder. |
|
4606 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
4607 |
dialog open. |
|
4608 |
dialog accepted ifFalse:[^ self]. |
|
4609 |
||
4610 |
LastScriptBlockString := textHolder value. |
|
4611 |
||
4612 |
Class classConventionViolationConfirmationQuerySignal |
|
4613 |
answer:true |
|
4614 |
do:[ |
|
4615 |
dummyClass := Object class |
|
4616 |
name:#Dummy |
|
4617 |
inEnvironment:nil |
|
4618 |
subclassOf:Object |
|
4619 |
instanceVariableNames:'directory selectedFiles' |
|
4620 |
variable:false |
|
4621 |
words:true |
|
4622 |
pointers:true |
|
4623 |
classVariableNames:'' |
|
4624 |
poolDictionaries:'' |
|
4625 |
category:#dummyCategory |
|
4626 |
comment:nil |
|
4627 |
changed:true. |
|
4628 |
]. |
|
4629 |
||
4630 |
dummyInstance := dummyClass basicNew. |
|
4631 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
4632 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
4633 |
||
4634 |
Compiler |
|
4635 |
evaluate:textHolder value |
|
4636 |
in:nil |
|
4637 |
receiver:dummyInstance |
|
4638 |
notifying:nil |
|
4639 |
logged:false |
|
4640 |
ifFail:[] |
|
4641 |
compile:true. |
|
4642 |
||
4643 |
"/ fileName := self firstSelectedFile. |
|
4644 |
"/ action := [:command | |
|
4645 |
"/ self addToCommandHistory:command for:fileName. |
|
4646 |
"/ self executeCommand:command. |
|
4647 |
"/ ]. |
|
4648 |
"/ self askForCommandFor:fileName thenDo:action |
|
4649 |
! |
|
4650 |
||
4230 | 4651 |
doMake |
4652 |
||
4653 |
| cmd | |
|
4654 |
||
4655 |
cmd := 'make'. |
|
4656 |
self executeCommand:cmd. |
|
4657 |
! |
|
4658 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4659 |
doOpenSettings |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4660 |
|
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4661 |
| inst | |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4662 |
|
4581 | 4663 |
inst := FileBrowserV2SettingsDialog new. |
5034 | 4664 |
inst settingsDialog:self. |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4665 |
inst open. |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4666 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4667 |
|
3892 | 4668 |
fileFileIn |
4669 |
"fileIn the selected file(s)" |
|
4670 |
||
4671 |
self fileFileInLazy:false |
|
4672 |
! |
|
4673 |
||
4674 |
fileFileInLazy |
|
4675 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
4676 |
||
4677 |
self fileFileInLazy:true |
|
4678 |
! |
|
4679 |
||
4680 |
fileFileInLazy:lazy |
|
4681 |
"fileIn the selected file(s)" |
|
4682 |
||
4345 | 4683 |
|
4878 | 4684 |
"/ [ |
4345 | 4685 |
self withActivityIndicationDo:[ |
4686 |
| selectedFiles| |
|
4687 |
selectedFiles:= self currentSelectedFiles. |
|
4688 |
selectedFiles do:[:fileName | |
|
4523 | 4689 |
self notify:('File in:', fileName baseName). |
4345 | 4690 |
self singleFileFileIn:fileName lazy:lazy |
4691 |
]. |
|
6190 | 4692 |
self notify:nil. |
4345 | 4693 |
] |
4878 | 4694 |
"/ ] fork. |
3892 | 4695 |
! |
4696 |
||
4697 |
fileFileInToNameSpace |
|
4698 |
"fileIn the selected file(s)<into a nameSpace" |
|
4699 |
||
4700 |
|ns listOfKnownNameSpaces| |
|
4701 |
||
4702 |
listOfKnownNameSpaces := Set new. |
|
4703 |
NameSpace |
|
4414 | 4704 |
allNamespaces |
4705 |
do:[:eachNameSpace | |
|
4706 |
listOfKnownNameSpaces add:eachNameSpace name |
|
4707 |
]. |
|
3892 | 4708 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
4709 |
||
4710 |
ns := Dialog |
|
4414 | 4711 |
request:'During fileIn, new classes are created in nameSpace:' |
4712 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
4713 |
list:listOfKnownNameSpaces. |
|
3892 | 4714 |
ns isEmptyOrNil ifTrue:[^ self]. |
4715 |
||
4716 |
LastEnforcedNameSpace := ns. |
|
4717 |
ns := NameSpace name:ns. |
|
4718 |
||
4719 |
Class nameSpaceQuerySignal |
|
4414 | 4720 |
answer:ns |
4721 |
do:[ |
|
4722 |
self fileFileInLazy:false |
|
4723 |
] |
|
3892 | 4724 |
! |
4725 |
||
4726 |
fileFindAllDuplicates |
|
4727 |
"scan directory and all subdirs for duplicate files" |
|
4728 |
||
4729 |
|fileNames dir infoDir filesBySize |
|
4730 |
result info dirPrefix myName stream textBox maxLength directories| |
|
4731 |
||
4732 |
||
4733 |
self withWaitCursorDo:[ |
|
4414 | 4734 |
result := Dictionary new. |
4735 |
myName := self class name asString. |
|
4736 |
directories := self currentSelectedDirectories. |
|
4737 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 4738 |
|
4414 | 4739 |
dir := directories first. |
3892 | 4740 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4741 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4742 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4743 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 4744 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
4745 |
with:ex pathName |
|
4746 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4747 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4748 |
]. |
4765 | 4749 |
fileNames := fileNames |
4750 |
collect:[:fn | dir construct:fn] |
|
4751 |
thenSelect:[:fn | fn isDirectory not]. |
|
3892 | 4752 |
|
4753 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 4754 |
infoDir := Dictionary new. |
4755 |
fileNames do:[:fn | |
|
4756 |
infoDir at:fn put:(fn fileSize) |
|
4757 |
]. |
|
4758 |
||
4759 |
"/ for each, get the files size. |
|
4760 |
"/ in a first pass, look for files of the same size and |
|
4761 |
"/ compare them ... |
|
3892 | 4762 |
|
4763 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 4764 |
filesBySize := Dictionary new. |
4765 |
infoDir keysAndValuesDo:[:fn :sz | |
|
4766 |
|entry| |
|
4767 |
||
4768 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
4769 |
entry add:fn. |
|
4770 |
]. |
|
4771 |
||
4772 |
"/ any of same size ? |
|
3892 | 4773 |
|
4774 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 4775 |
filesBySize do:[:entry | |
4776 |
|files| |
|
4777 |
||
4778 |
entry size > 1 ifTrue:[ |
|
4779 |
files := entry asArray. |
|
4780 |
1 to:files size-1 do:[:idx1 | |
|
4781 |
idx1+1 to:files size do:[:idx2 | |
|
4782 |
|fn1 fn2| |
|
4783 |
||
4784 |
fn1 := files at:idx1. |
|
4785 |
fn2 := files at:idx2. |
|
3892 | 4786 |
|
4787 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 4788 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
4789 |
"/ compare the files |
|
4790 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 4791 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 4792 |
result at:fn1 put:fn2. |
4793 |
] |
|
4794 |
] |
|
4795 |
] |
|
4796 |
] |
|
4797 |
] |
|
4798 |
]. |
|
3892 | 4799 |
|
4800 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 4801 |
dirPrefix := dir pathName. |
4802 |
result := result associations. |
|
4803 |
result := result collect:[:assoc | |
|
4804 |
|f1 f2| |
|
4805 |
||
4806 |
f1 := assoc key name. |
|
4807 |
f2 := assoc value name. |
|
4808 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
4809 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
4810 |
]. |
|
4811 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
4812 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
4813 |
]. |
|
4814 |
f1 < f2 ifTrue:[ |
|
4815 |
f2 -> f1 |
|
4816 |
] ifFalse:[ |
|
4817 |
f1 -> f2 |
|
4818 |
] |
|
4819 |
]. |
|
4820 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
4821 |
||
4822 |
info := OrderedCollection new. |
|
4823 |
result do:[:assoc | |
|
4824 |
info add:(assoc key , ' same as ' , assoc value) |
|
4825 |
]. |
|
4826 |
info isEmpty ifTrue:[ |
|
5543 | 4827 |
Dialog information:'No duplicate files found.'. |
4828 |
^ self. |
|
4414 | 4829 |
]. |
3892 | 4830 |
]. |
4831 |
||
4832 |
stream := WriteStream on:''. |
|
4833 |
info do:[:el| |
|
4535 | 4834 |
stream nextPutLine:el. |
3892 | 4835 |
]. |
5542 | 4836 |
|
3892 | 4837 |
textBox := TextBox new. |
4838 |
textBox initialText:(stream contents). |
|
5542 | 4839 |
stream close. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4840 |
textBox title:'File duplicates in directory: ', dir asString. |
3892 | 4841 |
textBox readOnly:true. |
4842 |
textBox noCancel. |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4843 |
textBox label:'Duplicates in ', dir asString. |
3892 | 4844 |
maxLength := 10. |
4845 |
info do:[: el | |
|
4414 | 4846 |
maxLength := maxLength max:(el size). |
3892 | 4847 |
]. |
4848 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 4849 |
textBox maxExtent:Screen current extent. |
4850 |
textBox openModeless. |
|
3892 | 4851 |
! |
4852 |
||
4853 |
fileFindDuplicates |
|
4854 |
"scan directory for duplicate files" |
|
4855 |
||
5543 | 4856 |
|fileNames infoDir filesBySize result info stream textBox maxLength directories allFiles titleStream size| |
3892 | 4857 |
|
4858 |
self withWaitCursorDo:[ |
|
4355 | 4859 |
result := Dictionary new. |
4860 |
||
4861 |
directories := self currentSelectedDirectories. |
|
4862 |
directories isEmpty ifTrue:[^ self]. |
|
4863 |
||
4864 |
allFiles := OrderedCollection new. |
|
4865 |
directories do:[ : dir| |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4866 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4867 |
fileNames := dir directoryContents. |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4868 |
fileNames notNil ifTrue:[ |
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4869 |
fileNames := fileNames |
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4870 |
collect:[:fn | dir construct:fn] |
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4871 |
thenSelect:[:fn | fn isDirectory not]. |
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4872 |
allFiles addAll:fileNames. |
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4873 |
] |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4874 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 4875 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
4876 |
with:ex pathName |
|
4877 |
with:ex description). |
|
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4878 |
ex proceedWith:nil. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4879 |
]. |
4355 | 4880 |
]. |
4881 |
||
4882 |
infoDir := Dictionary new. |
|
4883 |
allFiles do:[:fn | |
|
4884 |
infoDir at:fn put:(fn info) |
|
4885 |
]. |
|
4886 |
||
4887 |
"/ for each, get the files size. |
|
4888 |
"/ in a first pass, look for files of the same size and |
|
4889 |
"/ compare them ... |
|
4890 |
||
4891 |
filesBySize := Dictionary new. |
|
4892 |
infoDir keysAndValuesDo:[:fn :info | |
|
4893 |
|sz entry| |
|
4894 |
||
4895 |
sz := info size. |
|
4896 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
4897 |
entry add:fn. |
|
4898 |
]. |
|
4899 |
||
4900 |
"/ any of same size ? |
|
4901 |
||
4902 |
filesBySize do:[:entry | |
|
4903 |
|files| |
|
4904 |
||
4905 |
entry size > 1 ifTrue:[ |
|
4906 |
files := entry asArray. |
|
4907 |
1 to:files size-1 do:[:idx1 | |
|
4908 |
idx1+1 to:files size do:[:idx2 | |
|
4909 |
|fn1 fn2| |
|
4910 |
||
4911 |
fn1 := files at:idx1. |
|
4912 |
fn2 := files at:idx2. |
|
4913 |
||
4914 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
4915 |
"/ compare the files |
|
4916 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 4917 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4355 | 4918 |
result at:fn1 put:fn2. |
4919 |
] |
|
4920 |
] |
|
4921 |
] |
|
4922 |
] |
|
4923 |
] |
|
4924 |
]. |
|
4925 |
||
4926 |
result := result associations. |
|
4927 |
result := result collect:[:assoc | |
|
4928 |
|f1 f2| |
|
4929 |
||
4930 |
f1 := assoc key asString. |
|
4931 |
f2 := assoc value asString. |
|
4932 |
f1 < f2 ifTrue:[ |
|
4933 |
f2 -> f1 |
|
4934 |
] ifFalse:[ |
|
4935 |
f1 -> f2 |
|
4936 |
] |
|
4937 |
]. |
|
5789 | 4938 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
4939 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
4355 | 4940 |
|
4941 |
info := OrderedCollection new. |
|
4942 |
size := self getBestDirectory asString size. |
|
4943 |
result do:[:assoc | |
|
4944 |
|fn1 fn2| |
|
4945 |
||
4946 |
fn1 := assoc key. |
|
4947 |
fn2 := assoc value. |
|
4948 |
size > 1 ifTrue:[ |
|
4949 |
fn1 := ('..', (fn1 copyFrom:(size + 1))). |
|
4950 |
fn2 := ('..', (fn2 copyFrom:(size + 1))). |
|
4951 |
]. |
|
4952 |
(fn1 includes:Character space) ifTrue:[ |
|
4953 |
fn1 := '"' , fn1 , '"' |
|
4954 |
]. |
|
4955 |
(fn2 includes:Character space) ifTrue:[ |
|
4956 |
fn2 := '"' , fn2 , '"' |
|
4957 |
]. |
|
4958 |
info add:(fn1 , ' same as ' , fn2) |
|
4959 |
]. |
|
4960 |
info isEmpty ifTrue:[ |
|
5543 | 4961 |
Dialog information:'No duplicate files found.'. |
4962 |
^ self. |
|
4355 | 4963 |
]. |
3892 | 4964 |
]. |
4965 |
stream := WriteStream on:''. |
|
4966 |
info do:[:el| |
|
4535 | 4967 |
stream nextPutLine:el. |
3892 | 4968 |
]. |
4969 |
titleStream := WriteStream on:''. |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4970 |
titleStream nextPutAll:'File duplicates in director'. |
3892 | 4971 |
directories size == 1 ifTrue:[ |
4355 | 4972 |
titleStream nextPutAll:'y: ', directories first asString. |
3892 | 4973 |
] ifFalse:[ |
4535 | 4974 |
titleStream nextPutLine:'ies: '. |
4355 | 4975 |
directories do:[:dir| |
4976 |
size > 1 ifTrue:[ |
|
4977 |
titleStream nextPutAll:'..'. |
|
4535 | 4978 |
titleStream nextPutLine:((dir asString) copyFrom:(size + 1)). |
4355 | 4979 |
] ifFalse:[ |
4535 | 4980 |
titleStream nextPutLine:(dir asString). |
4355 | 4981 |
]. |
4982 |
] |
|
3892 | 4983 |
]. |
5543 | 4984 |
|
3892 | 4985 |
textBox := TextBox new. |
4986 |
textBox initialText:(stream contents). |
|
4987 |
textBox title:(titleStream contents). |
|
4988 |
textBox readOnly:true. |
|
4989 |
textBox noCancel. |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4990 |
stream := WriteStream on:'Duplicates in '. |
4170 | 4991 |
directories do:[ :aDirectory | |
4355 | 4992 |
stream nextPutAll:aDirectory baseName. |
4993 |
stream space. |
|
4050 | 4994 |
]. |
4170 | 4995 |
textBox label:stream contents. |
3892 | 4996 |
maxLength := 10. |
4997 |
info do:[: el | |
|
4355 | 4998 |
maxLength := maxLength max:(el size). |
3892 | 4999 |
]. |
5092 | 5000 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
5001 |
textBox maxExtent:Screen current extent. |
|
4355 | 5002 |
textBox openModeless. "/ showAtPointer. |
3892 | 5003 |
! |
5004 |
||
5005 |
fileFindFile |
|
5961 | 5006 |
|filename| |
5007 |
||
5008 |
filename := self firstSelectedFileName. |
|
5009 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
5010 |
filename := Filename homeDirectory. |
3892 | 5011 |
]. |
4101 | 5012 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 5013 |
! |
5014 |
||
4618 | 5015 |
fileHexDump |
5016 |
||
5017 |
| file item| |
|
5018 |
||
5019 |
file := self firstSelectedFile. |
|
5020 |
file notNil ifTrue:[ |
|
5021 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 5022 |
self |
5023 |
applicationNamed:#FileApplicationNoteBook |
|
5024 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 5025 |
]. |
5026 |
! |
|
5027 |
||
4930 | 5028 |
filterSelectedFiles:whichFilter |
5029 |
|selectedFiles numFiles msg filterBlock| |
|
5030 |
||
5031 |
selectedFiles := self currentFileNameHolder value. |
|
5032 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
5033 |
||
5034 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
5035 |
numFiles > 1 ifTrue:[ |
|
5036 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
5037 |
]. |
|
5038 |
||
5039 |
(Dialog |
|
6352 | 5040 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 5041 |
initialAnswer:false |
5042 |
) ifFalse:[ |
|
5043 |
^ self |
|
5044 |
]. |
|
5045 |
||
5046 |
whichFilter == #rot13 ifTrue:[ |
|
5047 |
filterBlock := [:charIn | charIn rot13 ]. |
|
5048 |
]. |
|
5049 |
"/ add more here... |
|
5050 |
||
5051 |
filterBlock isNil ifTrue:[ |
|
5052 |
self information:'No such filter: ' , whichFilter. |
|
5053 |
^ self. |
|
5054 |
]. |
|
5055 |
||
5056 |
selectedFiles do:[:fileName | |
|
5057 |
|s| |
|
5058 |
||
5059 |
self notify:('Processing:', fileName baseName). |
|
5060 |
fileName isDirectory ifFalse:[ |
|
5061 |
[ |
|
5062 |
|inFile outFile in out| |
|
5063 |
||
5064 |
inFile := fileName asFilename. |
|
5065 |
outFile := (fileName pathName , '.filter') asFilename. |
|
5066 |
||
5067 |
[ |
|
5068 |
|charIn charOut| |
|
5069 |
||
5070 |
in := inFile readStream. |
|
5071 |
out := outFile writeStream. |
|
5072 |
[in atEnd] whileFalse:[ |
|
5073 |
charIn := in next. |
|
5074 |
charOut := filterBlock value:charIn. |
|
5075 |
out nextPut:charOut. |
|
5076 |
]. |
|
5077 |
outFile renameTo:inFile. |
|
5078 |
] ensure:[ |
|
5079 |
out notNil ifTrue:[ out close ]. |
|
5080 |
in notNil ifTrue:[ in close ]. |
|
5081 |
outFile delete. |
|
5082 |
] |
|
5083 |
] on:FileStream openErrorSignal do:[:ex| |
|
5084 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
5085 |
]. |
|
5086 |
] |
|
5087 |
]. |
|
6190 | 5088 |
self notify:nil. |
4930 | 5089 |
! |
5090 |
||
3892 | 5091 |
installAllAsAutoloaded |
5092 |
"install all classes found here as autoloaded classes" |
|
5093 |
||
4345 | 5094 |
[ |
5095 |
self withActivityIndicationDo:[ |
|
6113 | 5096 |
self allItemsOfCurrentDirectory copy do:[:fileItem | |
4343 | 5097 |
(fileItem hasMimeType and:[fileItem mimeType isSmalltalkSource]) ifTrue:[ |
4774 | 5098 |
self notify:('Install as autoloaded:', fileItem baseName). |
4343 | 5099 |
self installAsAutoloaded:(fileItem fileName). |
5100 |
] |
|
5101 |
]. |
|
6190 | 5102 |
self notify:nil. |
4345 | 5103 |
] |
5104 |
] fork. |
|
3892 | 5105 |
! |
5106 |
||
5107 |
installAsAutoloaded:aFilename |
|
5108 |
"install aFilename as autoloaded class" |
|
5109 |
||
5971
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5110 |
|chunks s filename| |
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5111 |
|
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5112 |
filename := aFilename asFilename. |
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5113 |
|
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5114 |
chunks := ChangeSet fromStream:(s := filename readStream). s close. |
3892 | 5115 |
chunks |
4414 | 5116 |
select:[:eachChunk | eachChunk isClassDefinitionChange] |
5971
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5117 |
thenDo:[:eachClassChunk | |
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5118 |
eachClassChunk installAsAutoloadedClassIfPublicWithFilename:filename withoutSuffix baseName |
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5119 |
]. |
3892 | 5120 |
! |
5121 |
||
4558 | 5122 |
joinSelectedFiles |
6264 | 5123 |
|selectedFiles numFiles msg outFileName outFile outStream| |
4558 | 5124 |
|
5125 |
selectedFiles := self currentFileNameHolder value. |
|
5126 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
5127 |
||
5128 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
6352 | 5129 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 5130 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
5131 |
outFile := selectedFiles first directory construct:outFileName. |
|
4558 | 5132 |
|
5133 |
outStream := outFile writeStream. |
|
5134 |
||
5135 |
selectedFiles do:[:fileName | |
|
5136 |
|inStream| |
|
5137 |
||
5138 |
self notify:('Adding:', fileName baseName). |
|
5139 |
inStream := fileName readStream. |
|
5140 |
inStream copyToEndInto:outStream. |
|
5141 |
inStream close. |
|
5142 |
]. |
|
5143 |
outStream close. |
|
6190 | 5144 |
self notify:nil. |
4558 | 5145 |
! |
5146 |
||
6292 | 5147 |
loadImageThenDo:aBlock |
3892 | 5148 |
|img path files| |
5149 |
||
3982 | 5150 |
files := self currentSelectedFiles. |
3892 | 5151 |
files isEmpty ifTrue:[ ^ self]. |
5152 |
files do:[:fileName | |
|
4414 | 5153 |
path := fileName. |
5154 |
path isDirectory ifFalse:[ |
|
5155 |
img := Image fromFile:(path pathName). |
|
5156 |
img notNil ifTrue:[ |
|
6292 | 5157 |
aBlock value:img |
4414 | 5158 |
] ifFalse:[ |
6292 | 5159 |
Dialog warn:'Unknown format: ' , fileName asString |
4414 | 5160 |
] |
5161 |
] |
|
3892 | 5162 |
]. |
5163 |
! |
|
5164 |
||
5165 |
openASN1Browser |
|
5166 |
||
5167 |
self openTool:OSI::ASN1Browser |
|
5168 |
! |
|
5169 |
||
5170 |
openAppletViewer |
|
5171 |
|numItems files| |
|
5172 |
||
3982 | 5173 |
files := self currentSelectedFiles. |
3892 | 5174 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 5175 |
(self |
5176 |
confirm:(resources string:'open for each of the %1 items ?' |
|
5177 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 5178 |
]. |
5179 |
||
5180 |
Java startupJavaSystem. |
|
5181 |
"/ Java markAllClassesUninitialized. |
|
5182 |
"/ Java initAllStaticFields. |
|
5183 |
"/ Java initAllClasses. |
|
5184 |
||
5185 |
files do:[:fileName | |
|
4414 | 5186 |
|p path| |
5187 |
||
5188 |
path := fileName. |
|
5189 |
path isDirectory ifFalse:[ |
|
5190 |
p := Java |
|
5191 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
5192 |
argumentString:path pathName. |
|
5193 |
p resume. |
|
5194 |
] |
|
3892 | 5195 |
]. |
5196 |
! |
|
5197 |
||
5198 |
openCBrowser |
|
6031 | 5199 |
|dir files| |
5880 | 5200 |
|
5201 |
dir := self theSingleSelectedDirectoryOrNil. |
|
5202 |
dir isNil ifTrue:[ ^ self]. |
|
3892 | 5203 |
self withWaitCursorDo:[ |
6031 | 5204 |
files := self currentFileNameHolder value. |
5205 |
files notEmptyOrNil ifTrue:[ |
|
5206 |
CBrowser::Browser openOn:files first. |
|
5207 |
] ifFalse:[ |
|
5208 |
CBrowser::Browser openIn:dir. |
|
5209 |
] |
|
3892 | 5210 |
] |
5211 |
! |
|
5212 |
||
4230 | 5213 |
openChangeSetBrowser |
5214 |
self |
|
5215 |
openTool:ChangeSetBrowser |
|
5216 |
with:#openOnFile: |
|
5217 |
ignoreDirectories:true |
|
5218 |
! |
|
5219 |
||
3892 | 5220 |
openChangesBrowser |
5221 |
"open a change browser on the selected file(s)" |
|
5222 |
||
5223 |
self openTool:(UserPreferences current changesBrowserClass) |
|
5224 |
! |
|
5225 |
||
5226 |
openDiffView |
|
5227 |
"open a diff-view" |
|
5228 |
||
4170 | 5229 |
| name1 name2 text1 text2 d err nm l1 files title defaultName lastFile| |
3892 | 5230 |
|
3982 | 5231 |
files := self currentSelectedFiles. |
3892 | 5232 |
files isEmpty ifTrue:[ |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5233 |
Dialog warn:'You have to select a file first'. |
4414 | 5234 |
^ self. |
3892 | 5235 |
]. |
5236 |
(files size == 2) ifTrue:[ |
|
4414 | 5237 |
name1 := files last. |
5238 |
name2 := files first. |
|
3892 | 5239 |
] ifFalse:[ |
4414 | 5240 |
LastFileDiffFile notNil ifTrue:[ |
5960 | 5241 |
| directory | |
5242 |
directory := self currentDirectory. |
|
5243 |
directory notNil ifTrue:[ |
|
5244 |
lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
4414 | 5245 |
(lastFile exists and:[lastFile isReadable]) ifTrue:[ |
5246 |
name1 := lastFile. |
|
5247 |
] |
|
5248 |
] |
|
5249 |
]. |
|
5250 |
name2 := files first. |
|
4432 | 5251 |
title := 'Show differences between ', name2 baseName, ' and:'. |
4414 | 5252 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
5253 |
name1 := DialogBox |
|
5254 |
requestFileName:title |
|
5255 |
default:defaultName |
|
5256 |
ok:'OK' |
|
5830 | 5257 |
abort:'Compare against File List' |
4414 | 5258 |
pattern:'*' |
5259 |
fromDirectory:(name2 asFilename directory). |
|
3892 | 5260 |
]. |
5261 |
||
5262 |
(name1 isNil or:[name1 asString isEmpty]) ifTrue:[ |
|
4768 | 5263 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
4414 | 5264 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l]]. |
5265 |
name1 := nil. |
|
5266 |
l1 := 'browser contents' |
|
3892 | 5267 |
] ifFalse:[ |
4414 | 5268 |
name1 := name1 asFilename. |
5269 |
LastFileDiffFile := name1. |
|
5832 | 5270 |
name1 isReadable ifFalse:[ |
4414 | 5271 |
nm := name1. |
5832 | 5272 |
name1 exists ifFalse:[ |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5273 |
err := '"%1" does not exist.'. |
4414 | 5274 |
] ifTrue:[ |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5275 |
err := '"%1" is not readable.' |
4414 | 5276 |
]. |
5277 |
]. |
|
5832 | 5278 |
l1 := name1 pathName |
3892 | 5279 |
]. |
5280 |
||
5281 |
err isNil ifTrue:[ |
|
4414 | 5282 |
name2 isReadable ifFalse:[ |
5283 |
nm := name2. |
|
5284 |
name2 exists ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5285 |
err := '"%1" does not exist.'. |
4414 | 5286 |
] ifTrue:[ |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5287 |
err := '"%1" is not readable.' |
4414 | 5288 |
]. |
5289 |
]. |
|
3892 | 5290 |
]. |
5291 |
err notNil ifTrue:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5292 |
Dialog warn:(resources string:err with:nm pathName allBold). |
4414 | 5293 |
^ self |
3892 | 5294 |
]. |
5295 |
||
5296 |
self withWaitCursorDo:[ |
|
6176 | 5297 |
((name1 notNil and:[name1 fileSize > (1024*1024*8)]) |
5298 |
or:[ name2 fileSize > (1024*1024*8) ]) ifTrue:[ |
|
5299 |
name1 fileSize = name2 fileSize ifTrue:[ |
|
5300 |
(name1 sameContentsAs:name2) ifTrue:[ |
|
5301 |
self information:'Same contents.' |
|
5302 |
] ifFalse:[ |
|
5303 |
self information:'Different contents (File(s) too big for more details).' |
|
5304 |
]. |
|
5305 |
] ifFalse:[ |
|
5306 |
self information:'Different size (File(s) too big for more details).' |
|
5307 |
]. |
|
5308 |
^ self. |
|
5309 |
]. |
|
5310 |
||
4414 | 5311 |
name1 notNil ifTrue:[ |
5312 |
text1 := name1 contents. |
|
5313 |
]. |
|
5314 |
text2 := name2 contents. |
|
5315 |
text1 = text2 ifTrue:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5316 |
self information:'Same contents.' |
4414 | 5317 |
] ifFalse:[ |
5318 |
d := DiffTextView |
|
5319 |
openOn:text1 label:l1 |
|
5320 |
and:text2 label:name2 pathName. |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5321 |
d topView label:'File Differences'. |
4414 | 5322 |
] |
3892 | 5323 |
] |
5324 |
! |
|
5325 |
||
5326 |
openEditor |
|
5327 |
self openTool:EditTextView |
|
5328 |
! |
|
5329 |
||
4957 | 5330 |
openGV |
5331 |
self openOSCommandWithFiles:'gv' |
|
5332 |
! |
|
5333 |
||
3892 | 5334 |
openHTMLReader |
5335 |
||
5336 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
5337 |
! |
|
5338 |
||
5339 |
openImageEditor |
|
6292 | 5340 |
[ |
5341 |
self loadImageThenDo:[:img | img edit] |
|
5342 |
] fork |
|
3892 | 5343 |
! |
5344 |
||
5345 |
openImageInspector |
|
6292 | 5346 |
[ |
5347 |
self loadImageThenDo:[:img | img inspect] |
|
5348 |
] fork |
|
3892 | 5349 |
! |
5350 |
||
5351 |
openImagePreview |
|
5778 | 5352 |
[ |
5353 |
self |
|
6292 | 5354 |
loadImageThenDo: |
5778 | 5355 |
[:img | |
5356 |
|i top viewer| |
|
5357 |
||
5358 |
top := StandardSystemView new. |
|
5359 |
||
5360 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
5361 |
i := img. |
|
5362 |
top extent:200@200. |
|
5363 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
5364 |
top openAndWait. |
|
5365 |
||
5366 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
5367 |
i := i magnifiedPreservingRatioTo:200@200. |
|
5368 |
]. |
|
5369 |
viewer image:i. |
|
5370 |
]. |
|
3892 | 5371 |
] fork |
5372 |
! |
|
5373 |
||
5374 |
openMP3Player |
|
5375 |
|file| |
|
5376 |
||
3982 | 5377 |
file := self currentSelectedFiles. |
3892 | 5378 |
(file isEmpty) ifTrue:[ |
4414 | 5379 |
^ self. |
3892 | 5380 |
]. |
5381 |
file := file first. |
|
5382 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
5383 |
! |
|
5384 |
||
4957 | 5385 |
openOSCommandWithFiles:command |
5386 |
|files fileNames| |
|
5387 |
||
5388 |
files := self currentSelectedFiles. |
|
5389 |
(files isEmpty) ifTrue:[ |
|
5390 |
^ self. |
|
5391 |
]. |
|
5392 |
||
5393 |
fileNames := files collect:[:each | |
|
5394 |
'"' , each asFilename pathName , '"' |
|
5395 |
]. |
|
5396 |
||
5397 |
[ |
|
5398 |
OperatingSystem |
|
4959 | 5399 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
5400 |
inDirectory:(files first asFilename directory). |
|
4957 | 5401 |
] fork |
5402 |
! |
|
5403 |
||
4820 | 5404 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5405 |
|files fileNames cmd arg| |
4820 | 5406 |
|
5407 |
files := self currentSelectedFiles. |
|
5408 |
(files isEmpty) ifTrue:[ |
|
5409 |
^ self. |
|
5410 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5411 |
cmd := MIMETypes defaultCommandForMimeType:'application/pdf'. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5412 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5413 |
Dialog warn:'No viewer has been defined for pdf-files (See MIMETypes initialization).'. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5414 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5415 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5416 |
|
4820 | 5417 |
fileNames := |
5418 |
files |
|
5419 |
collect: |
|
5420 |
[:each | |
|
5421 |
'"' , each asFilename pathName , '"' |
|
5422 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5423 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5424 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5425 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5426 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5427 |
]. |
4820 | 5428 |
|
4950 | 5429 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5430 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 5431 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5432 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5433 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 5434 |
! |
5435 |
||
4958 | 5436 |
openRP |
5437 |
self openOSCommandWithFiles:'realplay' |
|
5438 |
! |
|
5439 |
||
3892 | 5440 |
openSlideShow |
5880 | 5441 |
|dir| |
5442 |
||
5443 |
dir := self theSingleSelectedDirectoryOrNil. |
|
5444 |
dir isNil ifTrue:[^ self]. |
|
5445 |
||
3892 | 5446 |
CodingExamples_GUI::SlideShow openIn:dir. |
5447 |
! |
|
5448 |
||
5449 |
openSnapshotImageBrowser |
|
4491 | 5450 |
"Sorry, for now, only the old browser can handle snapShotImages." |
5451 |
||
3892 | 5452 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
5453 |
! |
|
5454 |
||
5455 |
openTerminal |
|
5880 | 5456 |
|dir| |
5457 |
||
5458 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 5459 |
|
5300 | 5460 |
TerminalApplication notNil ifTrue:[ |
5461 |
TerminalApplication openIn:dir |
|
5462 |
] ifFalse:[ |
|
5463 |
VT100TerminalView openShellIn:dir. |
|
5464 |
]. |
|
3892 | 5465 |
! |
5466 |
||
5467 |
openTool:aToolClass |
|
5468 |
"open a tool on the selected file(s)" |
|
5469 |
||
5470 |
^ self openTool:aToolClass ignoreDirectories:true |
|
5471 |
! |
|
5472 |
||
5473 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
5474 |
"open a tool on the selected file(s)" |
|
5475 |
||
5476 |
^ self |
|
4414 | 5477 |
openTool:aToolClass |
5478 |
with:#openOn: |
|
5479 |
ignoreDirectories:ignoreDirs |
|
3892 | 5480 |
! |
5481 |
||
5482 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
|
5483 |
"open a tool on the selected file(s)" |
|
5484 |
||
5485 |
|numItems path tool files| |
|
5486 |
||
5487 |
aToolClass isNil ifTrue:[ |
|
4414 | 5488 |
Dialog warn:'Sorry, that tool seems to be not available'. |
5489 |
^ nil. |
|
3892 | 5490 |
]. |
3982 | 5491 |
files := self currentSelectedFiles. |
3892 | 5492 |
|
5493 |
(numItems := files size) > 2 ifTrue:[ |
|
4414 | 5494 |
(self |
5495 |
confirm:(resources string:'open for each of the %1 items ?' |
|
5496 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 5497 |
]. |
5498 |
||
5499 |
self withWaitCursorDo:[ |
|
4414 | 5500 |
files do:[:fileName | |
5501 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
5502 |
fileName isAbsolute ifTrue:[ |
|
5503 |
path := fileName getName. |
|
5504 |
] ifFalse:[ |
|
5505 |
path := fileName pathName. |
|
5506 |
]. |
|
5507 |
tool := aToolClass perform:aSelector with:path. |
|
5508 |
] |
|
5509 |
]. |
|
3892 | 5510 |
]. |
5511 |
^ tool |
|
5512 |
! |
|
5513 |
||
6022 | 5514 |
openWorkspace |
5515 |
self |
|
5516 |
openTool:WorkspaceApplication |
|
5517 |
with:#openOnFile: |
|
5518 |
ignoreDirectories:true |
|
5519 |
! |
|
5520 |
||
4950 | 5521 |
openXV |
4957 | 5522 |
self openOSCommandWithFiles:'xv' |
4950 | 5523 |
! |
5524 |
||
3892 | 5525 |
openZipTool |
5880 | 5526 |
|zipTool| |
3892 | 5527 |
|
5528 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 5529 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 5530 |
]. |
5531 |
! |
|
5532 |
||
5533 |
readAbbrevFile |
|
5534 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
5535 |
||
5880 | 5536 |
|directories| |
3892 | 5537 |
|
3982 | 5538 |
directories := self currentSelectedDirectories. |
3892 | 5539 |
directories isEmpty ifTrue:[^ self]. |
5540 |
||
5828 | 5541 |
self withWaitCursorDo:[ |
5880 | 5542 |
directories do:[:eachDir | |
5543 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
5544 |
] |
|
5828 | 5545 |
] |
3892 | 5546 |
! |
5547 |
||
5548 |
singleFileFileIn:fileName lazy:lazy |
|
5549 |
"fileIn the selected file(s)" |
|
5550 |
||
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5551 |
|aStream wasLazy notifyString dontAskSignals| |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5552 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5553 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5554 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5555 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5556 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5557 |
[ |
4345 | 5558 |
(ObjectFileLoader notNil |
5491 | 5559 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 5560 |
AbortOperationRequest catch:[ |
5561 |
|p| |
|
5562 |
||
5563 |
"/ |
|
5564 |
"/ look if already loaded ... then unload first |
|
5565 |
"/ |
|
5566 |
p := fileName pathName. |
|
5567 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
5568 |
(Dialog confirm:(resources |
|
5569 |
string:'%1 is already loaded; load anyway ?' |
|
5570 |
with:p)) ifFalse:[ |
|
5571 |
^ self |
|
5572 |
]. |
|
5573 |
notifyString := 'unloading old ' , p , ' ...'. |
|
5574 |
Transcript showCR:notifyString. |
|
4523 | 5575 |
self notify:notifyString. |
4345 | 5576 |
ObjectFileLoader unloadObjectFile:p. |
5577 |
]. |
|
5578 |
||
5579 |
notifyString := 'loading ' , p , ' ...'. |
|
5580 |
Transcript showCR:notifyString. |
|
4523 | 5581 |
self notify:notifyString. |
4345 | 5582 |
ObjectFileLoader loadObjectFile:p. |
5583 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
5584 |
] |
|
5585 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
5586 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
5587 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5588 |
aStream := fileName readStreamOrNil. |
4345 | 5589 |
aStream notNil ifTrue:[ |
5590 |
aStream fileInBinary. |
|
5591 |
] |
|
5592 |
] ifFalse:[ |
|
5593 |
((fileName hasSuffix:'class') |
|
5491 | 5594 |
or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 5595 |
"/ loading a java class file |
5596 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 5597 |
JavaClassReader loadFile:fileName |
4345 | 5598 |
] |
5599 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
5600 |
"/ loading a sif (smalltalk interchange format) file |
|
5601 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
5602 |
SmalltalkInterchangeFileManager newForFileIn |
|
5603 |
fileName: fileName pathName; |
|
5604 |
fileIn. |
|
5756 | 5605 |
] ifFalse:[ (fileName hasSuffix:'js') ifTrue:[ |
5606 |
"/ loading a javaScript file |
|
5607 |
JavaScriptSourceReader new fileIn:fileName. |
|
4345 | 5608 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
5609 |
Parcel isNil ifTrue:[ |
|
5610 |
Dialog warn:'Parcel support not loaded.' |
|
5611 |
] ifFalse:[ |
|
5612 |
Parcel loadParcelFrom: fileName pathName |
|
5613 |
] |
|
5614 |
] ifFalse:[ |
|
5615 |
"/ loading a regular (chunk) or xml source file |
|
6223
328a3fddfc5c
Allow opening of a debugger when an error on fileIn occurs.
Stefan Vogel <sv@exept.de>
parents:
6220
diff
changeset
|
5616 |
Error handle:[:ex | |
328a3fddfc5c
Allow opening of a debugger when an error on fileIn occurs.
Stefan Vogel <sv@exept.de>
parents:
6220
diff
changeset
|
5617 |
self errorNotify:'Error on file in: ', ex description. |
5491 | 5618 |
] do:[ |
5619 |
aStream := fileName readStream. |
|
5620 |
[ |
|
5621 |
Class withoutUpdatingChangesDo:[ |
|
5622 |
wasLazy := Compiler compileLazy:lazy. |
|
5948 | 5623 |
Smalltalk fileInStream:aStream. |
5491 | 5624 |
]. |
5625 |
Class addInfoRecord:('fileIn ' , fileName asString) |
|
5626 |
] ensure:[ |
|
5627 |
Compiler compileLazy:wasLazy. |
|
5628 |
aStream close |
|
4345 | 5629 |
] |
5630 |
] |
|
5756 | 5631 |
]]]] |
4345 | 5632 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5633 |
] on:Error, HaltInterrupt, Class packageRedefinitionNotification do:[:ex| |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5634 |
|sig msg label labels values action proceedValue isRedef| |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5635 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5636 |
isRedef := false. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5637 |
sig := ex signal. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5638 |
(sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5639 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5640 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5641 |
sig == Class methodRedefinitionNotification ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5642 |
msg := 'trying to overwrite method:\\ ' , ex oldMethod whoString , '\\in package ''' |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5643 |
, ex oldPackage , ''' with method from package ''' , ex newPackage , ''''. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5644 |
label := 'Method redefinition in fileIn'. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5645 |
isRedef := true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5646 |
] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5647 |
msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5648 |
, ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5649 |
label := 'Class redefinition in fileIn'. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5650 |
isRedef := true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5651 |
] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender| |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5652 |
label := 'Breakpoint/Halt in fileIn'. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5653 |
sender := ex suspendedContext. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5654 |
msg := msg , '\\in ' , sender receiver class name , '>>' , sender selector |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5655 |
] ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5656 |
label := 'Error in fileIn'. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5657 |
msg := 'error in fileIn: %1' |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5658 |
]]]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5659 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5660 |
msg := msg bindWith:ex description. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5661 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5662 |
isRedef ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5663 |
labels := #('Cancel' 'Skip' 'Debug' 'Continue' 'ContinueForAll'). |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5664 |
values := #(abort skip debug continue continueForAll). |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5665 |
] ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5666 |
labels := #('Cancel' 'Skip' 'Debug' 'Continue'). |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5667 |
values := #(abort skip debug continue). |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5668 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5669 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5670 |
AbortAllOperationRequest isHandled ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5671 |
labels := #('Cancel All') , labels. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5672 |
values := #(cancelAll) , values. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5673 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5674 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5675 |
action := OptionBox |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5676 |
request:(msg withCRs) |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5677 |
label:label |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5678 |
image:(WarningBox iconBitmap) |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5679 |
buttonLabels:labels |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5680 |
values:values |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5681 |
default:#continue |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5682 |
onCancel:#abort. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5683 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5684 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5685 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5686 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5687 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5688 |
dontAskSignals at:sig put:#continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5689 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5690 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5691 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5692 |
action == #continue ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5693 |
ex proceedWith:(isRedef ifTrue:[#keep] ifFalse:[#continue]). |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5694 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5695 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5696 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5697 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5698 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5699 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5700 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5701 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5702 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5703 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5704 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5705 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5706 |
action == #debug ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5707 |
Debugger enter:ex suspendedContext |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5708 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5709 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5710 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5711 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5712 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5713 |
] |
4531 | 5714 |
! |
5715 |
||
4558 | 5716 |
splitFile:infile intoPiecesOfSize:kiloBytes |
5717 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
5718 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
5719 |
||
5720 |
bufferSize := 32*1024. |
|
5721 |
||
5722 |
inStream := infile readStream. |
|
5723 |
||
5724 |
bytesPerSplit := kiloBytes * 1024. |
|
5725 |
||
5726 |
remaining := infile fileSize. |
|
5727 |
splitIndex := 1. |
|
5728 |
[remaining > 0] whileTrue:[ |
|
5729 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
5730 |
outStream := outFile asFilename writeStream. |
|
5731 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
5732 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
5733 |
buffer := ByteArray new:bufferSize. |
|
5734 |
n := inStream |
|
5735 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
5736 |
into:buffer |
|
5737 |
startingAt:1. |
|
5738 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
5739 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
5740 |
remaining := remaining - n. |
|
5741 |
]. |
|
5742 |
outStream close. |
|
5743 |
splitIndex := splitIndex + 1. |
|
5744 |
]. |
|
5745 |
inStream close. |
|
5746 |
! |
|
5747 |
||
5748 |
splitSelectedFiles |
|
6264 | 5749 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 5750 |
|
5751 |
selectedFiles := self currentFileNameHolder value. |
|
5752 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
5753 |
||
6265 | 5754 |
msg := (numFiles > 1) |
5755 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
5756 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 5757 |
|
6352 | 5758 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 5759 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
5760 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 5761 |
kiloBytes isNil ifTrue:[^ self]. |
5762 |
||
5763 |
selectedFiles do:[:fileName | |
|
5764 |
self notify:('Splitting:', fileName baseName). |
|
5765 |
fileName isDirectory ifFalse:[ |
|
5766 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
|
5767 |
] |
|
5768 |
]. |
|
6190 | 5769 |
self notify:nil. |
6265 | 5770 |
|
5771 |
"Modified: / 20-04-2005 / 11:25:11 / cg" |
|
4558 | 5772 |
! |
5773 |
||
4531 | 5774 |
truncateSelectedFilesToZeroSize |
4554 | 5775 |
|selectedFiles numFiles msg| |
4531 | 5776 |
|
5777 |
selectedFiles := self currentFileNameHolder value. |
|
4554 | 5778 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
5779 |
||
4930 | 5780 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
4554 | 5781 |
numFiles > 1 ifTrue:[ |
4930 | 5782 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
4554 | 5783 |
]. |
4531 | 5784 |
|
5785 |
(Dialog |
|
6352 | 5786 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
4531 | 5787 |
initialAnswer:false |
5788 |
) ifFalse:[ |
|
5789 |
^ self |
|
5790 |
]. |
|
5791 |
||
5792 |
selectedFiles do:[:fileName | |
|
5793 |
|s| |
|
5794 |
||
5795 |
self notify:('Truncating:', fileName baseName). |
|
5796 |
fileName isDirectory ifFalse:[ |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5797 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5798 |
s := fileName writeStream. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5799 |
s close. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5800 |
] on:FileStream openErrorSignal do:[:ex| |
4531 | 5801 |
self warn:('Cannot truncate "%1".' bindWith:fileName baseName allBold). |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5802 |
]. |
4531 | 5803 |
] |
5804 |
]. |
|
6190 | 5805 |
self notify:nil. |
3892 | 5806 |
! ! |
5807 |
||
4849 | 5808 |
!AbstractFileBrowser methodsFor:'menu queries-cvs'! |
3892 | 5809 |
|
5810 |
canCvsAddAndCommit |
|
5811 |
||
3982 | 5812 |
|selectedFiles| |
5813 |
||
5814 |
selectedFiles := self currentSelectedFiles. |
|
5815 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
3892 | 5816 |
! |
5817 |
||
5818 |
canRemoveCVSContainer |
|
5356
d08261ab1567
care for nonexisting bookmarks file in open
Claus Gittinger <cg@exept.de>
parents:
5334
diff
changeset
|
5819 |
^ self currentSelectedFiles |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5820 |
contains:[:fileName| |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5821 |
|dirOfFile cvsDir| |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5822 |
|
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5823 |
dirOfFile := self getDirWithoutFileName:fileName. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5824 |
cvsDir := dirOfFile construct:'CVS'. |
5318 | 5825 |
cvsDir isDirectory |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5826 |
]. |
3892 | 5827 |
! ! |
5828 |
||
4849 | 5829 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 5830 |
|
5831 |
anySTFilesPresent |
|
5832 |
^ self anyFilesPresentWithSuffix:'st' |
|
5833 |
! |
|
5834 |
||
5835 |
canCreateNewProject |
|
5836 |
||
3982 | 5837 |
| selectedFiles | |
3892 | 5838 |
|
5839 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
3982 | 5840 |
selectedFiles := self currentSelectedFiles. |
3892 | 5841 |
^ [ |
4414 | 5842 |
((selectedFiles detect:[:fileName| | suffix| |
5843 |
suffix := fileName suffix asLowercase. |
|
5844 |
(suffix = 'prj' or:[suffix = 'st']) |
|
5845 |
] ifNone:[nil]) notNil) |
|
3982 | 5846 |
] |
3892 | 5847 |
! |
5848 |
||
5849 |
canDoTerminal |
|
5850 |
||
5851 |
^ OperatingSystem isUNIXlike |
|
5852 |
or:[OperatingSystem isMSWINDOWSlike] |
|
5853 |
! |
|
5854 |
||
5855 |
canDoTerminalAndSystemIsDOS |
|
5856 |
||
5857 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
5858 |
! |
|
5859 |
||
5860 |
canDoTerminalAndSystemIsUnix |
|
5861 |
||
5862 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
5863 |
! |
|
5864 |
||
5865 |
canReadAbbrevFile |
|
5866 |
||
5960 | 5867 |
|currentDirectory| |
3892 | 5868 |
|
5869 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 5870 |
currentDirectory := self currentDirectory. |
5871 |
^ currentDirectory notNil |
|
5872 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 5873 |
! |
5874 |
||
5875 |
canRemoveFromSourcePath |
|
5876 |
||
5877 |
^ false |
|
5878 |
! |
|
5879 |
||
5880 |
hasASN1 |
|
5881 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 5882 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 5883 |
|
5884 |
! |
|
5885 |
||
5886 |
hasASN1AndSelection |
|
5887 |
^ [ self hasSelection value |
|
4414 | 5888 |
and:[self currentSelectedFiles size > 0 |
5889 |
and:[OSI::ASN1Parser notNil |
|
5890 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
3892 | 5891 |
! |
5892 |
||
5893 |
hasCBrowser |
|
5894 |
^ [ CBrowser::Browser notNil ] |
|
5895 |
! |
|
5896 |
||
5897 |
hasJava |
|
5898 |
||
5899 |
^ [ JavaClassReader notNil |
|
4414 | 5900 |
and:[JavaClassReader isLoaded]] |
3892 | 5901 |
! |
5902 |
||
5903 |
hasJavaAndSelection |
|
5904 |
||
3982 | 5905 |
^ [ self currentSelectedFiles size > 0 |
4414 | 5906 |
and:[JavaClassReader notNil |
5907 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 5908 |
! |
5909 |
||
5910 |
hasMP3Player |
|
5911 |
||
5912 |
^ [ MP3PlayerApplication notNil |
|
4414 | 5913 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 5914 |
! |
5915 |
||
5916 |
hasMP3PlayerAndSelection |
|
5917 |
||
3982 | 5918 |
^ [ self currentSelectedFiles size > 0 |
4414 | 5919 |
and:[ self hasMP3Player value]] |
3892 | 5920 |
! |
5921 |
||
5922 |
hasSlideShow |
|
5923 |
||
5924 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
5925 |
! |
|
5926 |
||
5927 |
hasSnapshotSelection |
|
5928 |
||
5929 |
^ [ |
|
4414 | 5930 |
| files | |
5931 |
files := self currentSelectedFiles. |
|
5932 |
((files size == 1) |
|
5933 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 5934 |
] |
5935 |
! |
|
5936 |
||
5937 |
hasZipFileSelected |
|
5938 |
||
3982 | 5939 |
^ [|sel fileName fn suff| |
5940 |
||
4414 | 5941 |
sel := self currentSelectedFiles. |
5942 |
sel size == 1 ifTrue:[ |
|
5943 |
fileName := sel first. |
|
5944 |
fileName notNil ifTrue:[ |
|
5945 |
suff := fileName suffix asLowercase. |
|
5946 |
suff = 'zip' or:[suff = 'jar'] |
|
5947 |
] ifFalse:[ |
|
5948 |
false |
|
5949 |
] |
|
5950 |
] ifFalse:[ |
|
5951 |
false |
|
5952 |
] |
|
3892 | 5953 |
] |
5954 |
! |
|
5955 |
||
5956 |
javaSupportLoaded |
|
5957 |
||
5958 |
^ false |
|
5959 |
! ! |
|
5960 |
||
3906 | 5961 |
!AbstractFileBrowser methodsFor:'presentation'! |
5962 |
||
5963 |
getModeString:modeBits |
|
5964 |
"convert file-mode bits into a more user-friendly string. |
|
5965 |
This is wrong here - should be moved into OperatingSystem." |
|
5966 |
||
5967 |
^ self getModeString:modeBits |
|
4414 | 5968 |
with:#( 'owner:' $r $w $x |
5969 |
' group:' $r $w $x |
|
5970 |
' others:' $r $w $x ) |
|
3906 | 5971 |
! |
5972 |
||
5973 |
getModeString:modeBits with:texts |
|
5974 |
"convert file-mode bits into a more user-friendly string. |
|
5975 |
This is wrong here - should be moved into OperatingSystem." |
|
5976 |
||
5977 |
|bits modeString| |
|
5978 |
||
5979 |
bits := modeBits bitAnd:8r777. |
|
5980 |
modeString := ''. |
|
5981 |
||
5982 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
5983 |
with: texts do:[:bitMask :access | |
|
4414 | 5984 |
|ch| |
5985 |
||
5986 |
bitMask isNil ifTrue:[ |
|
5987 |
modeString := modeString , access |
|
5988 |
] ifFalse:[ |
|
5989 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
5990 |
ch := $- |
|
5991 |
] ifFalse:[ |
|
5992 |
ch := access |
|
5993 |
]. |
|
5994 |
modeString := modeString copyWith:ch |
|
5995 |
] |
|
3906 | 5996 |
]. |
5997 |
^ modeString |
|
5998 |
! ! |
|
5999 |
||
5880 | 6000 |
!AbstractFileBrowser methodsFor:'private'! |
6001 |
||
6002 |
theSingleSelectedDirectoryOrHomeDir |
|
6003 |
|dir| |
|
6004 |
||
5888 | 6005 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 6006 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
6007 |
^ dir. |
|
6008 |
! |
|
6009 |
||
6010 |
theSingleSelectedDirectoryOrNil |
|
6011 |
|dirs| |
|
6012 |
||
6013 |
dirs := self currentSelectedDirectories. |
|
6014 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
6015 |
^ dirs anElement. |
|
6016 |
! ! |
|
6017 |
||
3892 | 6018 |
!AbstractFileBrowser methodsFor:'queries'! |
6019 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
6020 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
6021 |
"raise an error: must be redefined in concrete subclass(es)" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
6022 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
6023 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
6024 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
6025 |
|
3906 | 6026 |
getFileInfoStringForFirstSelectedFile:longInfo |
6027 |
"get stat info on selected file - return a string which can be |
|
6028 |
shown in a box" |
|
6029 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6030 |
|selFiles filename fileOutput modeBits modeString s info |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6031 |
sizeString fileSize tAccess tModification buffer| |
3906 | 6032 |
|
6033 |
selFiles := self currentFileNameHolder value. |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6034 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 6035 |
filename := selFiles first. |
6036 |
||
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
6037 |
buffer := Text writeStream. |
4765 | 6038 |
|
6039 |
buffer |
|
6040 |
nextPutAll:'filename: '; |
|
6041 |
nextPutLine:filename asString. |
|
6042 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6043 |
buffer nextPutAll:'type: '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6044 |
|
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6045 |
info := filename linkInfo. |
6235 | 6046 |
info isNil ifTrue:[ ^ nil]. |
6047 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6048 |
info isSymbolicLink ifTrue:[ |
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6049 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6050 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6051 |
]. |
4765 | 6052 |
buffer |
6053 |
nextPutAll:'symbolic link to: '; |
|
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6054 |
nextPutLine:info path. |
3906 | 6055 |
] ifFalse:[ |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6056 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6057 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6058 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6059 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6060 |
fileOutput isNil ifTrue:[ |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6061 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6062 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6063 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6064 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6065 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6066 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6067 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6068 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6069 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6070 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6071 |
fileSize > 1024 ifTrue:[ |
4708 | 6072 |
sizeString := sizeString , ' (' , ((fileSize / 1024) asFixedPoint:1) printString , ' K'. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6073 |
fileSize > (1024*1024) ifTrue:[ |
4708 | 6074 |
sizeString := sizeString , ' or ' , ((fileSize / (1024*1024)) asFixedPoint:1) printString , ' M'. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6075 |
]. |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6076 |
sizeString := sizeString , ')'. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6077 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6078 |
]. |
4765 | 6079 |
buffer nextPutLine:sizeString. |
3906 | 6080 |
|
6081 |
modeBits := info mode. |
|
6082 |
modeString := self getModeString:modeBits. |
|
4765 | 6083 |
|
6084 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 6085 |
longInfo ifTrue:[ |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6086 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 6087 |
]. |
4765 | 6088 |
buffer |
6089 |
cr; |
|
6090 |
nextPutAll:'owner: '; |
|
6091 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
6092 |
||
3906 | 6093 |
longInfo ifTrue:[ |
4765 | 6094 |
buffer |
6095 |
nextPutAll:'group: '; |
|
6096 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
6097 |
||
6098 |
tAccess := info accessTime. |
|
6099 |
buffer |
|
6100 |
nextPutAll:'last access: '; |
|
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6101 |
nextPutAll:tAccess asDate printString; |
4765 | 6102 |
space; |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6103 |
nextPutLine:tAccess asTime printString. |
4765 | 6104 |
|
6105 |
tModification := info modificationTime. |
|
6106 |
buffer |
|
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6107 |
nextPutAll:'last modification: '; |
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6108 |
nextPutAll:tModification asDate printString; |
4765 | 6109 |
space; |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6110 |
nextPutLine:tModification asTime printString. |
3906 | 6111 |
]. |
4765 | 6112 |
^ buffer contents |
3906 | 6113 |
! |
6114 |
||
3892 | 6115 |
initialCommandFor:fileName into:aBox |
6116 |
"set a useful initial command for execute box." |
|
6117 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
6118 |
self class initialCommandFor:fileName in:Filename currentDirectory intoBox:aBox |
3892 | 6119 |
! |
6120 |
||
6121 |
isAbstractFileBrowser |
|
6122 |
||
6123 |
^ true |
|
6124 |
! |
|
6125 |
||
6126 |
systemIsDOS |
|
6127 |
||
6128 |
^ OperatingSystem isMSDOSlike |
|
6129 |
! |
|
6130 |
||
6131 |
systemIsUnix |
|
6132 |
^ OperatingSystem isUNIXlike |
|
6133 |
! ! |
|
6134 |
||
6135 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
6136 |
||
6137 |
allItemsOfCurrentDirectory |
|
5009 | 6138 |
self |
4774 | 6139 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 6140 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
6141 |
||
6142 |
^ nil |
|
3892 | 6143 |
! |
6144 |
||
6145 |
anyFilesPresentWithSuffix:suffix |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6146 |
|directories| |
3892 | 6147 |
|
6148 |
directories := self currentDirectories value. |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6149 |
directories do:[:dir| |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6150 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6151 |
(dir directoryContentsAsFilenamesDo:[:fn | (fn suffix = suffix) ifTrue:[ ^ true]]) |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6152 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 6153 |
]. |
6154 |
^ false. |
|
6155 |
! |
|
6156 |
||
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6157 |
commonPrefixOfSelectedFiles |
4773 | 6158 |
|selFiles stringCol firstPre| |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6159 |
|
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6160 |
selFiles := self currentFileNameHolder value. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6161 |
selFiles isEmpty ifTrue:[^ nil]. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6162 |
|
4772 | 6163 |
stringCol := selFiles collect:[:file | file asString]. |
4773 | 6164 |
firstPre := stringCol at:1. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6165 |
stringCol from:2 do:[:el| |
4773 | 6166 |
firstPre := firstPre commonPrefixWith:el. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6167 |
]. |
4773 | 6168 |
^ firstPre asFilename |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6169 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6170 |
|
3892 | 6171 |
currentFilesAreInSameDirectory |
6172 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6173 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 6174 |
! |
6175 |
||
6176 |
currentFilesHasDirectories |
|
6177 |
||
6178 |
^ self currentDirectories value notEmpty. |
|
6179 |
! |
|
6180 |
||
3982 | 6181 |
directoriesForFiles:aFileCol |
6182 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6183 |
^ (aFileCol collect:[:file| self getDirWithoutFileName:file]) asSet. |
3982 | 6184 |
! |
6185 |
||
3892 | 6186 |
fileListIsEmpty |
5009 | 6187 |
self |
6188 |
applicationNamed:#DirectoryContentsBrowser |
|
6189 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
6190 |
||
6191 |
^ nil. |
|
3892 | 6192 |
! |
6193 |
||
6194 |
fileListIsNotEmpty |
|
6195 |
||
6196 |
^ self fileListIsEmpty not. |
|
6197 |
! |
|
6198 |
||
6199 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 6200 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 6201 |
|
6202 |
| file1 file2 | |
|
6203 |
||
6284 | 6204 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 6205 |
file1 := aFilename1 asFilename. |
6206 |
file2 := aFilename2 asFilename. |
|
6284 | 6207 |
|
3892 | 6208 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 6209 |
|
3892 | 6210 |
((file1 isDirectory) |
6211 |
and:[(file2 isDirectory) |
|
6212 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 6213 |
^ file1 baseName = file2 baseName |
3892 | 6214 |
]. |
3982 | 6215 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 6216 |
! |
6217 |
||
6218 |
getAllFilesAsStringCollection |
|
5009 | 6219 |
self |
6220 |
applicationNamed:#DirectoryContentsBrowser |
|
6221 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
6222 |
||
6223 |
^ nil |
|
3892 | 6224 |
! |
6225 |
||
6226 |
getBestDirectory |
|
6227 |
||
6228 |
|selFiles stringCol firstPre| |
|
6229 |
||
6230 |
selFiles := self currentDirectories value. |
|
6231 |
selFiles isEmpty ifTrue:[^ nil]. |
|
6232 |
selFiles size == 1 ifTrue:[^ selFiles first]. |
|
4486 | 6233 |
stringCol := (selFiles collect:[:file| file asString]) asOrderedCollection. |
3892 | 6234 |
firstPre := stringCol at:1. |
6235 |
stringCol from:2 do:[:el| |
|
4414 | 6236 |
firstPre := firstPre commonPrefixWith:el. |
3892 | 6237 |
]. |
6238 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
4414 | 6239 |
firstPre removeLast. |
3892 | 6240 |
]. |
6241 |
^ firstPre asFilename |
|
6242 |
! |
|
6243 |
||
6244 |
getDirWithoutFileName:aFileName |
|
6245 |
||
6246 |
| dir | |
|
6247 |
aFileName isNil ifTrue:[ |
|
4414 | 6248 |
^ aFileName. |
3892 | 6249 |
]. |
6250 |
dir := aFileName asFilename. |
|
6251 |
dir isDirectory ifFalse:[ |
|
4414 | 6252 |
dir := dir directory. |
3892 | 6253 |
]. |
6254 |
^ dir. |
|
6255 |
! |
|
6256 |
||
6257 |
getInfoItem |
|
6258 |
"get filename of a description-file (.dir.info, README etc.); |
|
6259 |
This file is automatically shown when a directory is enterred. |
|
6260 |
You can add more names below if you like." |
|
6261 |
||
5880 | 6262 |
|dir| |
6263 |
||
6264 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6265 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 6266 |
|
6267 |
#( |
|
6268 |
'.dir.info' |
|
6269 |
'README' |
|
6270 |
'ReadMe' |
|
6271 |
'Readme' |
|
6272 |
'readme' |
|
6273 |
'read.me' |
|
6274 |
'Read.me' |
|
6275 |
'READ.ME' |
|
6276 |
'README.TXT' |
|
6277 |
'readme.txt' |
|
6278 |
'Readme.txt' |
|
6279 |
'Info.txt' |
|
6280 |
'info.txt' |
|
6281 |
'INFO.TXT' |
|
6282 |
) do:[:f | |
|
5883 | 6283 |
|n| |
4414 | 6284 |
|
5880 | 6285 |
n := dir construct:f. |
4414 | 6286 |
(n isReadable and:[n isDirectory not]) ifTrue:[ |
6287 |
^ DirectoryContentsBrowser itemClass fileName:n |
|
6288 |
] |
|
3892 | 6289 |
]. |
6290 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6291 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6292 |
|
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6293 |
parentDirectoriesOfCurrentFiles |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6294 |
|
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6295 |
^ (self currentFileNameHolder value collect:[:file | file directory]) asSet |
3982 | 6296 |
! ! |
6297 |
||
6298 |
!AbstractFileBrowser methodsFor:'selection'! |
|
6299 |
||
6300 |
currentSelectedDirectories |
|
6301 |
||
6302 |
^ self currentDirectories value. |
|
6303 |
! |
|
6304 |
||
6305 |
currentSelectedFiles |
|
6306 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6307 |
^ self currentFileNameHolder value select:[:file | file isDirectory not]. |
3982 | 6308 |
! |
6309 |
||
6310 |
firstSelectedFile |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6311 |
^ self currentFileNameHolder value |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6312 |
detect:[:file | file asFilename isDirectory not] |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6313 |
ifNone:[]. |
4414 | 6314 |
! |
6315 |
||
6316 |
hasOnlyFilesSelected |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6317 |
|
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6318 |
^ self currentFileNameHolder value conform:[:file | file isDirectory not]. |
4414 | 6319 |
! |
6320 |
||
6321 |
hasTwoFilesSelected |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6322 |
|
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6323 |
^ self currentFileNameHolder value size == 2 |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6324 |
and:[self hasOnlyFilesSelected] |
3892 | 6325 |
! ! |
6326 |
||
3964 | 6327 |
!AbstractFileBrowser methodsFor:'sorting'! |
6328 |
||
3989 | 6329 |
currentSortOrder |
6330 |
||
6331 |
" returns a Ordered Collection of all directories currently selected |
|
6332 |
if only a file is selected currentDirectories holds the directory of the file |
|
6333 |
" |
|
6334 |
||
4027 | 6335 |
^ self aspectFor:#currentSortOrder ifAbsent:[ Dictionary new asValue ]. |
3989 | 6336 |
! |
6337 |
||
6338 |
sortBlockHolder |
|
6339 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 6340 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
6341 |
selector:#fileName |
|
6342 |
sortCaseless:self sortCaseless value |
|
6343 |
sortReverse:false) asValue. |
|
3989 | 6344 |
]. |
6345 |
! |
|
6346 |
||
6347 |
sortBlockProperty |
|
6348 |
||
4027 | 6349 |
|
3989 | 6350 |
^ self aspectFor:#sortBlockProperty ifAbsent:[ #baseName asValue ]. |
6351 |
! |
|
6352 |
||
6353 |
sortCaseless |
|
4201 | 6354 |
" aspect for sort caseless " |
3989 | 6355 |
|
6356 |
^ self aspectFor:#sortCaseless ifAbsent:[ |
|
4201 | 6357 |
| holder | |
6358 |
holder := (Filename isCaseSensitive not) asValue. |
|
6359 |
holder |
|
3989 | 6360 |
] |
6361 |
! |
|
6362 |
||
4074 | 6363 |
sortDirectoriesBeforeFiles |
6364 |
||
4201 | 6365 |
" aspect for sort directories always before files" |
4074 | 6366 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
6367 |
! |
|
6368 |
||
3989 | 6369 |
sortFileListsBy:instanceName |
6370 |
||
6371 |
self sortFileListsBy:instanceName withReverse:true |
|
6372 |
! |
|
6373 |
||
6374 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
6375 |
||
5383 | 6376 |
| aSymbol sortCaselessLocal currentSortOrder sorter| |
3964 | 6377 |
|
6378 |
aSymbol := instanceName asSymbol. |
|
4027 | 6379 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 6380 |
sortCaselessLocal := self sortCaseless value. |
4027 | 6381 |
currentSortOrder := self currentSortOrder value. |
3989 | 6382 |
currentSortOrder isEmpty ifTrue:[ |
4343 | 6383 |
currentSortOrder at:#column put:aSymbol. |
6384 |
currentSortOrder at:#reverse put:false. |
|
6385 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 6386 |
] ifFalse:[ |
4343 | 6387 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
6388 |
"/ sort caseless changed |
|
6389 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
6390 |
] ifFalse:[ |
|
6391 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
6392 |
"/ same column like before - change sort order ifReverse is true |
|
6393 |
aBoolean ifTrue:[ |
|
6394 |
| isReverse | |
|
6395 |
isReverse := currentSortOrder at:#reverse. |
|
6396 |
currentSortOrder at:#reverse put:(isReverse not). |
|
6397 |
]. |
|
6398 |
] ifFalse:[ |
|
6399 |
"/ another column - remark column |
|
6400 |
currentSortOrder at:#column put:aSymbol. |
|
6401 |
] |
|
6402 |
] |
|
3964 | 6403 |
]. |
4027 | 6404 |
self currentSortOrder changed. |
5383 | 6405 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
6406 |
selector:instanceName |
|
6407 |
sortCaseless:sortCaselessLocal |
|
6408 |
sortReverse:(currentSortOrder at:#reverse). |
|
6409 |
self sortBlockHolder value:sorter. |
|
3964 | 6410 |
! ! |
6411 |
||
3892 | 6412 |
!AbstractFileBrowser methodsFor:'startup & release'! |
6413 |
||
6414 |
makeDependent |
|
4074 | 6415 |
self filterModel addDependent:self. |
4004 | 6416 |
self currentFileNameHolder addDependent:self. |
4074 | 6417 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 6418 |
self sortCaseless addDependent:self. |
4011 | 6419 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
6420 |
self rootHolder addDependent:self. |
3892 | 6421 |
! |
6422 |
||
6423 |
masterApplication:anApplication |
|
6424 |
||
6425 |
masterApplication isNil ifTrue:[ |
|
4414 | 6426 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
6427 |
aspects := anApplication aspects |
|
6428 |
] ifFalse:[ |
|
6429 |
aspects isNil ifTrue:[ |
|
6430 |
aspects := IdentityDictionary new. |
|
6431 |
aspects at:#applications put:(IdentityDictionary new). |
|
6432 |
] |
|
6433 |
]. |
|
6434 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6435 |
"/ self makeDependent. |
3892 | 6436 |
]. |
3952 | 6437 |
^ super masterApplication:anApplication. |
3892 | 6438 |
! |
6439 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6440 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6441 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6442 |
super postBuildWith:aBuilder. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6443 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6444 |
|
3892 | 6445 |
postOpenWith:aBuilder |
6446 |
||
6447 |
super postOpenWith:aBuilder. |
|
6448 |
! ! |
|
6449 |
||
6450 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
6451 |
||
6452 |
files |
|
6453 |
"return the value of the instance variable 'files' (automatically generated)" |
|
6454 |
||
6455 |
^ files |
|
6456 |
! |
|
6457 |
||
6458 |
files:something |
|
6459 |
"set the value of the instance variable 'files' (automatically generated)" |
|
6460 |
||
6461 |
files := something. |
|
6462 |
! |
|
6463 |
||
6464 |
method |
|
6465 |
"return the value of the instance variable 'method' (automatically generated)" |
|
6466 |
||
6467 |
^ method |
|
6468 |
! |
|
6469 |
||
6470 |
method:something |
|
6471 |
"set the value of the instance variable 'method' (automatically generated)" |
|
6472 |
||
6473 |
method := something. |
|
6474 |
! ! |
|
6475 |
||
6476 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
6477 |
||
6478 |
locked |
|
6479 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
6480 |
||
6481 |
locked isNil ifTrue:[ |
|
4414 | 6482 |
locked := false. |
3892 | 6483 |
]. |
6484 |
^ locked |
|
6485 |
! ! |
|
6486 |
||
6487 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
6488 |
||
6489 |
doIfUnLocked:aBlock |
|
6490 |
||
6491 |
self locked ifFalse:[ |
|
4414 | 6492 |
aBlock value. |
3892 | 6493 |
]. |
6494 |
! |
|
6495 |
||
6496 |
doLocked:aBlock |
|
6497 |
||
6498 |
locked := true. |
|
4004 | 6499 |
aBlock ensure:[ |
4414 | 6500 |
locked := false. |
4004 | 6501 |
] |
3892 | 6502 |
! ! |
6503 |
||
3952 | 6504 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
6505 |
||
6369 | 6506 |
defaultHistorySize |
6507 |
^ 50 |
|
3892 | 6508 |
! ! |
6509 |
||
6371 | 6510 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 6511 |
|
6512 |
new |
|
6371 | 6513 |
^ (super new) initializeHistory. |
6369 | 6514 |
! ! |
6515 |
||
6516 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
6517 |
||
6518 |
historySize |
|
6519 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
6520 |
^ historySize |
|
6521 |
! |
|
6522 |
||
6523 |
historySize:aNumber |
|
6524 |
historySize := aNumber |
|
4032 | 6525 |
! ! |
6526 |
||
3892 | 6527 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
6528 |
||
3952 | 6529 |
addToHistory:aPath |
6530 |
| item| |
|
6531 |
||
6532 |
item := self getItemFor:aPath. |
|
4347 | 6533 |
self backForwardListAdd:aPath. |
3952 | 6534 |
item isNil ifTrue:[ |
4347 | 6535 |
" not already in history" |
6369 | 6536 |
self size >= self historySize ifTrue:[ |
4347 | 6537 |
self removeLast. |
6538 |
]. |
|
6539 |
item := DirectoryHistoryItem path:aPath. |
|
6540 |
self addFirst:item |
|
3952 | 6541 |
] ifFalse:[ |
4347 | 6542 |
"already been there before; move the entry to |
6543 |
the beginning, so it will fall out later." |
|
6544 |
self remove:item. |
|
6545 |
self addFirst:item |
|
3892 | 6546 |
]. |
3952 | 6547 |
! |
6548 |
||
4347 | 6549 |
backForwardListAdd:aPath |
6550 |
|pathIndex| |
|
6551 |
||
6552 |
pathIndex := backForwardList indexOf:aPath. |
|
6553 |
pathIndex == 0 ifTrue:[ |
|
6554 |
" a new path comes in remove forward paths " |
|
6555 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
6556 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
6557 |
]. |
|
6558 |
] ifFalse:[ |
|
6559 |
backForwardList remove:aPath. |
|
6560 |
pathIndex <= backForwardIndex ifTrue:[ |
|
6561 |
backForwardIndex := backForwardIndex - 1. |
|
6562 |
] |
|
4022 | 6563 |
]. |
4347 | 6564 |
backForwardList add:aPath afterIndex:backForwardIndex. |
6565 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 6566 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 6567 |
backForwardList removeFirst. |
6568 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 6569 |
]. |
4347 | 6570 |
! |
6571 |
||
6572 |
goBackward |
|
4288 | 6573 |
"return the first path of the backward list; |
6574 |
remove it from the back list and add it ti the forward list." |
|
4022 | 6575 |
|
4347 | 6576 |
|retPath| |
6577 |
||
6578 |
self canBackward ifTrue:[ |
|
6579 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
6580 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 6581 |
]. |
4022 | 6582 |
^ retPath. |
6583 |
! |
|
6584 |
||
6585 |
goForward |
|
4288 | 6586 |
"return the first path of the forward list; |
6587 |
remove it from the list." |
|
4022 | 6588 |
|
4347 | 6589 |
|retPath| |
6590 |
||
6591 |
self canForward ifTrue:[ |
|
6592 |
retPath := backForwardList at:backForwardIndex + 1. |
|
6593 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 6594 |
]. |
4022 | 6595 |
^ retPath. |
6596 |
! |
|
6597 |
||
6598 |
resetForwardBackward |
|
6599 |
||
4347 | 6600 |
self initialize |
4022 | 6601 |
! |
6602 |
||
6603 |
setPosition:aPosition for:aPath |
|
6604 |
||
6605 |
self do:[:item| |
|
4414 | 6606 |
item path = aPath ifTrue:[ |
6607 |
item position:aPosition. |
|
6608 |
] |
|
4022 | 6609 |
]. |
3892 | 6610 |
! ! |
6611 |
||
4870 | 6612 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 6613 |
|
6371 | 6614 |
initializeHistory |
4032 | 6615 |
|
4347 | 6616 |
backForwardList := OrderedCollection new. |
6617 |
self reverseDo:[:el| |
|
6618 |
backForwardList add:el path. |
|
6619 |
]. |
|
6620 |
backForwardIndex := backForwardList size. |
|
4032 | 6621 |
! ! |
6622 |
||
3892 | 6623 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
6624 |
||
4288 | 6625 |
canBackward |
4347 | 6626 |
|
6627 |
^ backForwardIndex > 1 |
|
4288 | 6628 |
! |
6629 |
||
3892 | 6630 |
canForward |
4347 | 6631 |
|
6632 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
6633 |
! |
|
6634 |
||
6635 |
getBackCollection |
|
6636 |
||
6637 |
| backCol | |
|
6638 |
||
6639 |
backCol := OrderedCollection new. |
|
6640 |
self canBackward ifTrue:[ |
|
6641 |
| tmpCol | |
|
6642 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
6643 |
tmpCol reverseDo:[ :el| |
|
6644 |
backCol add:el. |
|
6645 |
] |
|
6646 |
]. |
|
6647 |
^ backCol |
|
3952 | 6648 |
! |
6649 |
||
6650 |
getForwardCollection |
|
6651 |
||
4347 | 6652 |
| forwCol | |
6653 |
||
6654 |
forwCol := OrderedCollection new. |
|
6655 |
self canForward ifTrue:[ |
|
6656 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
6657 |
]. |
|
6658 |
^ forwCol |
|
3952 | 6659 |
! |
6660 |
||
6661 |
getItemFor:aPath |
|
6662 |
||
6663 |
self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
6664 |
^ nil. |
|
6665 |
! |
|
6666 |
||
6667 |
getPositionFor:aPath |
|
6668 |
||
6669 |
|item| |
|
6670 |
||
6671 |
item := self getItemFor:aPath. |
|
6672 |
||
6673 |
item notNil ifTrue:[ |
|
4414 | 6674 |
^ item position. |
3952 | 6675 |
]. |
6676 |
^ nil |
|
6677 |
! |
|
6678 |
||
6679 |
includesPath:aPath |
|
6680 |
||
6681 |
self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
6682 |
^ false. |
|
4347 | 6683 |
! |
6684 |
||
6685 |
nextBackwardItem |
|
6686 |
"return the first path of the backward list" |
|
6687 |
||
6688 |
|retPath| |
|
6689 |
||
6690 |
self canBackward ifTrue:[ |
|
6691 |
retPath := backForwardList at:backForwardIndex. |
|
6692 |
]. |
|
6693 |
^ retPath. |
|
6694 |
! |
|
6695 |
||
6696 |
nextForwardItem |
|
6697 |
"return the first path of the forward list" |
|
6698 |
||
6699 |
|retPath| |
|
6700 |
||
6701 |
self canForward ifTrue:[ |
|
6702 |
retPath := backForwardList at:backForwardIndex + 1. |
|
6703 |
]. |
|
6704 |
^ retPath. |
|
3952 | 6705 |
! ! |
6706 |
||
6707 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
6708 |
||
6709 |
path:aPath |
|
6710 |
||
6711 |
^ self new path:aPath |
|
6712 |
! ! |
|
6713 |
||
6714 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
6715 |
||
6716 |
path |
|
6717 |
"return the value of the instance variable 'path' (automatically generated)" |
|
6718 |
||
6719 |
^ path |
|
6720 |
! |
|
6721 |
||
6722 |
path:something |
|
6723 |
"set the value of the instance variable 'path' (automatically generated)" |
|
6724 |
||
6725 |
path := something. |
|
6726 |
! |
|
6727 |
||
6728 |
position |
|
6729 |
"return the value of the instance variable 'position' (automatically generated)" |
|
6730 |
||
6731 |
^ position |
|
6732 |
! |
|
6733 |
||
6734 |
position:something |
|
6735 |
"set the value of the instance variable 'position' (automatically generated)" |
|
6736 |
||
6737 |
position := something. |
|
6738 |
! |
|
6739 |
||
6740 |
printString |
|
6741 |
||
6742 |
^ self path asString |
|
3892 | 6743 |
! ! |
6744 |
||
4915 | 6745 |
!AbstractFileBrowser::FilenameHistory class methodsFor:'accessing-attributes'! |
3892 | 6746 |
|
4337
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
6747 |
filenameHistorySize |
3892 | 6748 |
|
6749 |
^ 20 |
|
6750 |
! ! |
|
6751 |
||
6752 |
!AbstractFileBrowser::FilenameHistory methodsFor:'adding & removing'! |
|
6753 |
||
5242
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
6754 |
add:aFileItem |
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
6755 |
(self includes:aFileItem) ifTrue:[ |
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
6756 |
self remove:aFileItem. |
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
6757 |
]. |
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
6758 |
self addFirst:aFileItem. |
3892 | 6759 |
! ! |
6760 |
||
6761 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
6762 |
||
6763 |
withValue:aValue isHolder:aBoolean |
|
6764 |
||
6765 |
| instance | |
|
6766 |
||
6767 |
instance := self basicNew. |
|
6768 |
instance value:aValue. |
|
6769 |
instance isHolder:aBoolean. |
|
6770 |
^ instance |
|
6771 |
! ! |
|
6772 |
||
6773 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
6774 |
||
6775 |
isHolder |
|
6776 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
6777 |
||
6778 |
^ isHolder |
|
6779 |
! |
|
6780 |
||
6781 |
isHolder:something |
|
6782 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
|
6783 |
||
6784 |
isHolder := something. |
|
6785 |
! |
|
6786 |
||
6787 |
value |
|
6788 |
"return the value of the instance variable 'value' (automatically generated)" |
|
6789 |
||
6790 |
^ value |
|
6791 |
! |
|
6792 |
||
6793 |
value:something |
|
6794 |
"set the value of the instance variable 'value' (automatically generated)" |
|
6795 |
||
6796 |
value := something. |
|
6797 |
! ! |
|
6798 |
||
6799 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
6800 |
||
6801 |
version |
|
6373 | 6802 |
^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.304 2005-08-05 09:34:33 cg Exp $' |
3892 | 6803 |
! ! |