author | Claus Gittinger <cg@exept.de> |
Wed, 13 Jul 2005 17:42:44 +0200 | |
changeset 6352 | 1dfde810826f |
parent 6346 | 3b3d962e691c |
child 6369 | 7b21b4675578 |
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 |
52 |
backForwardList backForwardIndex' |
|
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 |
|
282 |
||
4190 | 283 |
"max no of entries in the HistoryList " |
3892 | 284 |
CommandHistorySize isNil ifTrue:[ |
4414 | 285 |
CommandHistorySize := 50 |
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 |
|
2443 |
|cmd suffix cmdHist| |
|
2444 |
||
2445 |
cmdHist := self class commandHistory. |
|
2446 |
(aCommandString notNil and:[aCommandString notEmpty]) ifTrue:[ |
|
4414 | 2447 |
cmdHist notNil ifTrue:[ |
2448 |
cmdHist addFirst:aCommandString. |
|
2449 |
cmdHist size > self class commandHistorySize ifTrue:[ |
|
2450 |
cmdHist removeLast |
|
2451 |
] |
|
2452 |
]. |
|
2453 |
aFilename notNil ifTrue:[ |
|
2454 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
2455 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
2456 |
DefaultCommandPerSuffix := Dictionary new. |
|
2457 |
]. |
|
2458 |
suffix := aFilename asFilename suffix. |
|
2459 |
suffix notNil ifTrue:[ |
|
2460 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
2461 |
] |
|
2462 |
] |
|
3892 | 2463 |
] |
2464 |
! |
|
2465 |
||
2466 |
doBack |
|
6286 | 2467 |
"go backward in the history" |
3892 | 2468 |
|
4022 | 2469 |
| fileName| |
2470 |
||
4347 | 2471 |
fileName := self dirHistory goBackward. |
3892 | 2472 |
fileName notNil ifTrue:[ |
4347 | 2473 |
self gotoFile:(fileName asFilename). |
3892 | 2474 |
] |
2475 |
! |
|
2476 |
||
2477 |
doForward |
|
6286 | 2478 |
"go forward in the history" |
3892 | 2479 |
|
3964 | 2480 |
| fileName| |
2481 |
||
3952 | 2482 |
fileName := self dirHistory goForward. |
3892 | 2483 |
fileName notNil ifTrue:[ |
4414 | 2484 |
self gotoFile:(fileName asFilename). |
4022 | 2485 |
] ifFalse:[ |
4414 | 2486 |
self enableForward value:false. |
4022 | 2487 |
|
2488 |
]. |
|
3892 | 2489 |
! ! |
2490 |
||
2491 |
!AbstractFileBrowser methodsFor:'applications'! |
|
2492 |
||
5009 | 2493 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
2494 |
|appl| |
|
2495 |
||
2496 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
2497 |
appl notNil ifTrue:[ |
|
2498 |
^ aBlock value:appl |
|
2499 |
]. |
|
2500 |
^ nil. |
|
2501 |
! |
|
2502 |
||
4004 | 2503 |
directoryContentsBrowser |
2504 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 2505 |
! ! |
2506 |
||
2507 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
2508 |
||
2509 |
applications |
|
2510 |
^ aspects at:#applications |
|
2511 |
! |
|
2512 |
||
2513 |
backgroundProcesses |
|
2514 |
||
2515 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
2516 |
! |
|
2517 |
||
4230 | 2518 |
canMake |
6095 | 2519 |
^ self aspectFor:#canMake ifAbsent:[ false asValue ]. |
4230 | 2520 |
! |
2521 |
||
3892 | 2522 |
currentDirectories |
2523 |
||
2524 |
" returns a Ordered Collection of all directories currently selected |
|
2525 |
if only a file is selected currentDirectories holds the directory of the file |
|
2526 |
" |
|
2527 |
||
2528 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
2529 |
! |
|
2530 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2531 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2532 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2533 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2534 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2535 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2536 |
directories := self currentDirectories value. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2537 |
(directories size ~= 1) ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2538 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2539 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2540 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2541 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2542 |
|
3892 | 2543 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2544 |
"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
|
2545 |
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
|
2546 |
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
|
2547 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2548 |
^ self aspectFor:#currentFileNameHolder ifAbsent:[ |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2549 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2550 |
|
4692 | 2551 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2552 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2553 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2554 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2555 |
currentSel asValue |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2556 |
] notPresentDo:[:holder| |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2557 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2558 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2559 |
newFilenames := Set new. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2560 |
filenames do:[:eachFilename| |existingFilename| |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2561 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2562 |
existingFilename notNil ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2563 |
[existingFilename exists] whileFalse:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2564 |
existingFilename := existingFilename directory. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
2565 |
]. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2566 |
newFilenames add:existingFilename. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
2567 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2568 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2569 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2570 |
] |
3892 | 2571 |
! |
2572 |
||
5528 | 2573 |
defaultFileEncoding |
2574 |
^ #'iso8859-1' "/ #'utf-8' |
|
2575 |
! |
|
2576 |
||
3892 | 2577 |
enableDirectoryUp |
2578 |
||
2579 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[false asValue] |
|
2580 |
! |
|
2581 |
||
4593 | 2582 |
enableGotoDefault |
2583 |
||
2584 |
^ self aspectFor:#enableGotoDefault ifAbsent:[ true asValue ]. |
|
2585 |
! |
|
2586 |
||
3892 | 2587 |
enableHome |
2588 |
||
2589 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
2590 |
! |
|
2591 |
||
2592 |
enableViewNoteBookApplication |
|
2593 |
||
2594 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
2595 |
! |
|
2596 |
||
5528 | 2597 |
fileEncoding |
2598 |
^ self fileEncodingHolder value |
|
2599 |
! |
|
2600 |
||
2601 |
fileEncoding:newEncoding |
|
5533 | 2602 |
self fileEncodingHolder value:newEncoding. |
2603 |
||
2604 |
self |
|
2605 |
applicationNamed:#FileApplicationNoteBook |
|
2606 |
ifPresentDo:[:nb | |
|
2607 |
|appl| |
|
2608 |
||
2609 |
appl := nb selectedApplication. |
|
5535 | 2610 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 2611 |
appl fileEncoding:newEncoding |
2612 |
] |
|
2613 |
]. |
|
5528 | 2614 |
! |
2615 |
||
5737 | 2616 |
fileEncodingHolder |
2617 |
^ self |
|
2618 |
aspectFor:#fileEncodingHolder |
|
2619 |
ifAbsent:[ |
|
2620 |
self |
|
2621 |
applicationNamed:#FileApplicationNoteBook |
|
2622 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
2623 |
] |
|
2624 |
! |
|
2625 |
||
5961 | 2626 |
firstSelectedFileName |
2627 |
|files| |
|
2628 |
||
2629 |
files := self currentFileNameHolder value. |
|
2630 |
files notEmpty ifTrue:[ |
|
2631 |
^ files first |
|
2632 |
]. |
|
2633 |
^ nil |
|
2634 |
! |
|
2635 |
||
4618 | 2636 |
hasFileSelection |
2637 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
2638 |
! |
|
2639 |
||
5830 | 2640 |
hasNotTwoFilesSelectedHolder |
2641 |
^ self aspectFor:#hasNotTwoFilesSelectedHolder |
|
2642 |
ifAbsent:[ |
|
2643 |
BlockValue |
|
2644 |
with:[:m | self hasTwoFilesSelected not] |
|
2645 |
argument:self currentFileNameHolder |
|
2646 |
]. |
|
2647 |
! |
|
2648 |
||
3892 | 2649 |
hasSelection |
2650 |
||
2651 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
2652 |
! |
|
2653 |
||
4414 | 2654 |
hasTwoFilesSelectedHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2655 |
^ self aspectFor:#hasTwoFilesSelectedHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2656 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2657 |
BlockValue |
5830 | 2658 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2659 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2660 |
]. |
4414 | 2661 |
! |
2662 |
||
5737 | 2663 |
lockFileEncoding:aBoolean |
2664 |
self lockFileEncodingHolder value:aBoolean. |
|
2665 |
||
2666 |
self |
|
2667 |
applicationNamed:#FileApplicationNoteBook |
|
2668 |
ifPresentDo:[:nb | |
|
2669 |
|appl| |
|
2670 |
||
2671 |
appl := nb selectedApplication. |
|
2672 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
2673 |
appl lockFileEncoding:aBoolean |
|
2674 |
] |
|
2675 |
]. |
|
2676 |
! |
|
2677 |
||
2678 |
lockFileEncodingHolder |
|
2679 |
^ self |
|
2680 |
aspectFor:#lockFileEncodingHolder |
|
2681 |
ifAbsent:[ |
|
2682 |
self |
|
2683 |
applicationNamed:#FileApplicationNoteBook |
|
2684 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
2685 |
] |
|
2686 |
! |
|
2687 |
||
4523 | 2688 |
notify:aString |
2689 |
self notifyChannel value:aString |
|
2690 |
! |
|
2691 |
||
3892 | 2692 |
notifyChannel |
2693 |
||
2694 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 2695 |
! |
2696 |
||
2697 |
rootHolder |
|
2698 |
"holder, which keeps the rootHolder of the treeView |
|
2699 |
" |
|
2700 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
2701 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
2702 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
2703 |
]. |
3892 | 2704 |
! ! |
2705 |
||
2706 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
2707 |
||
2708 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 2709 |
"returns the model for an aspect; these are stored in a common dictionary" |
2710 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2711 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 2712 |
! |
2713 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2714 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 2715 |
"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
|
2716 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2717 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2718 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2719 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2720 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2721 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2722 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2723 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2724 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2725 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2726 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2727 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2728 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2729 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2730 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2731 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2732 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2733 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2734 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2735 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2736 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2737 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2738 |
]. |
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 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2741 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2742 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2743 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2744 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2745 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2746 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2747 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2748 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2749 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2750 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2751 |
aspectFor:something put:aValueHolder |
6284 | 2752 |
"stores the model for an aspect; these are stored in a common dictionary" |
2753 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2754 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2755 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2756 |
|
3892 | 2757 |
aspects |
6284 | 2758 |
"returns the common aspect dictionary" |
2759 |
||
3892 | 2760 |
^ aspects |
2761 |
! |
|
2762 |
||
2763 |
runtimeAspectValueFor:something |
|
2764 |
"returns the default aspect item from the class variable RuntimeAspects |
|
2765 |
" |
|
2766 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
2767 |
! |
|
2768 |
||
4201 | 2769 |
saveAspectValues |
2770 |
|saveAspects aspectValue| |
|
2771 |
||
2772 |
||
2773 |
saveAspects := self class userPreferencesAspectList. |
|
2774 |
saveAspects do:[ : aspectKey | |
|
2775 |
aspectValue := (self perform:aspectKey) value. |
|
2776 |
UserPreferences current perform:((aspectKey asString, ':') asSymbol) with:aspectValue. |
|
2777 |
]. |
|
2778 |
! |
|
2779 |
||
3892 | 2780 |
saveRuntimeAspectValues |
2781 |
|savedAspects dictionary value isHolder aspect| |
|
2782 |
||
5941 | 2783 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 2784 |
dictionary := Dictionary new. |
5941 | 2785 |
savedAspects do:[:aspectKey | |
4414 | 2786 |
aspect := self perform:aspectKey. |
2787 |
isHolder := aspect isValueModel. |
|
5941 | 2788 |
isHolder ifTrue:[ |
2789 |
value := aspect value |
|
2790 |
] ifFalse:[ |
|
2791 |
value := aspect |
|
2792 |
]. |
|
2793 |
dictionary at:aspectKey |
|
2794 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
2795 |
]. |
|
2796 |
RuntimeAspects := dictionary. |
|
3892 | 2797 |
! |
2798 |
||
4201 | 2799 |
userPreferencesAspectValueFor:something |
2800 |
"returns the default aspect from the Userpreferences |
|
3892 | 2801 |
" |
4201 | 2802 |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6236
diff
changeset
|
2803 |
(self class userPreferencesAspectList includes:something) ifFalse:[ ^ nil]. |
4201 | 2804 |
^ UserPreferences current perform:something. |
3892 | 2805 |
! ! |
2806 |
||
4011 | 2807 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
2808 |
||
4018 | 2809 |
filterBackgroundColor |
2810 |
||
2811 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
2812 |
! |
|
2813 |
||
4011 | 2814 |
filterBlockHolder |
2815 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2816 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 2817 |
! |
2818 |
||
2819 |
filterListModel |
|
2820 |
||
2821 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
2822 |
! |
|
2823 |
||
2824 |
filterModel |
|
5941 | 2825 |
|m| |
2826 |
||
2827 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
2828 |
^ m |
|
4011 | 2829 |
! |
2830 |
||
4018 | 2831 |
filterValueBox |
2832 |
||
2833 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
2834 |
! |
|
2835 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2836 |
makeFilterBlock |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2837 |
| filterString filterStrings filters showHidden yesOrNo filterBlock| |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2838 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2839 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2840 |
filterString = '' ifTrue:[filterString := '*']. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2841 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2842 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2843 |
filters := filterStrings |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2844 |
collect:[:eachPattern | |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2845 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2846 |
|pattern| |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2847 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2848 |
pattern := eachPattern withoutSeparators. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2849 |
yesOrNo := true. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2850 |
(pattern startsWith:'~') ifTrue:[ |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2851 |
yesOrNo := false. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2852 |
pattern := pattern copyFrom:2. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2853 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2854 |
yesOrNo ifTrue:[ |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2855 |
[:name | pattern match:name ] |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2856 |
] ifFalse:[ |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2857 |
[:name | (pattern match:name) not ] |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2858 |
]. |
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 |
filters size == 1 ifTrue:[ |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2862 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2863 |
] ifFalse:[ |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2864 |
filterBlock := [: name | filters contains:[:aFilter | aFilter value:name ]]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2865 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2866 |
|
4011 | 2867 |
showHidden := self showHiddenFiles value. |
2868 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2869 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
2870 |
]. |
5870 | 2871 |
^ [: el | ((el asString startsWith:'.') not) and:[filterBlock value:el]]. |
4018 | 2872 |
! |
2873 |
||
2874 |
shownFiles |
|
2875 |
||
2876 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 2877 |
! ! |
2878 |
||
3892 | 2879 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
2880 |
||
2881 |
dirHistory |
|
3952 | 2882 |
^ self class directoryHistory |
3892 | 2883 |
! |
2884 |
||
2885 |
enableBack |
|
2886 |
||
2887 |
^ self aspectFor:#enableBack ifAbsent:[false asValue] |
|
2888 |
! |
|
2889 |
||
2890 |
enableFileHistory |
|
2891 |
||
2892 |
^ self aspectFor:#enableFileHistory ifAbsent:[false asValue] |
|
2893 |
! |
|
2894 |
||
2895 |
enableForward |
|
2896 |
||
2897 |
^ self aspectFor:#enableForward ifAbsent:[false asValue] |
|
2898 |
! |
|
2899 |
||
2900 |
fileHistory |
|
2901 |
||
2902 |
^ self aspectFor:#fileHistory ifAbsent:[FilenameHistory new] |
|
2903 |
! ! |
|
2904 |
||
2905 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
2906 |
||
4345 | 2907 |
activityVisibilityChannel |
6284 | 2908 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 2909 |
|
2910 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ false asValue ]. |
|
2911 |
! |
|
2912 |
||
4110 | 2913 |
openAlwaysInTextEditor |
4201 | 2914 |
" aspect for open every file in TextEditor dont use e.g. HtmlEditor for *.html'" |
4110 | 2915 |
|
2916 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
|
2917 |
! |
|
2918 |
||
3892 | 2919 |
openMultipleApplicationsForType |
2920 |
||
4201 | 2921 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
2922 |
open TextEditor " |
|
2923 |
||
3892 | 2924 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
2925 |
! |
|
2926 |
||
4201 | 2927 |
showDirectoryTree |
2928 |
||
2929 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 2930 |
! |
2931 |
||
4554 | 2932 |
showDiskUsageHolder |
2933 |
|holder| |
|
2934 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
2935 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 2936 |
holder addDependent:self. |
4554 | 2937 |
^ holder |
2938 |
! |
|
2939 |
||
3892 | 2940 |
showHiddenFiles |
2941 |
||
2942 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
|
2943 |
! |
|
2944 |
||
4648 | 2945 |
userContextAvailable |
2946 |
||
2947 |
" aspect for show group and user columns in contents view |
|
2948 |
windows provides no user context" |
|
2949 |
||
2950 |
^ OperatingSystem isMSWINDOWSlike not |
|
2951 |
! |
|
2952 |
||
3892 | 2953 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2954 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2955 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2956 |
^ self directoryContentsBrowser viewDescription |
3892 | 2957 |
! |
2958 |
||
2959 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2960 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 2961 |
" |
3892 | 2962 |
|
6121 | 2963 |
|directoryContentsBrowser| |
2964 |
||
2965 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
2966 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
2967 |
^ directoryContentsBrowser viewDetails |
|
3892 | 2968 |
! |
2969 |
||
2970 |
viewDirectoryDescription |
|
2971 |
||
4201 | 2972 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
2973 |
on change directory " |
|
2974 |
||
3892 | 2975 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
2976 |
! |
|
2977 |
||
4201 | 2978 |
viewDirsInContentsBrowser |
2979 |
||
2980 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
2981 |
! |
|
2982 |
||
5870 | 2983 |
viewFilesInContentsBrowser |
2984 |
||
2985 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
2986 |
! |
|
2987 |
||
3892 | 2988 |
viewFilesInDirectoryTree |
2989 |
||
4201 | 2990 |
" aspect for view files in tree view (not only directories) " |
2991 |
||
3892 | 2992 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
2993 |
! |
|
2994 |
||
2995 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2996 |
" aspect for show group information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2997 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2998 |
^ self directoryContentsBrowser viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
2999 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3000 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3001 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3002 |
" aspect for show file-type icon 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 viewIcon |
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 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3008 |
" aspect for show inode numbers 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 viewInodeNumber |
3892 | 3011 |
! |
3012 |
||
3013 |
viewNoteBookApplicationHolder |
|
3014 |
||
3015 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
3016 |
! |
|
3017 |
||
3018 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3019 |
" aspect for show owner information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3020 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3021 |
^ self directoryContentsBrowser viewOwner |
3892 | 3022 |
! |
3023 |
||
3024 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3025 |
" aspect for show permission 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 viewPermissions |
3892 | 3028 |
! |
3029 |
||
3030 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3031 |
" aspect for show image previev 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 viewPreview |
3892 | 3034 |
! |
3035 |
||
3036 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3037 |
" aspect for show size information 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 viewSize |
3892 | 3040 |
! |
3041 |
||
4974 | 3042 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3043 |
" aspect for show size-in-bytes 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 viewSizeInBytes |
4974 | 3046 |
! |
3047 |
||
5312 | 3048 |
viewSizeInKiloBytes |
3049 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
3050 |
||
3051 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
3052 |
! |
|
3053 |
||
3892 | 3054 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3055 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3056 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3057 |
^ self directoryContentsBrowser viewTime |
3892 | 3058 |
! |
3059 |
||
3060 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3061 |
" aspect for show suffix (type) 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 viewType |
3892 | 3064 |
! ! |
3065 |
||
3066 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
3067 |
||
3068 |
executeCommand:cmd |
|
3069 |
||
3070 |
self executeCommand:cmd inDirectory:nil |
|
3071 |
! |
|
3072 |
||
5880 | 3073 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 3074 |
| nameString executionBlock| |
3075 |
||
5880 | 3076 |
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
|
3077 |
nameString := 'Execute: ', cmd. |
3892 | 3078 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
3079 |
! |
|
3080 |
||
3081 |
getExecutionBlockForCommand:cmd |
|
3082 |
||
3083 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
3084 |
! |
|
3085 |
||
5880 | 3086 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
3087 |
| dir| |
|
3088 |
||
3089 |
dir := directoryOrNil. |
|
3090 |
directoryOrNil isNil ifTrue:[ |
|
3091 |
dir := self theSingleSelectedDirectoryOrNil. |
|
3092 |
dir isNil ifTrue:[ ^ self]. |
|
3892 | 3093 |
]. |
4523 | 3094 |
|
3095 |
^ [:stream| |
|
3096 |
stream notNil ifTrue:[ |
|
4414 | 3097 |
OperatingSystem |
3098 |
executeCommand:cmd |
|
3099 |
inputFrom:nil |
|
3100 |
outputTo:stream |
|
3101 |
errorTo:stream |
|
3102 |
inDirectory:dir |
|
3103 |
onError:[:status| false]. |
|
3104 |
] |
|
4523 | 3105 |
]. |
3892 | 3106 |
! |
3107 |
||
3108 |
killAllRunningBackgroundProcesses |
|
3109 |
||
3110 |
self backgroundProcesses do:[ : process | |
|
4523 | 3111 |
self notify:'kill ', process name. |
4414 | 3112 |
process terminate. |
3892 | 3113 |
]. |
3114 |
! |
|
3115 |
||
3116 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
3117 |
| stream process appl nameString| |
|
3118 |
||
3119 |
appl := self openCommandResultApplication. |
|
3120 |
stream := appl resultStream. |
|
3121 |
nameString := aString ? 'Execution Result'. |
|
3122 |
appl changeTabTo:nameString. |
|
4523 | 3123 |
|
4516
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3124 |
process := [ [aBlock value:stream] |
4891
5422df926e2d
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
4881
diff
changeset
|
3125 |
ensure:[ |
4516
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3126 |
self backgroundProcesses remove:process ifAbsent:[]. |
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3127 |
appl process value:nil. |
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3128 |
|
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3129 |
"/ close automatically, if there was no output. |
4571 | 3130 |
"/ appl resultStream contents isEmpty ifTrue:[ |
3131 |
"/ appl doClose. |
|
3132 |
"/ ] |
|
4516
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3133 |
] |
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3134 |
] newProcess. |
3892 | 3135 |
process priority:(Processor userBackgroundPriority). |
3136 |
process name:nameString. |
|
3137 |
self backgroundProcesses add:process. |
|
3138 |
appl process value:process. |
|
3139 |
process resume. |
|
3140 |
! ! |
|
3141 |
||
3142 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
3143 |
||
4915 | 3144 |
currentFileNameHolderChanged |
3145 |
"/ self currentFileNameHolderChangedForCommon |
|
3146 |
! |
|
3147 |
||
4577 | 3148 |
currentFileNameHolderChangedForCommon |
5476 | 3149 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3150 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3151 |
selection := self currentFileNameHolder value. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3152 |
self class currentSelection:selection. |
4734 | 3153 |
|
5476 | 3154 |
selectionNotEmpty := selection notEmpty. |
3155 |
self hasSelection value:selectionNotEmpty. |
|
3156 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
4734 | 3157 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3158 |
newDirectories := self directoriesForFiles:selection. |
4011 | 3159 |
oldDirectories := self currentDirectories value. |
3160 |
oldDirectories ~= newDirectories ifTrue:[ |
|
4347 | 3161 |
self currentDirectories value:newDirectories. |
3162 |
size := newDirectories size. |
|
4774 | 3163 |
rootInTreeView := self |
3164 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 3165 |
ifPresentDo:[:appl | appl rootHolder]. |
3166 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
3167 |
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
|
3168 |
|
4347 | 3169 |
newDirectories notEmpty ifTrue:[ |
3170 |
self dirHistory addToHistory:(newDirectories first asString). |
|
3171 |
]. |
|
5074 | 3172 |
self enableHome value:((newDirectories includes:(Filename homeDirectory asAbsoluteFilename))not). |
3173 |
self enableGotoDefault value:((newDirectories includes:(Filename defaultDirectory asAbsoluteFilename))not). |
|
4011 | 3174 |
]. |
4022 | 3175 |
self enableForward value:self canForward. |
4734 | 3176 |
self enableBack value:self canBackward. |
6095 | 3177 |
|
3178 |
self updateCanMake. |
|
4011 | 3179 |
! |
3180 |
||
3181 |
filterModelChanged |
|
3182 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3183 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 3184 |
! |
3185 |
||
3892 | 3186 |
update:something with:aParameter from:changedObject |
3187 |
||
3188 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
3189 |
and the things that have to be done if it runs standalone " |
|
3190 |
||
3191 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 3192 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3193 |
^ self |
3892 | 3194 |
]. |
3989 | 3195 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3196 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3197 |
^ self |
3989 | 3198 |
]. |
4011 | 3199 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3200 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3201 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3202 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3203 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3204 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3205 |
^ self |
4004 | 3206 |
]. |
4781 | 3207 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 3208 |
self notify:nil. |
4781 | 3209 |
^ self |
3210 |
]. |
|
3989 | 3211 |
|
3892 | 3212 |
super update:something with:aParameter from:changedObject |
5543 | 3213 |
! |
3214 |
||
6095 | 3215 |
updateCanMake |
3216 |
|dir can| |
|
3217 |
||
3218 |
can := false. |
|
3219 |
dir := self currentDirectory. |
|
3220 |
dir notNil ifTrue:[ |
|
3221 |
can := (dir asFilename construct:'Makefile') exists. |
|
3222 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
3223 |
can ifFalse:[ |
|
3224 |
can := (self currentDirectory asFilename construct:'nt.mak') exists. |
|
3225 |
] |
|
3226 |
]. |
|
3227 |
]. |
|
3228 |
self canMake value:can. |
|
3229 |
! |
|
3230 |
||
5543 | 3231 |
updateListAfterDelete:colOfFiles |
3232 |
self updateCurrentDirectory |
|
3892 | 3233 |
! ! |
3234 |
||
3235 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
3236 |
||
3237 |
canPaste |
|
3238 |
||
3239 |
^ self aspectFor:#canPaste ifAbsent:[ false asValue ]. |
|
3240 |
! |
|
3241 |
||
3242 |
clipboard |
|
3243 |
||
3244 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
3245 |
! |
|
3246 |
||
3247 |
copyFilesToClipBoard:colOfFiles |
|
3248 |
self putInClipBoard:colOfFiles as:#copy. |
|
3249 |
! |
|
3250 |
||
3251 |
cutFilesToClipBoard:colOfFiles |
|
3252 |
"defete current selected files/directories |
|
3253 |
" |
|
3254 |
self putInClipBoard:colOfFiles as:#cut. |
|
3255 |
! |
|
3256 |
||
3257 |
emptyClipBoard |
|
3258 |
||
3259 |
self clipboard files:nil. |
|
3260 |
self canPaste value:false. |
|
3261 |
! |
|
3262 |
||
3263 |
putInClipBoard:colOfFiles as:aSymbol |
|
3264 |
| stream clp| |
|
3265 |
||
3266 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
3267 |
clp := self clipboard. |
|
3268 |
clp files:nil. |
|
3269 |
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
|
3270 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3271 |
stream := String writeStream. |
3892 | 3272 |
stream nextPutAll:aSymbol asString. |
3273 |
stream nextPutAll:' <'. |
|
3274 |
stream nextPutAll:colOfFiles first asString. |
|
3275 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 3276 |
stream nextPutAll:' ...'. |
3892 | 3277 |
]. |
3278 |
stream nextPutAll:'> to clipboard'. |
|
3279 |
||
4523 | 3280 |
self notify:stream contents. |
3892 | 3281 |
stream close. |
3282 |
clp files:colOfFiles. |
|
3283 |
self canPaste value:true. |
|
3284 |
! ! |
|
3285 |
||
3286 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
3287 |
||
3288 |
canDropFiles:dropedObjects for:filename |
|
6284 | 3289 |
|filenameDirString filenameDir| |
3892 | 3290 |
|
3291 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 3292 |
|
3892 | 3293 |
filenameDir := self getDirWithoutFileName:filename. |
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6236
diff
changeset
|
3294 |
filenameDir isWritable ifFalse:[^ false]. |
6284 | 3295 |
|
3892 | 3296 |
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
|
3297 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
3298 |
dropedObjects do:[:aDropObject | |
6284 | 3299 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
3300 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
3301 |
"/ |
|
3302 |
"/ dropFileName := aDropObject theObject. |
|
3303 |
"/ dropFileNameString := dropFileName asString. |
|
3304 |
"/ dropFileName isDirectory ifTrue:[ |
|
3305 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
3306 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
3307 |
"/ ^ false |
|
3308 |
"/ ] |
|
3309 |
"/ ] ifFalse:[ |
|
3310 |
"/ physicalPathName := dropFileName physicalPathName. |
|
3311 |
"/ (filenameDirString = dropFileName directory asString |
|
3312 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
3313 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
3314 |
"/ self notify:'Cannot drop a file into same directory'. |
|
3315 |
"/ ^ false |
|
3316 |
"/ ] |
|
3317 |
"/ ] |
|
3318 |
]. |
|
3319 |
self notify:nil. |
|
3320 |
^ true |
|
3321 |
! |
|
3322 |
||
3323 |
canDropObject:aDropObject into:aDirectory |
|
3324 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
3325 |
||
3326 |
dropFileName := aDropObject theObject. |
|
3327 |
dropFileNameString := dropFileName asString. |
|
3328 |
dropFileName isDirectory ifTrue:[ |
|
3329 |
filenameDirString := aDirectory asString. |
|
3330 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
3331 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
3332 |
^ false |
|
4414 | 3333 |
] |
6284 | 3334 |
] ifFalse:[ |
3335 |
physicalPathName := dropFileName physicalPathName. |
|
3336 |
(aDirectory = dropFileName directory |
|
3337 |
or:[ aDropObject isFileInArchive not |
|
3338 |
and:[physicalPathName notNil |
|
3339 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
3340 |
self notify:'Cannot drop a file into same directory'. |
|
3341 |
^ false |
|
3342 |
] |
|
3343 |
]. |
|
3344 |
^ true. |
|
3892 | 3345 |
! |
3346 |
||
3347 |
doStartDrag:aDropSource in:aView |
|
3348 |
"set the cursors before starting the drag & drop operation |
|
3349 |
" |
|
3350 |
|hdl| |
|
3351 |
||
3352 |
hdl := DragAndDropManager new. |
|
3353 |
||
4337
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
3354 |
hdl disabledCursor:self class disabledCursorImage. |
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
3355 |
hdl enabledCursor:self class enabledCursorImage. |
3892 | 3356 |
hdl alienCursor:nil. |
3357 |
||
4745 | 3358 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft. |
3359 |
||
3892 | 3360 |
! ! |
3361 |
||
3362 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
3363 |
||
3364 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 3365 |
"copy to" |
3366 |
||
3367 |
|copy msg| |
|
3892 | 3368 |
|
5961 | 3369 |
copy := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
3892 | 3370 |
copy result ifTrue:[ |
6190 | 3371 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 3372 |
] ifFalse:[ |
6190 | 3373 |
msg := copy errorString. |
3374 |
]. |
|
3375 |
self notify:msg. |
|
3892 | 3376 |
^ copy result |
3377 |
! |
|
3378 |
||
3379 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
3380 |
|copy| |
|
3381 |
||
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3382 |
self withWaitCursorDo:[ |
5961 | 3383 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3384 |
copy result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3385 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3386 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3387 |
self updateCurrentDirectory. |
3892 | 3388 |
]. |
3389 |
^ copy colOfCopiedFiles |
|
3390 |
! |
|
3391 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3392 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3393 |
|size stream msg answer file| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3394 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3395 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3396 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3397 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3398 |
"/ 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
|
3399 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3400 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3401 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3402 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3403 |
"/ 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
|
3404 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3405 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3406 |
"/ 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
|
3407 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3408 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3409 |
"/ 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
|
3410 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3411 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3412 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3413 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3414 |
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
|
3415 |
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
|
3416 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3417 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3418 |
] ifFalse:[ |
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 objects\to:\ %2 ?' |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3421 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3422 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 3423 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3424 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3425 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3426 |
request:msg |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3427 |
label:'Move or Copy' |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
3428 |
image:(WarningBox iconBitmap) |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3429 |
buttonLabels:#('Cancel' 'Move' 'Copy' 'Copy As...') |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3430 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3431 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3432 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3433 |
^ answer. |
3892 | 3434 |
! |
3435 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3436 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 3437 |
"copy or move aColOfSourceFiles to aDirectory. |
3438 |
Asks the used if a move or a copy is wanted. |
|
3439 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
3440 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3441 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3442 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3443 |
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
|
3444 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3445 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3446 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3447 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3448 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3449 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3450 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3451 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3452 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3453 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3454 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3455 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 3456 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3457 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3458 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3459 |
lastNew := dstBase. |
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 |
|
4745 | 3462 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3463 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3464 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3465 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 3466 |
^ true. |
3892 | 3467 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3468 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3469 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 3470 |
^ true. |
3892 | 3471 |
]. |
4745 | 3472 |
^ false. |
3892 | 3473 |
! |
3474 |
||
6107 | 3475 |
copySelectionTo |
3476 |
"copy the selected file(s) to another directory" |
|
3477 |
||
6299 | 3478 |
|selectedFiles msg destination directory| |
3479 |
||
3480 |
selectedFiles := self currentFileNameHolder value copy. |
|
3481 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
|
3482 |
||
3483 |
msg := (selectedFiles size > 1) |
|
3484 |
ifTrue:[ 'Copy Selected Items To Directory:' ] |
|
3485 |
ifFalse:[ 'Copy "%1" To Directory:' ]. |
|
3486 |
||
3487 |
destination := Dialog |
|
3488 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first pathName) |
|
6107 | 3489 |
default:(LastMoveDestination ? self currentDirectory) |
3490 |
ok:'Copy' |
|
3491 |
abort:nil. |
|
6299 | 3492 |
destination isEmptyOrNil ifTrue:[^ self]. |
3493 |
destination := destination asFilename. |
|
3494 |
||
3495 |
destination isDirectory ifFalse:[ |
|
3496 |
selectedFiles size == 1 ifTrue:[ |
|
3497 |
directory := destination directory. |
|
3498 |
directory isDirectory ifTrue:[ |
|
3499 |
LastMoveDestination := directory. |
|
3500 |
self copyFile:selectedFiles first to:destination. |
|
3501 |
^ self. |
|
3502 |
] |
|
3503 |
] |
|
3504 |
]. |
|
3505 |
||
3506 |
LastMoveDestination := destination. |
|
3507 |
self copyFiles:selectedFiles to:destination |
|
6107 | 3508 |
! |
3509 |
||
3892 | 3510 |
deleteFile:aFile |
3511 |
"delete current selected files/directories |
|
3512 |
" |
|
3513 |
||
3514 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
3515 |
! |
|
3516 |
||
3517 |
deleteFiles:colOfFiles |
|
3518 |
"delete current selected files/directories |
|
3519 |
" |
|
5081 | 3520 |
^ self deleteFiles:colOfFiles confirm:true. |
3521 |
! |
|
3522 |
||
3523 |
deleteFiles:colOfFiles confirm:confirm |
|
3524 |
"delete current selected files/directories |
|
3525 |
" |
|
5673 | 3526 |
|delete result| |
3892 | 3527 |
|
5418 | 3528 |
self windowGroup withWaitCursorDo:[ |
5961 | 3529 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
5673 | 3530 |
result := delete result. |
3531 |
result notNil ifTrue:[ |
|
3532 |
result ifFalse:[ |
|
3533 |
self notify:delete errorString. |
|
5753 | 3534 |
] ifTrue:[ |
3535 |
self updateListAfterDelete:colOfFiles. |
|
3536 |
] |
|
4394 | 3537 |
]. |
5673 | 3538 |
]. |
3539 |
^ result. |
|
3892 | 3540 |
! |
3541 |
||
6169 | 3542 |
eraseFiles:colOfFiles |
3543 |
"delete current selected files/directories |
|
3544 |
" |
|
3545 |
^ self eraseFiles:colOfFiles confirm:true. |
|
3546 |
! |
|
3547 |
||
3548 |
eraseFiles:colOfFiles confirm:confirm |
|
3549 |
"erase current selected files/directories |
|
3550 |
" |
|
3551 |
|delete result| |
|
3552 |
||
3553 |
self windowGroup withWaitCursorDo:[ |
|
3554 |
delete := FileOperation eraseFiles:colOfFiles confirm:confirm. |
|
3555 |
result := delete result. |
|
3556 |
result notNil ifTrue:[ |
|
3557 |
result ifFalse:[ |
|
3558 |
self notify:delete errorString. |
|
3559 |
] ifTrue:[ |
|
3560 |
self updateListAfterDelete:colOfFiles. |
|
3561 |
] |
|
3562 |
]. |
|
3563 |
]. |
|
3564 |
^ result. |
|
3565 |
! |
|
3566 |
||
3892 | 3567 |
moveFile:aSourceFile to:aDestFile |
6190 | 3568 |
"defete current selected files/directories" |
3892 | 3569 |
|
3570 |
|move| |
|
3571 |
||
5961 | 3572 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 3573 |
move result ifTrue:[ |
4523 | 3574 |
self notify:('move ', aSourceFile asString, ' to ', aDestFile asString). |
3892 | 3575 |
] ifFalse:[ |
4523 | 3576 |
self notify:move errorString. |
3892 | 3577 |
]. |
3578 |
self updateCurrentDirectory. |
|
3579 |
^ move result |
|
3580 |
! |
|
3581 |
||
3582 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
3583 |
"move aColOfSourceFiles to aDirectory |
|
3584 |
" |
|
3585 |
|move| |
|
3586 |
||
5419 | 3587 |
self windowGroup withWaitCursorDo:[ |
5961 | 3588 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3589 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3590 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3591 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3592 |
self updateCurrentDirectory. |
3892 | 3593 |
]. |
3594 |
^ move colOfMovedFiles |
|
3595 |
! |
|
3596 |
||
6107 | 3597 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3598 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3599 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3600 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3601 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3602 |
destinationDirectory := Dialog |
6352 | 3603 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items To:') |
5789 | 3604 |
default:(LastMoveDestination ? self currentDirectory) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3605 |
ok:'Move' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3606 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3607 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3608 |
|
5789 | 3609 |
LastMoveDestination := destinationDirectory. |
3610 |
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
|
3611 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3612 |
|
3892 | 3613 |
newDirectory |
3614 |
"ask for and create a new directory" |
|
3615 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3616 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3617 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3618 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3619 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3620 |
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
|
3621 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3622 |
]. |
4521 | 3623 |
|
3624 |
"/ 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
|
3625 |
selectedFiles := self currentSelectedFiles. |
4521 | 3626 |
selectedFiles size == 1 ifTrue:[ |
3627 |
singleSelectedFile := selectedFiles first. |
|
3628 |
||
3629 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
3630 |
(mime notNil and:[mime isArchive]) ifTrue:[ |
|
3631 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
|
3632 |
||
3633 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
4982
c38742d99bfd
care for nil mime in newDirectory
Claus Gittinger <cg@exept.de>
parents:
4979
diff
changeset
|
3634 |
(mime notNil and:[mime isArchive]) ifTrue:[ |
4521 | 3635 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
3636 |
]. |
|
3637 |
]. |
|
3638 |
]. |
|
3639 |
||
5961 | 3640 |
|
4521 | 3641 |
defaultAnswer notNil ifTrue:[ |
5961 | 3642 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 3643 |
] ifFalse:[ |
5961 | 3644 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 3645 |
]. |
3646 |
createOp result ifFalse:[ ^ self]. |
|
3647 |
newFile := createOp createdFile. |
|
3892 | 3648 |
newFile notNil ifTrue:[ |
4414 | 3649 |
self updateCurrentDirectory. |
3892 | 3650 |
] |
3651 |
! |
|
3652 |
||
3653 |
newFile |
|
3654 |
"ask for and create a new file" |
|
3655 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3656 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3657 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3658 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3659 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3660 |
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
|
3661 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3662 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3663 |
|
3982 | 3664 |
curFile := self firstSelectedFile. |
3892 | 3665 |
curFile notNil ifTrue:[ |
4414 | 3666 |
file := curFile. |
3892 | 3667 |
] ifFalse:[ |
4414 | 3668 |
file := directory. |
3892 | 3669 |
]. |
5961 | 3670 |
create := FileOperation createFileIn:file. |
3892 | 3671 |
create result ifFalse:[ ^ self]. |
3672 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
3673 |
! |
|
3674 |
||
3675 |
newHardLink |
|
3676 |
"ask for and create a hard link (unix only)" |
|
3677 |
||
6151 | 3678 |
self newLink:#hard. |
3679 |
! |
|
3680 |
||
3681 |
newLink:typeOfLink |
|
3892 | 3682 |
|
3683 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
|
3684 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3685 |
| sel dir create createdFile| |
3892 | 3686 |
|
3687 |
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
|
3688 |
(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
|
3689 |
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
|
3690 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
3691 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3692 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3693 |
|
6151 | 3694 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 3695 |
create result ifFalse:[ ^ self]. |
3696 |
createdFile := create createdFile. |
|
3697 |
createdFile notNil ifTrue:[ |
|
6151 | 3698 |
typeOfLink == #soft ifTrue:[ |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3699 |
self updateCurrentDirectory. |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3700 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3701 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3702 |
] |
3892 | 3703 |
]. |
3704 |
! |
|
3705 |
||
3706 |
newSoftLink |
|
3707 |
"ask for and create a soft link (unix only)" |
|
3708 |
||
6151 | 3709 |
self newLink:#soft. |
3892 | 3710 |
! |
3711 |
||
3712 |
pasteFiles |
|
3713 |
"defete current selected files/directories |
|
3714 |
" |
|
3715 |
| buffer destination files directories copiedFiles| |
|
3716 |
||
3717 |
files := self clipboard files. |
|
3718 |
(files isNil or:[files isEmpty]) ifTrue:[ ^ self ]. |
|
3719 |
buffer := self clipboard copy. |
|
3982 | 3720 |
directories := self currentSelectedDirectories. |
5880 | 3721 |
directories size ~~ 1 ifTrue:[ |
4414 | 3722 |
|box dirStringCol| |
5880 | 3723 |
|
4414 | 3724 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
3725 |
box := ListSelectionBox new. |
|
3726 |
box title:'In which directory you want to paste ?'. |
|
3727 |
box list:dirStringCol. |
|
3728 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
3729 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
3730 |
box destroy. |
3892 | 3731 |
] ifFalse:[ |
5880 | 3732 |
destination := directories anElement. |
3892 | 3733 |
]. |
3734 |
(self clipboard method == #cut) ifTrue:[ |
|
5081 | 3735 |
buffer files copy do:[:aFile| |
3736 |
aFile directory = destination ifTrue:[ |
|
3737 |
buffer files remove:aFile. |
|
3738 |
]. |
|
3739 |
]. |
|
3740 |
]. |
|
3741 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
3742 |
(self clipboard method == #cut) ifTrue:[ |
|
3743 |
self deleteFiles:copiedFiles confirm:false. |
|
3744 |
]. |
|
3892 | 3745 |
! |
3746 |
||
3747 |
renameFile:aFile |
|
3748 |
"rename the selected file(s)" |
|
3749 |
||
3750 |
^ self renameFiles:(OrderedCollection with:aFile). |
|
3751 |
! |
|
3752 |
||
4230 | 3753 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 3754 |
"rename filename to newFileString" |
3755 |
||
3756 |
|rename| |
|
3757 |
||
5961 | 3758 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 3759 |
rename result ifTrue:[ |
4230 | 3760 |
aBoolean ifTrue:[ |
3761 |
self updateAndSelect:(rename renamedFiles). |
|
3762 |
]. |
|
3892 | 3763 |
] ifFalse:[ |
4523 | 3764 |
self notify:rename errorString. |
3892 | 3765 |
]. |
3766 |
^ rename result |
|
3767 |
! |
|
3768 |
||
3769 |
renameFiles:aColOfFiles |
|
3770 |
"rename the selected file(s)" |
|
3771 |
||
3772 |
|rename| |
|
3773 |
||
5961 | 3774 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 3775 |
rename result ifFalse:[ |
4523 | 3776 |
self notify:rename errorString |
3892 | 3777 |
] ifTrue:[ |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3778 |
self updateAndSelect:nil. "/ (rename renamedFiles) |
3892 | 3779 |
]. |
3780 |
^ rename result |
|
3781 |
! |
|
3782 |
||
3783 |
renameSelection |
|
3784 |
"rename the selected file(s)" |
|
3785 |
||
6346 | 3786 |
self renameFiles:(self currentFileNameHolder value copy) |
3892 | 3787 |
! ! |
3788 |
||
4080 | 3789 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 3790 |
|
3952 | 3791 |
bookmarksMenuSpec |
3792 |
<resource: #programMenu> |
|
3793 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3794 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3795 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3796 |
menu := self class baseBookmarksMenuSpec decodeAsLiteralArray. |
4080 | 3797 |
menu findGuiResourcesIn:self. |
3952 | 3798 |
menu receiver:self. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3799 |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3800 |
"/ add the bookmark items ... |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3801 |
bookmarks := self class directoryBookmarks. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3802 |
bookmarks notEmptyOrNil ifTrue:[ |
4414 | 3803 |
menu addItem:(MenuItem labeled:'-'). |
3804 |
bookmarks do:[:dirName | |
|
3805 |
menu addItem:((MenuItem label:dirName asString value:[ |
|
3806 |
(self currentDirectories value includes:dirName) ifFalse:[ |
|
5959 | 3807 |
self setCurrentFileName:dirName. |
4414 | 3808 |
]. |
3809 |
])). |
|
3810 |
]. |
|
3952 | 3811 |
]. |
3812 |
^ menu |
|
3813 |
||
3814 |
"Modified: / 17.8.1998 / 10:13:05 / cg" |
|
3815 |
! |
|
3816 |
||
4347 | 3817 |
canBackward |
3818 |
||
3819 |
||
3820 |
^ self dirHistory canBackward. |
|
3906 | 3821 |
! |
3822 |
||
3823 |
canForward |
|
3824 |
||
3825 |
^ self dirHistory canForward. |
|
3826 |
! |
|
3827 |
||
6099 | 3828 |
gotoBookmarksMenuSpec |
3829 |
<resource: #programMenu> |
|
3830 |
||
3831 |
|menu bookmarks| |
|
3832 |
||
6102 | 3833 |
menu := self class baseBookmarksMenuSpec2 decodeAsLiteralArray. |
6099 | 3834 |
menu findGuiResourcesIn:self. |
3835 |
menu receiver:self. |
|
3836 |
||
3837 |
"/ add the bookmark items ... |
|
3838 |
bookmarks := self class directoryBookmarks. |
|
3839 |
bookmarks notEmptyOrNil ifTrue:[ |
|
6102 | 3840 |
menu addItem:(MenuItem labeled:'-'). |
6099 | 3841 |
bookmarks do:[:dirName | |
3842 |
menu addItem:((MenuItem label:dirName asString value:[ |
|
3843 |
(self currentDirectories value includes:dirName) ifFalse:[ |
|
3844 |
self setCurrentFileName:dirName. |
|
3845 |
]. |
|
3846 |
])). |
|
3847 |
]. |
|
3848 |
]. |
|
3849 |
^ menu |
|
3850 |
||
3851 |
"Modified: / 17.8.1998 / 10:13:05 / cg" |
|
3852 |
! |
|
3853 |
||
3892 | 3854 |
menuDirHistory:backOrForward |
3855 |
"initialize the directory menu |
|
3856 |
" |
|
3857 |
<resource: #programMenu > |
|
3858 |
||
3964 | 3859 |
|menu pathList currentSel currentPath| |
3892 | 3860 |
|
3861 |
menu := Menu new. |
|
3862 |
menu receiver:self. |
|
3863 |
||
3864 |
self dirHistory isEmpty ifTrue:[^ nil]. |
|
3865 |
backOrForward == #back ifTrue:[ |
|
4347 | 3866 |
currentSel := self currentDirectories value. |
3867 |
currentSel size == 1 ifTrue:[ |
|
3868 |
currentPath := currentSel first asString. |
|
3869 |
] ifFalse:[ |
|
3870 |
currentPath := nil. |
|
3871 |
]. |
|
3872 |
pathList := self dirHistory getBackCollection. |
|
3892 | 3873 |
] ifFalse:[ |
4347 | 3874 |
pathList := self dirHistory getForwardCollection. |
3892 | 3875 |
]. |
4022 | 3876 |
pathList isEmpty ifTrue:[ ^ nil]. |
3964 | 3877 |
pathList do:[:aPath| |
4347 | 3878 |
| menuItem | |
3879 |
menuItem := MenuItem new. |
|
3880 |
menuItem label:aPath. |
|
3881 |
menuItem value:[ |
|
5959 | 3882 |
self setCurrentFileName:(aPath asFilename). |
4347 | 3883 |
]. |
3884 |
menu addItem:menuItem. |
|
3952 | 3885 |
]. |
3892 | 3886 |
^ menu |
3887 |
! |
|
3888 |
||
3889 |
menuDirHistoryBack |
|
3890 |
"initialize the directory menu |
|
3891 |
" |
|
3892 |
<resource: #programMenu > |
|
3893 |
||
3894 |
^ self menuDirHistory:#back. |
|
3895 |
! |
|
3896 |
||
3897 |
menuDirHistoryForward |
|
3898 |
"initialize the directory menu |
|
3899 |
" |
|
3900 |
<resource: #programMenu > |
|
3901 |
||
3902 |
^ self menuDirHistory:#forward. |
|
3906 | 3903 |
! |
3904 |
||
3905 |
menuFileHistory |
|
3906 |
"initialize the file history menu |
|
3907 |
" |
|
3908 |
<resource: #programMenu > |
|
3909 |
||
3910 |
|menu hist text removeItem removeCol| |
|
3911 |
||
3912 |
menu := Menu new. |
|
4080 | 3913 |
menu findGuiResourcesIn:self. |
3906 | 3914 |
menu receiver:self. |
3915 |
||
3916 |
hist := self fileHistory. |
|
3917 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3918 |
|
3906 | 3919 |
removeCol := OrderedCollection new. |
3920 |
hist do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3921 |
aFileItem fileName exists ifTrue:[ |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3922 |
menu addItem:(MenuItem label: aFileItem fileName asString value:[ |
5959 | 3923 |
self setCurrentFileName:(aFileItem fileName). |
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3924 |
self openApplByFileItem:aFileItem |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3925 |
]). |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3926 |
] ifFalse:[ |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3927 |
removeCol add:aFileItem. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3928 |
] |
3906 | 3929 |
]. |
3930 |
"/ remove all not existing history entries |
|
3931 |
removeCol do:[ : el | |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3932 |
hist remove:el. |
3906 | 3933 |
]. |
4080 | 3934 |
removeItem := MenuItem new. |
3935 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3936 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3937 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 3938 |
removeItem label:text. |
3939 |
removeItem value:[ |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3940 |
self fileHistory removeAll. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
3941 |
self enableFileHistory value:false. |
3906 | 3942 |
]. |
5977 | 3943 |
menu addSeparator. |
3906 | 3944 |
menu addItem:removeItem. |
3945 |
^ menu |
|
3952 | 3946 |
! |
3947 |
||
4080 | 3948 |
sortMenu |
3949 |
||
3950 |
<resource: #programMenu > |
|
3951 |
||
3952 |
|menu| |
|
3953 |
||
3954 |
menu := Menu new fromLiteralArrayEncoding:self class sortMenu. |
|
3955 |
menu ifNil:[ ^ nil ]. |
|
3956 |
menu findGuiResourcesIn:self. |
|
3957 |
menu receiver:self. |
|
3958 |
^ menu |
|
3959 |
! |
|
3960 |
||
3961 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3962 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3963 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3964 |
specHere := self class viewDetailsMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3965 |
itemsHere := specHere at:2. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3966 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3967 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3968 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3969 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3970 |
spec := specHere copy. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3971 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3972 |
^ spec |
4080 | 3973 |
! |
3974 |
||
3975 |
viewInContentsBrowserMenu |
|
5009 | 3976 |
self |
3977 |
applicationNamed:#DirectoryContentsBrowser |
|
3978 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
3979 |
||
3980 |
^ nil. |
|
4080 | 3981 |
! |
3982 |
||
3952 | 3983 |
visitedDirectoriesMenu |
3984 |
||
3985 |
<resource: #programMenu > |
|
3986 |
||
3987 |
|menu histCopy text removeItem| |
|
3988 |
||
3989 |
menu := Menu new. |
|
3990 |
menu receiver:self. |
|
3991 |
||
3992 |
self dirHistory isEmpty ifTrue:[^ nil]. |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3993 |
"/ 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
|
3994 |
text := (resources string:'Clear History'). |
3952 | 3995 |
removeItem := MenuItem new. |
4040 | 3996 |
removeItem translateLabel:true. |
3952 | 3997 |
removeItem label:text. |
3998 |
removeItem value:[ |
|
4347 | 3999 |
self dirHistory removeAll. |
4000 |
self enableForward value:self canForward. |
|
4001 |
self enableBack value:self canBackward. |
|
3952 | 4002 |
]. |
4003 |
histCopy := self dirHistory. |
|
4004 |
histCopy do:[:aFile| |
|
4347 | 4005 |
menu addItem:(MenuItem label:aFile asString value:[ |
5959 | 4006 |
self setCurrentFileName:(aFile path asFilename). |
4347 | 4007 |
]). |
3952 | 4008 |
]. |
5977 | 4009 |
menu addSeparator. |
3952 | 4010 |
menu addItem:removeItem. |
4011 |
^ menu |
|
3892 | 4012 |
! ! |
4013 |
||
5880 | 4014 |
!AbstractFileBrowser methodsFor:'menu actions'! |
4015 |
||
4016 |
doCompareTwoFiles |
|
4017 |
self openDiffView. |
|
4018 |
! |
|
4019 |
||
4020 |
doGoDirectoryUp |
|
5960 | 4021 |
| upDir directory rootInTreeView| |
5880 | 4022 |
|
4023 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
4024 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 4025 |
directory := self currentDirectory. |
4026 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 4027 |
] ifFalse:[ |
4028 |
rootInTreeView := self |
|
4029 |
applicationNamed:#DirectoryTreeBrowser |
|
4030 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 4031 |
directory := rootInTreeView value asFilename. |
4032 |
]. |
|
4033 |
upDir := directory directory. |
|
5959 | 4034 |
self setCurrentFileName:upDir. |
5880 | 4035 |
! |
4036 |
||
4037 |
doGotoDefaultDirectory |
|
4038 |
self gotoFile:(Filename defaultDirectory). |
|
4039 |
! |
|
4040 |
||
4041 |
doGotoHomeDirectory |
|
4042 |
||
4043 |
| home | |
|
4044 |
||
4045 |
home := Filename homeDirectory. |
|
4046 |
self gotoFile:home. |
|
4047 |
! |
|
4048 |
||
4049 |
fileGetInfo:longInfo |
|
4050 |
"get info on selected file - show it in a box" |
|
4051 |
||
4052 |
|string box updater| |
|
4053 |
||
4054 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
4055 |
string notNil ifTrue:[ |
|
4056 |
box := InfoBox title:string. |
|
4057 |
updater := [ |
|
4058 |
[true] whileTrue:[ |
|
4059 |
Delay waitForSeconds:2. |
|
4060 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
4061 |
string isNil ifTrue:[ ^ self]. |
|
4062 |
box title:string |
|
4063 |
] |
|
4064 |
] fork. |
|
4065 |
box show. |
|
4066 |
updater terminate. |
|
4067 |
box destroy |
|
4068 |
] |
|
4069 |
! ! |
|
4070 |
||
4849 | 4071 |
!AbstractFileBrowser methodsFor:'menu actions-cvs'! |
3892 | 4072 |
|
4073 |
cvsAddAndCommit |
|
4849 | 4074 |
self cvsAddAndCommitAsBinary:false |
4075 |
! |
|
4076 |
||
4077 |
cvsAddAndCommitAsBinary:asBinary |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4078 |
|sel log logArg cmd dir executionBlock nameString| |
3892 | 4079 |
|
4080 |
log := Dialog |
|
4849 | 4081 |
requestText:(resources string:'Enter initial log message') |
4414 | 4082 |
lines:10 |
4083 |
columns:70 |
|
4084 |
initialAnswer:nil. |
|
3892 | 4085 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4086 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4087 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4088 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4089 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4090 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4091 |
|
3982 | 4092 |
sel := self currentSelectedFiles. |
3892 | 4093 |
executionBlock := [ : stream | |
4414 | 4094 |
log notNil ifTrue:[ |
4095 |
sel size > 0 ifTrue:[ |
|
4096 |
sel do:[:fn | |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4097 |
|
4414 | 4098 |
dir := self getDirWithoutFileName:fn. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4099 |
cmd := 'cvs add ',logArg,' ',fn baseName. |
6204 | 4100 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
4849 | 4101 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4102 |
cmd := ('cvs commit -l ',logArg,' ',fn baseName). |
6204 | 4103 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
4849 | 4104 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4105 |
asBinary ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4106 |
cmd := ('cvs admin -kb ' , fn baseName). |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4107 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4108 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4109 |
cmd := ('cvs upd ' , fn baseName). |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4110 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4111 |
]. |
4414 | 4112 |
] |
4113 |
] |
|
4114 |
] |
|
3892 | 4115 |
]. |
4107 | 4116 |
nameString := 'Command> cvs add and commit'. |
3892 | 4117 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4118 |
! |
|
4119 |
||
4849 | 4120 |
cvsAddBinaryAndCommit |
4121 |
self cvsAddAndCommitAsBinary:true |
|
4122 |
! |
|
4123 |
||
3892 | 4124 |
cvsCommit |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4125 |
|nSel log logArg msg cmd selectedFiles sel executionBlock nameString| |
3892 | 4126 |
|
3982 | 4127 |
selectedFiles:= self currentSelectedFiles. |
3892 | 4128 |
nSel := selectedFiles size. |
4129 |
||
4130 |
nSel == 1 ifTrue:[ |
|
4414 | 4131 |
msg := resources string:'enter log message for checkIn of ''%1''' with:(selectedFiles first baseName) |
3892 | 4132 |
] ifFalse:[ |
4414 | 4133 |
nSel > 1 ifTrue:[ |
4134 |
msg := resources string:'enter log message for %1 files to checkIn' with:nSel printString |
|
4135 |
] ifFalse:[ |
|
4136 |
msg := resources string:'enter log message for checkIn' |
|
4137 |
] |
|
3892 | 4138 |
]. |
4139 |
||
4140 |
log := Dialog |
|
4414 | 4141 |
requestText:msg |
4142 |
lines:10 |
|
4143 |
columns:70 |
|
4144 |
initialAnswer:nil. |
|
3892 | 4145 |
|
4663 | 4146 |
log isNil ifTrue:[^ self]. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4147 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4148 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4149 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4150 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4151 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4152 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4153 |
|
4663 | 4154 |
sel := self currentFileNameHolder value. |
4155 |
sel isEmpty ifTrue:[ ^ self ]. |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4156 |
executionBlock := [:stream | |
4663 | 4157 |
log notNil ifTrue:[ |
4158 |
sel size > 0 ifTrue:[ |
|
4159 |
sel do:[:fn | |
|
6204 | 4160 |
| dir | |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4161 |
|
4663 | 4162 |
dir := fn directory. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4163 |
cmd := 'cvs commit ',logArg,' ' , fn baseName. |
6204 | 4164 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
4663 | 4165 |
] |
4166 |
] |
|
4167 |
] |
|
4107 | 4168 |
]. |
4169 |
nameString := 'Command> cvs commit'. |
|
4170 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 4171 |
! |
4172 |
||
4173 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
|
4174 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
4175 |
||
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4176 |
|toRemove updateRunning executionBlock nameString| |
3892 | 4177 |
|
4178 |
updateRunning := self backgroundProcesses value notEmpty. |
|
4179 |
self killAllRunningBackgroundProcesses. |
|
4180 |
toRemove := OrderedCollection new. |
|
4181 |
||
4182 |
executionBlock := [ : stream | |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4183 |
|cmd logArg| |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4184 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4185 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4186 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4187 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4188 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4189 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4190 |
|
4414 | 4191 |
filesToRemove do:[:fileName | |
4192 |
OperatingSystem accessDeniedErrorSignal handle:[:ex| |
|
4193 |
"was not able to remove it" |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4194 |
| lastError msg | |
4414 | 4195 |
lastError := OperatingSystem lastErrorString. |
4196 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
4197 |
lastError isNil ifFalse:[ |
|
4198 |
msg := msg , '\\(' , lastError , ')' |
|
4199 |
]. |
|
4200 |
Dialog warn:msg withCRs |
|
4201 |
] do:[ |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6236
diff
changeset
|
4202 |
(fileName isSymbolicLink) ifFalse:[ |
4414 | 4203 |
fileName remove. |
4204 |
cmd := ('cvs remove -f ' , fileName baseName). |
|
6204 | 4205 |
(self getExecutionBlockForCommand:cmd) value:stream. |
4414 | 4206 |
] |
4207 |
]. |
|
4208 |
]. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4209 |
cmd := 'cvs commit -l ',logArg. |
6204 | 4210 |
(self getExecutionBlockForCommand:cmd) value:stream. |
3892 | 4211 |
]. |
4107 | 4212 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
3892 | 4213 |
filesToRemove size > 1 ifTrue:[ |
4414 | 4214 |
nameString := nameString, ' ...'. |
3892 | 4215 |
]. |
4216 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
4217 |
! |
|
4218 |
||
4219 |
cvsRemoveFileAndCVSContainer |
|
4220 |
|sel question aswer| |
|
4221 |
||
4294 | 4222 |
sel := self currentSelectedFiles copy. |
3892 | 4223 |
sel size > 0 ifTrue:[ |
4294 | 4224 |
sel size > 1 ifTrue:[ |
4225 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:(sel size) |
|
4226 |
] ifFalse:[ |
|
4227 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(sel first baseName allBold) |
|
4228 |
]. |
|
4229 |
||
4230 |
aswer := Dialog |
|
4231 |
confirm:question withCRs |
|
4232 |
yesLabel:(resources at:'Remove') |
|
4233 |
noLabel:(resources at:'Cancel'). |
|
4234 |
aswer ifTrue:[ |
|
4235 |
self withCursor:(Cursor wait) do:[ |
|
4236 |
self cvsRemoveAndRemoveFromCVS:sel |
|
4237 |
] |
|
4238 |
] |
|
3892 | 4239 |
] |
4240 |
! |
|
4241 |
||
4242 |
cvsUpdateAll |
|
4243 |
| cmd | |
|
4244 |
||
4245 |
cmd := 'cvs upd -l'. |
|
4246 |
self executeCommand:cmd. |
|
4247 |
! |
|
4248 |
||
4249 |
cvsUpdateAllRecursive |
|
4250 |
| cmd | |
|
4251 |
||
4252 |
cmd := 'cvs upd -d'. |
|
4253 |
self executeCommand:cmd. |
|
4254 |
! |
|
4255 |
||
4256 |
cvsUpdateSelection |
|
4257 |
| selectedFiles stream| |
|
4258 |
||
3982 | 4259 |
selectedFiles:= self currentSelectedFiles. |
3892 | 4260 |
stream := WriteStream on:''. |
4261 |
stream nextPutAll:'cvs upd '. |
|
4262 |
selectedFiles do:[: file | |
|
4414 | 4263 |
stream nextPutAll:file baseName. |
4264 |
stream space. |
|
3892 | 4265 |
]. |
4266 |
self executeCommand:stream contents. |
|
4267 |
stream close. |
|
4268 |
! ! |
|
4269 |
||
6169 | 4270 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
3892 | 4271 |
|
4453
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4272 |
copyFiles |
6169 | 4273 |
self |
4274 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
4453
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4275 |
! |
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4276 |
|
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4277 |
cutFiles |
6169 | 4278 |
self |
4279 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
4453
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4280 |
! |
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4281 |
|
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4282 |
deleteFiles |
6169 | 4283 |
self |
4284 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
4285 |
! |
|
4286 |
||
4287 |
eraseFiles |
|
4288 |
self |
|
4289 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
4940
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4290 |
! |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4291 |
|
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4292 |
openSettingsDialog |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4293 |
|dialog| |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4294 |
|
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4295 |
dialog := FileBrowserV2SettingsDialog new. |
5034 | 4296 |
dialog settingsDialog:self. |
4940
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4297 |
dialog allButOpen. |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4298 |
dialog doReload. |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4299 |
dialog openWindow |
6169 | 4300 |
! |
4301 |
||
4302 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
4303 |
|files dirs| |
|
4304 |
||
4305 |
files := self currentSelectedFiles. |
|
4306 |
files notEmpty ifTrue:[ |
|
4307 |
aBlock value:files. |
|
4308 |
] ifFalse:[ |
|
4309 |
dirs := self currentSelectedDirectories. |
|
4310 |
dirs notEmpty ifTrue:[ |
|
4311 |
aBlock value:dirs. |
|
4312 |
]. |
|
4313 |
]. |
|
3892 | 4314 |
! ! |
4315 |
||
4849 | 4316 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
4317 |
||
4318 |
openAboutThisApplication |
|
4319 |
"opens an about box for this application." |
|
4320 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4321 |
Dialog aboutClass:self class. |
4849 | 4322 |
! |
4323 |
||
4324 |
openHTMLDocument:relativeDocPath |
|
4325 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
4326 |
! ! |
|
4327 |
||
4328 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
|
3892 | 4329 |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4330 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4331 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4332 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4333 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4334 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4335 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4336 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4337 |
"/ 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
|
4338 |
"/ 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
|
4339 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4340 |
conv := OrderedCollection new. |
4722 | 4341 |
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
|
4342 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4343 |
outSuffix = 'png' ifTrue:[ |
4722 | 4344 |
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
|
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 |
outSuffix = 'gif' ifTrue:[ |
4722 | 4348 |
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
|
4349 |
^ conv. |
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 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 4352 |
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
|
4353 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4354 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4355 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 4356 |
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
|
4357 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4358 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4359 |
self error:'unimplemented conversion'. |
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 |
|
4367 | 4362 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4363 |
self convertImageToSuffix:'gif' |
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 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4366 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4367 |
self convertImageToSuffix:'jpg' |
4531 | 4368 |
! |
4369 |
||
4370 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4371 |
self convertImageToSuffix:'png' |
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 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4374 |
convertImageToSuffix:outSuffix |
4922 | 4375 |
|image writer tempFileXPM chainOfConversions conversionStream skipSignal |
4376 |
inFile outFile eachConversionSuffixCommandPair doneWithThisFile |
|
5880 | 4377 |
eachConversionSuffix eachConversionCommand tempFileTemplate |
4378 |
filesToConvert| |
|
4721
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 |
"/ [ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4381 |
skipSignal := Signal new. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4382 |
|
4367 | 4383 |
self withActivityIndicationDo:[ |
5880 | 4384 |
filesToConvert := self currentFileNameHolder value copy. |
4385 |
filesToConvert do:[:fileName | |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4386 |
skipSignal handle:[:ex | ] |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4387 |
do:[ |
4722 | 4388 |
|answer| |
4389 |
||
4390 |
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
|
4391 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4392 |
fileName isDirectory ifFalse:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4393 |
outFile := fileName withSuffix:outSuffix. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4394 |
outFile exists ifTrue:[ |
4722 | 4395 |
answer := Dialog |
4396 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
|
4397 |
default:false. |
|
4398 |
answer isNil ifTrue:[AbortSignal raise]. |
|
4399 |
answer ifFalse:[ |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4400 |
skipSignal raise. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4401 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4402 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4403 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4404 |
image := Image fromFile:fileName. |
4922 | 4405 |
image notNil ifTrue:[ |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4406 |
writer := MIMETypes imageReaderForSuffix:outSuffix. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4407 |
(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
|
4408 |
writer save:image onFile:outFile. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4409 |
skipSignal raise. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4410 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4411 |
]. |
4922 | 4412 |
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
|
4413 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4414 |
chainOfConversions isNil ifTrue:[ skipSignal raise ]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4415 |
conversionStream := chainOfConversions readStream. |
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 |
doneWithThisFile := false. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4418 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4419 |
tempFileTemplate := Filename newTemporary. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4420 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4421 |
inFile := fileName. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4422 |
eachConversionSuffixCommandPair := conversionStream next. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4423 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
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 |
eachConversionCommand == #readToXPM ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4426 |
image := Image fromFile:(inFile pathName). |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4427 |
image isNil ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4428 |
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
|
4429 |
skipSignal raise. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4430 |
] ifFalse:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4431 |
tempFileXPM := tempFileTemplate withSuffix:'xpm'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4432 |
image saveOn:tempFileXPM using:XPMReader. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4433 |
inFile := tempFileXPM. |
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 |
eachConversionSuffixCommandPair := conversionStream next. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4436 |
]. |
4531 | 4437 |
|
4367 | 4438 |
[ |
5880 | 4439 |
|command errOutput errMsg| |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4440 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4441 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4442 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4443 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
4531 | 4444 |
|
4722 | 4445 |
self notify:(resources string:'Converting: %1 to %2...' with:fileName baseName with:eachConversionSuffix). |
4446 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4447 |
outFile := tempFileTemplate withSuffix:eachConversionSuffix. |
4722 | 4448 |
command := eachConversionCommand |
4449 |
bindWith:(inFile pathName) |
|
4450 |
with:(outFile pathName). |
|
4451 |
||
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
4452 |
errOutput := String writeStream. |
4922 | 4453 |
|
4722 | 4454 |
(OperatingSystem executeCommand:command errorTo:errOutput) |
4367 | 4455 |
ifFalse:[ |
5880 | 4456 |
errMsg := resources |
4722 | 4457 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
4458 |
with:inFile baseName allBold |
|
4459 |
with:eachConversionSuffix |
|
4460 |
with:eachConversionCommand allBold |
|
5880 | 4461 |
with:errOutput contents. |
4462 |
filesToConvert size == 1 ifTrue:[ |
|
4463 |
Dialog warn:errMsg |
|
4464 |
] ifFalse:[ |
|
4465 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
|
4466 |
^ self |
|
4467 |
] |
|
4468 |
]. |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4469 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4470 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4471 |
outFile delete. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4472 |
skipSignal raise |
4367 | 4473 |
]. |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4474 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
4531 | 4475 |
inFile := outFile. |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4476 |
eachConversionSuffixCommandPair := conversionStream next |
4367 | 4477 |
]. |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4478 |
] ifCurtailed:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4479 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
4531 | 4480 |
outFile delete. |
4481 |
]. |
|
4482 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4483 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
4531 | 4484 |
self updateAndSelect:nil. |
4367 | 4485 |
] |
4486 |
] |
|
4487 |
]. |
|
6190 | 4488 |
self notify:nil. |
4367 | 4489 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4490 |
"/ ] fork. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4491 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4492 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4493 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
4494 |
self convertImageToSuffix:'xpm' |
4367 | 4495 |
! |
4496 |
||
3892 | 4497 |
createProjectAndOpenProjectBrowser |
4498 |
|nm f s directory| |
|
4499 |
||
4500 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 4501 |
directory := self currentDirectory. |
3892 | 4502 |
nm := directory baseName. |
4503 |
f := (directory construct:nm) withSuffix:'prj'. |
|
4504 |
f exists ifTrue:[ |
|
4414 | 4505 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
4506 |
^ self. |
|
3892 | 4507 |
]. |
4508 |
s := f writeStream. |
|
4509 |
s nextPutAll:' |
|
4510 |
name ''' , nm , ''' |
|
4511 |
type #classLibrary |
|
4512 |
package #''private:' , nm , ''' |
|
4513 |
prerequisites nil |
|
4514 |
||
4515 |
classes #( ) |
|
4516 |
'. |
|
4517 |
s close. |
|
4518 |
ProjectBrowser openOnFile:f. |
|
4519 |
! |
|
4520 |
||
5880 | 4521 |
doExecuteCommand |
4522 |
"execute an OperatingSystem-command" |
|
4523 |
||
4524 |
| action fileName| |
|
4525 |
||
4526 |
fileName := self firstSelectedFile. |
|
4527 |
action := [:command | |
|
4528 |
self addToCommandHistory:command for:fileName. |
|
4529 |
self executeCommand:command. |
|
4530 |
]. |
|
4531 |
self askForCommandFor:fileName thenDo:action |
|
4532 |
! |
|
4533 |
||
4534 |
doExecuteScript |
|
4535 |
"execute a smalltalk script" |
|
4536 |
||
4537 |
|textHolder dialog template dummyClass dummyInstance| |
|
4538 |
||
4539 |
template := |
|
4540 |
'"/ Smalltalk script: |
|
4541 |
||
4542 |
"/ the following variables are accessable: |
|
4543 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
|
4544 |
"/ selectedFiles (= ...) |
|
4545 |
"/ |
|
4546 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
4547 |
"/ |
|
4548 |
"/ Useful operations are: |
|
4549 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
4550 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
4551 |
"/ directory directory |
|
4552 |
"/ |
|
4553 |
"/ example: move all files which match a aarticular pattern to |
|
4554 |
"/ a separate directory: |
|
4555 |
"/ |
|
4556 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
4557 |
"/ |
|
4558 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
4559 |
"/ |
|
4560 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
4561 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
4562 |
"/ idx := eachBaseNameString indexOf:$_. |
|
4563 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
4564 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
4565 |
"/ newDir := directory construct:prefix. |
|
4566 |
"/ newDir exists ifFalse:[ |
|
4567 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
4568 |
"/ newDir makeDirectory. |
|
4569 |
"/ ]. |
|
4570 |
"/ ]. |
|
4571 |
"/ newDir exists ifTrue:[ |
|
4572 |
"/ oldFile := directory construct:eachBaseNameString. |
|
4573 |
"/ newFile := newDir construct:rest. |
|
4574 |
"/ oldFile moveTo:newFile |
|
4575 |
"/ ] |
|
4576 |
"/ ] |
|
4577 |
"/ ] |
|
4578 |
'. |
|
4579 |
||
4580 |
LastScriptBlockString isNil ifTrue:[ |
|
4581 |
LastScriptBlockString := template. |
|
4582 |
]. |
|
4583 |
||
4584 |
textHolder := ValueHolder new. |
|
4585 |
dialog := Dialog |
|
4586 |
forRequestText:(resources string:'Enter script') |
|
4587 |
editViewClass:CodeView |
|
4588 |
lines:25 |
|
4589 |
columns:70 |
|
4590 |
initialAnswer:LastScriptBlockString |
|
4591 |
model:textHolder. |
|
4592 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
4593 |
dialog open. |
|
4594 |
dialog accepted ifFalse:[^ self]. |
|
4595 |
||
4596 |
LastScriptBlockString := textHolder value. |
|
4597 |
||
4598 |
Class classConventionViolationConfirmationQuerySignal |
|
4599 |
answer:true |
|
4600 |
do:[ |
|
4601 |
dummyClass := Object class |
|
4602 |
name:#Dummy |
|
4603 |
inEnvironment:nil |
|
4604 |
subclassOf:Object |
|
4605 |
instanceVariableNames:'directory selectedFiles' |
|
4606 |
variable:false |
|
4607 |
words:true |
|
4608 |
pointers:true |
|
4609 |
classVariableNames:'' |
|
4610 |
poolDictionaries:'' |
|
4611 |
category:#dummyCategory |
|
4612 |
comment:nil |
|
4613 |
changed:true. |
|
4614 |
]. |
|
4615 |
||
4616 |
dummyInstance := dummyClass basicNew. |
|
4617 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
4618 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
4619 |
||
4620 |
Compiler |
|
4621 |
evaluate:textHolder value |
|
4622 |
in:nil |
|
4623 |
receiver:dummyInstance |
|
4624 |
notifying:nil |
|
4625 |
logged:false |
|
4626 |
ifFail:[] |
|
4627 |
compile:true. |
|
4628 |
||
4629 |
"/ fileName := self firstSelectedFile. |
|
4630 |
"/ action := [:command | |
|
4631 |
"/ self addToCommandHistory:command for:fileName. |
|
4632 |
"/ self executeCommand:command. |
|
4633 |
"/ ]. |
|
4634 |
"/ self askForCommandFor:fileName thenDo:action |
|
4635 |
! |
|
4636 |
||
4230 | 4637 |
doMake |
4638 |
||
4639 |
| cmd | |
|
4640 |
||
4641 |
cmd := 'make'. |
|
4642 |
self executeCommand:cmd. |
|
4643 |
! |
|
4644 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4645 |
doOpenSettings |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4646 |
|
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4647 |
| inst | |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4648 |
|
4581 | 4649 |
inst := FileBrowserV2SettingsDialog new. |
5034 | 4650 |
inst settingsDialog:self. |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4651 |
inst open. |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4652 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
4653 |
|
3892 | 4654 |
fileFileIn |
4655 |
"fileIn the selected file(s)" |
|
4656 |
||
4657 |
self fileFileInLazy:false |
|
4658 |
! |
|
4659 |
||
4660 |
fileFileInLazy |
|
4661 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
4662 |
||
4663 |
self fileFileInLazy:true |
|
4664 |
! |
|
4665 |
||
4666 |
fileFileInLazy:lazy |
|
4667 |
"fileIn the selected file(s)" |
|
4668 |
||
4345 | 4669 |
|
4878 | 4670 |
"/ [ |
4345 | 4671 |
self withActivityIndicationDo:[ |
4672 |
| selectedFiles| |
|
4673 |
selectedFiles:= self currentSelectedFiles. |
|
4674 |
selectedFiles do:[:fileName | |
|
4523 | 4675 |
self notify:('File in:', fileName baseName). |
4345 | 4676 |
self singleFileFileIn:fileName lazy:lazy |
4677 |
]. |
|
6190 | 4678 |
self notify:nil. |
4345 | 4679 |
] |
4878 | 4680 |
"/ ] fork. |
3892 | 4681 |
! |
4682 |
||
4683 |
fileFileInToNameSpace |
|
4684 |
"fileIn the selected file(s)<into a nameSpace" |
|
4685 |
||
4686 |
|ns listOfKnownNameSpaces| |
|
4687 |
||
4688 |
listOfKnownNameSpaces := Set new. |
|
4689 |
NameSpace |
|
4414 | 4690 |
allNamespaces |
4691 |
do:[:eachNameSpace | |
|
4692 |
listOfKnownNameSpaces add:eachNameSpace name |
|
4693 |
]. |
|
3892 | 4694 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
4695 |
||
4696 |
ns := Dialog |
|
4414 | 4697 |
request:'During fileIn, new classes are created in nameSpace:' |
4698 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
4699 |
list:listOfKnownNameSpaces. |
|
3892 | 4700 |
ns isEmptyOrNil ifTrue:[^ self]. |
4701 |
||
4702 |
LastEnforcedNameSpace := ns. |
|
4703 |
ns := NameSpace name:ns. |
|
4704 |
||
4705 |
Class nameSpaceQuerySignal |
|
4414 | 4706 |
answer:ns |
4707 |
do:[ |
|
4708 |
self fileFileInLazy:false |
|
4709 |
] |
|
3892 | 4710 |
! |
4711 |
||
4712 |
fileFindAllDuplicates |
|
4713 |
"scan directory and all subdirs for duplicate files" |
|
4714 |
||
4715 |
|fileNames dir infoDir filesBySize |
|
4716 |
result info dirPrefix myName stream textBox maxLength directories| |
|
4717 |
||
4718 |
||
4719 |
self withWaitCursorDo:[ |
|
4414 | 4720 |
result := Dictionary new. |
4721 |
myName := self class name asString. |
|
4722 |
directories := self currentSelectedDirectories. |
|
4723 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 4724 |
|
4414 | 4725 |
dir := directories first. |
3892 | 4726 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4727 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4728 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4729 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 4730 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
4731 |
with:ex pathName |
|
4732 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4733 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4734 |
]. |
4765 | 4735 |
fileNames := fileNames |
4736 |
collect:[:fn | dir construct:fn] |
|
4737 |
thenSelect:[:fn | fn isDirectory not]. |
|
3892 | 4738 |
|
4739 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 4740 |
infoDir := Dictionary new. |
4741 |
fileNames do:[:fn | |
|
4742 |
infoDir at:fn put:(fn fileSize) |
|
4743 |
]. |
|
4744 |
||
4745 |
"/ for each, get the files size. |
|
4746 |
"/ in a first pass, look for files of the same size and |
|
4747 |
"/ compare them ... |
|
3892 | 4748 |
|
4749 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 4750 |
filesBySize := Dictionary new. |
4751 |
infoDir keysAndValuesDo:[:fn :sz | |
|
4752 |
|entry| |
|
4753 |
||
4754 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
4755 |
entry add:fn. |
|
4756 |
]. |
|
4757 |
||
4758 |
"/ any of same size ? |
|
3892 | 4759 |
|
4760 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 4761 |
filesBySize do:[:entry | |
4762 |
|files| |
|
4763 |
||
4764 |
entry size > 1 ifTrue:[ |
|
4765 |
files := entry asArray. |
|
4766 |
1 to:files size-1 do:[:idx1 | |
|
4767 |
idx1+1 to:files size do:[:idx2 | |
|
4768 |
|fn1 fn2| |
|
4769 |
||
4770 |
fn1 := files at:idx1. |
|
4771 |
fn2 := files at:idx2. |
|
3892 | 4772 |
|
4773 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 4774 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
4775 |
"/ compare the files |
|
4776 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 4777 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 4778 |
result at:fn1 put:fn2. |
4779 |
] |
|
4780 |
] |
|
4781 |
] |
|
4782 |
] |
|
4783 |
] |
|
4784 |
]. |
|
3892 | 4785 |
|
4786 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 4787 |
dirPrefix := dir pathName. |
4788 |
result := result associations. |
|
4789 |
result := result collect:[:assoc | |
|
4790 |
|f1 f2| |
|
4791 |
||
4792 |
f1 := assoc key name. |
|
4793 |
f2 := assoc value name. |
|
4794 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
4795 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
4796 |
]. |
|
4797 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
4798 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
4799 |
]. |
|
4800 |
f1 < f2 ifTrue:[ |
|
4801 |
f2 -> f1 |
|
4802 |
] ifFalse:[ |
|
4803 |
f1 -> f2 |
|
4804 |
] |
|
4805 |
]. |
|
4806 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
4807 |
||
4808 |
info := OrderedCollection new. |
|
4809 |
result do:[:assoc | |
|
4810 |
info add:(assoc key , ' same as ' , assoc value) |
|
4811 |
]. |
|
4812 |
info isEmpty ifTrue:[ |
|
5543 | 4813 |
Dialog information:'No duplicate files found.'. |
4814 |
^ self. |
|
4414 | 4815 |
]. |
3892 | 4816 |
]. |
4817 |
||
4818 |
stream := WriteStream on:''. |
|
4819 |
info do:[:el| |
|
4535 | 4820 |
stream nextPutLine:el. |
3892 | 4821 |
]. |
5542 | 4822 |
|
3892 | 4823 |
textBox := TextBox new. |
4824 |
textBox initialText:(stream contents). |
|
5542 | 4825 |
stream close. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4826 |
textBox title:'File duplicates in directory: ', dir asString. |
3892 | 4827 |
textBox readOnly:true. |
4828 |
textBox noCancel. |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4829 |
textBox label:'Duplicates in ', dir asString. |
3892 | 4830 |
maxLength := 10. |
4831 |
info do:[: el | |
|
4414 | 4832 |
maxLength := maxLength max:(el size). |
3892 | 4833 |
]. |
4834 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 4835 |
textBox maxExtent:Screen current extent. |
4836 |
textBox openModeless. |
|
3892 | 4837 |
! |
4838 |
||
4839 |
fileFindDuplicates |
|
4840 |
"scan directory for duplicate files" |
|
4841 |
||
5543 | 4842 |
|fileNames infoDir filesBySize result info stream textBox maxLength directories allFiles titleStream size| |
3892 | 4843 |
|
4844 |
self withWaitCursorDo:[ |
|
4355 | 4845 |
result := Dictionary new. |
4846 |
||
4847 |
directories := self currentSelectedDirectories. |
|
4848 |
directories isEmpty ifTrue:[^ self]. |
|
4849 |
||
4850 |
allFiles := OrderedCollection new. |
|
4851 |
directories do:[ : dir| |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4852 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4853 |
fileNames := dir directoryContents. |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4854 |
fileNames notNil ifTrue:[ |
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4855 |
fileNames := fileNames |
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4856 |
collect:[:fn | dir construct:fn] |
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4857 |
thenSelect:[:fn | fn isDirectory not]. |
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4858 |
allFiles addAll:fileNames. |
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4859 |
] |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4860 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 4861 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
4862 |
with:ex pathName |
|
4863 |
with:ex description). |
|
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
4864 |
ex proceedWith:nil. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4865 |
]. |
4355 | 4866 |
]. |
4867 |
||
4868 |
infoDir := Dictionary new. |
|
4869 |
allFiles do:[:fn | |
|
4870 |
infoDir at:fn put:(fn info) |
|
4871 |
]. |
|
4872 |
||
4873 |
"/ for each, get the files size. |
|
4874 |
"/ in a first pass, look for files of the same size and |
|
4875 |
"/ compare them ... |
|
4876 |
||
4877 |
filesBySize := Dictionary new. |
|
4878 |
infoDir keysAndValuesDo:[:fn :info | |
|
4879 |
|sz entry| |
|
4880 |
||
4881 |
sz := info size. |
|
4882 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
4883 |
entry add:fn. |
|
4884 |
]. |
|
4885 |
||
4886 |
"/ any of same size ? |
|
4887 |
||
4888 |
filesBySize do:[:entry | |
|
4889 |
|files| |
|
4890 |
||
4891 |
entry size > 1 ifTrue:[ |
|
4892 |
files := entry asArray. |
|
4893 |
1 to:files size-1 do:[:idx1 | |
|
4894 |
idx1+1 to:files size do:[:idx2 | |
|
4895 |
|fn1 fn2| |
|
4896 |
||
4897 |
fn1 := files at:idx1. |
|
4898 |
fn2 := files at:idx2. |
|
4899 |
||
4900 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
4901 |
"/ compare the files |
|
4902 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 4903 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4355 | 4904 |
result at:fn1 put:fn2. |
4905 |
] |
|
4906 |
] |
|
4907 |
] |
|
4908 |
] |
|
4909 |
] |
|
4910 |
]. |
|
4911 |
||
4912 |
result := result associations. |
|
4913 |
result := result collect:[:assoc | |
|
4914 |
|f1 f2| |
|
4915 |
||
4916 |
f1 := assoc key asString. |
|
4917 |
f2 := assoc value asString. |
|
4918 |
f1 < f2 ifTrue:[ |
|
4919 |
f2 -> f1 |
|
4920 |
] ifFalse:[ |
|
4921 |
f1 -> f2 |
|
4922 |
] |
|
4923 |
]. |
|
5789 | 4924 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
4925 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
4355 | 4926 |
|
4927 |
info := OrderedCollection new. |
|
4928 |
size := self getBestDirectory asString size. |
|
4929 |
result do:[:assoc | |
|
4930 |
|fn1 fn2| |
|
4931 |
||
4932 |
fn1 := assoc key. |
|
4933 |
fn2 := assoc value. |
|
4934 |
size > 1 ifTrue:[ |
|
4935 |
fn1 := ('..', (fn1 copyFrom:(size + 1))). |
|
4936 |
fn2 := ('..', (fn2 copyFrom:(size + 1))). |
|
4937 |
]. |
|
4938 |
(fn1 includes:Character space) ifTrue:[ |
|
4939 |
fn1 := '"' , fn1 , '"' |
|
4940 |
]. |
|
4941 |
(fn2 includes:Character space) ifTrue:[ |
|
4942 |
fn2 := '"' , fn2 , '"' |
|
4943 |
]. |
|
4944 |
info add:(fn1 , ' same as ' , fn2) |
|
4945 |
]. |
|
4946 |
info isEmpty ifTrue:[ |
|
5543 | 4947 |
Dialog information:'No duplicate files found.'. |
4948 |
^ self. |
|
4355 | 4949 |
]. |
3892 | 4950 |
]. |
4951 |
stream := WriteStream on:''. |
|
4952 |
info do:[:el| |
|
4535 | 4953 |
stream nextPutLine:el. |
3892 | 4954 |
]. |
4955 |
titleStream := WriteStream on:''. |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4956 |
titleStream nextPutAll:'File duplicates in director'. |
3892 | 4957 |
directories size == 1 ifTrue:[ |
4355 | 4958 |
titleStream nextPutAll:'y: ', directories first asString. |
3892 | 4959 |
] ifFalse:[ |
4535 | 4960 |
titleStream nextPutLine:'ies: '. |
4355 | 4961 |
directories do:[:dir| |
4962 |
size > 1 ifTrue:[ |
|
4963 |
titleStream nextPutAll:'..'. |
|
4535 | 4964 |
titleStream nextPutLine:((dir asString) copyFrom:(size + 1)). |
4355 | 4965 |
] ifFalse:[ |
4535 | 4966 |
titleStream nextPutLine:(dir asString). |
4355 | 4967 |
]. |
4968 |
] |
|
3892 | 4969 |
]. |
5543 | 4970 |
|
3892 | 4971 |
textBox := TextBox new. |
4972 |
textBox initialText:(stream contents). |
|
4973 |
textBox title:(titleStream contents). |
|
4974 |
textBox readOnly:true. |
|
4975 |
textBox noCancel. |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
4976 |
stream := WriteStream on:'Duplicates in '. |
4170 | 4977 |
directories do:[ :aDirectory | |
4355 | 4978 |
stream nextPutAll:aDirectory baseName. |
4979 |
stream space. |
|
4050 | 4980 |
]. |
4170 | 4981 |
textBox label:stream contents. |
3892 | 4982 |
maxLength := 10. |
4983 |
info do:[: el | |
|
4355 | 4984 |
maxLength := maxLength max:(el size). |
3892 | 4985 |
]. |
5092 | 4986 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
4987 |
textBox maxExtent:Screen current extent. |
|
4355 | 4988 |
textBox openModeless. "/ showAtPointer. |
3892 | 4989 |
! |
4990 |
||
4991 |
fileFindFile |
|
5961 | 4992 |
|filename| |
4993 |
||
4994 |
filename := self firstSelectedFileName. |
|
4995 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4996 |
filename := Filename homeDirectory. |
3892 | 4997 |
]. |
4101 | 4998 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 4999 |
! |
5000 |
||
4618 | 5001 |
fileHexDump |
5002 |
||
5003 |
| file item| |
|
5004 |
||
5005 |
file := self firstSelectedFile. |
|
5006 |
file notNil ifTrue:[ |
|
5007 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 5008 |
self |
5009 |
applicationNamed:#FileApplicationNoteBook |
|
5010 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 5011 |
]. |
5012 |
! |
|
5013 |
||
4930 | 5014 |
filterSelectedFiles:whichFilter |
5015 |
|selectedFiles numFiles msg filterBlock| |
|
5016 |
||
5017 |
selectedFiles := self currentFileNameHolder value. |
|
5018 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
5019 |
||
5020 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
5021 |
numFiles > 1 ifTrue:[ |
|
5022 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
5023 |
]. |
|
5024 |
||
5025 |
(Dialog |
|
6352 | 5026 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 5027 |
initialAnswer:false |
5028 |
) ifFalse:[ |
|
5029 |
^ self |
|
5030 |
]. |
|
5031 |
||
5032 |
whichFilter == #rot13 ifTrue:[ |
|
5033 |
filterBlock := [:charIn | charIn rot13 ]. |
|
5034 |
]. |
|
5035 |
"/ add more here... |
|
5036 |
||
5037 |
filterBlock isNil ifTrue:[ |
|
5038 |
self information:'No such filter: ' , whichFilter. |
|
5039 |
^ self. |
|
5040 |
]. |
|
5041 |
||
5042 |
selectedFiles do:[:fileName | |
|
5043 |
|s| |
|
5044 |
||
5045 |
self notify:('Processing:', fileName baseName). |
|
5046 |
fileName isDirectory ifFalse:[ |
|
5047 |
[ |
|
5048 |
|inFile outFile in out| |
|
5049 |
||
5050 |
inFile := fileName asFilename. |
|
5051 |
outFile := (fileName pathName , '.filter') asFilename. |
|
5052 |
||
5053 |
[ |
|
5054 |
|charIn charOut| |
|
5055 |
||
5056 |
in := inFile readStream. |
|
5057 |
out := outFile writeStream. |
|
5058 |
[in atEnd] whileFalse:[ |
|
5059 |
charIn := in next. |
|
5060 |
charOut := filterBlock value:charIn. |
|
5061 |
out nextPut:charOut. |
|
5062 |
]. |
|
5063 |
outFile renameTo:inFile. |
|
5064 |
] ensure:[ |
|
5065 |
out notNil ifTrue:[ out close ]. |
|
5066 |
in notNil ifTrue:[ in close ]. |
|
5067 |
outFile delete. |
|
5068 |
] |
|
5069 |
] on:FileStream openErrorSignal do:[:ex| |
|
5070 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
5071 |
]. |
|
5072 |
] |
|
5073 |
]. |
|
6190 | 5074 |
self notify:nil. |
4930 | 5075 |
! |
5076 |
||
3892 | 5077 |
installAllAsAutoloaded |
5078 |
"install all classes found here as autoloaded classes" |
|
5079 |
||
4345 | 5080 |
[ |
5081 |
self withActivityIndicationDo:[ |
|
6113 | 5082 |
self allItemsOfCurrentDirectory copy do:[:fileItem | |
4343 | 5083 |
(fileItem hasMimeType and:[fileItem mimeType isSmalltalkSource]) ifTrue:[ |
4774 | 5084 |
self notify:('Install as autoloaded:', fileItem baseName). |
4343 | 5085 |
self installAsAutoloaded:(fileItem fileName). |
5086 |
] |
|
5087 |
]. |
|
6190 | 5088 |
self notify:nil. |
4345 | 5089 |
] |
5090 |
] fork. |
|
3892 | 5091 |
! |
5092 |
||
5093 |
installAsAutoloaded:aFilename |
|
5094 |
"install aFilename as autoloaded class" |
|
5095 |
||
5971
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5096 |
|chunks s filename| |
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5097 |
|
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5098 |
filename := aFilename asFilename. |
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5099 |
|
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5100 |
chunks := ChangeSet fromStream:(s := filename readStream). s close. |
3892 | 5101 |
chunks |
4414 | 5102 |
select:[:eachChunk | eachChunk isClassDefinitionChange] |
5971
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5103 |
thenDo:[:eachClassChunk | |
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5104 |
eachClassChunk installAsAutoloadedClassIfPublicWithFilename:filename withoutSuffix baseName |
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
5105 |
]. |
3892 | 5106 |
! |
5107 |
||
4558 | 5108 |
joinSelectedFiles |
6264 | 5109 |
|selectedFiles numFiles msg outFileName outFile outStream| |
4558 | 5110 |
|
5111 |
selectedFiles := self currentFileNameHolder value. |
|
5112 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
5113 |
||
5114 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
6352 | 5115 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 5116 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
5117 |
outFile := selectedFiles first directory construct:outFileName. |
|
4558 | 5118 |
|
5119 |
outStream := outFile writeStream. |
|
5120 |
||
5121 |
selectedFiles do:[:fileName | |
|
5122 |
|inStream| |
|
5123 |
||
5124 |
self notify:('Adding:', fileName baseName). |
|
5125 |
inStream := fileName readStream. |
|
5126 |
inStream copyToEndInto:outStream. |
|
5127 |
inStream close. |
|
5128 |
]. |
|
5129 |
outStream close. |
|
6190 | 5130 |
self notify:nil. |
4558 | 5131 |
! |
5132 |
||
6292 | 5133 |
loadImageThenDo:aBlock |
3892 | 5134 |
|img path files| |
5135 |
||
3982 | 5136 |
files := self currentSelectedFiles. |
3892 | 5137 |
files isEmpty ifTrue:[ ^ self]. |
5138 |
files do:[:fileName | |
|
4414 | 5139 |
path := fileName. |
5140 |
path isDirectory ifFalse:[ |
|
5141 |
img := Image fromFile:(path pathName). |
|
5142 |
img notNil ifTrue:[ |
|
6292 | 5143 |
aBlock value:img |
4414 | 5144 |
] ifFalse:[ |
6292 | 5145 |
Dialog warn:'Unknown format: ' , fileName asString |
4414 | 5146 |
] |
5147 |
] |
|
3892 | 5148 |
]. |
5149 |
! |
|
5150 |
||
5151 |
openASN1Browser |
|
5152 |
||
5153 |
self openTool:OSI::ASN1Browser |
|
5154 |
! |
|
5155 |
||
5156 |
openAppletViewer |
|
5157 |
|numItems files| |
|
5158 |
||
3982 | 5159 |
files := self currentSelectedFiles. |
3892 | 5160 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 5161 |
(self |
5162 |
confirm:(resources string:'open for each of the %1 items ?' |
|
5163 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 5164 |
]. |
5165 |
||
5166 |
Java startupJavaSystem. |
|
5167 |
"/ Java markAllClassesUninitialized. |
|
5168 |
"/ Java initAllStaticFields. |
|
5169 |
"/ Java initAllClasses. |
|
5170 |
||
5171 |
files do:[:fileName | |
|
4414 | 5172 |
|p path| |
5173 |
||
5174 |
path := fileName. |
|
5175 |
path isDirectory ifFalse:[ |
|
5176 |
p := Java |
|
5177 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
5178 |
argumentString:path pathName. |
|
5179 |
p resume. |
|
5180 |
] |
|
3892 | 5181 |
]. |
5182 |
! |
|
5183 |
||
5184 |
openCBrowser |
|
6031 | 5185 |
|dir files| |
5880 | 5186 |
|
5187 |
dir := self theSingleSelectedDirectoryOrNil. |
|
5188 |
dir isNil ifTrue:[ ^ self]. |
|
3892 | 5189 |
self withWaitCursorDo:[ |
6031 | 5190 |
files := self currentFileNameHolder value. |
5191 |
files notEmptyOrNil ifTrue:[ |
|
5192 |
CBrowser::Browser openOn:files first. |
|
5193 |
] ifFalse:[ |
|
5194 |
CBrowser::Browser openIn:dir. |
|
5195 |
] |
|
3892 | 5196 |
] |
5197 |
! |
|
5198 |
||
4230 | 5199 |
openChangeSetBrowser |
5200 |
self |
|
5201 |
openTool:ChangeSetBrowser |
|
5202 |
with:#openOnFile: |
|
5203 |
ignoreDirectories:true |
|
5204 |
! |
|
5205 |
||
3892 | 5206 |
openChangesBrowser |
5207 |
"open a change browser on the selected file(s)" |
|
5208 |
||
5209 |
self openTool:(UserPreferences current changesBrowserClass) |
|
5210 |
! |
|
5211 |
||
5212 |
openDiffView |
|
5213 |
"open a diff-view" |
|
5214 |
||
4170 | 5215 |
| name1 name2 text1 text2 d err nm l1 files title defaultName lastFile| |
3892 | 5216 |
|
3982 | 5217 |
files := self currentSelectedFiles. |
3892 | 5218 |
files isEmpty ifTrue:[ |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5219 |
Dialog warn:'You have to select a file first'. |
4414 | 5220 |
^ self. |
3892 | 5221 |
]. |
5222 |
(files size == 2) ifTrue:[ |
|
4414 | 5223 |
name1 := files last. |
5224 |
name2 := files first. |
|
3892 | 5225 |
] ifFalse:[ |
4414 | 5226 |
LastFileDiffFile notNil ifTrue:[ |
5960 | 5227 |
| directory | |
5228 |
directory := self currentDirectory. |
|
5229 |
directory notNil ifTrue:[ |
|
5230 |
lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
4414 | 5231 |
(lastFile exists and:[lastFile isReadable]) ifTrue:[ |
5232 |
name1 := lastFile. |
|
5233 |
] |
|
5234 |
] |
|
5235 |
]. |
|
5236 |
name2 := files first. |
|
4432 | 5237 |
title := 'Show differences between ', name2 baseName, ' and:'. |
4414 | 5238 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
5239 |
name1 := DialogBox |
|
5240 |
requestFileName:title |
|
5241 |
default:defaultName |
|
5242 |
ok:'OK' |
|
5830 | 5243 |
abort:'Compare against File List' |
4414 | 5244 |
pattern:'*' |
5245 |
fromDirectory:(name2 asFilename directory). |
|
3892 | 5246 |
]. |
5247 |
||
5248 |
(name1 isNil or:[name1 asString isEmpty]) ifTrue:[ |
|
4768 | 5249 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
4414 | 5250 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l]]. |
5251 |
name1 := nil. |
|
5252 |
l1 := 'browser contents' |
|
3892 | 5253 |
] ifFalse:[ |
4414 | 5254 |
name1 := name1 asFilename. |
5255 |
LastFileDiffFile := name1. |
|
5832 | 5256 |
name1 isReadable ifFalse:[ |
4414 | 5257 |
nm := name1. |
5832 | 5258 |
name1 exists ifFalse:[ |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5259 |
err := '"%1" does not exist.'. |
4414 | 5260 |
] ifTrue:[ |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5261 |
err := '"%1" is not readable.' |
4414 | 5262 |
]. |
5263 |
]. |
|
5832 | 5264 |
l1 := name1 pathName |
3892 | 5265 |
]. |
5266 |
||
5267 |
err isNil ifTrue:[ |
|
4414 | 5268 |
name2 isReadable ifFalse:[ |
5269 |
nm := name2. |
|
5270 |
name2 exists ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5271 |
err := '"%1" does not exist.'. |
4414 | 5272 |
] ifTrue:[ |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5273 |
err := '"%1" is not readable.' |
4414 | 5274 |
]. |
5275 |
]. |
|
3892 | 5276 |
]. |
5277 |
err notNil ifTrue:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5278 |
Dialog warn:(resources string:err with:nm pathName allBold). |
4414 | 5279 |
^ self |
3892 | 5280 |
]. |
5281 |
||
5282 |
self withWaitCursorDo:[ |
|
6176 | 5283 |
((name1 notNil and:[name1 fileSize > (1024*1024*8)]) |
5284 |
or:[ name2 fileSize > (1024*1024*8) ]) ifTrue:[ |
|
5285 |
name1 fileSize = name2 fileSize ifTrue:[ |
|
5286 |
(name1 sameContentsAs:name2) ifTrue:[ |
|
5287 |
self information:'Same contents.' |
|
5288 |
] ifFalse:[ |
|
5289 |
self information:'Different contents (File(s) too big for more details).' |
|
5290 |
]. |
|
5291 |
] ifFalse:[ |
|
5292 |
self information:'Different size (File(s) too big for more details).' |
|
5293 |
]. |
|
5294 |
^ self. |
|
5295 |
]. |
|
5296 |
||
4414 | 5297 |
name1 notNil ifTrue:[ |
5298 |
text1 := name1 contents. |
|
5299 |
]. |
|
5300 |
text2 := name2 contents. |
|
5301 |
text1 = text2 ifTrue:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5302 |
self information:'Same contents.' |
4414 | 5303 |
] ifFalse:[ |
5304 |
d := DiffTextView |
|
5305 |
openOn:text1 label:l1 |
|
5306 |
and:text2 label:name2 pathName. |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5307 |
d topView label:'File Differences'. |
4414 | 5308 |
] |
3892 | 5309 |
] |
5310 |
! |
|
5311 |
||
5312 |
openEditor |
|
5313 |
self openTool:EditTextView |
|
5314 |
! |
|
5315 |
||
4957 | 5316 |
openGV |
5317 |
self openOSCommandWithFiles:'gv' |
|
5318 |
! |
|
5319 |
||
3892 | 5320 |
openHTMLReader |
5321 |
||
5322 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
5323 |
! |
|
5324 |
||
5325 |
openImageEditor |
|
6292 | 5326 |
[ |
5327 |
self loadImageThenDo:[:img | img edit] |
|
5328 |
] fork |
|
3892 | 5329 |
! |
5330 |
||
5331 |
openImageInspector |
|
6292 | 5332 |
[ |
5333 |
self loadImageThenDo:[:img | img inspect] |
|
5334 |
] fork |
|
3892 | 5335 |
! |
5336 |
||
5337 |
openImagePreview |
|
5778 | 5338 |
[ |
5339 |
self |
|
6292 | 5340 |
loadImageThenDo: |
5778 | 5341 |
[:img | |
5342 |
|i top viewer| |
|
5343 |
||
5344 |
top := StandardSystemView new. |
|
5345 |
||
5346 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
5347 |
i := img. |
|
5348 |
top extent:200@200. |
|
5349 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
5350 |
top openAndWait. |
|
5351 |
||
5352 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
5353 |
i := i magnifiedPreservingRatioTo:200@200. |
|
5354 |
]. |
|
5355 |
viewer image:i. |
|
5356 |
]. |
|
3892 | 5357 |
] fork |
5358 |
! |
|
5359 |
||
5360 |
openMP3Player |
|
5361 |
|file| |
|
5362 |
||
3982 | 5363 |
file := self currentSelectedFiles. |
3892 | 5364 |
(file isEmpty) ifTrue:[ |
4414 | 5365 |
^ self. |
3892 | 5366 |
]. |
5367 |
file := file first. |
|
5368 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
5369 |
! |
|
5370 |
||
4957 | 5371 |
openOSCommandWithFiles:command |
5372 |
|files fileNames| |
|
5373 |
||
5374 |
files := self currentSelectedFiles. |
|
5375 |
(files isEmpty) ifTrue:[ |
|
5376 |
^ self. |
|
5377 |
]. |
|
5378 |
||
5379 |
fileNames := files collect:[:each | |
|
5380 |
'"' , each asFilename pathName , '"' |
|
5381 |
]. |
|
5382 |
||
5383 |
[ |
|
5384 |
OperatingSystem |
|
4959 | 5385 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
5386 |
inDirectory:(files first asFilename directory). |
|
4957 | 5387 |
] fork |
5388 |
! |
|
5389 |
||
4820 | 5390 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5391 |
|files fileNames cmd arg| |
4820 | 5392 |
|
5393 |
files := self currentSelectedFiles. |
|
5394 |
(files isEmpty) ifTrue:[ |
|
5395 |
^ self. |
|
5396 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5397 |
cmd := MIMETypes defaultCommandForMimeType:'application/pdf'. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5398 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5399 |
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
|
5400 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5401 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5402 |
|
4820 | 5403 |
fileNames := |
5404 |
files |
|
5405 |
collect: |
|
5406 |
[:each | |
|
5407 |
'"' , each asFilename pathName , '"' |
|
5408 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5409 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5410 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5411 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5412 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5413 |
]. |
4820 | 5414 |
|
4950 | 5415 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5416 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 5417 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5418 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
5419 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 5420 |
! |
5421 |
||
4958 | 5422 |
openRP |
5423 |
self openOSCommandWithFiles:'realplay' |
|
5424 |
! |
|
5425 |
||
3892 | 5426 |
openSlideShow |
5880 | 5427 |
|dir| |
5428 |
||
5429 |
dir := self theSingleSelectedDirectoryOrNil. |
|
5430 |
dir isNil ifTrue:[^ self]. |
|
5431 |
||
3892 | 5432 |
CodingExamples_GUI::SlideShow openIn:dir. |
5433 |
! |
|
5434 |
||
5435 |
openSnapshotImageBrowser |
|
4491 | 5436 |
"Sorry, for now, only the old browser can handle snapShotImages." |
5437 |
||
3892 | 5438 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
5439 |
! |
|
5440 |
||
5441 |
openTerminal |
|
5880 | 5442 |
|dir| |
5443 |
||
5444 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 5445 |
|
5300 | 5446 |
TerminalApplication notNil ifTrue:[ |
5447 |
TerminalApplication openIn:dir |
|
5448 |
] ifFalse:[ |
|
5449 |
VT100TerminalView openShellIn:dir. |
|
5450 |
]. |
|
3892 | 5451 |
! |
5452 |
||
5453 |
openTool:aToolClass |
|
5454 |
"open a tool on the selected file(s)" |
|
5455 |
||
5456 |
^ self openTool:aToolClass ignoreDirectories:true |
|
5457 |
! |
|
5458 |
||
5459 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
5460 |
"open a tool on the selected file(s)" |
|
5461 |
||
5462 |
^ self |
|
4414 | 5463 |
openTool:aToolClass |
5464 |
with:#openOn: |
|
5465 |
ignoreDirectories:ignoreDirs |
|
3892 | 5466 |
! |
5467 |
||
5468 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
|
5469 |
"open a tool on the selected file(s)" |
|
5470 |
||
5471 |
|numItems path tool files| |
|
5472 |
||
5473 |
aToolClass isNil ifTrue:[ |
|
4414 | 5474 |
Dialog warn:'Sorry, that tool seems to be not available'. |
5475 |
^ nil. |
|
3892 | 5476 |
]. |
3982 | 5477 |
files := self currentSelectedFiles. |
3892 | 5478 |
|
5479 |
(numItems := files size) > 2 ifTrue:[ |
|
4414 | 5480 |
(self |
5481 |
confirm:(resources string:'open for each of the %1 items ?' |
|
5482 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 5483 |
]. |
5484 |
||
5485 |
self withWaitCursorDo:[ |
|
4414 | 5486 |
files do:[:fileName | |
5487 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
5488 |
fileName isAbsolute ifTrue:[ |
|
5489 |
path := fileName getName. |
|
5490 |
] ifFalse:[ |
|
5491 |
path := fileName pathName. |
|
5492 |
]. |
|
5493 |
tool := aToolClass perform:aSelector with:path. |
|
5494 |
] |
|
5495 |
]. |
|
3892 | 5496 |
]. |
5497 |
^ tool |
|
5498 |
! |
|
5499 |
||
6022 | 5500 |
openWorkspace |
5501 |
self |
|
5502 |
openTool:WorkspaceApplication |
|
5503 |
with:#openOnFile: |
|
5504 |
ignoreDirectories:true |
|
5505 |
! |
|
5506 |
||
4950 | 5507 |
openXV |
4957 | 5508 |
self openOSCommandWithFiles:'xv' |
4950 | 5509 |
! |
5510 |
||
3892 | 5511 |
openZipTool |
5880 | 5512 |
|zipTool| |
3892 | 5513 |
|
5514 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 5515 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 5516 |
]. |
5517 |
! |
|
5518 |
||
5519 |
readAbbrevFile |
|
5520 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
5521 |
||
5880 | 5522 |
|directories| |
3892 | 5523 |
|
3982 | 5524 |
directories := self currentSelectedDirectories. |
3892 | 5525 |
directories isEmpty ifTrue:[^ self]. |
5526 |
||
5828 | 5527 |
self withWaitCursorDo:[ |
5880 | 5528 |
directories do:[:eachDir | |
5529 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
5530 |
] |
|
5828 | 5531 |
] |
3892 | 5532 |
! |
5533 |
||
5534 |
singleFileFileIn:fileName lazy:lazy |
|
5535 |
"fileIn the selected file(s)" |
|
5536 |
||
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5537 |
|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
|
5538 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5539 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5540 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5541 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5542 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5543 |
[ |
4345 | 5544 |
(ObjectFileLoader notNil |
5491 | 5545 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 5546 |
AbortOperationRequest catch:[ |
5547 |
|p| |
|
5548 |
||
5549 |
"/ |
|
5550 |
"/ look if already loaded ... then unload first |
|
5551 |
"/ |
|
5552 |
p := fileName pathName. |
|
5553 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
5554 |
(Dialog confirm:(resources |
|
5555 |
string:'%1 is already loaded; load anyway ?' |
|
5556 |
with:p)) ifFalse:[ |
|
5557 |
^ self |
|
5558 |
]. |
|
5559 |
notifyString := 'unloading old ' , p , ' ...'. |
|
5560 |
Transcript showCR:notifyString. |
|
4523 | 5561 |
self notify:notifyString. |
4345 | 5562 |
ObjectFileLoader unloadObjectFile:p. |
5563 |
]. |
|
5564 |
||
5565 |
notifyString := 'loading ' , p , ' ...'. |
|
5566 |
Transcript showCR:notifyString. |
|
4523 | 5567 |
self notify:notifyString. |
4345 | 5568 |
ObjectFileLoader loadObjectFile:p. |
5569 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
5570 |
] |
|
5571 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
5572 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
5573 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5574 |
aStream := fileName readStreamOrNil. |
4345 | 5575 |
aStream notNil ifTrue:[ |
5576 |
aStream fileInBinary. |
|
5577 |
] |
|
5578 |
] ifFalse:[ |
|
5579 |
((fileName hasSuffix:'class') |
|
5491 | 5580 |
or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 5581 |
"/ loading a java class file |
5582 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 5583 |
JavaClassReader loadFile:fileName |
4345 | 5584 |
] |
5585 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
5586 |
"/ loading a sif (smalltalk interchange format) file |
|
5587 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
5588 |
SmalltalkInterchangeFileManager newForFileIn |
|
5589 |
fileName: fileName pathName; |
|
5590 |
fileIn. |
|
5756 | 5591 |
] ifFalse:[ (fileName hasSuffix:'js') ifTrue:[ |
5592 |
"/ loading a javaScript file |
|
5593 |
JavaScriptSourceReader new fileIn:fileName. |
|
4345 | 5594 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
5595 |
Parcel isNil ifTrue:[ |
|
5596 |
Dialog warn:'Parcel support not loaded.' |
|
5597 |
] ifFalse:[ |
|
5598 |
Parcel loadParcelFrom: fileName pathName |
|
5599 |
] |
|
5600 |
] ifFalse:[ |
|
5601 |
"/ 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
|
5602 |
Error handle:[:ex | |
328a3fddfc5c
Allow opening of a debugger when an error on fileIn occurs.
Stefan Vogel <sv@exept.de>
parents:
6220
diff
changeset
|
5603 |
self errorNotify:'Error on file in: ', ex description. |
5491 | 5604 |
] do:[ |
5605 |
aStream := fileName readStream. |
|
5606 |
[ |
|
5607 |
Class withoutUpdatingChangesDo:[ |
|
5608 |
wasLazy := Compiler compileLazy:lazy. |
|
5948 | 5609 |
Smalltalk fileInStream:aStream. |
5491 | 5610 |
]. |
5611 |
Class addInfoRecord:('fileIn ' , fileName asString) |
|
5612 |
] ensure:[ |
|
5613 |
Compiler compileLazy:wasLazy. |
|
5614 |
aStream close |
|
4345 | 5615 |
] |
5616 |
] |
|
5756 | 5617 |
]]]] |
4345 | 5618 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5619 |
] 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
|
5620 |
|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
|
5621 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5622 |
isRedef := false. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5623 |
sig := ex signal. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5624 |
(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
|
5625 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5626 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5627 |
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
|
5628 |
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
|
5629 |
, 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
|
5630 |
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
|
5631 |
isRedef := true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5632 |
] 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
|
5633 |
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
|
5634 |
, 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
|
5635 |
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
|
5636 |
isRedef := true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5637 |
] 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
|
5638 |
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
|
5639 |
sender := ex suspendedContext. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5640 |
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
|
5641 |
] ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5642 |
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
|
5643 |
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
|
5644 |
]]]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5645 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5646 |
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
|
5647 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5648 |
isRedef ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5649 |
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
|
5650 |
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
|
5651 |
] ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5652 |
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
|
5653 |
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
|
5654 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5655 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5656 |
AbortAllOperationRequest isHandled ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5657 |
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
|
5658 |
values := #(cancelAll) , values. |
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 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5661 |
action := OptionBox |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5662 |
request:(msg withCRs) |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5663 |
label:label |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5664 |
image:(WarningBox iconBitmap) |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5665 |
buttonLabels:labels |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5666 |
values:values |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5667 |
default:#continue |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5668 |
onCancel:#abort. |
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 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5671 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5672 |
dontAskSignals := IdentityDictionary new. |
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 |
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
|
5675 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5676 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5677 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5678 |
action == #continue ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5679 |
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
|
5680 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5681 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5682 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5683 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5684 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5685 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5686 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5687 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5688 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5689 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5690 |
ex proceedWith:nil |
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 == #debug ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5693 |
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
|
5694 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5695 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5696 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5697 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5698 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
5699 |
] |
4531 | 5700 |
! |
5701 |
||
4558 | 5702 |
splitFile:infile intoPiecesOfSize:kiloBytes |
5703 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
5704 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
5705 |
||
5706 |
bufferSize := 32*1024. |
|
5707 |
||
5708 |
inStream := infile readStream. |
|
5709 |
||
5710 |
bytesPerSplit := kiloBytes * 1024. |
|
5711 |
||
5712 |
remaining := infile fileSize. |
|
5713 |
splitIndex := 1. |
|
5714 |
[remaining > 0] whileTrue:[ |
|
5715 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
5716 |
outStream := outFile asFilename writeStream. |
|
5717 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
5718 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
5719 |
buffer := ByteArray new:bufferSize. |
|
5720 |
n := inStream |
|
5721 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
5722 |
into:buffer |
|
5723 |
startingAt:1. |
|
5724 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
5725 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
5726 |
remaining := remaining - n. |
|
5727 |
]. |
|
5728 |
outStream close. |
|
5729 |
splitIndex := splitIndex + 1. |
|
5730 |
]. |
|
5731 |
inStream close. |
|
5732 |
! |
|
5733 |
||
5734 |
splitSelectedFiles |
|
6264 | 5735 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 5736 |
|
5737 |
selectedFiles := self currentFileNameHolder value. |
|
5738 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
5739 |
||
6265 | 5740 |
msg := (numFiles > 1) |
5741 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
5742 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 5743 |
|
6352 | 5744 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 5745 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
5746 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 5747 |
kiloBytes isNil ifTrue:[^ self]. |
5748 |
||
5749 |
selectedFiles do:[:fileName | |
|
5750 |
self notify:('Splitting:', fileName baseName). |
|
5751 |
fileName isDirectory ifFalse:[ |
|
5752 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
|
5753 |
] |
|
5754 |
]. |
|
6190 | 5755 |
self notify:nil. |
6265 | 5756 |
|
5757 |
"Modified: / 20-04-2005 / 11:25:11 / cg" |
|
4558 | 5758 |
! |
5759 |
||
4531 | 5760 |
truncateSelectedFilesToZeroSize |
4554 | 5761 |
|selectedFiles numFiles msg| |
4531 | 5762 |
|
5763 |
selectedFiles := self currentFileNameHolder value. |
|
4554 | 5764 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
5765 |
||
4930 | 5766 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
4554 | 5767 |
numFiles > 1 ifTrue:[ |
4930 | 5768 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
4554 | 5769 |
]. |
4531 | 5770 |
|
5771 |
(Dialog |
|
6352 | 5772 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
4531 | 5773 |
initialAnswer:false |
5774 |
) ifFalse:[ |
|
5775 |
^ self |
|
5776 |
]. |
|
5777 |
||
5778 |
selectedFiles do:[:fileName | |
|
5779 |
|s| |
|
5780 |
||
5781 |
self notify:('Truncating:', fileName baseName). |
|
5782 |
fileName isDirectory ifFalse:[ |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5783 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5784 |
s := fileName writeStream. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5785 |
s close. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5786 |
] on:FileStream openErrorSignal do:[:ex| |
4531 | 5787 |
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
|
5788 |
]. |
4531 | 5789 |
] |
5790 |
]. |
|
6190 | 5791 |
self notify:nil. |
3892 | 5792 |
! ! |
5793 |
||
4849 | 5794 |
!AbstractFileBrowser methodsFor:'menu queries-cvs'! |
3892 | 5795 |
|
5796 |
canCvsAddAndCommit |
|
5797 |
||
3982 | 5798 |
|selectedFiles| |
5799 |
||
5800 |
selectedFiles := self currentSelectedFiles. |
|
5801 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
3892 | 5802 |
! |
5803 |
||
5804 |
canRemoveCVSContainer |
|
5356
d08261ab1567
care for nonexisting bookmarks file in open
Claus Gittinger <cg@exept.de>
parents:
5334
diff
changeset
|
5805 |
^ self currentSelectedFiles |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5806 |
contains:[:fileName| |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5807 |
|dirOfFile cvsDir| |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5808 |
|
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5809 |
dirOfFile := self getDirWithoutFileName:fileName. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5810 |
cvsDir := dirOfFile construct:'CVS'. |
5318 | 5811 |
cvsDir isDirectory |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
5812 |
]. |
3892 | 5813 |
! ! |
5814 |
||
4849 | 5815 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 5816 |
|
5817 |
anySTFilesPresent |
|
5818 |
^ self anyFilesPresentWithSuffix:'st' |
|
5819 |
! |
|
5820 |
||
5821 |
canCreateNewProject |
|
5822 |
||
3982 | 5823 |
| selectedFiles | |
3892 | 5824 |
|
5825 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
3982 | 5826 |
selectedFiles := self currentSelectedFiles. |
3892 | 5827 |
^ [ |
4414 | 5828 |
((selectedFiles detect:[:fileName| | suffix| |
5829 |
suffix := fileName suffix asLowercase. |
|
5830 |
(suffix = 'prj' or:[suffix = 'st']) |
|
5831 |
] ifNone:[nil]) notNil) |
|
3982 | 5832 |
] |
3892 | 5833 |
! |
5834 |
||
5835 |
canDoTerminal |
|
5836 |
||
5837 |
^ OperatingSystem isUNIXlike |
|
5838 |
or:[OperatingSystem isMSWINDOWSlike] |
|
5839 |
! |
|
5840 |
||
5841 |
canDoTerminalAndSystemIsDOS |
|
5842 |
||
5843 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
5844 |
! |
|
5845 |
||
5846 |
canDoTerminalAndSystemIsUnix |
|
5847 |
||
5848 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
5849 |
! |
|
5850 |
||
5851 |
canReadAbbrevFile |
|
5852 |
||
5960 | 5853 |
|currentDirectory| |
3892 | 5854 |
|
5855 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 5856 |
currentDirectory := self currentDirectory. |
5857 |
^ currentDirectory notNil |
|
5858 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 5859 |
! |
5860 |
||
5861 |
canRemoveFromSourcePath |
|
5862 |
||
5863 |
^ false |
|
5864 |
! |
|
5865 |
||
5866 |
hasASN1 |
|
5867 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 5868 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 5869 |
|
5870 |
! |
|
5871 |
||
5872 |
hasASN1AndSelection |
|
5873 |
^ [ self hasSelection value |
|
4414 | 5874 |
and:[self currentSelectedFiles size > 0 |
5875 |
and:[OSI::ASN1Parser notNil |
|
5876 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
3892 | 5877 |
! |
5878 |
||
5879 |
hasCBrowser |
|
5880 |
^ [ CBrowser::Browser notNil ] |
|
5881 |
! |
|
5882 |
||
5883 |
hasJava |
|
5884 |
||
5885 |
^ [ JavaClassReader notNil |
|
4414 | 5886 |
and:[JavaClassReader isLoaded]] |
3892 | 5887 |
! |
5888 |
||
5889 |
hasJavaAndSelection |
|
5890 |
||
3982 | 5891 |
^ [ self currentSelectedFiles size > 0 |
4414 | 5892 |
and:[JavaClassReader notNil |
5893 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 5894 |
! |
5895 |
||
5896 |
hasMP3Player |
|
5897 |
||
5898 |
^ [ MP3PlayerApplication notNil |
|
4414 | 5899 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 5900 |
! |
5901 |
||
5902 |
hasMP3PlayerAndSelection |
|
5903 |
||
3982 | 5904 |
^ [ self currentSelectedFiles size > 0 |
4414 | 5905 |
and:[ self hasMP3Player value]] |
3892 | 5906 |
! |
5907 |
||
5908 |
hasSlideShow |
|
5909 |
||
5910 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
5911 |
! |
|
5912 |
||
5913 |
hasSnapshotSelection |
|
5914 |
||
5915 |
^ [ |
|
4414 | 5916 |
| files | |
5917 |
files := self currentSelectedFiles. |
|
5918 |
((files size == 1) |
|
5919 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 5920 |
] |
5921 |
! |
|
5922 |
||
5923 |
hasZipFileSelected |
|
5924 |
||
3982 | 5925 |
^ [|sel fileName fn suff| |
5926 |
||
4414 | 5927 |
sel := self currentSelectedFiles. |
5928 |
sel size == 1 ifTrue:[ |
|
5929 |
fileName := sel first. |
|
5930 |
fileName notNil ifTrue:[ |
|
5931 |
suff := fileName suffix asLowercase. |
|
5932 |
suff = 'zip' or:[suff = 'jar'] |
|
5933 |
] ifFalse:[ |
|
5934 |
false |
|
5935 |
] |
|
5936 |
] ifFalse:[ |
|
5937 |
false |
|
5938 |
] |
|
3892 | 5939 |
] |
5940 |
! |
|
5941 |
||
5942 |
javaSupportLoaded |
|
5943 |
||
5944 |
^ false |
|
5945 |
! ! |
|
5946 |
||
3906 | 5947 |
!AbstractFileBrowser methodsFor:'presentation'! |
5948 |
||
5949 |
getModeString:modeBits |
|
5950 |
"convert file-mode bits into a more user-friendly string. |
|
5951 |
This is wrong here - should be moved into OperatingSystem." |
|
5952 |
||
5953 |
^ self getModeString:modeBits |
|
4414 | 5954 |
with:#( 'owner:' $r $w $x |
5955 |
' group:' $r $w $x |
|
5956 |
' others:' $r $w $x ) |
|
3906 | 5957 |
! |
5958 |
||
5959 |
getModeString:modeBits with:texts |
|
5960 |
"convert file-mode bits into a more user-friendly string. |
|
5961 |
This is wrong here - should be moved into OperatingSystem." |
|
5962 |
||
5963 |
|bits modeString| |
|
5964 |
||
5965 |
bits := modeBits bitAnd:8r777. |
|
5966 |
modeString := ''. |
|
5967 |
||
5968 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
5969 |
with: texts do:[:bitMask :access | |
|
4414 | 5970 |
|ch| |
5971 |
||
5972 |
bitMask isNil ifTrue:[ |
|
5973 |
modeString := modeString , access |
|
5974 |
] ifFalse:[ |
|
5975 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
5976 |
ch := $- |
|
5977 |
] ifFalse:[ |
|
5978 |
ch := access |
|
5979 |
]. |
|
5980 |
modeString := modeString copyWith:ch |
|
5981 |
] |
|
3906 | 5982 |
]. |
5983 |
^ modeString |
|
5984 |
! ! |
|
5985 |
||
5880 | 5986 |
!AbstractFileBrowser methodsFor:'private'! |
5987 |
||
5988 |
theSingleSelectedDirectoryOrHomeDir |
|
5989 |
|dir| |
|
5990 |
||
5888 | 5991 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 5992 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
5993 |
^ dir. |
|
5994 |
! |
|
5995 |
||
5996 |
theSingleSelectedDirectoryOrNil |
|
5997 |
|dirs| |
|
5998 |
||
5999 |
dirs := self currentSelectedDirectories. |
|
6000 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
6001 |
^ dirs anElement. |
|
6002 |
! ! |
|
6003 |
||
3892 | 6004 |
!AbstractFileBrowser methodsFor:'queries'! |
6005 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
6006 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
6007 |
"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
|
6008 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
6009 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
6010 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
6011 |
|
3906 | 6012 |
getFileInfoStringForFirstSelectedFile:longInfo |
6013 |
"get stat info on selected file - return a string which can be |
|
6014 |
shown in a box" |
|
6015 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6016 |
|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
|
6017 |
sizeString fileSize tAccess tModification buffer| |
3906 | 6018 |
|
6019 |
selFiles := self currentFileNameHolder value. |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6020 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 6021 |
filename := selFiles first. |
6022 |
||
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
6023 |
buffer := Text writeStream. |
4765 | 6024 |
|
6025 |
buffer |
|
6026 |
nextPutAll:'filename: '; |
|
6027 |
nextPutLine:filename asString. |
|
6028 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6029 |
buffer nextPutAll:'type: '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6030 |
|
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6031 |
info := filename linkInfo. |
6235 | 6032 |
info isNil ifTrue:[ ^ nil]. |
6033 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
6034 |
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
|
6035 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6036 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6037 |
]. |
4765 | 6038 |
buffer |
6039 |
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
|
6040 |
nextPutLine:info path. |
3906 | 6041 |
] 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
|
6042 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6043 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6044 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6045 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6046 |
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
|
6047 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6048 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6049 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6050 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6051 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6052 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6053 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6054 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6055 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6056 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6057 |
fileSize > 1024 ifTrue:[ |
4708 | 6058 |
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
|
6059 |
fileSize > (1024*1024) ifTrue:[ |
4708 | 6060 |
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
|
6061 |
]. |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
6062 |
sizeString := sizeString , ')'. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6063 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
6064 |
]. |
4765 | 6065 |
buffer nextPutLine:sizeString. |
3906 | 6066 |
|
6067 |
modeBits := info mode. |
|
6068 |
modeString := self getModeString:modeBits. |
|
4765 | 6069 |
|
6070 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 6071 |
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
|
6072 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 6073 |
]. |
4765 | 6074 |
buffer |
6075 |
cr; |
|
6076 |
nextPutAll:'owner: '; |
|
6077 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
6078 |
||
3906 | 6079 |
longInfo ifTrue:[ |
4765 | 6080 |
buffer |
6081 |
nextPutAll:'group: '; |
|
6082 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
6083 |
||
6084 |
tAccess := info accessTime. |
|
6085 |
buffer |
|
6086 |
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
|
6087 |
nextPutAll:tAccess asDate printString; |
4765 | 6088 |
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
|
6089 |
nextPutLine:tAccess asTime printString. |
4765 | 6090 |
|
6091 |
tModification := info modificationTime. |
|
6092 |
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
|
6093 |
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
|
6094 |
nextPutAll:tModification asDate printString; |
4765 | 6095 |
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
|
6096 |
nextPutLine:tModification asTime printString. |
3906 | 6097 |
]. |
4765 | 6098 |
^ buffer contents |
3906 | 6099 |
! |
6100 |
||
3892 | 6101 |
initialCommandFor:fileName into:aBox |
6102 |
"set a useful initial command for execute box." |
|
6103 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
6104 |
self class initialCommandFor:fileName in:Filename currentDirectory intoBox:aBox |
3892 | 6105 |
! |
6106 |
||
6107 |
isAbstractFileBrowser |
|
6108 |
||
6109 |
^ true |
|
6110 |
! |
|
6111 |
||
6112 |
systemIsDOS |
|
6113 |
||
6114 |
^ OperatingSystem isMSDOSlike |
|
6115 |
! |
|
6116 |
||
6117 |
systemIsUnix |
|
6118 |
^ OperatingSystem isUNIXlike |
|
6119 |
! ! |
|
6120 |
||
6121 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
6122 |
||
6123 |
allItemsOfCurrentDirectory |
|
5009 | 6124 |
self |
4774 | 6125 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 6126 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
6127 |
||
6128 |
^ nil |
|
3892 | 6129 |
! |
6130 |
||
6131 |
anyFilesPresentWithSuffix:suffix |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6132 |
|directories| |
3892 | 6133 |
|
6134 |
directories := self currentDirectories value. |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6135 |
directories do:[:dir| |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6136 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
6137 |
(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
|
6138 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 6139 |
]. |
6140 |
^ false. |
|
6141 |
! |
|
6142 |
||
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6143 |
commonPrefixOfSelectedFiles |
4773 | 6144 |
|selFiles stringCol firstPre| |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6145 |
|
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6146 |
selFiles := self currentFileNameHolder value. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6147 |
selFiles isEmpty ifTrue:[^ nil]. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6148 |
|
4772 | 6149 |
stringCol := selFiles collect:[:file | file asString]. |
4773 | 6150 |
firstPre := stringCol at:1. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6151 |
stringCol from:2 do:[:el| |
4773 | 6152 |
firstPre := firstPre commonPrefixWith:el. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6153 |
]. |
4773 | 6154 |
^ firstPre asFilename |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6155 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
6156 |
|
3892 | 6157 |
currentFilesAreInSameDirectory |
6158 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6159 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 6160 |
! |
6161 |
||
6162 |
currentFilesHasDirectories |
|
6163 |
||
6164 |
^ self currentDirectories value notEmpty. |
|
6165 |
! |
|
6166 |
||
3982 | 6167 |
directoriesForFiles:aFileCol |
6168 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6169 |
^ (aFileCol collect:[:file| self getDirWithoutFileName:file]) asSet. |
3982 | 6170 |
! |
6171 |
||
3892 | 6172 |
fileListIsEmpty |
5009 | 6173 |
self |
6174 |
applicationNamed:#DirectoryContentsBrowser |
|
6175 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
6176 |
||
6177 |
^ nil. |
|
3892 | 6178 |
! |
6179 |
||
6180 |
fileListIsNotEmpty |
|
6181 |
||
6182 |
^ self fileListIsEmpty not. |
|
6183 |
! |
|
6184 |
||
6185 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 6186 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 6187 |
|
6188 |
| file1 file2 | |
|
6189 |
||
6284 | 6190 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 6191 |
file1 := aFilename1 asFilename. |
6192 |
file2 := aFilename2 asFilename. |
|
6284 | 6193 |
|
3892 | 6194 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 6195 |
|
3892 | 6196 |
((file1 isDirectory) |
6197 |
and:[(file2 isDirectory) |
|
6198 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 6199 |
^ file1 baseName = file2 baseName |
3892 | 6200 |
]. |
3982 | 6201 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 6202 |
! |
6203 |
||
6204 |
getAllFilesAsStringCollection |
|
5009 | 6205 |
self |
6206 |
applicationNamed:#DirectoryContentsBrowser |
|
6207 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
6208 |
||
6209 |
^ nil |
|
3892 | 6210 |
! |
6211 |
||
6212 |
getBestDirectory |
|
6213 |
||
6214 |
|selFiles stringCol firstPre| |
|
6215 |
||
6216 |
selFiles := self currentDirectories value. |
|
6217 |
selFiles isEmpty ifTrue:[^ nil]. |
|
6218 |
selFiles size == 1 ifTrue:[^ selFiles first]. |
|
4486 | 6219 |
stringCol := (selFiles collect:[:file| file asString]) asOrderedCollection. |
3892 | 6220 |
firstPre := stringCol at:1. |
6221 |
stringCol from:2 do:[:el| |
|
4414 | 6222 |
firstPre := firstPre commonPrefixWith:el. |
3892 | 6223 |
]. |
6224 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
4414 | 6225 |
firstPre removeLast. |
3892 | 6226 |
]. |
6227 |
^ firstPre asFilename |
|
6228 |
! |
|
6229 |
||
6230 |
getDirWithoutFileName:aFileName |
|
6231 |
||
6232 |
| dir | |
|
6233 |
aFileName isNil ifTrue:[ |
|
4414 | 6234 |
^ aFileName. |
3892 | 6235 |
]. |
6236 |
dir := aFileName asFilename. |
|
6237 |
dir isDirectory ifFalse:[ |
|
4414 | 6238 |
dir := dir directory. |
3892 | 6239 |
]. |
6240 |
^ dir. |
|
6241 |
! |
|
6242 |
||
6243 |
getInfoItem |
|
6244 |
"get filename of a description-file (.dir.info, README etc.); |
|
6245 |
This file is automatically shown when a directory is enterred. |
|
6246 |
You can add more names below if you like." |
|
6247 |
||
5880 | 6248 |
|dir| |
6249 |
||
6250 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6251 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 6252 |
|
6253 |
#( |
|
6254 |
'.dir.info' |
|
6255 |
'README' |
|
6256 |
'ReadMe' |
|
6257 |
'Readme' |
|
6258 |
'readme' |
|
6259 |
'read.me' |
|
6260 |
'Read.me' |
|
6261 |
'READ.ME' |
|
6262 |
'README.TXT' |
|
6263 |
'readme.txt' |
|
6264 |
'Readme.txt' |
|
6265 |
'Info.txt' |
|
6266 |
'info.txt' |
|
6267 |
'INFO.TXT' |
|
6268 |
) do:[:f | |
|
5883 | 6269 |
|n| |
4414 | 6270 |
|
5880 | 6271 |
n := dir construct:f. |
4414 | 6272 |
(n isReadable and:[n isDirectory not]) ifTrue:[ |
6273 |
^ DirectoryContentsBrowser itemClass fileName:n |
|
6274 |
] |
|
3892 | 6275 |
]. |
6276 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6277 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6278 |
|
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6279 |
parentDirectoriesOfCurrentFiles |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6280 |
|
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
6281 |
^ (self currentFileNameHolder value collect:[:file | file directory]) asSet |
3982 | 6282 |
! ! |
6283 |
||
6284 |
!AbstractFileBrowser methodsFor:'selection'! |
|
6285 |
||
6286 |
currentSelectedDirectories |
|
6287 |
||
6288 |
^ self currentDirectories value. |
|
6289 |
! |
|
6290 |
||
6291 |
currentSelectedFiles |
|
6292 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6293 |
^ self currentFileNameHolder value select:[:file | file isDirectory not]. |
3982 | 6294 |
! |
6295 |
||
6296 |
firstSelectedFile |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6297 |
^ self currentFileNameHolder value |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6298 |
detect:[:file | file asFilename isDirectory not] |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6299 |
ifNone:[]. |
4414 | 6300 |
! |
6301 |
||
6302 |
hasOnlyFilesSelected |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6303 |
|
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6304 |
^ self currentFileNameHolder value conform:[:file | file isDirectory not]. |
4414 | 6305 |
! |
6306 |
||
6307 |
hasTwoFilesSelected |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6308 |
|
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6309 |
^ self currentFileNameHolder value size == 2 |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6310 |
and:[self hasOnlyFilesSelected] |
3892 | 6311 |
! ! |
6312 |
||
3964 | 6313 |
!AbstractFileBrowser methodsFor:'sorting'! |
6314 |
||
3989 | 6315 |
currentSortOrder |
6316 |
||
6317 |
" returns a Ordered Collection of all directories currently selected |
|
6318 |
if only a file is selected currentDirectories holds the directory of the file |
|
6319 |
" |
|
6320 |
||
4027 | 6321 |
^ self aspectFor:#currentSortOrder ifAbsent:[ Dictionary new asValue ]. |
3989 | 6322 |
! |
6323 |
||
6324 |
sortBlockHolder |
|
6325 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 6326 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
6327 |
selector:#fileName |
|
6328 |
sortCaseless:self sortCaseless value |
|
6329 |
sortReverse:false) asValue. |
|
3989 | 6330 |
]. |
6331 |
! |
|
6332 |
||
6333 |
sortBlockProperty |
|
6334 |
||
4027 | 6335 |
|
3989 | 6336 |
^ self aspectFor:#sortBlockProperty ifAbsent:[ #baseName asValue ]. |
6337 |
! |
|
6338 |
||
6339 |
sortCaseless |
|
4201 | 6340 |
" aspect for sort caseless " |
3989 | 6341 |
|
6342 |
^ self aspectFor:#sortCaseless ifAbsent:[ |
|
4201 | 6343 |
| holder | |
6344 |
holder := (Filename isCaseSensitive not) asValue. |
|
6345 |
holder |
|
3989 | 6346 |
] |
6347 |
! |
|
6348 |
||
4074 | 6349 |
sortDirectoriesBeforeFiles |
6350 |
||
4201 | 6351 |
" aspect for sort directories always before files" |
4074 | 6352 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
6353 |
! |
|
6354 |
||
3989 | 6355 |
sortFileListsBy:instanceName |
6356 |
||
6357 |
self sortFileListsBy:instanceName withReverse:true |
|
6358 |
! |
|
6359 |
||
6360 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
6361 |
||
5383 | 6362 |
| aSymbol sortCaselessLocal currentSortOrder sorter| |
3964 | 6363 |
|
6364 |
aSymbol := instanceName asSymbol. |
|
4027 | 6365 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 6366 |
sortCaselessLocal := self sortCaseless value. |
4027 | 6367 |
currentSortOrder := self currentSortOrder value. |
3989 | 6368 |
currentSortOrder isEmpty ifTrue:[ |
4343 | 6369 |
currentSortOrder at:#column put:aSymbol. |
6370 |
currentSortOrder at:#reverse put:false. |
|
6371 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 6372 |
] ifFalse:[ |
4343 | 6373 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
6374 |
"/ sort caseless changed |
|
6375 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
6376 |
] ifFalse:[ |
|
6377 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
6378 |
"/ same column like before - change sort order ifReverse is true |
|
6379 |
aBoolean ifTrue:[ |
|
6380 |
| isReverse | |
|
6381 |
isReverse := currentSortOrder at:#reverse. |
|
6382 |
currentSortOrder at:#reverse put:(isReverse not). |
|
6383 |
]. |
|
6384 |
] ifFalse:[ |
|
6385 |
"/ another column - remark column |
|
6386 |
currentSortOrder at:#column put:aSymbol. |
|
6387 |
] |
|
6388 |
] |
|
3964 | 6389 |
]. |
4027 | 6390 |
self currentSortOrder changed. |
5383 | 6391 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
6392 |
selector:instanceName |
|
6393 |
sortCaseless:sortCaselessLocal |
|
6394 |
sortReverse:(currentSortOrder at:#reverse). |
|
6395 |
self sortBlockHolder value:sorter. |
|
3964 | 6396 |
! ! |
6397 |
||
3892 | 6398 |
!AbstractFileBrowser methodsFor:'startup & release'! |
6399 |
||
6400 |
makeDependent |
|
4074 | 6401 |
self filterModel addDependent:self. |
4004 | 6402 |
self currentFileNameHolder addDependent:self. |
4074 | 6403 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 6404 |
self sortCaseless addDependent:self. |
4011 | 6405 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
6406 |
self rootHolder addDependent:self. |
3892 | 6407 |
! |
6408 |
||
6409 |
masterApplication:anApplication |
|
6410 |
||
6411 |
masterApplication isNil ifTrue:[ |
|
4414 | 6412 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
6413 |
aspects := anApplication aspects |
|
6414 |
] ifFalse:[ |
|
6415 |
aspects isNil ifTrue:[ |
|
6416 |
aspects := IdentityDictionary new. |
|
6417 |
aspects at:#applications put:(IdentityDictionary new). |
|
6418 |
] |
|
6419 |
]. |
|
6420 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6421 |
"/ self makeDependent. |
3892 | 6422 |
]. |
3952 | 6423 |
^ super masterApplication:anApplication. |
3892 | 6424 |
! |
6425 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6426 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6427 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6428 |
super postBuildWith:aBuilder. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6429 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6430 |
|
3892 | 6431 |
postOpenWith:aBuilder |
6432 |
||
6433 |
super postOpenWith:aBuilder. |
|
6434 |
! ! |
|
6435 |
||
6436 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
6437 |
||
6438 |
files |
|
6439 |
"return the value of the instance variable 'files' (automatically generated)" |
|
6440 |
||
6441 |
^ files |
|
6442 |
! |
|
6443 |
||
6444 |
files:something |
|
6445 |
"set the value of the instance variable 'files' (automatically generated)" |
|
6446 |
||
6447 |
files := something. |
|
6448 |
! |
|
6449 |
||
6450 |
method |
|
6451 |
"return the value of the instance variable 'method' (automatically generated)" |
|
6452 |
||
6453 |
^ method |
|
6454 |
! |
|
6455 |
||
6456 |
method:something |
|
6457 |
"set the value of the instance variable 'method' (automatically generated)" |
|
6458 |
||
6459 |
method := something. |
|
6460 |
! ! |
|
6461 |
||
6462 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
6463 |
||
6464 |
locked |
|
6465 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
6466 |
||
6467 |
locked isNil ifTrue:[ |
|
4414 | 6468 |
locked := false. |
3892 | 6469 |
]. |
6470 |
^ locked |
|
6471 |
! ! |
|
6472 |
||
6473 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
6474 |
||
6475 |
doIfUnLocked:aBlock |
|
6476 |
||
6477 |
self locked ifFalse:[ |
|
4414 | 6478 |
aBlock value. |
3892 | 6479 |
]. |
6480 |
! |
|
6481 |
||
6482 |
doLocked:aBlock |
|
6483 |
||
6484 |
locked := true. |
|
4004 | 6485 |
aBlock ensure:[ |
4414 | 6486 |
locked := false. |
4004 | 6487 |
] |
3892 | 6488 |
! ! |
6489 |
||
3952 | 6490 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
6491 |
||
6492 |
historySize |
|
3892 | 6493 |
|
6494 |
^ 20 |
|
6495 |
! ! |
|
6496 |
||
4032 | 6497 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'new'! |
6498 |
||
6499 |
new |
|
6500 |
||
6501 |
^ super new initialize. |
|
6502 |
! ! |
|
6503 |
||
3892 | 6504 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
6505 |
||
3952 | 6506 |
addToHistory:aPath |
6507 |
| item| |
|
6508 |
||
6509 |
item := self getItemFor:aPath. |
|
4347 | 6510 |
self backForwardListAdd:aPath. |
3952 | 6511 |
item isNil ifTrue:[ |
4347 | 6512 |
" not already in history" |
6513 |
self size >= self class historySize ifTrue:[ |
|
6514 |
self removeLast. |
|
6515 |
]. |
|
6516 |
item := DirectoryHistoryItem path:aPath. |
|
6517 |
self addFirst:item |
|
3952 | 6518 |
] ifFalse:[ |
4347 | 6519 |
"already been there before; move the entry to |
6520 |
the beginning, so it will fall out later." |
|
6521 |
self remove:item. |
|
6522 |
self addFirst:item |
|
3892 | 6523 |
]. |
3952 | 6524 |
! |
6525 |
||
4347 | 6526 |
backForwardListAdd:aPath |
6527 |
||
6528 |
|pathIndex| |
|
6529 |
||
6530 |
pathIndex := backForwardList indexOf:aPath. |
|
6531 |
pathIndex == 0 ifTrue:[ |
|
6532 |
" a new path comes in remove forward paths " |
|
6533 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
6534 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
6535 |
]. |
|
6536 |
] ifFalse:[ |
|
6537 |
backForwardList remove:aPath. |
|
6538 |
pathIndex <= backForwardIndex ifTrue:[ |
|
6539 |
backForwardIndex := backForwardIndex - 1. |
|
6540 |
] |
|
4022 | 6541 |
]. |
4347 | 6542 |
backForwardList add:aPath afterIndex:backForwardIndex. |
6543 |
backForwardIndex := backForwardIndex + 1. |
|
6544 |
backForwardIndex > self class historySize ifTrue:[ |
|
6545 |
backForwardList removeFirst. |
|
6546 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 6547 |
]. |
4347 | 6548 |
! |
6549 |
||
6550 |
goBackward |
|
4288 | 6551 |
"return the first path of the backward list; |
6552 |
remove it from the back list and add it ti the forward list." |
|
4022 | 6553 |
|
4347 | 6554 |
|retPath| |
6555 |
||
6556 |
self canBackward ifTrue:[ |
|
6557 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
6558 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 6559 |
]. |
4022 | 6560 |
^ retPath. |
6561 |
! |
|
6562 |
||
6563 |
goForward |
|
4288 | 6564 |
"return the first path of the forward list; |
6565 |
remove it from the list." |
|
4022 | 6566 |
|
4347 | 6567 |
|retPath| |
6568 |
||
6569 |
self canForward ifTrue:[ |
|
6570 |
retPath := backForwardList at:backForwardIndex + 1. |
|
6571 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 6572 |
]. |
4022 | 6573 |
^ retPath. |
6574 |
! |
|
6575 |
||
6576 |
resetForwardBackward |
|
6577 |
||
4347 | 6578 |
self initialize |
4022 | 6579 |
! |
6580 |
||
6581 |
setPosition:aPosition for:aPath |
|
6582 |
||
6583 |
self do:[:item| |
|
4414 | 6584 |
item path = aPath ifTrue:[ |
6585 |
item position:aPosition. |
|
6586 |
] |
|
4022 | 6587 |
]. |
3892 | 6588 |
! ! |
6589 |
||
4870 | 6590 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 6591 |
|
6592 |
initialize |
|
6593 |
||
4347 | 6594 |
backForwardList := OrderedCollection new. |
6595 |
self reverseDo:[:el| |
|
6596 |
backForwardList add:el path. |
|
6597 |
]. |
|
6598 |
backForwardIndex := backForwardList size. |
|
4032 | 6599 |
! ! |
6600 |
||
3892 | 6601 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
6602 |
||
4288 | 6603 |
canBackward |
4347 | 6604 |
|
6605 |
^ backForwardIndex > 1 |
|
4288 | 6606 |
! |
6607 |
||
3892 | 6608 |
canForward |
4347 | 6609 |
|
6610 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
6611 |
! |
|
6612 |
||
6613 |
getBackCollection |
|
6614 |
||
6615 |
| backCol | |
|
6616 |
||
6617 |
backCol := OrderedCollection new. |
|
6618 |
self canBackward ifTrue:[ |
|
6619 |
| tmpCol | |
|
6620 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
6621 |
tmpCol reverseDo:[ :el| |
|
6622 |
backCol add:el. |
|
6623 |
] |
|
6624 |
]. |
|
6625 |
^ backCol |
|
3952 | 6626 |
! |
6627 |
||
6628 |
getForwardCollection |
|
6629 |
||
4347 | 6630 |
| forwCol | |
6631 |
||
6632 |
forwCol := OrderedCollection new. |
|
6633 |
self canForward ifTrue:[ |
|
6634 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
6635 |
]. |
|
6636 |
^ forwCol |
|
3952 | 6637 |
! |
6638 |
||
6639 |
getItemFor:aPath |
|
6640 |
||
6641 |
self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
6642 |
^ nil. |
|
6643 |
! |
|
6644 |
||
6645 |
getPositionFor:aPath |
|
6646 |
||
6647 |
|item| |
|
6648 |
||
6649 |
item := self getItemFor:aPath. |
|
6650 |
||
6651 |
item notNil ifTrue:[ |
|
4414 | 6652 |
^ item position. |
3952 | 6653 |
]. |
6654 |
^ nil |
|
6655 |
! |
|
6656 |
||
6657 |
includesPath:aPath |
|
6658 |
||
6659 |
self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
6660 |
^ false. |
|
4347 | 6661 |
! |
6662 |
||
6663 |
nextBackwardItem |
|
6664 |
"return the first path of the backward list" |
|
6665 |
||
6666 |
|retPath| |
|
6667 |
||
6668 |
self canBackward ifTrue:[ |
|
6669 |
retPath := backForwardList at:backForwardIndex. |
|
6670 |
]. |
|
6671 |
^ retPath. |
|
6672 |
! |
|
6673 |
||
6674 |
nextForwardItem |
|
6675 |
"return the first path of the forward list" |
|
6676 |
||
6677 |
|retPath| |
|
6678 |
||
6679 |
self canForward ifTrue:[ |
|
6680 |
retPath := backForwardList at:backForwardIndex + 1. |
|
6681 |
]. |
|
6682 |
^ retPath. |
|
3952 | 6683 |
! ! |
6684 |
||
6685 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
6686 |
||
6687 |
path:aPath |
|
6688 |
||
6689 |
^ self new path:aPath |
|
6690 |
! ! |
|
6691 |
||
6692 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
6693 |
||
6694 |
path |
|
6695 |
"return the value of the instance variable 'path' (automatically generated)" |
|
6696 |
||
6697 |
^ path |
|
6698 |
! |
|
6699 |
||
6700 |
path:something |
|
6701 |
"set the value of the instance variable 'path' (automatically generated)" |
|
6702 |
||
6703 |
path := something. |
|
6704 |
! |
|
6705 |
||
6706 |
position |
|
6707 |
"return the value of the instance variable 'position' (automatically generated)" |
|
6708 |
||
6709 |
^ position |
|
6710 |
! |
|
6711 |
||
6712 |
position:something |
|
6713 |
"set the value of the instance variable 'position' (automatically generated)" |
|
6714 |
||
6715 |
position := something. |
|
6716 |
! |
|
6717 |
||
6718 |
printString |
|
6719 |
||
6720 |
^ self path asString |
|
3892 | 6721 |
! ! |
6722 |
||
4915 | 6723 |
!AbstractFileBrowser::FilenameHistory class methodsFor:'accessing-attributes'! |
3892 | 6724 |
|
4337
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
6725 |
filenameHistorySize |
3892 | 6726 |
|
6727 |
^ 20 |
|
6728 |
! ! |
|
6729 |
||
6730 |
!AbstractFileBrowser::FilenameHistory methodsFor:'adding & removing'! |
|
6731 |
||
5242
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
6732 |
add:aFileItem |
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
6733 |
(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
|
6734 |
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
|
6735 |
]. |
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
6736 |
self addFirst:aFileItem. |
3892 | 6737 |
! ! |
6738 |
||
6739 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
6740 |
||
6741 |
withValue:aValue isHolder:aBoolean |
|
6742 |
||
6743 |
| instance | |
|
6744 |
||
6745 |
instance := self basicNew. |
|
6746 |
instance value:aValue. |
|
6747 |
instance isHolder:aBoolean. |
|
6748 |
^ instance |
|
6749 |
! ! |
|
6750 |
||
6751 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
6752 |
||
6753 |
isHolder |
|
6754 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
6755 |
||
6756 |
^ isHolder |
|
6757 |
! |
|
6758 |
||
6759 |
isHolder:something |
|
6760 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
|
6761 |
||
6762 |
isHolder := something. |
|
6763 |
! |
|
6764 |
||
6765 |
value |
|
6766 |
"return the value of the instance variable 'value' (automatically generated)" |
|
6767 |
||
6768 |
^ value |
|
6769 |
! |
|
6770 |
||
6771 |
value:something |
|
6772 |
"set the value of the instance variable 'value' (automatically generated)" |
|
6773 |
||
6774 |
value := something. |
|
6775 |
! ! |
|
6776 |
||
6777 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
6778 |
||
6779 |
version |
|
6352 | 6780 |
^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.300 2005-07-13 15:41:54 cg Exp $' |
3892 | 6781 |
! ! |