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