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