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