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