author | Claus Gittinger <cg@exept.de> |
Thu, 20 May 2010 11:18:17 +0200 | |
changeset 9493 | 3fc4fb8c1b0a |
parent 9490 | ce987b121e32 |
child 9496 | 0cfc347edb59 |
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 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
98 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
99 |
Notice: this certainly needs a redesign - all those abstract-abstract classes which |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
100 |
define stuff which is only needed in some parts makes this hard to understand. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
101 |
Especially the fact, that AbstractFileBrowser defines things both as abstract superclass |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
102 |
and as a container is almost incomprehensable... |
5967 | 103 |
" |
5140 | 104 |
! ! |
3892 | 105 |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
106 |
!AbstractFileBrowser class methodsFor:'accessing'! |
3952 | 107 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
108 |
currentSelection |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
109 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
110 |
LastFileSelection isNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
111 |
LastFileSelection := #(). |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
112 |
]. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
113 |
^ LastFileSelection |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
114 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
115 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
116 |
currentSelection:aFilenameCol |
6589 | 117 |
aFilenameCol notEmptyOrNil ifTrue:[ |
118 |
LastFileSelection := aFilenameCol collect:[:file | file asFilename] |
|
119 |
] |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
120 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
121 |
|
3952 | 122 |
directoryHistory |
123 |
||
124 |
DirectoryHistory isNil ifTrue:[ |
|
4414 | 125 |
DirectoryHistory := self directoryHistoryClass new. |
3964 | 126 |
"/ DirectoryHistory inspect. |
3952 | 127 |
]. |
128 |
^ DirectoryHistory |
|
129 |
! |
|
130 |
||
131 |
resetClassVars |
|
132 |
DirectoryHistory := nil. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
133 |
LastFileSelection := nil. |
5936 | 134 |
|
135 |
" |
|
136 |
AbstractFileBrowser resetClassVars |
|
137 |
" |
|
4368
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 |
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 |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
143 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
144 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
145 |
rootHolder:aRoot |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
146 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
147 |
RootHolder := aRoot |
3952 | 148 |
! ! |
149 |
||
4915 | 150 |
!AbstractFileBrowser class methodsFor:'accessing-bookmarks'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
151 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
152 |
addBookmark:aDirectoryPath |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
153 |
"add aDirectoryPath to the list of our known bookmarks. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
154 |
Do not add duplicates." |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
155 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
156 |
|bookmarks| |
4672
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 |
bookmarks := self directoryBookmarks. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
159 |
(bookmarks includes:aDirectoryPath) ifFalse:[ |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
160 |
bookmarks add:aDirectoryPath asFilename. |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
161 |
]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
162 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
163 |
|
8013 | 164 |
bookmarksFrom:aFileNameOrString |
165 |
|bookmarks s fileName| |
|
166 |
||
167 |
fileName := aFileNameOrString asFilename. |
|
168 |
[ |
|
169 |
s := fileName readStream. |
|
170 |
] on:OpenError do:[:ex| |
|
171 |
^ nil. |
|
172 |
]. |
|
173 |
||
174 |
bookmarks := OrderedCollection new. |
|
175 |
[s atEnd] whileFalse:[ |
|
176 |
bookmarks add:(Base64Coder decode:s nextLine) asString. |
|
177 |
]. |
|
178 |
s close. |
|
179 |
||
180 |
^ bookmarks |
|
181 |
! |
|
182 |
||
4679 | 183 |
defaultBookMarksFileDirectory |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
184 |
^ Filename homeDirectory |
4679 | 185 |
! |
186 |
||
187 |
defaultBookMarksFilename |
|
188 |
^ '.fileBrowserBookmarks' |
|
189 |
! |
|
190 |
||
191 |
directoryBookmarks |
|
192 |
DirectoryBookmarks isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
193 |
self loadBookmarksFrom:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename). |
4679 | 194 |
|
195 |
DirectoryBookmarks isEmptyOrNil ifTrue:[ |
|
196 |
DirectoryBookmarks := OrderedCollection new. |
|
197 |
DirectoryBookmarks add:Filename homeDirectory asAbsoluteFilename. |
|
198 |
DirectoryBookmarks add:Filename currentDirectory asAbsoluteFilename. |
|
199 |
] |
|
200 |
]. |
|
201 |
^ DirectoryBookmarks |
|
202 |
||
203 |
" |
|
5438
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
204 |
DirectoryBookmarks := nil. |
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
205 |
self directoryBookmarks. |
4679 | 206 |
" |
207 |
! |
|
208 |
||
8013 | 209 |
directoryBookmarks: collectionOfFilenames |
210 |
||
211 |
DirectoryBookmarks := collectionOfFilenames. |
|
212 |
self saveBookmarksInDefaultBookmarksFile. |
|
213 |
! |
|
214 |
||
215 |
editBookmarksWithDefault: aFilenameOrNil |
|
216 |
||
217 |
| oldBookmarks newBookmarks | |
|
218 |
||
219 |
oldBookmarks := self directoryBookmarks copy. |
|
220 |
newBookmarks := BookmarksEditDialog openWith: oldBookmarks defaultBookmark: aFilenameOrNil. |
|
221 |
newBookmarks isNil ifTrue:[^ self]. |
|
222 |
self directoryBookmarks: newBookmarks. |
|
223 |
! |
|
224 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
225 |
hasBookmarks |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
226 |
^ self directoryBookmarks notEmptyOrNil |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
227 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
228 |
|
4679 | 229 |
loadBookmarksFrom:aFileNameOrString |
8013 | 230 |
|bookmarks| |
231 |
||
232 |
bookmarks := self bookmarksFrom: aFileNameOrString. |
|
233 |
bookmarks isNil ifTrue:[^ self]. |
|
4679 | 234 |
|
235 |
DirectoryBookmarks := OrderedCollection new. |
|
236 |
bookmarks do:[:eachPath | |
|
237 |
self addBookmark:eachPath asFilename |
|
238 |
]. |
|
239 |
! |
|
240 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
241 |
removeBookmark:aDirectoryPath |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
242 |
|bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
243 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
244 |
bookmarks := self directoryBookmarks. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
245 |
bookmarks isEmptyOrNil ifTrue:[ ^ self]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
246 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
247 |
bookmarks remove:aDirectoryPath ifAbsent:[]. |
4679 | 248 |
! |
249 |
||
250 |
saveBookmarks |
|
251 |
|fn| |
|
252 |
||
253 |
fn := Dialog |
|
254 |
requestFileName:'Save Bookmarks' |
|
255 |
default:(self defaultBookMarksFilename) |
|
256 |
fromDirectory:(self defaultBookMarksFileDirectory). |
|
257 |
fn isEmptyOrNil ifTrue:[^ self]. |
|
258 |
||
259 |
self saveBookmarksIn:fn |
|
260 |
! |
|
261 |
||
8013 | 262 |
saveBookmarks: bookmarks in:aFileNameOrString |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
263 |
"save the bokmarks in aFileNameOrString. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
264 |
Use Base64 coding" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
265 |
|
8013 | 266 |
| bookmarkStream fileName coder| |
4679 | 267 |
|
268 |
fileName := aFileNameOrString asFilename. |
|
269 |
fileName exists ifTrue:[ |
|
270 |
fileName renameTo:(fileName withSuffix:'sav'). |
|
271 |
]. |
|
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
272 |
bookmarkStream := fileName writeStream. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
273 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
274 |
"save each bookmark in one line" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
275 |
coder := (Base64Coder on:bookmarkStream) lineLimit:nil. |
4679 | 276 |
bookmarks do:[:eachPath | |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
277 |
eachPath asFilename pathName acceptVisitor:coder. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
278 |
coder flush. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
279 |
bookmarkStream cr. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
280 |
]. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
281 |
bookmarkStream close. |
5960 | 282 |
! |
283 |
||
8013 | 284 |
saveBookmarksIn:aFileNameOrString |
285 |
"save the bokmarks in aFileNameOrString. |
|
286 |
Use Base64 coding" |
|
287 |
||
288 |
| bookmarks | |
|
289 |
||
290 |
bookmarks := self directoryBookmarks. |
|
291 |
self saveBookmarks: bookmarks in:aFileNameOrString |
|
292 |
! |
|
293 |
||
5960 | 294 |
saveBookmarksInDefaultBookmarksFile |
295 |
self saveBookmarksIn:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename) |
|
4672
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 |
|
4915 | 298 |
!AbstractFileBrowser class methodsFor:'accessing-classes'! |
4672
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 |
directoryHistoryClass |
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 |
^ AbstractFileBrowser::DirectoryHistory |
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 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
305 |
filenameHistoryClass |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
306 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
307 |
^ FilenameHistory |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
308 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
309 |
|
3892 | 310 |
!AbstractFileBrowser class methodsFor:'defaults'! |
311 |
||
312 |
commandHistory |
|
313 |
||
314 |
CommandHistory isNil ifTrue:[ |
|
4414 | 315 |
CommandHistory := OrderedCollection new. |
3892 | 316 |
]. |
317 |
^ CommandHistory |
|
318 |
! |
|
319 |
||
320 |
commandHistorySize |
|
4190 | 321 |
"max no of entries in the HistoryList " |
6369 | 322 |
|
3892 | 323 |
CommandHistorySize isNil ifTrue:[ |
6369 | 324 |
CommandHistorySize := 150 |
3892 | 325 |
]. |
326 |
^ CommandHistorySize |
|
327 |
! |
|
328 |
||
329 |
defaultFilterList |
|
330 |
||
331 |
DefaultFilters isNil ifTrue:[ |
|
4414 | 332 |
DefaultFilters := #( '*' |
333 |
'*.st' |
|
334 |
'*.htm*' |
|
335 |
'*.txt' |
|
336 |
'*.gif' |
|
337 |
'*.xpm' |
|
338 |
'*.jpg' |
|
339 |
'*.[h,c]*' |
|
340 |
) |
|
3892 | 341 |
]. |
342 |
^ DefaultFilters. |
|
343 |
! |
|
344 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
345 |
initialCommandFor:fileName in:aDirectory intoBox:aBox |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
346 |
"set a useful initial command in an execute box." |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
347 |
|
4523 | 348 |
|mime cmd select path suffix baseName pathName| |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
349 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
350 |
path := aDirectory filenameFor:fileName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
351 |
baseName := path baseName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
352 |
suffix := path suffix. |
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 |
mime := MIMETypes mimeTypeForSuffix:suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
355 |
"/ mime notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
356 |
"/ cmd := self initialCommandForMIME:mime file:path |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
357 |
"/ ]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
358 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
359 |
"/ 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
|
360 |
"/ XXX or from resources. |
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 |
(path type == #regular) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
363 |
path isExecutableProgram ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
364 |
aBox initialText:(path pathName , ' <arguments>'). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
365 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
366 |
]. |
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 |
select := true. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
369 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
370 |
"some heuristics - my personal preferences ... |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
371 |
(actually this should come from a configfile)" |
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 |
(baseName endsWith:'akefile') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
374 |
aBox initialText:'make target' selectFrom:6 to:11. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
375 |
^ self |
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 := MIMETypes defaultCommandPerMIME at:mime ifAbsent:nil. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
379 |
cmd notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
380 |
select := false |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
381 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
382 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
383 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
384 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
385 |
(suffix = 'C') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
386 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
387 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
388 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
389 |
suffix := suffix asLowercase. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
390 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
391 |
(suffix = 'taz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
392 |
aBox initialText:'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
393 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
394 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
395 |
(suffix = 'tar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
396 |
cmd := 'tar tvf %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
397 |
select := 7. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
398 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
399 |
(suffix = 'zoo') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
400 |
cmd := 'zoo -list %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
401 |
select := 9. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
402 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
403 |
(suffix = 'zip') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
404 |
cmd := 'unzip -l %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
405 |
select := 8. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
406 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
407 |
(suffix = 'jar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
408 |
cmd := 'unzip -l %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
409 |
select := 8. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
410 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
411 |
(suffix = 'z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
412 |
(baseName asLowercase endsWith:'tar.z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
413 |
cmd := 'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
414 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
415 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
416 |
cmd := 'uncompress %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
417 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
418 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
419 |
(suffix = 'gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
420 |
(baseName asLowercase endsWith:'tar.gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
421 |
cmd := ('gunzip < %1 | tar tvf -' ). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
422 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
423 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
424 |
cmd := 'gunzip %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
425 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
426 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
427 |
(suffix = 'html') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
428 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
429 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
430 |
(suffix = 'htm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
431 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
432 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
433 |
(suffix = 'uue') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
434 |
cmd := 'uudecode %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
435 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
436 |
(suffix = 'c') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
437 |
cmd := 'cc -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
438 |
select := 5. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
439 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
440 |
(suffix = 'cc') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
441 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
442 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
443 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
444 |
(suffix = 'xbm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
445 |
cmd := 'bitmap %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
446 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
447 |
(suffix = 'ps') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
448 |
cmd := 'ghostview %1' |
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 |
((suffix = '1') or:[suffix = 'man']) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
451 |
cmd := 'nroff -man %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
452 |
select := 10. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
453 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
454 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
455 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
456 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
457 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
458 |
DefaultCommandPerSuffix isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
459 |
cmd := '<cmd>' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
460 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
461 |
cmd := DefaultCommandPerSuffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
462 |
at:suffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
463 |
ifAbsent:'<cmd>'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
464 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
465 |
cmd := cmd , ' %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
466 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
467 |
|
4523 | 468 |
pathName := path pathName. |
469 |
OperatingSystem isUNIXlike ifTrue:[ |
|
470 |
pathName includesSeparator ifTrue:[ |
|
471 |
pathName := '"' , pathName , '"' |
|
472 |
] |
|
473 |
]. |
|
474 |
||
475 |
cmd := cmd bindWith:pathName. |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
476 |
select == false ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
477 |
aBox initialText:cmd |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
478 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
479 |
select class == Interval ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
480 |
aBox initialText:cmd selectFrom:select start to:select stop |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
481 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
482 |
select isInteger ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
483 |
select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1. |
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 |
aBox initialText:cmd selectFrom:1 to:select |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
486 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
487 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
488 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
489 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
490 |
"Modified: / 24.9.1997 / 16:34:52 / stefan" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
491 |
"Modified: / 9.4.1998 / 17:15:57 / cg" |
3892 | 492 |
! |
493 |
||
5941 | 494 |
listOfRuntimeValuesToRemember |
495 |
" list of all aspects that will be remembered after closing a FileBrowserV2" |
|
496 |
||
497 |
^ #( |
|
498 |
"/ #filterModel |
|
499 |
#enableFileHistory |
|
500 |
#fileHistory |
|
501 |
#currentSortOrder |
|
502 |
#sortBlockProperty |
|
503 |
) |
|
3892 | 504 |
! |
505 |
||
506 |
resetAspects |
|
507 |
||
508 |
RuntimeAspects := nil. |
|
509 |
||
5941 | 510 |
" |
511 |
self resetAspects |
|
512 |
" |
|
3892 | 513 |
! |
514 |
||
515 |
runtimeAspects |
|
516 |
||
517 |
RuntimeAspects isNil ifTrue:[ |
|
4414 | 518 |
RuntimeAspects := Dictionary new. |
3892 | 519 |
]. |
520 |
^ RuntimeAspects |
|
521 |
! |
|
522 |
||
4201 | 523 |
userPreferencesAspectList |
524 |
" list of all aspects that will be saved with save settings |
|
525 |
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
|
526 |
dont forget to add a access methos in UserPreferences if you add a aspect here |
4201 | 527 |
" |
528 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
529 |
^ Dictionary |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
530 |
withKeysAndValues:#( |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
531 |
viewDirsInContentsBrowser true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
532 |
showDirectoryTree true |
9119
77cc26a119cf
changed: #userPreferencesAspectList
Claus Gittinger <cg@exept.de>
parents:
9118
diff
changeset
|
533 |
showHiddenFiles false |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
534 |
viewDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
535 |
viewDetails true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
536 |
viewDirectoryDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
537 |
viewFilesInDirectoryTree false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
538 |
viewGroup false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
539 |
viewOwner false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
540 |
viewPermissions false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
541 |
viewPreview false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
542 |
viewSize true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
543 |
viewSizeInKiloBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
544 |
viewSizeInBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
545 |
viewTime true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
546 |
viewType false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
547 |
openMultipleApplicationsForType false |
7788 | 548 |
filenameEntryFieldVisibleHolder true |
549 |
toolBarVisibleHolder true |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
550 |
sortDirectoriesBeforeFiles true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
551 |
openAlwaysInTextEditor false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
552 |
sortCaseless false |
4201 | 553 |
) |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
554 |
|
7788 | 555 |
"Modified: / 03-04-2007 / 08:47:45 / cg" |
3892 | 556 |
! ! |
557 |
||
5398 | 558 |
!AbstractFileBrowser class methodsFor:'help specs'! |
559 |
||
8261 | 560 |
basicFlyByHelpSpec |
6099 | 561 |
<resource: #help> |
562 |
||
8261 | 563 |
^ super flyByHelpSpec addPairsFrom:#( |
6099 | 564 |
|
6100 | 565 |
#closeTabButton |
566 |
'Close this Tab' |
|
567 |
||
6099 | 568 |
#addTerminal |
569 |
'Shell Terminal' |
|
570 |
||
571 |
#make |
|
572 |
'Make' |
|
573 |
||
574 |
#searchFile |
|
575 |
'Search a File' |
|
576 |
||
577 |
#directoryUp |
|
578 |
'Directory Up' |
|
579 |
||
580 |
#directoryBack |
|
581 |
'Directory Back' |
|
582 |
||
583 |
#directoryForward |
|
584 |
'Directory Forward' |
|
585 |
||
586 |
#directoryHistory |
|
587 |
'Directory' |
|
588 |
||
589 |
#copyFile |
|
6146 | 590 |
'Copy the Selected File(s)' |
6099 | 591 |
|
592 |
#cutFile |
|
6146 | 593 |
'Cut the Selected File(s)' |
6099 | 594 |
|
595 |
#editFile |
|
6146 | 596 |
'Edit the Selected File' |
6099 | 597 |
|
598 |
#fileHome |
|
599 |
'Goto Home Directory' |
|
600 |
||
8093 | 601 |
#fileDesktop |
602 |
'Goto Desktop Directory' |
|
603 |
||
6099 | 604 |
#fileGotoDefault |
605 |
'Goto Default Directory (ST/X Start Directory)' |
|
606 |
||
6454 | 607 |
#fileGotoSmalltalkDirectory |
608 |
'Goto Smalltalk Directory (ST/X Application)' |
|
609 |
||
6456 | 610 |
#fileGotoDefaultDirectory |
611 |
'Goto Current Directory' |
|
612 |
||
6099 | 613 |
#pasteFile |
614 |
'Paste File(s)' |
|
615 |
||
616 |
#deleteFile |
|
6146 | 617 |
'Delete the Selected File(s)' |
6099 | 618 |
|
619 |
#fileIn |
|
620 |
'File In' |
|
621 |
||
622 |
#fileHistory |
|
623 |
'File History' |
|
624 |
||
625 |
#fileGotoBookmark |
|
626 |
'Goto Bookmarked Directory' |
|
627 |
||
628 |
#hideToolBar |
|
629 |
'Hide Toolbar' |
|
630 |
||
631 |
#hideFilenameEntryField |
|
6307 | 632 |
'Hide Filename & Filter Fields' |
6099 | 633 |
|
634 |
#openChangeBrowser |
|
635 |
'Open a ChangeBrowser on File' |
|
636 |
||
637 |
#showFileDetails |
|
638 |
'Show File Details' |
|
639 |
||
640 |
#hideFileDetails |
|
641 |
'Hide File Details' |
|
642 |
||
643 |
#toggleDetails |
|
644 |
'Show/Hide File Details' |
|
645 |
||
646 |
#viewDetails |
|
647 |
'Show/Hide File Details' |
|
648 |
||
649 |
#selectDetails |
|
650 |
'Select File Details to be Shown' |
|
651 |
||
8088 | 652 |
#showDifferences |
653 |
'Show Differences between File and Editor Versions' |
|
654 |
||
655 |
#toggleHexDisplay |
|
656 |
'Toggle between Hexadecimal and Textual Representation' |
|
657 |
||
658 |
#findInBrowser |
|
659 |
'Navigate the Browsers File List to the Edited File' |
|
660 |
||
661 |
#saveFile |
|
662 |
'Save the Editor''s Contents into the File' |
|
663 |
||
664 |
#reloadFile |
|
665 |
'Reload from the File' |
|
666 |
||
667 |
||
668 |
'Send to the Printer' |
|
669 |
||
6099 | 670 |
). |
671 |
||
8261 | 672 |
" |
673 |
self flyByHelpSpec |
|
674 |
" |
|
675 |
||
676 |
"Modified: / 03-11-2007 / 12:05:01 / cg" |
|
677 |
! |
|
678 |
||
679 |
flyByHelpSpec |
|
680 |
<resource: #programHelp> |
|
681 |
||
682 |
|spec hist resources| |
|
683 |
||
684 |
spec := self basicFlyByHelpSpec. |
|
685 |
||
686 |
"/ add help items for the history |
|
6099 | 687 |
hist := self directoryHistory. |
688 |
hist notNil ifTrue:[ |
|
689 |
resources := self classResources. |
|
690 |
hist canForward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
691 |
spec at:#directoryForward put:[ resources string:'Forward to: %1' with:hist nextForwardItem ]. |
6099 | 692 |
]. |
693 |
hist canBackward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
694 |
spec at:#directoryBack put:[ resources string:'Back to: %1' with:hist nextBackwardItem ]. |
6099 | 695 |
]. |
696 |
]. |
|
697 |
^ spec. |
|
698 |
||
699 |
" |
|
700 |
self flyByHelpSpec |
|
701 |
" |
|
702 |
||
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
703 |
"Modified: / 03-11-2007 / 12:05:01 / cg" |
6099 | 704 |
! |
705 |
||
5398 | 706 |
helpSpec |
707 |
"This resource specification was automatically generated |
|
708 |
by the UIHelpTool of ST/X." |
|
709 |
||
710 |
"Do not manually edit this!! If it is corrupted, |
|
711 |
the UIHelpTool may not be able to read the specification." |
|
712 |
||
713 |
" |
|
714 |
UIHelpTool openOnClass:AbstractFileBrowser |
|
715 |
" |
|
716 |
||
717 |
<resource: #help> |
|
718 |
||
719 |
^ super helpSpec addPairsFrom:#( |
|
720 |
||
5737 | 721 |
#lockFileEncoding |
722 |
'Do not guess the encoding from the files contents.' |
|
723 |
||
5398 | 724 |
) |
725 |
! ! |
|
726 |
||
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
727 |
!AbstractFileBrowser class methodsFor:'image specs'! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
728 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
729 |
clearHistoryIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
730 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
731 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
732 |
^ Icon deleteIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
733 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
734 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
735 |
copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
736 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
737 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
738 |
^ ToolbarIconLibrary copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
739 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
740 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
741 |
cutIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
742 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
743 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
744 |
^ ToolbarIconLibrary cut20x20Icon2 "cut28x28Icon" |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
745 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
746 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
747 |
deleteIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
748 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
749 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
750 |
^ ToolbarIconLibrary erase20x20Icon "/ delete28x28Icon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
751 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
752 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
753 |
directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
754 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
755 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
756 |
^ ToolbarIconLibrary directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
757 |
! |
3892 | 758 |
|
6337 | 759 |
disabledCursorIcon |
760 |
"This resource specification was automatically generated |
|
761 |
by the ImageEditor of ST/X." |
|
762 |
||
763 |
"Do not manually edit this!! If it is corrupted, |
|
764 |
the ImageEditor may not be able to read the specification." |
|
765 |
||
766 |
" |
|
767 |
self disabledCursorImage inspect |
|
768 |
ImageEditor openOnClass:self andSelector:#disabledCursorImage |
|
769 |
Icon flushCachedIcons |
|
770 |
" |
|
771 |
||
772 |
<resource: #image> |
|
773 |
||
774 |
^Icon |
|
8473 | 775 |
constantNamed:#'AbstractFileBrowser class disabledCursorIcon' |
6337 | 776 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
777 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@XF@@@H@P@@DOB@@BLLP@AA@"@@RHD @H1AD@BRHI@@$QBP@IBH$@BPQI@@"BLP@D QH@ADBB@@H0Q@@AC |
|
778 |
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:' |
|
779 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@_>@@@O?0@@G?>@@C<O0@A?@>@@_8G @O?A<@C38O@@<_C0@OC8<@C0_O@@>C?0@G _8@A<C>@@O0_@@A? |
|
780 |
? @@O?0@@A?8@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
781 |
! |
|
782 |
||
4337
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
783 |
disabledCursorImage |
6337 | 784 |
"/ DisabledCursorImage isNil ifTrue:[ |
785 |
"/ DisabledCursorImage := self disabledCursorIcon. "/ Image fromFile:'xpmBitmaps/cursors/no_entry.xpm' |
|
786 |
"/ ]. |
|
3892 | 787 |
^ DisabledCursorImage |
788 |
! |
|
789 |
||
6337 | 790 |
enabledCursorIcon |
791 |
"This resource specification was automatically generated |
|
792 |
by the ImageEditor of ST/X." |
|
793 |
||
794 |
"Do not manually edit this!! If it is corrupted, |
|
795 |
the ImageEditor may not be able to read the specification." |
|
796 |
||
797 |
" |
|
798 |
self enabledCursorImage inspect |
|
799 |
ImageEditor openOnClass:self andSelector:#enabledCursorImage |
|
800 |
Icon flushCachedIcons |
|
801 |
" |
|
802 |
||
803 |
<resource: #image> |
|
804 |
||
805 |
^Icon |
|
8473 | 806 |
constantNamed:#'AbstractFileBrowser class enabledCursorIcon' |
6337 | 807 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
808 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@@@@@?0_0@@@@@@C?A?@@@@@@@@AP@@@@T@@@@E@@@@A |
|
809 |
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:' |
|
810 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@?8?0@O>O<@C?#?@@@G@@@@A0@@@@\@@@@G@@@@A |
|
811 |
0@@@@\@@@@G@@@@A0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
812 |
! |
|
813 |
||
4337
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
814 |
enabledCursorImage |
6337 | 815 |
"/ EnabledCursorImage isNil ifTrue:[ |
816 |
"/ EnabledCursorImage := self enabledCursorIcon. "/ Image fromFile:'xpmBitmaps/cursors/double_crossHair.xpm' |
|
817 |
"/ ]. |
|
3892 | 818 |
^ EnabledCursorImage |
6083 | 819 |
! |
820 |
||
3892 | 821 |
fileInIcon |
822 |
<resource: #programImage> |
|
823 |
||
6116 | 824 |
^ ToolbarIconLibrary fileInIcon |
3892 | 825 |
! |
826 |
||
6079 | 827 |
historyBackIcon |
828 |
<resource: #programImage> |
|
829 |
||
830 |
^ ToolbarIconLibrary historyBackIcon |
|
831 |
! |
|
832 |
||
833 |
historyForwardIcon |
|
834 |
<resource: #programImage> |
|
835 |
||
836 |
^ ToolbarIconLibrary historyForwardIcon |
|
837 |
! |
|
838 |
||
3892 | 839 |
homeIcon |
840 |
<resource: #programImage> |
|
841 |
||
6079 | 842 |
^ ToolbarIconLibrary homeIcon |
3892 | 843 |
! |
844 |
||
6074 | 845 |
homeIcon2 |
6079 | 846 |
<resource: #programImage> |
847 |
||
848 |
^ ToolbarIconLibrary homeIcon2 |
|
6074 | 849 |
! |
850 |
||
851 |
htmlReloadIcon |
|
852 |
<resource: #programImage> |
|
853 |
||
854 |
^ ToolbarIconLibrary reload22x22Icon |
|
855 |
! |
|
856 |
||
3892 | 857 |
leftDownIcon |
858 |
"This resource specification was automatically generated |
|
859 |
by the ImageEditor of ST/X." |
|
860 |
||
861 |
"Do not manually edit this!! If it is corrupted, |
|
862 |
the ImageEditor may not be able to read the specification." |
|
863 |
||
864 |
" |
|
865 |
self leftDownIcon inspect |
|
866 |
ImageEditor openOnClass:self andSelector:#leftDownIcon |
|
867 |
" |
|
868 |
||
869 |
<resource: #image> |
|
870 |
||
871 |
^Icon |
|
4414 | 872 |
constantNamed:#'AbstractFileBrowser class leftDownIcon' |
873 |
ifAbsentPut:[(Depth2Image new) width: 28; height: 28; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
3892 | 874 |
UUUUUUUUUUUPAUUUUUUUP@UUUUUUUPB!!UUUUUU@B*AUUUUU@B*(UUUUUPB** UUUUPB***AUUUTB***(EUUUB****%UUUR*****UUUUU@*%UUUUUUPJ)UUUU |
875 |
UUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*$@@@@AUPJ*****)UTB******UU@******%UPJ*****)UTAUUUU |
|
876 |
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:' |
|
877 |
@@@@@@@@@@@@ @@@@\@@@@O @@@G<@@@C? @@A?<@@@?? @@_?<@@G?? @@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C??? @???8@O? |
|
878 |
?>@C??? @???8@O??>@@@@@@@@@@@@@a') ; yourself); yourself] |
|
879 |
! |
|
880 |
||
881 |
menuHistoryList9x20Icon |
|
882 |
"This resource specification was automatically generated |
|
883 |
by the ImageEditor of ST/X." |
|
884 |
||
885 |
"Do not manually edit this!! If it is corrupted, |
|
886 |
the ImageEditor may not be able to read the specification." |
|
887 |
||
888 |
" |
|
889 |
self menuHistoryList9x20Icon inspect |
|
890 |
ImageEditor openOnClass:self andSelector:#menuHistoryList9x20Icon |
|
891 |
Icon flushCachedIcons |
|
892 |
" |
|
893 |
||
894 |
<resource: #image> |
|
895 |
||
896 |
^Icon |
|
4414 | 897 |
constantNamed:#'AbstractFileBrowser class menuHistoryList9x20Icon' |
898 |
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 | 899 |
! |
900 |
||
901 |
menuHistoryListIcon |
|
902 |
"This resource specification was automatically generated |
|
903 |
by the ImageEditor of ST/X." |
|
904 |
||
905 |
"Do not manually edit this!! If it is corrupted, |
|
906 |
the ImageEditor may not be able to read the specification." |
|
907 |
||
908 |
" |
|
909 |
self menuHistoryListIcon inspect |
|
910 |
ImageEditor openOnClass:self andSelector:#menuHistoryListIcon |
|
911 |
" |
|
912 |
||
913 |
<resource: #image> |
|
914 |
||
915 |
^Icon |
|
4414 | 916 |
constantNamed:#'AbstractFileBrowser class menuHistoryListIcon' |
917 |
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 | 918 |
! |
919 |
||
6087 | 920 |
newDirectoryIcon |
6074 | 921 |
<resource: #programImage> |
922 |
||
6087 | 923 |
^ ToolbarIconLibrary newDirectoryIcon |
3923 | 924 |
! |
925 |
||
6091 | 926 |
removeTabIcon |
927 |
<resource: #programImage> |
|
928 |
||
929 |
^ ToolbarIconLibrary removeTabIcon |
|
930 |
! |
|
931 |
||
3892 | 932 |
vt100Terminal |
933 |
<resource: #programImage> |
|
934 |
||
935 |
^ ToolbarIconLibrary shell20x20Icon |
|
936 |
! ! |
|
937 |
||
5528 | 938 |
!AbstractFileBrowser class methodsFor:'interface specs'! |
939 |
||
940 |
encodingDialogSpec |
|
941 |
"This resource specification was automatically generated |
|
942 |
by the UIPainter of ST/X." |
|
943 |
||
944 |
"Do not manually edit this!! If it is corrupted, |
|
945 |
the UIPainter may not be able to read the specification." |
|
946 |
||
947 |
" |
|
948 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#encodingDialogSpec |
|
949 |
AbstractFileBrowser new openInterface:#encodingDialogSpec |
|
950 |
" |
|
951 |
||
952 |
<resource: #canvas> |
|
953 |
||
954 |
^ |
|
955 |
#(FullSpec |
|
956 |
name: encodingDialogSpec |
|
957 |
window: |
|
958 |
(WindowSpec |
|
959 |
label: 'File Encoding' |
|
960 |
name: 'File Encoding' |
|
961 |
min: (Point 10 10) |
|
5626 | 962 |
bounds: (Rectangle 0 0 379 590) |
5528 | 963 |
) |
964 |
component: |
|
965 |
(SpecCollection |
|
966 |
collection: ( |
|
967 |
(LabelSpec |
|
6339 | 968 |
label: 'Select the External (File-) Encoding' |
6236 | 969 |
name: 'Label1' |
5528 | 970 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
971 |
translateLabel: true |
|
972 |
adjust: left |
|
973 |
) |
|
974 |
(DataSetSpec |
|
975 |
name: 'Table1' |
|
5737 | 976 |
layout: (LayoutFrame 0 0 30 0 0 1 -60 1) |
5528 | 977 |
model: selectedEncoding |
978 |
hasHorizontalScrollBar: true |
|
979 |
hasVerticalScrollBar: true |
|
980 |
dataList: encodingList |
|
981 |
has3Dsepartors: true |
|
982 |
has3Dseparators: true |
|
983 |
columns: |
|
984 |
(OrderedCollection |
|
985 |
||
986 |
(DataSetColumnSpec |
|
987 |
label: 'Encoding' |
|
988 |
translateLabel: true |
|
989 |
labelButtonType: Button |
|
990 |
model: at: |
|
991 |
canSelect: false |
|
992 |
isResizeable: false |
|
993 |
showRowSeparator: false |
|
994 |
showColSeparator: false |
|
995 |
) |
|
996 |
(DataSetColumnSpec |
|
997 |
label: 'Description' |
|
998 |
translateLabel: true |
|
999 |
labelButtonType: Button |
|
1000 |
model: at: |
|
1001 |
canSelect: false |
|
1002 |
isResizeable: false |
|
1003 |
showRowSeparator: false |
|
1004 |
showColSeparator: false |
|
1005 |
) |
|
1006 |
) |
|
5626 | 1007 |
doubleClickChannel: accept |
5528 | 1008 |
) |
1009 |
(HorizontalPanelViewSpec |
|
5737 | 1010 |
name: 'ButtonPanel' |
5528 | 1011 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
1012 |
horizontalLayout: fitSpace |
|
1013 |
verticalLayout: center |
|
1014 |
horizontalSpace: 3 |
|
1015 |
verticalSpace: 3 |
|
1016 |
reverseOrderIfOKAtLeft: true |
|
1017 |
component: |
|
1018 |
(SpecCollection |
|
1019 |
collection: ( |
|
1020 |
(ActionButtonSpec |
|
1021 |
label: 'Cancel' |
|
1022 |
name: 'Button2' |
|
1023 |
translateLabel: true |
|
1024 |
model: cancel |
|
5737 | 1025 |
extent: (Point 185 22) |
5528 | 1026 |
) |
1027 |
(ActionButtonSpec |
|
1028 |
label: 'OK' |
|
1029 |
name: 'Button1' |
|
1030 |
translateLabel: true |
|
1031 |
model: accept |
|
1032 |
isDefault: true |
|
5737 | 1033 |
extent: (Point 185 22) |
5528 | 1034 |
) |
1035 |
) |
|
1036 |
||
1037 |
) |
|
1038 |
) |
|
5737 | 1039 |
(CheckBoxSpec |
1040 |
label: 'Lock Encoding' |
|
1041 |
name: 'LockEncodingCheckBox' |
|
1042 |
layout: (LayoutFrame 3 0 -60 1 217 0 -30 1) |
|
1043 |
activeHelpKey: lockFileEncoding |
|
1044 |
model: lockFileEncoding |
|
1045 |
translateLabel: true |
|
1046 |
) |
|
5528 | 1047 |
) |
1048 |
||
1049 |
) |
|
1050 |
) |
|
1051 |
! ! |
|
1052 |
||
3892 | 1053 |
!AbstractFileBrowser class methodsFor:'menu specs'! |
1054 |
||
1055 |
baseBookmarksMenuSpec |
|
1056 |
"This resource specification was automatically generated |
|
1057 |
by the MenuEditor of ST/X." |
|
1058 |
||
1059 |
"Do not manually edit this!! If it is corrupted, |
|
1060 |
the MenuEditor may not be able to read the specification." |
|
1061 |
||
1062 |
" |
|
1063 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec |
|
1064 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec)) startUp |
|
1065 |
" |
|
1066 |
||
1067 |
<resource: #menu> |
|
1068 |
||
1069 |
^ |
|
6551 | 1070 |
#(Menu |
1071 |
( |
|
1072 |
(MenuItem |
|
1073 |
enabled: currentFilesHasDirectories |
|
1074 |
label: 'Add Bookmark' |
|
1075 |
itemValue: addBookmark |
|
1076 |
translateLabel: true |
|
4414 | 1077 |
) |
6551 | 1078 |
(MenuItem |
1079 |
enabled: hasBookmarksToRemove |
|
1080 |
label: 'Remove Bookmark' |
|
1081 |
itemValue: removeBookmark |
|
1082 |
translateLabel: true |
|
4414 | 1083 |
) |
6551 | 1084 |
(MenuItem |
1085 |
label: 'Save Bookmarks In...' |
|
1086 |
itemValue: saveBookmarks |
|
1087 |
translateLabel: true |
|
4679 | 1088 |
) |
4414 | 1089 |
) |
1090 |
nil |
|
1091 |
nil |
|
3892 | 1092 |
) |
1093 |
! |
|
1094 |
||
6102 | 1095 |
baseBookmarksMenuSpec2 |
1096 |
"This resource specification was automatically generated |
|
1097 |
by the MenuEditor of ST/X." |
|
1098 |
||
1099 |
"Do not manually edit this!! If it is corrupted, |
|
1100 |
the MenuEditor may not be able to read the specification." |
|
1101 |
||
1102 |
" |
|
8013 | 1103 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec2 |
1104 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec2)) startUp |
|
6102 | 1105 |
" |
1106 |
||
1107 |
<resource: #menu> |
|
1108 |
||
1109 |
^ |
|
8013 | 1110 |
#(Menu |
1111 |
( |
|
1112 |
(MenuItem |
|
1113 |
label: 'Edit Bookmarks' |
|
1114 |
itemValue: editBookmarks |
|
1115 |
translateLabel: true |
|
1116 |
) |
|
1117 |
(MenuItem |
|
1118 |
label: '-' |
|
1119 |
) |
|
1120 |
(MenuItem |
|
1121 |
enabled: currentFilesHasDirectories |
|
1122 |
label: 'Add Bookmark' |
|
1123 |
itemValue: addBookmark |
|
1124 |
translateLabel: true |
|
6102 | 1125 |
) |
1126 |
) |
|
1127 |
nil |
|
1128 |
nil |
|
1129 |
) |
|
1130 |
! |
|
1131 |
||
4110 | 1132 |
browserMenu |
1133 |
"This resource specification was automatically generated |
|
1134 |
by the MenuEditor of ST/X." |
|
1135 |
||
1136 |
"Do not manually edit this!! If it is corrupted, |
|
1137 |
the MenuEditor may not be able to read the specification." |
|
1138 |
||
1139 |
" |
|
1140 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#browserMenu |
|
1141 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser browserMenu)) startUp |
|
1142 |
" |
|
1143 |
||
1144 |
<resource: #menu> |
|
1145 |
||
1146 |
^ |
|
5273 | 1147 |
#(Menu |
1148 |
( |
|
1149 |
(MenuItem |
|
7315 | 1150 |
label: 'Spawn Filebrowser' |
5273 | 1151 |
itemValue: doSpawn |
1152 |
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
|
1153 |
shortcutKey: Ctrln |
4201 | 1154 |
) |
5273 | 1155 |
(MenuItem |
7829 | 1156 |
label: 'Windows Explorer' |
1157 |
itemValue: doOpenExplorer |
|
1158 |
translateLabel: true |
|
8256 | 1159 |
isVisible: systemIsDOS |
7829 | 1160 |
shortcutKey: Ctrle |
8256 | 1161 |
) |
1162 |
(MenuItem |
|
1163 |
label: 'C Browser' |
|
1164 |
itemValue: doOpenCBrowser |
|
1165 |
translateLabel: true |
|
1166 |
isVisible: cBrowserLoaded |
|
7829 | 1167 |
) |
1168 |
(MenuItem |
|
5273 | 1169 |
label: '-' |
4201 | 1170 |
) |
5273 | 1171 |
(MenuItem |
6335 | 1172 |
label: 'Add Text Editor Page' |
5273 | 1173 |
itemValue: newTextEditor |
1174 |
translateLabel: true |
|
5963
57ae5e061db8
Accelerator Ctrl-t for new text editor
Stefan Vogel <sv@exept.de>
parents:
5962
diff
changeset
|
1175 |
shortcutKey: Ctrlt |
4392 | 1176 |
) |
5273 | 1177 |
(MenuItem |
6335 | 1178 |
label: 'Add Shell Terminal Page' |
5273 | 1179 |
itemValue: doAddTerminal |
1180 |
translateLabel: true |
|
4201 | 1181 |
) |
5273 | 1182 |
(MenuItem |
6335 | 1183 |
label: 'Add Search Page' |
5273 | 1184 |
itemValue: doOpenSearchFile |
1185 |
translateLabel: true |
|
4201 | 1186 |
) |
5273 | 1187 |
(MenuItem |
1188 |
label: '-' |
|
4201 | 1189 |
) |
5273 | 1190 |
(MenuItem |
1191 |
label: 'Settings...' |
|
1192 |
itemValue: doOpenSettings |
|
1193 |
translateLabel: true |
|
5104 | 1194 |
) |
5273 | 1195 |
(MenuItem |
5528 | 1196 |
label: 'Encoding...' |
1197 |
itemValue: fileEncodingDialog |
|
1198 |
translateLabel: true |
|
1199 |
) |
|
1200 |
(MenuItem |
|
5273 | 1201 |
label: '-' |
5104 | 1202 |
) |
5273 | 1203 |
(MenuItem |
1204 |
label: 'Exit' |
|
1205 |
itemValue: closeRequest |
|
1206 |
translateLabel: true |
|
4201 | 1207 |
) |
1208 |
) |
|
1209 |
nil |
|
1210 |
nil |
|
4110 | 1211 |
) |
1212 |
! |
|
1213 |
||
4107 | 1214 |
cvsMenu |
1215 |
"This resource specification was automatically generated |
|
1216 |
by the MenuEditor of ST/X." |
|
1217 |
||
1218 |
"Do not manually edit this!! If it is corrupted, |
|
1219 |
the MenuEditor may not be able to read the specification." |
|
1220 |
||
1221 |
" |
|
1222 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#cvsMenu |
|
1223 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser cvsMenu)) startUp |
|
1224 |
" |
|
1225 |
||
1226 |
<resource: #menu> |
|
1227 |
||
1228 |
^ |
|
1229 |
#(#Menu |
|
4414 | 1230 |
#( |
1231 |
#(#MenuItem |
|
1232 |
#label: 'Commit...' |
|
1233 |
#itemValue: #cvsCommit |
|
1234 |
#translateLabel: true |
|
1235 |
) |
|
1236 |
#(#MenuItem |
|
1237 |
#enabled: #canCvsAddAndCommit |
|
1238 |
#label: 'Add && Commit...' |
|
1239 |
#itemValue: #cvsAddAndCommit |
|
1240 |
#translateLabel: true |
|
1241 |
) |
|
1242 |
#(#MenuItem |
|
4849 | 1243 |
#enabled: #canCvsAddAndCommit |
1244 |
#label: 'Add as Binary && Commit...' |
|
1245 |
#itemValue: #cvsAddBinaryAndCommit |
|
1246 |
#translateLabel: true |
|
1247 |
) |
|
1248 |
#(#MenuItem |
|
4414 | 1249 |
#label: '-' |
1250 |
) |
|
1251 |
#(#MenuItem |
|
6316 | 1252 |
#enabled: #hasSelection |
8562 | 1253 |
#label: 'Tag...' |
1254 |
#itemValue: #cvsTagSelection |
|
1255 |
#translateLabel: true |
|
1256 |
) |
|
1257 |
#(#MenuItem |
|
9338 | 1258 |
#enabled: #hasSelection |
1259 |
#label: 'Revision Log' |
|
1260 |
#itemValue: #cvsRevisionLog |
|
1261 |
#translateLabel: true |
|
1262 |
) |
|
1263 |
#(#MenuItem |
|
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
1264 |
#enabled: #hasSelection |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
1265 |
#label: 'Compare with newest in Repository' |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
1266 |
#itemValue: #cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
1267 |
#translateLabel: true |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
1268 |
) |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
1269 |
#(#MenuItem |
8562 | 1270 |
#label: '-' |
1271 |
) |
|
1272 |
#(#MenuItem |
|
1273 |
#enabled: #hasSelection |
|
6316 | 1274 |
#label: 'Update selected Files/Directories' |
1275 |
#itemValue: #cvsUpdateSelection |
|
1276 |
#translateLabel: true |
|
1277 |
) |
|
1278 |
#(#MenuItem |
|
1279 |
#label: 'Update Directory Local' |
|
1280 |
#itemValue: #cvsUpdateAll |
|
1281 |
#translateLabel: true |
|
1282 |
) |
|
1283 |
#(#MenuItem |
|
1284 |
#label: 'Update Directory Recursive' |
|
1285 |
#itemValue: #cvsUpdateAllRecursive |
|
1286 |
#translateLabel: true |
|
1287 |
) |
|
1288 |
#(#MenuItem |
|
1289 |
#label: '-' |
|
1290 |
) |
|
1291 |
#(#MenuItem |
|
4414 | 1292 |
#enabled: #canRemoveCVSContainer |
1293 |
#label: 'Remove File && CVS Container...' |
|
1294 |
#itemValue: #cvsRemoveFileAndCVSContainer |
|
1295 |
#translateLabel: true |
|
1296 |
) |
|
1297 |
) |
|
1298 |
nil |
|
1299 |
nil |
|
4107 | 1300 |
) |
1301 |
! |
|
1302 |
||
3892 | 1303 |
directoryMenu |
1304 |
"This resource specification was automatically generated |
|
1305 |
by the MenuEditor of ST/X." |
|
1306 |
||
1307 |
"Do not manually edit this!! If it is corrupted, |
|
1308 |
the MenuEditor may not be able to read the specification." |
|
1309 |
||
1310 |
" |
|
1311 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#directoryMenu |
|
1312 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser directoryMenu)) startUp |
|
1313 |
" |
|
1314 |
||
1315 |
<resource: #menu> |
|
1316 |
||
1317 |
^ |
|
6220 | 1318 |
#(Menu |
1319 |
( |
|
1320 |
(MenuItem |
|
1321 |
label: 'Up' |
|
1322 |
itemValue: doGoDirectoryUp |
|
1323 |
translateLabel: true |
|
4414 | 1324 |
) |
6220 | 1325 |
(MenuItem |
1326 |
label: '-' |
|
4414 | 1327 |
) |
6220 | 1328 |
(MenuItem |
1329 |
activeHelpKey: directoryBack |
|
1330 |
enabled: enableBack |
|
1331 |
label: 'Back' |
|
1332 |
itemValue: doBack |
|
1333 |
translateLabel: true |
|
4414 | 1334 |
) |
6220 | 1335 |
(MenuItem |
1336 |
activeHelpKey: directoryBack |
|
1337 |
enabled: enableForward |
|
1338 |
label: 'Forward' |
|
1339 |
itemValue: doForward |
|
1340 |
translateLabel: true |
|
4414 | 1341 |
) |
6220 | 1342 |
(MenuItem |
1343 |
label: '-' |
|
4414 | 1344 |
) |
6220 | 1345 |
(MenuItem |
6434 | 1346 |
label: 'Home Directory' |
1347 |
itemValue: doGotoHomeDirectory |
|
6456 | 1348 |
enabled: enableHome |
6434 | 1349 |
translateLabel: true |
1350 |
) |
|
1351 |
(MenuItem |
|
1352 |
label: 'Default (Current) Directory' |
|
6220 | 1353 |
itemValue: doGotoDefaultDirectory |
6456 | 1354 |
isVisible: gotoDefaultDirectoryIsVisible |
1355 |
enabled: enableGotoDefaultDirectory |
|
6220 | 1356 |
translateLabel: true |
4414 | 1357 |
) |
6220 | 1358 |
(MenuItem |
6434 | 1359 |
label: 'Smalltalk (Application) Directory' |
1360 |
itemValue: doGotoSmalltalkDirectory |
|
1361 |
enabled: enableGotoSmalltalkDirectory |
|
6220 | 1362 |
translateLabel: true |
4414 | 1363 |
) |
6220 | 1364 |
(MenuItem |
1365 |
label: 'Bookmarks' |
|
1366 |
translateLabel: true |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1367 |
submenuChannel: bookmarksMenu |
4414 | 1368 |
) |
6220 | 1369 |
(MenuItem |
1370 |
label: 'Visited Directories' |
|
1371 |
translateLabel: true |
|
1372 |
submenuChannel: visitedDirectoriesMenu |
|
4414 | 1373 |
) |
1374 |
) |
|
1375 |
nil |
|
1376 |
nil |
|
3892 | 1377 |
) |
1378 |
! |
|
1379 |
||
1380 |
editMenu |
|
1381 |
"This resource specification was automatically generated |
|
1382 |
by the MenuEditor of ST/X." |
|
1383 |
||
1384 |
"Do not manually edit this!! If it is corrupted, |
|
1385 |
the MenuEditor may not be able to read the specification." |
|
1386 |
||
1387 |
" |
|
1388 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#editMenu |
|
1389 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser editMenu)) startUp |
|
1390 |
" |
|
1391 |
||
1392 |
<resource: #menu> |
|
1393 |
||
1394 |
^ |
|
5888 | 1395 |
#(Menu |
1396 |
( |
|
1397 |
(MenuItem |
|
1398 |
enabled: hasFileSelection |
|
1399 |
label: 'Copy Selected Filenames to Clipboard' |
|
1400 |
itemValue: copySelectedFilenames |
|
1401 |
translateLabel: true |
|
4414 | 1402 |
) |
5888 | 1403 |
(MenuItem |
1404 |
enabled: fileListIsNotEmpty |
|
1405 |
label: 'Copy All Filenames to Clipboard' |
|
1406 |
itemValue: copyFileList |
|
1407 |
translateLabel: true |
|
4940
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
1408 |
) |
4414 | 1409 |
) |
1410 |
nil |
|
1411 |
nil |
|
3892 | 1412 |
) |
1413 |
! |
|
1414 |
||
6099 | 1415 |
emptyMenuSpec |
1416 |
"This resource specification was automatically generated |
|
1417 |
by the MenuEditor of ST/X." |
|
1418 |
||
1419 |
"Do not manually edit this!! If it is corrupted, |
|
1420 |
the MenuEditor may not be able to read the specification." |
|
1421 |
||
1422 |
" |
|
1423 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#emptyMenuSpec |
|
1424 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser emptyMenuSpec)) startUp |
|
1425 |
" |
|
1426 |
||
1427 |
<resource: #menu> |
|
1428 |
||
1429 |
^ |
|
1430 |
#(#Menu |
|
1431 |
#( |
|
1432 |
) |
|
1433 |
nil |
|
1434 |
nil |
|
1435 |
) |
|
1436 |
! |
|
1437 |
||
3892 | 1438 |
fileMenu |
1439 |
"This resource specification was automatically generated |
|
1440 |
by the MenuEditor of ST/X." |
|
1441 |
||
1442 |
"Do not manually edit this!! If it is corrupted, |
|
1443 |
the MenuEditor may not be able to read the specification." |
|
1444 |
||
1445 |
" |
|
1446 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileMenu |
|
1447 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileMenu)) startUp |
|
1448 |
" |
|
1449 |
||
1450 |
<resource: #menu> |
|
1451 |
||
1452 |
^ |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1453 |
#(Menu |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1454 |
( |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1455 |
(MenuItem |
6593 | 1456 |
label: 'Open' |
1457 |
itemValue: doShowFileContents |
|
1458 |
translateLabel: true |
|
1459 |
) |
|
1460 |
(MenuItem |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
1461 |
label: '-' |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
1462 |
) |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
1463 |
(MenuItem |
6593 | 1464 |
enabled: hasFileSelection |
1465 |
label: 'FileIn' |
|
1466 |
itemValue: fileFileIn |
|
1467 |
translateLabel: true |
|
1468 |
) |
|
1469 |
(MenuItem |
|
1470 |
enabled: hasFileSelection |
|
1471 |
label: 'FileIn to Namespace...' |
|
1472 |
itemValue: fileFileInToNameSpace |
|
1473 |
translateLabel: true |
|
1474 |
) |
|
1475 |
(MenuItem |
|
1476 |
label: '-' |
|
1477 |
) |
|
1478 |
(MenuItem |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1479 |
label: 'New' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1480 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1481 |
submenuChannel: newMenu |
5425 | 1482 |
keepLinkedMenu: true |
4414 | 1483 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1484 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1485 |
label: '-' |
4534 | 1486 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1487 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1488 |
enabled: hasSelection |
5945 | 1489 |
label: 'Cut' |
1490 |
itemValue: cutFiles |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1491 |
translateLabel: true |
4789
238d5e783f5c
editMenu was really a file menu
Claus Gittinger <cg@exept.de>
parents:
4785
diff
changeset
|
1492 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1493 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1494 |
enabled: hasSelection |
5945 | 1495 |
label: 'Copy' |
1496 |
itemValue: copyFiles |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1497 |
translateLabel: true |
4789
238d5e783f5c
editMenu was really a file menu
Claus Gittinger <cg@exept.de>
parents:
4785
diff
changeset
|
1498 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1499 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1500 |
enabled: canPaste |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1501 |
label: 'Paste' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1502 |
itemValue: pasteFiles |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1503 |
translateLabel: true |
4789
238d5e783f5c
editMenu was really a file menu
Claus Gittinger <cg@exept.de>
parents:
4785
diff
changeset
|
1504 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1505 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1506 |
enabled: hasSelection |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1507 |
label: 'Delete' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1508 |
itemValue: deleteFiles |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1509 |
translateLabel: true |
4789
238d5e783f5c
editMenu was really a file menu
Claus Gittinger <cg@exept.de>
parents:
4785
diff
changeset
|
1510 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1511 |
(MenuItem |
6169 | 1512 |
enabled: hasSelection |
1513 |
label: 'Erase' |
|
1514 |
itemValue: eraseFiles |
|
1515 |
translateLabel: true |
|
1516 |
) |
|
1517 |
(MenuItem |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1518 |
label: '-' |
4789
238d5e783f5c
editMenu was really a file menu
Claus Gittinger <cg@exept.de>
parents:
4785
diff
changeset
|
1519 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1520 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1521 |
enabled: hasSelection |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1522 |
label: 'Rename...' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1523 |
itemValue: renameSelection |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1524 |
translateLabel: true |
8716 | 1525 |
shortcutKey: Rename |
4414 | 1526 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1527 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1528 |
enabled: hasSelection |
5634 | 1529 |
label: 'Move To...' |
6107 | 1530 |
itemValue: moveSelectionTo |
1531 |
translateLabel: true |
|
1532 |
) |
|
1533 |
(MenuItem |
|
1534 |
enabled: hasSelection |
|
1535 |
label: 'Copy To...' |
|
1536 |
itemValue: copySelectionTo |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1537 |
translateLabel: true |
4414 | 1538 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1539 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1540 |
enabled: hasSelection |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1541 |
label: 'Properties...' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1542 |
itemValue: doShowProperties |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1543 |
translateLabel: true |
4554 | 1544 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1545 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1546 |
label: '-' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1547 |
isVisible: javaSupportLoaded |
4414 | 1548 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1549 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1550 |
enabled: canAddToClassPath |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1551 |
label: 'Add to Java Class Path' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1552 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1553 |
isVisible: javaSupportLoaded |
4414 | 1554 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1555 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1556 |
enabled: canRemoveFromClassPath |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1557 |
label: 'Remove from Java Class Path' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1558 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1559 |
isVisible: javaSupportLoaded |
4414 | 1560 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1561 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1562 |
enabled: canAddToSourcePath |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1563 |
label: 'Add to Java Source Path' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1564 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1565 |
isVisible: javaSupportLoaded |
4414 | 1566 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1567 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1568 |
enabled: canRemoveFromSourcePath |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1569 |
label: 'Remove from Java Source Path' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1570 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1571 |
isVisible: javaSupportLoaded |
4414 | 1572 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1573 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1574 |
label: '-' |
5242
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
1575 |
) |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1576 |
(MenuItem |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1577 |
enabled: enableFileHistory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1578 |
label: 'File History' |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1579 |
translateLabel: true |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
1580 |
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
|
1581 |
) |
4414 | 1582 |
) |
1583 |
nil |
|
1584 |
nil |
|
3892 | 1585 |
) |
7635 | 1586 |
|
1587 |
"Modified: / 07-02-2007 / 18:44:54 / cg" |
|
3892 | 1588 |
! |
1589 |
||
4930 | 1590 |
fileOpMenu |
1591 |
"This resource specification was automatically generated |
|
1592 |
by the MenuEditor of ST/X." |
|
1593 |
||
1594 |
"Do not manually edit this!! If it is corrupted, |
|
1595 |
the MenuEditor may not be able to read the specification." |
|
1596 |
||
1597 |
" |
|
1598 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileOpMenu |
|
1599 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileOpMenu)) startUp |
|
1600 |
" |
|
1601 |
||
1602 |
<resource: #menu> |
|
1603 |
||
1604 |
^ |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1605 |
#(Menu |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1606 |
( |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1607 |
(MenuItem |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1608 |
label: 'Split...' |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1609 |
itemValue: splitSelectedFiles |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1610 |
translateLabel: true |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1611 |
) |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1612 |
(MenuItem |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1613 |
label: 'Join...' |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1614 |
itemValue: joinSelectedFiles |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1615 |
translateLabel: true |
4930 | 1616 |
) |
7635 | 1617 |
(MenuItem |
1618 |
label: 'Copy Corrupted File To...' |
|
1619 |
itemValue: copySelectionToRepairingCorruptedFiles |
|
1620 |
translateLabel: true |
|
1621 |
) |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1622 |
(MenuItem |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1623 |
label: '-' |
4930 | 1624 |
) |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1625 |
(MenuItem |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1626 |
label: 'Rot13...' |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1627 |
itemValue: filterSelectedFiles: |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1628 |
translateLabel: true |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1629 |
argument: rot13 |
4930 | 1630 |
) |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1631 |
(MenuItem |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1632 |
label: '-' |
4930 | 1633 |
) |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1634 |
(MenuItem |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1635 |
label: 'Truncate...' |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1636 |
itemValue: truncateSelectedFilesToZeroSize |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
1637 |
translateLabel: true |
4930 | 1638 |
) |
9490 | 1639 |
(MenuItem |
1640 |
label: '-' |
|
1641 |
) |
|
1642 |
(MenuItem |
|
1643 |
label: 'Generate Signed Files' |
|
1644 |
itemValue: generateSignaturesForSelectedFiles |
|
1645 |
translateLabel: true |
|
1646 |
enabled: canGenerateSignatureFiles |
|
1647 |
) |
|
1648 |
(MenuItem |
|
1649 |
label: 'Generate Detached Signature Files (use for dll)' |
|
1650 |
itemValue: generateDetachedSignaturesForSelectedFiles |
|
1651 |
translateLabel: true |
|
1652 |
enabled: canGenerateSignatureFiles |
|
1653 |
) |
|
4930 | 1654 |
) |
1655 |
nil |
|
1656 |
nil |
|
1657 |
) |
|
9490 | 1658 |
|
1659 |
"Modified: / 20-05-2010 / 10:42:49 / cg" |
|
4930 | 1660 |
! |
1661 |
||
3892 | 1662 |
newMenu |
1663 |
"This resource specification was automatically generated |
|
1664 |
by the MenuEditor of ST/X." |
|
1665 |
||
1666 |
"Do not manually edit this!! If it is corrupted, |
|
1667 |
the MenuEditor may not be able to read the specification." |
|
1668 |
||
1669 |
" |
|
1670 |
MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#newMenu |
|
1671 |
(Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser newMenu)) startUp |
|
1672 |
" |
|
1673 |
||
1674 |
<resource: #menu> |
|
1675 |
||
1676 |
^ |
|
1677 |
#(#Menu |
|
4414 | 1678 |
#( |
1679 |
#(#MenuItem |
|
1680 |
#label: 'Directory...' |
|
1681 |
#translateLabel: true |
|
1682 |
#value: #newDirectory |
|
1683 |
) |
|
1684 |
#(#MenuItem |
|
1685 |
#label: 'File...' |
|
1686 |
#translateLabel: true |
|
1687 |
#value: #newFile |
|
1688 |
) |
|
1689 |
#(#MenuItem |
|
1690 |
#label: 'Hard Link...' |
|
1691 |
#translateLabel: true |
|
1692 |
#isVisible: #systemIsUnix |
|
1693 |
#value: #newHardLink |
|
1694 |
) |
|
1695 |
#(#MenuItem |
|
1696 |
#label: 'Symbolic Link...' |
|
1697 |
#translateLabel: true |
|
1698 |
#isVisible: #systemIsUnix |
|
1699 |
#value: #newSoftLink |
|
1700 |
) |
|
1701 |
) |
|
1702 |
nil |
|
1703 |
nil |
|
3892 | 1704 |
) |
3906 | 1705 |
! |
1706 |
||
4201 | 1707 |
showMenuSpec |
1708 |
"This resource specification was automatically generated |
|
1709 |
by the MenuEditor of ST/X." |
|
1710 |
||
1711 |
"Do not manually edit this!! If it is corrupted, |
|
1712 |
the MenuEditor may not be able to read the specification." |
|
1713 |
||
1714 |
" |
|
1715 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpec |
|
1716 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpec)) startUp |
|
1717 |
" |
|
1718 |
||
1719 |
<resource: #menu> |
|
1720 |
||
1721 |
^ |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1722 |
#(Menu |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1723 |
( |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1724 |
(MenuItem |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1725 |
label: 'Hidden Files' |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1726 |
translateLabel: true |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1727 |
hideMenuOnActivated: false |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1728 |
indication: showHiddenFiles |
4201 | 1729 |
) |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1730 |
(MenuItem |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1731 |
label: '-' |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1732 |
) |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1733 |
(MenuItem |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1734 |
label: 'Directory Tree' |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1735 |
translateLabel: true |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1736 |
hideMenuOnActivated: false |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1737 |
indication: showDirectoryTree |
4201 | 1738 |
) |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1739 |
(MenuItem |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1740 |
label: 'Regular Files in TreeView (Left)' |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1741 |
translateLabel: true |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1742 |
hideMenuOnActivated: false |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1743 |
indication: viewFilesInDirectoryTree |
4201 | 1744 |
) |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1745 |
(MenuItem |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1746 |
label: 'Directories in ContentsView (Right)' |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1747 |
translateLabel: true |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1748 |
hideMenuOnActivated: false |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1749 |
indication: viewDirsInContentsBrowser |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1750 |
) |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1751 |
(MenuItem |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1752 |
enabled: enableViewNoteBookApplication |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1753 |
label: 'File Applications' |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1754 |
translateLabel: true |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1755 |
hideMenuOnActivated: false |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1756 |
indication: viewNoteBookApplicationHolder |
4201 | 1757 |
) |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1758 |
(MenuItem |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1759 |
label: '-' |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1760 |
) |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1761 |
(MenuItem |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1762 |
label: 'DiskUsage' |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1763 |
translateLabel: true |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1764 |
hideMenuOnActivated: false |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1765 |
indication: showDiskUsageHolder |
4201 | 1766 |
) |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1767 |
) |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1768 |
nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1769 |
nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1770 |
) |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1771 |
! |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1772 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1773 |
showMenuSpecForDialog |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1774 |
"This resource specification was automatically generated |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1775 |
by the MenuEditor of ST/X." |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1776 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1777 |
"Do not manually edit this!! If it is corrupted, |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1778 |
the MenuEditor may not be able to read the specification." |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1779 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1780 |
" |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1781 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpecForDialog |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1782 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpecForDialog)) startUp |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1783 |
" |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1784 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1785 |
<resource: #menu> |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1786 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1787 |
^ |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1788 |
#(Menu |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1789 |
( |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1790 |
(MenuItem |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1791 |
label: 'Hidden Files' |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1792 |
translateLabel: true |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1793 |
hideMenuOnActivated: false |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
1794 |
indication: showHiddenFiles |
4554 | 1795 |
) |
4201 | 1796 |
) |
1797 |
nil |
|
1798 |
nil |
|
1799 |
) |
|
1800 |
! |
|
1801 |
||
3906 | 1802 |
sortMenu |
1803 |
"This resource specification was automatically generated |
|
1804 |
by the MenuEditor of ST/X." |
|
1805 |
||
1806 |
"Do not manually edit this!! If it is corrupted, |
|
1807 |
the MenuEditor may not be able to read the specification." |
|
1808 |
||
1809 |
" |
|
3907 | 1810 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#sortMenu |
1811 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser sortMenu)) startUp |
|
3906 | 1812 |
" |
1813 |
||
1814 |
<resource: #menu> |
|
1815 |
||
1816 |
^ |
|
1817 |
#(#Menu |
|
4414 | 1818 |
#( |
1819 |
#(#MenuItem |
|
1820 |
#label: 'By Filename' |
|
1821 |
#translateLabel: true |
|
1822 |
#hideMenuOnActivated: false |
|
1823 |
#choice: #sortBlockProperty |
|
1824 |
#choiceValue: #baseName |
|
1825 |
) |
|
1826 |
#(#MenuItem |
|
5122 | 1827 |
#label: 'By Extension' |
4414 | 1828 |
#translateLabel: true |
1829 |
#hideMenuOnActivated: false |
|
1830 |
#choice: #sortBlockProperty |
|
1831 |
#choiceValue: #suffix |
|
1832 |
) |
|
1833 |
#(#MenuItem |
|
1834 |
#label: 'By Permissions' |
|
1835 |
#translateLabel: true |
|
1836 |
#hideMenuOnActivated: false |
|
1837 |
#choice: #sortBlockProperty |
|
1838 |
#choiceValue: #permissions |
|
1839 |
) |
|
1840 |
#(#MenuItem |
|
1841 |
#label: 'By Owner' |
|
1842 |
#translateLabel: true |
|
1843 |
#isVisible: #viewOwner |
|
1844 |
#hideMenuOnActivated: false |
|
1845 |
#choice: #sortBlockProperty |
|
1846 |
#choiceValue: #owner |
|
1847 |
) |
|
1848 |
#(#MenuItem |
|
1849 |
#label: 'By Group' |
|
1850 |
#translateLabel: true |
|
1851 |
#isVisible: #viewOwner |
|
1852 |
#hideMenuOnActivated: false |
|
1853 |
#choice: #sortBlockProperty |
|
1854 |
#choiceValue: #group |
|
1855 |
) |
|
1856 |
#(#MenuItem |
|
1857 |
#label: 'By Size' |
|
1858 |
#translateLabel: true |
|
1859 |
#hideMenuOnActivated: false |
|
1860 |
#choice: #sortBlockProperty |
|
1861 |
#choiceValue: #fileSize |
|
1862 |
) |
|
1863 |
#(#MenuItem |
|
1864 |
#label: 'By Date && Time' |
|
1865 |
#translateLabel: true |
|
1866 |
#hideMenuOnActivated: false |
|
1867 |
#choice: #sortBlockProperty |
|
1868 |
#choiceValue: #modificationTime |
|
1869 |
) |
|
1870 |
#(#MenuItem |
|
1871 |
#label: '-' |
|
1872 |
) |
|
1873 |
#(#MenuItem |
|
1874 |
#label: 'Ignore Case in Sort' |
|
1875 |
#translateLabel: true |
|
1876 |
#hideMenuOnActivated: false |
|
1877 |
#indication: #sortCaseless |
|
1878 |
) |
|
1879 |
#(#MenuItem |
|
1880 |
#label: 'Directories before Files' |
|
1881 |
#translateLabel: true |
|
1882 |
#hideMenuOnActivated: false |
|
1883 |
#indication: #sortDirectoriesBeforeFiles |
|
1884 |
) |
|
1885 |
) |
|
1886 |
nil |
|
1887 |
nil |
|
3906 | 1888 |
) |
4018 | 1889 |
! |
1890 |
||
4164
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1891 |
toolsMenuSpec |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1892 |
"This resource specification was automatically generated |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1893 |
by the MenuEditor of ST/X." |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1894 |
|
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1895 |
"Do not manually edit this!! If it is corrupted, |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1896 |
the MenuEditor may not be able to read the specification." |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1897 |
|
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1898 |
" |
4367 | 1899 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec |
1900 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp |
|
4164
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1901 |
" |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1902 |
|
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1903 |
<resource: #menu> |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1904 |
|
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
1905 |
^ |
5830 | 1906 |
#(Menu |
1907 |
( |
|
1908 |
(MenuItem |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
1909 |
label: 'Open (Win32-Shell)' |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
1910 |
itemValue: doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
1911 |
translateLabel: true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
1912 |
isVisible: systemIsDOS |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
1913 |
) |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
1914 |
(MenuItem |
6528 | 1915 |
label: 'Execute UNIX Command...' |
5830 | 1916 |
itemValue: doExecuteCommand |
1917 |
translateLabel: true |
|
6528 | 1918 |
isVisible: systemIsUnix |
1919 |
) |
|
1920 |
(MenuItem |
|
1921 |
label: 'Execute DOS Command...' |
|
1922 |
itemValue: doExecuteCommand |
|
1923 |
translateLabel: true |
|
1924 |
isVisible: systemIsDOS |
|
4230 | 1925 |
) |
5830 | 1926 |
(MenuItem |
5880 | 1927 |
label: 'Execute Script...' |
1928 |
itemValue: doExecuteScript |
|
1929 |
translateLabel: true |
|
1930 |
) |
|
1931 |
(MenuItem |
|
5830 | 1932 |
enabled: canDoTerminal |
1933 |
label: 'Shell Terminal' |
|
1934 |
itemValue: openTerminal |
|
1935 |
translateLabel: true |
|
1936 |
isVisible: canDoTerminalAndSystemIsUnix |
|
4230 | 1937 |
) |
5830 | 1938 |
(MenuItem |
1939 |
enabled: canDoTerminal |
|
1940 |
label: 'DOS Terminal' |
|
1941 |
itemValue: openTerminal |
|
1942 |
translateLabel: true |
|
1943 |
isVisible: canDoTerminalAndSystemIsDOS |
|
4230 | 1944 |
) |
5830 | 1945 |
(MenuItem |
1946 |
label: '-' |
|
4230 | 1947 |
) |
5830 | 1948 |
(MenuItem |
1949 |
enabled: hasFileSelection |
|
1950 |
label: 'Changes Browser' |
|
1951 |
itemValue: openChangesBrowser |
|
1952 |
translateLabel: true |
|
4230 | 1953 |
) |
5830 | 1954 |
(MenuItem |
1955 |
enabled: hasFileSelection |
|
1956 |
label: 'ChangeSet Browser' |
|
1957 |
itemValue: openChangeSetBrowser |
|
1958 |
translateLabel: true |
|
6602 | 1959 |
isVisible: changeSetBrowserItemVisible |
4230 | 1960 |
) |
5830 | 1961 |
(MenuItem |
6022 | 1962 |
enabled: hasFileSelection |
1963 |
label: 'Workspace' |
|
1964 |
itemValue: openWorkspace |
|
1965 |
translateLabel: true |
|
1966 |
) |
|
1967 |
(MenuItem |
|
1968 |
label: '-' |
|
1969 |
) |
|
1970 |
(MenuItem |
|
5830 | 1971 |
enabled: canReadAbbrevFile |
1972 |
label: 'Install Autoloaded' |
|
1973 |
itemValue: readAbbrevFile |
|
1974 |
translateLabel: true |
|
4230 | 1975 |
) |
5830 | 1976 |
(MenuItem |
1977 |
enabled: anySTFilesPresent |
|
6521 | 1978 |
label: 'Install All ST-Files as Autoloaded' |
5830 | 1979 |
itemValue: installAllAsAutoloaded |
1980 |
translateLabel: true |
|
4230 | 1981 |
) |
5830 | 1982 |
(MenuItem |
6586 | 1983 |
enabled: recursiveAnySTFilesPresent |
6521 | 1984 |
label: 'Recursive Install All ST-Files as Autoloaded' |
1985 |
itemValue: installAllAsAutoloadedRecursive |
|
1986 |
translateLabel: true |
|
1987 |
) |
|
1988 |
(MenuItem |
|
5830 | 1989 |
label: '-' |
4230 | 1990 |
) |
5830 | 1991 |
(MenuItem |
6593 | 1992 |
label: 'File Operations' |
1993 |
translateLabel: true |
|
1994 |
submenuChannel: fileOpMenu |
|
1995 |
) |
|
1996 |
(MenuItem |
|
5830 | 1997 |
label: 'File Utilities' |
1998 |
translateLabel: true |
|
1999 |
submenu: |
|
2000 |
(Menu |
|
2001 |
( |
|
2002 |
(MenuItem |
|
2003 |
enabled: hasFileSelection |
|
2004 |
label: 'Editor' |
|
2005 |
itemValue: openEditor |
|
2006 |
translateLabel: true |
|
4820 | 2007 |
) |
5830 | 2008 |
(MenuItem |
2009 |
enabled: hasFileSelection |
|
2010 |
label: 'HTML Reader' |
|
2011 |
itemValue: openHTMLReader |
|
2012 |
translateLabel: true |
|
4820 | 2013 |
) |
5830 | 2014 |
(MenuItem |
8832 | 2015 |
enabled: hasFileSelection |
2016 |
label: 'Web Browser' |
|
2017 |
itemValue: openWebBrowser |
|
2018 |
translateLabel: true |
|
2019 |
) |
|
2020 |
(MenuItem |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
2021 |
"/ enabled: hasXmlFileSelected |
7869 | 2022 |
label: 'XML Inspector' |
2023 |
itemValue: parseXmlFile |
|
2024 |
translateLabel: true |
|
2025 |
isVisible: hasXml |
|
7897
598301fad7b4
Missing aspect #hasXmlFileSelection
Stefan Vogel <sv@exept.de>
parents:
7879
diff
changeset
|
2026 |
showBusyCursorWhilePerforming: true |
7869 | 2027 |
) |
2028 |
(MenuItem |
|
5830 | 2029 |
enabled: hasFileSelection |
2030 |
label: 'Acroread (PDF Viewer)' |
|
2031 |
itemValue: openPDFViewer |
|
2032 |
translateLabel: true |
|
4820 | 2033 |
) |
5830 | 2034 |
(MenuItem |
2035 |
enabled: hasASN1AndSelection |
|
2036 |
label: 'ASN1 Browser' |
|
2037 |
itemValue: openASN1Browser |
|
2038 |
translateLabel: true |
|
2039 |
isVisible: hasASN1 |
|
4820 | 2040 |
) |
5830 | 2041 |
(MenuItem |
2042 |
enabled: hasCBrowser |
|
2043 |
label: 'C Browser' |
|
2044 |
itemValue: openCBrowser |
|
2045 |
translateLabel: true |
|
2046 |
isVisible: hasCBrowser |
|
4820 | 2047 |
) |
5830 | 2048 |
(MenuItem |
2049 |
enabled: hasJavaAndSelection |
|
2050 |
label: 'Applet Viewer' |
|
2051 |
itemValue: openAppletViewer |
|
2052 |
translateLabel: true |
|
2053 |
isVisible: hasJava |
|
4820 | 2054 |
) |
5830 | 2055 |
(MenuItem |
2056 |
enabled: hasMP3PlayerAndSelection |
|
2057 |
label: 'MP3 Player' |
|
2058 |
itemValue: openMP3Player |
|
2059 |
translateLabel: true |
|
2060 |
isVisible: hasMP3Player |
|
4820 | 2061 |
) |
5830 | 2062 |
(MenuItem |
2063 |
enabled: hasFileSelection |
|
2064 |
label: 'xv (Image Viewer)' |
|
2065 |
itemValue: openXV |
|
2066 |
translateLabel: true |
|
6460 | 2067 |
isVisible: systemIsUnix |
4950 | 2068 |
) |
5830 | 2069 |
(MenuItem |
2070 |
enabled: currentFilesAreInSameDirectory |
|
2071 |
label: 'Slide Show' |
|
2072 |
itemValue: openSlideShow |
|
2073 |
translateLabel: true |
|
2074 |
isVisible: hasSlideShow |
|
4820 | 2075 |
) |
5830 | 2076 |
(MenuItem |
2077 |
enabled: hasFileSelection |
|
2078 |
label: 'gv (Postscript Viewer)' |
|
2079 |
itemValue: openGV |
|
2080 |
translateLabel: true |
|
6460 | 2081 |
isVisible: systemIsUnix |
2082 |
) |
|
2083 |
(MenuItem |
|
2084 |
enabled: hasMP3PlayerAndSelection |
|
2085 |
label: 'MP3 Player' |
|
2086 |
itemValue: openMP3Player |
|
2087 |
translateLabel: true |
|
2088 |
isVisible: hasMP3Player |
|
4957 | 2089 |
) |
5830 | 2090 |
(MenuItem |
2091 |
enabled: hasFileSelection |
|
2092 |
label: 'realplay (avi viewer)' |
|
2093 |
itemValue: openRP |
|
2094 |
translateLabel: true |
|
6460 | 2095 |
isVisible: systemIsUnix |
2096 |
) |
|
2097 |
(MenuItem |
|
2098 |
label: '-' |
|
2099 |
) |
|
2100 |
(MenuItem |
|
2101 |
label: 'Smalltalk' |
|
2102 |
translateLabel: true |
|
2103 |
submenu: |
|
2104 |
(Menu |
|
2105 |
( |
|
2106 |
(MenuItem |
|
2107 |
enabled: hasSnapshotSelection |
|
2108 |
label: 'Snapshot Image Browser' |
|
2109 |
itemValue: openSnapshotImageBrowser |
|
2110 |
translateLabel: true |
|
2111 |
) |
|
2112 |
(MenuItem |
|
2113 |
enabled: canCreateNewProject |
|
2114 |
label: 'Create Smalltalk Project' |
|
2115 |
itemValue: createProjectAndOpenProjectBrowser |
|
2116 |
translateLabel: true |
|
2117 |
) |
|
2118 |
(MenuItem |
|
2119 |
label: '-' |
|
2120 |
) |
|
2121 |
(MenuItem |
|
8426 | 2122 |
enabled: hasResourceFileSelected |
6460 | 2123 |
label: 'Show Contents of Resourcefile' |
2124 |
itemValue: readAndShowResources |
|
2125 |
translateLabel: true |
|
2126 |
) |
|
8426 | 2127 |
(MenuItem |
2128 |
enabled: hasResourceFileSelected |
|
2129 |
label: 'Resource File Editor' |
|
2130 |
itemValue: openResourceFileEditor |
|
2131 |
translateLabel: true |
|
2132 |
showBusyCursorWhilePerforming: true |
|
2133 |
) |
|
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
2134 |
(MenuItem |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
2135 |
label: '-' |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
2136 |
) |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
2137 |
(MenuItem |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
2138 |
enabled: hasFileSelection |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
2139 |
label: 'Contents as ByteArray' |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
2140 |
itemValue: fileContentsAsByteArray |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
2141 |
translateLabel: true |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
2142 |
) |
6460 | 2143 |
) |
2144 |
nil |
|
2145 |
nil |
|
2146 |
) |
|
2147 |
) |
|
2148 |
(MenuItem |
|
2149 |
label: 'Image' |
|
2150 |
translateLabel: true |
|
2151 |
submenu: |
|
2152 |
(Menu |
|
2153 |
( |
|
2154 |
(MenuItem |
|
2155 |
enabled: hasFileSelection |
|
2156 |
label: 'Image Editor' |
|
2157 |
itemValue: openImageEditor |
|
2158 |
translateLabel: true |
|
2159 |
) |
|
2160 |
(MenuItem |
|
2161 |
enabled: hasFileSelection |
|
2162 |
label: 'Image Preview' |
|
2163 |
itemValue: openImagePreview |
|
2164 |
translateLabel: true |
|
2165 |
) |
|
2166 |
(MenuItem |
|
2167 |
enabled: hasFileSelection |
|
2168 |
label: 'Image Inspector' |
|
2169 |
itemValue: openImageInspector |
|
2170 |
translateLabel: true |
|
2171 |
) |
|
2172 |
(MenuItem |
|
2173 |
label: '-' |
|
2174 |
) |
|
2175 |
(MenuItem |
|
2176 |
enabled: hasFileSelection |
|
2177 |
label: 'Convert to GIF' |
|
2178 |
itemValue: convertImageToGIF |
|
2179 |
translateLabel: true |
|
2180 |
) |
|
2181 |
(MenuItem |
|
2182 |
enabled: hasFileSelection |
|
2183 |
label: 'Convert to PNG' |
|
2184 |
itemValue: convertImageToPNG |
|
2185 |
translateLabel: true |
|
2186 |
) |
|
2187 |
(MenuItem |
|
2188 |
enabled: hasFileSelection |
|
2189 |
label: 'Convert to XPM' |
|
2190 |
itemValue: convertImageToXPM |
|
2191 |
translateLabel: true |
|
2192 |
) |
|
2193 |
(MenuItem |
|
2194 |
enabled: hasFileSelection |
|
2195 |
label: 'Convert to JPG' |
|
2196 |
itemValue: convertImageToJPG |
|
2197 |
translateLabel: true |
|
2198 |
) |
|
2199 |
) |
|
2200 |
nil |
|
2201 |
nil |
|
2202 |
) |
|
2203 |
) |
|
2204 |
(MenuItem |
|
2205 |
enabled: hasZipFileSelected |
|
2206 |
label: 'ZipFile Tool' |
|
2207 |
itemValue: openZipTool |
|
2208 |
translateLabel: true |
|
2209 |
) |
|
2210 |
(MenuItem |
|
2211 |
enabled: hasFileSelection |
|
2212 |
label: 'Hex Dump' |
|
2213 |
itemValue: fileHexDump |
|
2214 |
translateLabel: true |
|
4958 | 2215 |
) |
4820 | 2216 |
) |
2217 |
nil |
|
2218 |
nil |
|
2219 |
) |
|
4230 | 2220 |
) |
5830 | 2221 |
(MenuItem |
2222 |
label: 'Find' |
|
2223 |
translateLabel: true |
|
2224 |
submenu: |
|
2225 |
(Menu |
|
2226 |
( |
|
2227 |
(MenuItem |
|
2228 |
label: 'File...' |
|
2229 |
itemValue: fileFindFile |
|
2230 |
translateLabel: true |
|
4367 | 2231 |
) |
5830 | 2232 |
(MenuItem |
2233 |
label: 'Duplicate Files' |
|
2234 |
itemValue: fileFindDuplicates |
|
2235 |
translateLabel: true |
|
5082 | 2236 |
) |
5830 | 2237 |
(MenuItem |
2238 |
enabled: hasSelection |
|
2239 |
label: 'All Duplicate Files (Recursive)' |
|
2240 |
itemValue: fileFindAllDuplicates |
|
2241 |
translateLabel: true |
|
4367 | 2242 |
) |
8510 | 2243 |
(MenuItem |
2244 |
label: 'Similar Image Files' |
|
2245 |
itemValue: fileFindSimilarImages |
|
2246 |
translateLabel: true |
|
2247 |
isVisible: hasImageColorHistogram |
|
2248 |
) |
|
4367 | 2249 |
) |
2250 |
nil |
|
2251 |
nil |
|
2252 |
) |
|
4230 | 2253 |
) |
5830 | 2254 |
(MenuItem |
2255 |
enabled: hasSelection |
|
2256 |
label: 'File Differences' |
|
2257 |
itemValue: openDiffView |
|
2258 |
translateLabel: true |
|
2259 |
isVisible: hasTwoFilesSelectedHolder |
|
4230 | 2260 |
) |
5830 | 2261 |
(MenuItem |
2262 |
enabled: hasSelection |
|
2263 |
label: 'File Differences...' |
|
2264 |
itemValue: openDiffView |
|
2265 |
translateLabel: true |
|
2266 |
isVisible: hasNotTwoFilesSelectedHolder |
|
2267 |
) |
|
9490 | 2268 |
(MenuItem |
2269 |
enabled: hasSelection |
|
2270 |
label: 'Directory Differences' |
|
2271 |
itemValue: openDirectoryDiffView |
|
2272 |
translateLabel: true |
|
2273 |
isVisible: hasTwoDirectoriesSelectedHolder |
|
2274 |
) |
|
2275 |
(MenuItem |
|
2276 |
enabled: hasSelection |
|
2277 |
label: 'Directory Differences...' |
|
2278 |
itemValue: openDirectoryDiffView |
|
2279 |
translateLabel: true |
|
2280 |
isVisible: hasNotTwoDirectoriesSelectedHolder |
|
2281 |
) |
|
4230 | 2282 |
) |
2283 |
nil |
|
2284 |
nil |
|
4164
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
2285 |
) |
9490 | 2286 |
|
2287 |
"Modified: / 20-05-2010 / 10:44:24 / cg" |
|
4164
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
2288 |
! |
81154143d447
move toolsMenuSpec from FileBrowserV2 to AbstractFileBrowser
penk
parents:
4163
diff
changeset
|
2289 |
|
4018 | 2290 |
viewDetailsMenuSpec |
2291 |
"This resource specification was automatically generated |
|
2292 |
by the MenuEditor of ST/X." |
|
2293 |
||
2294 |
"Do not manually edit this!! If it is corrupted, |
|
2295 |
the MenuEditor may not be able to read the specification." |
|
2296 |
||
2297 |
" |
|
4648 | 2298 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#viewDetailsMenuSpec |
2299 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser viewDetailsMenuSpec)) startUp |
|
4018 | 2300 |
" |
2301 |
||
2302 |
<resource: #menu> |
|
2303 |
||
2304 |
^ |
|
2305 |
#(#Menu |
|
4414 | 2306 |
#( |
2307 |
#(#MenuItem |
|
2308 |
#label: '-' |
|
2309 |
) |
|
2310 |
#(#MenuItem |
|
2311 |
#label: 'Hidden Files' |
|
2312 |
#translateLabel: true |
|
2313 |
#indication: #showHiddenFiles |
|
2314 |
) |
|
2315 |
) |
|
2316 |
nil |
|
2317 |
nil |
|
4018 | 2318 |
) |
3892 | 2319 |
! ! |
2320 |
||
2321 |
!AbstractFileBrowser class methodsFor:'misc'! |
|
2322 |
||
2323 |
newLock |
|
2324 |
^ CodeExecutionLock new |
|
2325 |
! ! |
|
2326 |
||
5644
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2327 |
!AbstractFileBrowser class methodsFor:'resources'! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2328 |
|
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2329 |
classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2330 |
^ FileBrowser classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2331 |
! ! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2332 |
|
4610 | 2333 |
!AbstractFileBrowser class methodsFor:'utilities'! |
2334 |
||
2335 |
contentsOfFileAsHexDump:f |
|
8472 | 2336 |
^ self contentsOfFileAsHexDump:f withLimit:nil lastPart:nil |
2337 |
! |
|
2338 |
||
2339 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil |
|
4610 | 2340 |
|resources fileName stream data offs |
8472 | 2341 |
addrDigits col line lineStream asciiLineStream lines answer sizeLimit showLastPart| |
4610 | 2342 |
|
2343 |
resources := self classResources. |
|
2344 |
||
2345 |
fileName := f baseName. |
|
2346 |
f isDirectory ifTrue:[ |
|
2347 |
Dialog warn:(resources string:'%1 is a directory.' with:fileName). |
|
2348 |
^ nil |
|
2349 |
]. |
|
2350 |
f exists ifFalse:[ |
|
2351 |
Dialog warn:(resources string:'oops, ''%1'' is gone or unreadable.' with:fileName). |
|
2352 |
^ nil |
|
2353 |
]. |
|
2354 |
f isReadable ifFalse:[ |
|
2355 |
Dialog warn:(resources string:'''%1'' is unreadable.' with:fileName). |
|
2356 |
^ nil |
|
2357 |
]. |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
2358 |
f fileSize > (1024*1024) ifTrue:[ |
8472 | 2359 |
limitOrNil notNil ifTrue:[ |
2360 |
sizeLimit := limitOrNil. |
|
2361 |
showLastPart := showLastPartOrNil |
|
2362 |
] ifFalse:[ |
|
2363 |
answer := Dialog |
|
2364 |
confirmWithCancel:(resources |
|
2365 |
stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' |
|
2366 |
with:(fileName contractTo:40) allBold |
|
2367 |
with:(UnitConverter fileSizeStringFor:f fileSize)) |
|
2368 |
labels:#('Cancel' 'Show All' 'Show First Part' ). |
|
2369 |
||
2370 |
answer isNil ifTrue:[^ nil]. |
|
2371 |
answer ifTrue:[ |
|
2372 |
sizeLimit := 4 * 1024 * 1024 |
|
2373 |
]. |
|
8436 | 2374 |
]. |
4610 | 2375 |
]. |
2376 |
||
2377 |
stream := f readStream binary. |
|
8436 | 2378 |
sizeLimit notNil ifTrue:[ |
8472 | 2379 |
showLastPart == true ifTrue:[ |
2380 |
stream position:(f fileSize - sizeLimit). |
|
2381 |
]. |
|
8436 | 2382 |
data := stream nextBytes:sizeLimit. |
2383 |
] ifFalse:[ |
|
2384 |
data := stream contents. |
|
2385 |
]. |
|
4610 | 2386 |
stream close. |
2387 |
||
2388 |
col := 1. |
|
2389 |
offs := 0. |
|
2390 |
lines := StringCollection new. |
|
2391 |
||
2392 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
2393 |
||
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
2394 |
lineStream := String writeStream. |
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
2395 |
asciiLineStream := String writeStream. |
4610 | 2396 |
|
2397 |
lineStream nextPutAll:(offs hexPrintString:addrDigits). |
|
2398 |
lineStream nextPutAll:': '. |
|
2399 |
||
2400 |
data do:[:byte | |
|
2401 |
lineStream nextPutAll:(byte hexPrintString:2). |
|
2402 |
(byte between:32 and:127) ifTrue:[ |
|
2403 |
asciiLineStream nextPut:(Character value:byte) |
|
2404 |
] ifFalse:[ |
|
2405 |
asciiLineStream nextPut:$. |
|
2406 |
]. |
|
2407 |
||
2408 |
offs := offs + 1. |
|
2409 |
col := col + 1. |
|
2410 |
col > 16 ifTrue:[ |
|
2411 |
lineStream nextPutAll:' '. |
|
2412 |
lineStream nextPutAll:asciiLineStream contents. |
|
2413 |
lines add:(lineStream contents). |
|
2414 |
(offs bitAnd:16rFF) == 0 ifTrue:[ |
|
2415 |
lines add:nil |
|
2416 |
]. |
|
2417 |
lineStream reset. |
|
2418 |
asciiLineStream reset. |
|
2419 |
||
2420 |
lineStream nextPutAll:(offs hexPrintString:addrDigits). |
|
2421 |
lineStream nextPutAll:': '. |
|
2422 |
col := 1. |
|
2423 |
] ifFalse:[ |
|
2424 |
lineStream space |
|
2425 |
] |
|
2426 |
]. |
|
2427 |
line := lineStream contents paddedTo:(3*16 + addrDigits + 1). |
|
2428 |
lines add:(line , ' ' , asciiLineStream contents). |
|
2429 |
^ lines |
|
2430 |
! ! |
|
2431 |
||
3892 | 2432 |
!AbstractFileBrowser methodsFor:'actions'! |
2433 |
||
2434 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 2435 |
"setup and launch a querybox to ask for a unix command. |
3892 | 2436 |
Then evaluate aBlock passing the command-string as argument." |
2437 |
||
4523 | 2438 |
|box osName commandString| |
3892 | 2439 |
|
2440 |
osName := OperatingSystem platformName. |
|
2441 |
||
2442 |
box := FilenameEnterBox |
|
4414 | 2443 |
title:(resources string:'Execute %1 command:' with:osName) |
2444 |
okText:(resources string:'Execute') |
|
4523 | 2445 |
action:[:cmd | commandString := cmd]. |
3892 | 2446 |
|
2447 |
fileName notNil ifTrue:[ |
|
4414 | 2448 |
self initialCommandFor:fileName into:box. |
3892 | 2449 |
]. |
2450 |
box directory:(self getDirWithoutFileName:fileName). |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
2451 |
box show. |
3892 | 2452 |
box destroy. |
2453 |
||
4523 | 2454 |
commandString notNil ifTrue:[ |
2455 |
aBlock value:commandString |
|
2456 |
]. |
|
2457 |
||
3892 | 2458 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
2459 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
2460 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
2461 |
! |
|
2462 |
||
2463 |
changeFileBrowserTitleTo:aString |
|
4774 | 2464 |
self |
2465 |
applicationNamed:#FileBrowserV2 |
|
5009 | 2466 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 2467 |
! |
2468 |
||
2469 |
copyFileList |
|
4774 | 2470 |
"copy the fileList to the clipBoard" |
2471 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2472 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2473 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2474 |
fileList := self |
4774 | 2475 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 2476 |
ifPresentDo:[:app | app browserFileList]. |
2477 |
||
2478 |
fileList notNil ifTrue:[ |
|
2479 |
self copyFileListToClipBoard:fileList. |
|
2480 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2481 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2482 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2483 |
copyFileListToClipBoard:fileList |
4774 | 2484 |
"copy the itemList to the clipBoard" |
2485 |
||
2486 |
|stream| |
|
2487 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2488 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 2489 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2490 |
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
|
2491 |
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
|
2492 |
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
|
2493 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2494 |
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
|
2495 |
(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
|
2496 |
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
|
2497 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
2498 |
]. |
3892 | 2499 |
]. |
6034 | 2500 |
self window setClipboardText:stream contents. |
3892 | 2501 |
! |
2502 |
||
2503 |
copySelectedFilenames |
|
4774 | 2504 |
"copy the selected fileNames to the clipBoard" |
2505 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2506 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2507 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
2508 |
fileList := self |
4774 | 2509 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 2510 |
ifPresentDo:[:appl | appl selectedFileNames]. |
2511 |
fileList notNil ifTrue:[ |
|
2512 |
self copyFileListToClipBoard:fileList. |
|
2513 |
]. |
|
3892 | 2514 |
! |
2515 |
||
2516 |
doAddTerminal |
|
5960 | 2517 |
|dir| |
2518 |
||
2519 |
dir := self currentDirectory. |
|
3892 | 2520 |
|
5960 | 2521 |
dir isNil ifTrue:[ |
4414 | 2522 |
dir := Filename homeDirectory |
3892 | 2523 |
]. |
4774 | 2524 |
|
5009 | 2525 |
self |
2526 |
applicationNamed:#FileApplicationNoteBook |
|
2527 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
3892 | 2528 |
! |
2529 |
||
2530 |
doOpenSearchFile |
|
5961 | 2531 |
|item file| |
2532 |
||
2533 |
file := self firstSelectedFileName. |
|
2534 |
file isNil ifTrue:[ |
|
2535 |
file := Filename homeDirectory asAbsoluteFilename. |
|
2536 |
]. |
|
2537 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 2538 |
self openSearchFileOn:item. |
2539 |
! |
|
2540 |
||
2541 |
doShowFileContents |
|
5009 | 2542 |
self |
2543 |
applicationNamed:#DirectoryContentsBrowser |
|
2544 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
2545 |
||
2546 |
^ nil |
|
3892 | 2547 |
! |
2548 |
||
2549 |
doShowProperties |
|
2550 |
"show long stat (file)-info" |
|
2551 |
||
2552 |
self fileGetInfo:true |
|
2553 |
! |
|
2554 |
||
5528 | 2555 |
fileEncodingDialog |
2556 |
"open a dialog to allow change of the files character encoding. |
|
2557 |
Files are converted to internal encoding when read, and converted back |
|
2558 |
to this encoding when saved. |
|
2559 |
Notice: currently, not too many encodings are supported by the system." |
|
2560 |
||
2561 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
2562 |
||
2563 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
2564 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
2565 |
||
2566 |
bindings := IdentityDictionary new. |
|
2567 |
bindings at:#encodingList put:encodingDescr. |
|
2568 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 2569 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
2570 |
||
5528 | 2571 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
2572 |
ifTrue:[ |
|
2573 |
idx := (bindings at:#selectedEncoding) value. |
|
2574 |
selectedEncoding := encodings at:idx. |
|
2575 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 2576 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 2577 |
]. |
5737 | 2578 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 2579 |
]. |
2580 |
||
2581 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
2582 |
! |
|
2583 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2584 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
2585 |
"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
|
2586 |
|
5959 | 2587 |
|currentFileNameHolder currentSel| |
2588 |
||
2589 |
currentFileNameHolder := self currentFileNameHolder. |
|
2590 |
||
2591 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
2592 |
(currentSel includes:aFilename) ifFalse:[ |
5959 | 2593 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
3964 | 2594 |
]. |
3892 | 2595 |
! |
2596 |
||
4392 | 2597 |
newTextEditor |
5009 | 2598 |
self |
2599 |
applicationNamed:#FileApplicationNoteBook |
|
2600 |
ifPresentDo:[:appl | ^ appl newTextEditor]. |
|
2601 |
||
2602 |
^ nil. |
|
2603 |
! |
|
2604 |
||
2605 |
openApplByFileItem:anItem |
|
8490 | 2606 |
"/ q: is the following always wanted ? |
9267 | 2607 |
self window sensor shiftDown ifFalse:[ |
2608 |
anItem fileName isExecutableProgram ifTrue:[ |
|
2609 |
self executeCommand:anItem fileName pathName. |
|
2610 |
^ self. |
|
2611 |
]. |
|
2612 |
||
8490 | 2613 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
2614 |
"/ Error handle:[:ex | |
|
2615 |
"/ ] do:[ |
|
2616 |
"/ OperatingSystem |
|
2617 |
"/ shellExecute:nil |
|
2618 |
"/ lpOperation:'open' |
|
2619 |
"/ lpFile:(anItem fileName pathName) |
|
2620 |
"/ lpParameters:nil |
|
2621 |
"/ lpDirectory:(self directory pathName) |
|
2622 |
"/ nShowCmd:#SW_SHOWNORMAL. |
|
2623 |
"/ ^ self. |
|
2624 |
"/ ] |
|
2625 |
"/ ] |
|
9267 | 2626 |
]. |
5306 | 2627 |
^ self |
5009 | 2628 |
applicationNamed:#FileApplicationNoteBook |
5306 | 2629 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
3892 | 2630 |
! |
2631 |
||
4392 | 2632 |
openApplForFile:aFilename |
5306 | 2633 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 2634 |
! |
2635 |
||
3892 | 2636 |
openCommandResultApplication |
2637 |
||
5009 | 2638 |
self |
2639 |
applicationNamed:#FileApplicationNoteBook |
|
2640 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
2641 |
||
2642 |
^ nil |
|
3892 | 2643 |
! |
2644 |
||
5010 | 2645 |
openNewTextEditorOn:anItem |
5009 | 2646 |
self |
2647 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 2648 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 2649 |
|
2650 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
2651 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
2652 |
|
5010 | 2653 |
openSearchFileOn:anItem |
5009 | 2654 |
self |
2655 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 2656 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 2657 |
|
2658 |
^ nil. |
|
3892 | 2659 |
! |
2660 |
||
5162 | 2661 |
openTextEditorForFile:aFilename |
2662 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
2663 |
! |
|
2664 |
||
5010 | 2665 |
openTextEditorOn:anItem |
5009 | 2666 |
self |
2667 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 2668 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 2669 |
|
2670 |
^ nil. |
|
3892 | 2671 |
! |
2672 |
||
5010 | 2673 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 2674 |
self |
2675 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 2676 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 2677 |
|
2678 |
^ nil. |
|
4618 | 2679 |
! |
2680 |
||
5959 | 2681 |
setCurrentFileName:aFilename |
2682 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
2683 |
! |
|
2684 |
||
2685 |
setCurrentFileNames:aCollectionOfFilenames |
|
2686 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
2687 |
! |
|
2688 |
||
3892 | 2689 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
2690 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
2691 |
aColOfFiles notNil ifTrue:[ |
5959 | 2692 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
2693 |
]. |
3892 | 2694 |
! |
2695 |
||
2696 |
updateCurrentDirectory |
|
5739 | 2697 |
self updateCurrentDirectory:false |
2698 |
! |
|
2699 |
||
2700 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
2701 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
2702 |
|
5009 | 2703 |
self |
2704 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 2705 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 2706 |
self |
2707 |
applicationNamed:#DirectoryTreeBrowser |
|
2708 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 2709 |
! |
2710 |
||
5739 | 2711 |
updateCurrentDirectoryWithReread |
2712 |
self updateCurrentDirectory:true |
|
2713 |
! |
|
2714 |
||
4345 | 2715 |
withActivityIndicationDo:aBlock |
2716 |
||
2717 |
self activityVisibilityChannel value:true. |
|
2718 |
[ |
|
9361 | 2719 |
self withWaitCursorDo:[ |
2720 |
aBlock value. |
|
2721 |
] |
|
4345 | 2722 |
] ensure:[ |
2723 |
self activityVisibilityChannel value:false. |
|
2724 |
] |
|
3892 | 2725 |
! ! |
2726 |
||
2727 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
2728 |
||
2729 |
addBookmark |
|
2730 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
6725 | 2731 |
self addBookmarks:(self currentSelectedDirectories). |
5960 | 2732 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 2733 |
! |
2734 |
||
2735 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
2736 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
2737 |
self class addBookmark:path |
3892 | 2738 |
]. |
2739 |
! |
|
2740 |
||
8013 | 2741 |
editBookmarks |
2742 |
||
2743 |
| default selectedDirectories | |
|
2744 |
||
2745 |
selectedDirectories := self currentSelectedDirectories. |
|
2746 |
selectedDirectories notEmpty ifTrue:[default := selectedDirectories first]. |
|
2747 |
self class editBookmarksWithDefault: default. |
|
2748 |
! |
|
2749 |
||
3892 | 2750 |
hasBookmarks |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
2751 |
^ self class hasBookmarks |
3892 | 2752 |
! |
2753 |
||
2754 |
hasBookmarksToRemove |
|
2755 |
|bookmarks directories| |
|
2756 |
||
3982 | 2757 |
directories := self currentSelectedDirectories. |
3892 | 2758 |
bookmarks := self class directoryBookmarks. |
2759 |
^ (bookmarks size > 0 and:[directories notEmpty]) |
|
2760 |
! |
|
2761 |
||
2762 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
2763 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
2764 |
self class removeBookmark:dir |
3892 | 2765 |
]. |
4679 | 2766 |
! |
2767 |
||
2768 |
saveBookmarks |
|
2769 |
self class saveBookmarks |
|
3892 | 2770 |
! ! |
2771 |
||
2772 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
2773 |
||
2774 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 2775 |
|cmd suffix cmdHist historySize| |
3892 | 2776 |
|
2777 |
cmdHist := self class commandHistory. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
2778 |
(aCommandString notEmptyOrNil) ifTrue:[ |
4414 | 2779 |
cmdHist notNil ifTrue:[ |
2780 |
cmdHist addFirst:aCommandString. |
|
6369 | 2781 |
historySize := self class commandHistorySize. |
2782 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 2783 |
cmdHist removeLast |
2784 |
] |
|
2785 |
]. |
|
2786 |
aFilename notNil ifTrue:[ |
|
2787 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
2788 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
2789 |
DefaultCommandPerSuffix := Dictionary new. |
|
2790 |
]. |
|
2791 |
suffix := aFilename asFilename suffix. |
|
2792 |
suffix notNil ifTrue:[ |
|
2793 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
2794 |
] |
|
2795 |
] |
|
3892 | 2796 |
] |
2797 |
! |
|
2798 |
||
2799 |
doBack |
|
6286 | 2800 |
"go backward in the history" |
3892 | 2801 |
|
4022 | 2802 |
| fileName| |
2803 |
||
6369 | 2804 |
fileName := self directoryHistory goBackward. |
3892 | 2805 |
fileName notNil ifTrue:[ |
4347 | 2806 |
self gotoFile:(fileName asFilename). |
3892 | 2807 |
] |
2808 |
! |
|
2809 |
||
2810 |
doForward |
|
6286 | 2811 |
"go forward in the history" |
3892 | 2812 |
|
3964 | 2813 |
| fileName| |
2814 |
||
6369 | 2815 |
fileName := self directoryHistory goForward. |
3892 | 2816 |
fileName notNil ifTrue:[ |
4414 | 2817 |
self gotoFile:(fileName asFilename). |
4022 | 2818 |
] ifFalse:[ |
4414 | 2819 |
self enableForward value:false. |
4022 | 2820 |
|
2821 |
]. |
|
3892 | 2822 |
! ! |
2823 |
||
2824 |
!AbstractFileBrowser methodsFor:'applications'! |
|
2825 |
||
5009 | 2826 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
2827 |
|appl| |
|
2828 |
||
2829 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
2830 |
appl notNil ifTrue:[ |
|
2831 |
^ aBlock value:appl |
|
2832 |
]. |
|
2833 |
^ nil. |
|
2834 |
! |
|
2835 |
||
4004 | 2836 |
directoryContentsBrowser |
2837 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 2838 |
! ! |
2839 |
||
2840 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
2841 |
||
2842 |
applications |
|
2843 |
^ aspects at:#applications |
|
2844 |
! |
|
2845 |
||
2846 |
backgroundProcesses |
|
2847 |
||
2848 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
2849 |
! |
|
2850 |
||
4230 | 2851 |
canMake |
6095 | 2852 |
^ self aspectFor:#canMake ifAbsent:[ false asValue ]. |
4230 | 2853 |
! |
2854 |
||
3892 | 2855 |
currentDirectories |
6725 | 2856 |
" returns a holder on a Collection of all currently selected directories |
2857 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3892 | 2858 |
" |
2859 |
||
2860 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
2861 |
! |
|
2862 |
||
6725 | 2863 |
currentDirectoriesValue |
2864 |
" returns a Collection of all currently selected directories |
|
2865 |
if only a file is selected, currentDirectories holds the directory of the file |
|
2866 |
" |
|
2867 |
||
2868 |
^ self currentDirectories value |
|
2869 |
! |
|
2870 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2871 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2872 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2873 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2874 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2875 |
|
6725 | 2876 |
directories := self currentSelectedDirectories. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2877 |
(directories size ~= 1) ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2878 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2879 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2880 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2881 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
2882 |
|
3892 | 2883 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2884 |
"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
|
2885 |
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
|
2886 |
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
|
2887 |
|
6589 | 2888 |
^ self aspectFor:#currentFileNameHolder |
2889 |
ifAbsent:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2890 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
2891 |
|
4692 | 2892 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2893 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2894 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2895 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2896 |
currentSel asValue |
6589 | 2897 |
] |
2898 |
notPresentDo:[:holder| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2899 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2900 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2901 |
newFilenames := Set new. |
6589 | 2902 |
filenames do:[:eachFilename| |
2903 |
|existingFilename| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2904 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2905 |
existingFilename notNil ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2906 |
[existingFilename exists] whileFalse:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2907 |
existingFilename := existingFilename directory. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
2908 |
]. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
2909 |
newFilenames add:existingFilename. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
2910 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2911 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2912 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
2913 |
] |
3892 | 2914 |
! |
2915 |
||
5528 | 2916 |
defaultFileEncoding |
2917 |
^ #'iso8859-1' "/ #'utf-8' |
|
2918 |
! |
|
2919 |
||
3892 | 2920 |
enableDirectoryUp |
2921 |
||
2922 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[false asValue] |
|
2923 |
! |
|
2924 |
||
6456 | 2925 |
enableGotoDefaultDirectory |
2926 |
^ self aspectFor:#enableGotoDefaultDirectory ifAbsent:[ true asValue ]. |
|
4593 | 2927 |
! |
2928 |
||
8168 | 2929 |
enableGotoDesktop |
2930 |
^ self aspectFor:#enableGotoDesktop ifAbsent:[ true asValue ]. |
|
2931 |
! |
|
2932 |
||
6434 | 2933 |
enableGotoSmalltalkDirectory |
6456 | 2934 |
^ self aspectFor:#enableGotoSmalltalkDirectory ifAbsent:[ true asValue ]. |
6434 | 2935 |
! |
2936 |
||
3892 | 2937 |
enableHome |
2938 |
||
2939 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
2940 |
! |
|
2941 |
||
2942 |
enableViewNoteBookApplication |
|
2943 |
||
2944 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
2945 |
! |
|
2946 |
||
5528 | 2947 |
fileEncoding |
2948 |
^ self fileEncodingHolder value |
|
2949 |
! |
|
2950 |
||
2951 |
fileEncoding:newEncoding |
|
5533 | 2952 |
self fileEncodingHolder value:newEncoding. |
2953 |
||
2954 |
self |
|
2955 |
applicationNamed:#FileApplicationNoteBook |
|
2956 |
ifPresentDo:[:nb | |
|
2957 |
|appl| |
|
2958 |
||
2959 |
appl := nb selectedApplication. |
|
5535 | 2960 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 2961 |
appl fileEncoding:newEncoding |
2962 |
] |
|
2963 |
]. |
|
5528 | 2964 |
! |
2965 |
||
5737 | 2966 |
fileEncodingHolder |
2967 |
^ self |
|
2968 |
aspectFor:#fileEncodingHolder |
|
2969 |
ifAbsent:[ |
|
2970 |
self |
|
2971 |
applicationNamed:#FileApplicationNoteBook |
|
2972 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
2973 |
] |
|
2974 |
! |
|
2975 |
||
5961 | 2976 |
firstSelectedFileName |
2977 |
|files| |
|
2978 |
||
7560 | 2979 |
files := self currentSelectedObjects. |
5961 | 2980 |
files notEmpty ifTrue:[ |
2981 |
^ files first |
|
2982 |
]. |
|
2983 |
^ nil |
|
7560 | 2984 |
|
2985 |
"Modified: / 04-12-2006 / 13:14:53 / cg" |
|
5961 | 2986 |
! |
2987 |
||
6456 | 2988 |
gotoDefaultDirectoryIsVisible |
2989 |
^ (Filename defaultDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
2990 |
! |
|
2991 |
||
4618 | 2992 |
hasFileSelection |
2993 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
2994 |
! |
|
2995 |
||
9490 | 2996 |
hasNotTwoDirectoriesSelectedHolder |
2997 |
^ self |
|
2998 |
aspectFor:#hasNotTwoDirectoriesSelectedHolder |
|
2999 |
ifAbsent:[ |
|
3000 |
BlockValue |
|
3001 |
with:[:m | self hasTwoDirectoriesSelected not] |
|
3002 |
argument:self currentFileNameHolder |
|
3003 |
]. |
|
3004 |
||
3005 |
"Created: / 20-05-2010 / 10:45:50 / cg" |
|
3006 |
! |
|
3007 |
||
5830 | 3008 |
hasNotTwoFilesSelectedHolder |
9490 | 3009 |
^ self |
3010 |
aspectFor:#hasNotTwoFilesSelectedHolder |
|
5830 | 3011 |
ifAbsent:[ |
3012 |
BlockValue |
|
3013 |
with:[:m | self hasTwoFilesSelected not] |
|
3014 |
argument:self currentFileNameHolder |
|
3015 |
]. |
|
9490 | 3016 |
|
3017 |
"Modified: / 20-05-2010 / 10:46:01 / cg" |
|
5830 | 3018 |
! |
3019 |
||
3892 | 3020 |
hasSelection |
3021 |
||
3022 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
3023 |
! |
|
3024 |
||
9490 | 3025 |
hasTwoDirectoriesSelectedHolder |
3026 |
^ self |
|
3027 |
aspectFor:#hasTwoDirectoriesSelectedHolder |
|
3028 |
ifAbsent:[ |
|
3029 |
BlockValue |
|
3030 |
with:[:m | self hasTwoDirectoriesSelected] |
|
3031 |
argument:self currentFileNameHolder |
|
3032 |
]. |
|
3033 |
||
3034 |
"Created: / 20-05-2010 / 10:45:41 / cg" |
|
3035 |
! |
|
3036 |
||
4414 | 3037 |
hasTwoFilesSelectedHolder |
9490 | 3038 |
^ self |
3039 |
aspectFor:#hasTwoFilesSelectedHolder |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3040 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3041 |
BlockValue |
5830 | 3042 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3043 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3044 |
]. |
9490 | 3045 |
|
3046 |
"Modified: / 20-05-2010 / 10:46:08 / cg" |
|
4414 | 3047 |
! |
3048 |
||
5737 | 3049 |
lockFileEncoding:aBoolean |
3050 |
self lockFileEncodingHolder value:aBoolean. |
|
3051 |
||
3052 |
self |
|
3053 |
applicationNamed:#FileApplicationNoteBook |
|
3054 |
ifPresentDo:[:nb | |
|
3055 |
|appl| |
|
3056 |
||
3057 |
appl := nb selectedApplication. |
|
3058 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
3059 |
appl lockFileEncoding:aBoolean |
|
3060 |
] |
|
3061 |
]. |
|
3062 |
! |
|
3063 |
||
3064 |
lockFileEncodingHolder |
|
3065 |
^ self |
|
3066 |
aspectFor:#lockFileEncodingHolder |
|
3067 |
ifAbsent:[ |
|
3068 |
self |
|
3069 |
applicationNamed:#FileApplicationNoteBook |
|
3070 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
3071 |
] |
|
3072 |
! |
|
3073 |
||
4523 | 3074 |
notify:aString |
3075 |
self notifyChannel value:aString |
|
3076 |
! |
|
3077 |
||
3892 | 3078 |
notifyChannel |
3079 |
||
3080 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 3081 |
! |
3082 |
||
3083 |
rootHolder |
|
3084 |
"holder, which keeps the rootHolder of the treeView |
|
3085 |
" |
|
3086 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3087 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3088 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3089 |
]. |
8192
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3090 |
! |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3091 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3092 |
rootHolder:aHolder |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3093 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3094 |
self aspectFor:#rootHolder put:aHolder |
3892 | 3095 |
! ! |
3096 |
||
3097 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
3098 |
||
3099 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 3100 |
"returns the model for an aspect; these are stored in a common dictionary" |
3101 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3102 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 3103 |
! |
3104 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3105 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 3106 |
"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
|
3107 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3108 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3109 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3110 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3111 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3112 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3113 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3114 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3115 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3116 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3117 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3118 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3119 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3120 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3121 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3122 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3123 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3124 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3125 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3126 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3127 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3128 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3129 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3130 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3131 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3132 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3133 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3134 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3135 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3136 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3137 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3138 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3139 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3140 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3141 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3142 |
aspectFor:something put:aValueHolder |
6284 | 3143 |
"stores the model for an aspect; these are stored in a common dictionary" |
3144 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3145 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3146 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3147 |
|
3892 | 3148 |
aspects |
6284 | 3149 |
"returns the common aspect dictionary" |
3150 |
||
3892 | 3151 |
^ aspects |
3152 |
! |
|
3153 |
||
3154 |
runtimeAspectValueFor:something |
|
3155 |
"returns the default aspect item from the class variable RuntimeAspects |
|
3156 |
" |
|
3157 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
3158 |
! |
|
3159 |
||
4201 | 3160 |
saveAspectValues |
3161 |
|saveAspects aspectValue| |
|
3162 |
||
3163 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3164 |
saveAspects := self class userPreferencesAspectList keys. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3165 |
saveAspects do:[ :aspectKey | |
4201 | 3166 |
aspectValue := (self perform:aspectKey) value. |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3167 |
UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3168 |
at: ('fileBrowser_',aspectKey asString) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3169 |
put: aspectValue. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3170 |
]. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3171 |
|
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3172 |
"Modified: / 04-09-2006 / 10:02:41 / cg" |
4201 | 3173 |
! |
3174 |
||
3892 | 3175 |
saveRuntimeAspectValues |
3176 |
|savedAspects dictionary value isHolder aspect| |
|
3177 |
||
5941 | 3178 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 3179 |
dictionary := Dictionary new. |
5941 | 3180 |
savedAspects do:[:aspectKey | |
4414 | 3181 |
aspect := self perform:aspectKey. |
3182 |
isHolder := aspect isValueModel. |
|
5941 | 3183 |
isHolder ifTrue:[ |
3184 |
value := aspect value |
|
3185 |
] ifFalse:[ |
|
3186 |
value := aspect |
|
3187 |
]. |
|
3188 |
dictionary at:aspectKey |
|
3189 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
3190 |
]. |
|
3191 |
RuntimeAspects := dictionary. |
|
3892 | 3192 |
! |
3193 |
||
4201 | 3194 |
userPreferencesAspectValueFor:something |
3195 |
"returns the default aspect from the Userpreferences |
|
3892 | 3196 |
" |
4201 | 3197 |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3198 |
(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
|
3199 |
^ UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3200 |
at:('fileBrowser_',something) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3201 |
ifAbsent:(self class userPreferencesAspectList at:something). |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3202 |
|
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3203 |
"Modified: / 04-09-2006 / 10:02:34 / cg" |
3892 | 3204 |
! ! |
3205 |
||
4011 | 3206 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
3207 |
||
9015 | 3208 |
filter:aString |
3209 |
self filterModel value:aString |
|
3210 |
! |
|
3211 |
||
4018 | 3212 |
filterBackgroundColor |
3213 |
||
3214 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
3215 |
! |
|
3216 |
||
4011 | 3217 |
filterBlockHolder |
3218 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3219 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 3220 |
! |
3221 |
||
3222 |
filterListModel |
|
3223 |
||
3224 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
3225 |
! |
|
3226 |
||
3227 |
filterModel |
|
5941 | 3228 |
|m| |
3229 |
||
3230 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
3231 |
^ m |
|
4011 | 3232 |
! |
3233 |
||
8185
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
3234 |
filterModel:aHolder |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
3235 |
self aspectFor:#filterModel put:aHolder. |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
3236 |
! |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
3237 |
|
4018 | 3238 |
filterValueBox |
3239 |
||
3240 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
3241 |
! |
|
3242 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3243 |
makeFilterBlock |
9102 | 3244 |
"return a two-arg filterblock on the files path- and base-name. This block should return true for files |
3245 |
to be shown" |
|
3246 |
||
7565
521264d23941
ignoreCase if Filename is not case sensitive in #makeFilterBlock
fm
parents:
7560
diff
changeset
|
3247 |
| filterString filterStrings filters showHidden yesOrNo filterBlock ignoreCase| |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3248 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3249 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3250 |
filterString = '' ifTrue:[filterString := '*']. |
7565
521264d23941
ignoreCase if Filename is not case sensitive in #makeFilterBlock
fm
parents:
7560
diff
changeset
|
3251 |
ignoreCase := "ignoreCaseInPattern ? "(Filename isCaseSensitive not). |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3252 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3253 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3254 |
filters := filterStrings |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3255 |
collect:[:eachPattern | |
9296 | 3256 |
|pattern| |
3257 |
||
3258 |
pattern := eachPattern withoutSeparators. |
|
3259 |
yesOrNo := true. |
|
3260 |
(pattern startsWith:'~') ifTrue:[ |
|
3261 |
yesOrNo := false. |
|
3262 |
pattern := pattern copyFrom:2. |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3263 |
]. |
9296 | 3264 |
yesOrNo ifTrue:[ |
3265 |
[:name :baseName | pattern match:baseName ignoreCase:ignoreCase] |
|
3266 |
] ifFalse:[ |
|
3267 |
[:name :baseName | (pattern match:baseName ignoreCase:ignoreCase) not] |
|
3268 |
]. |
|
3269 |
]. |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3270 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3271 |
filters size == 1 ifTrue:[ |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3272 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3273 |
] ifFalse:[ |
9102 | 3274 |
filterBlock := [:name :baseName | filters contains:[:aFilter | aFilter value:name value:baseName ]]. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3275 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3276 |
|
4011 | 3277 |
showHidden := self showHiddenFiles value. |
3278 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3279 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3280 |
]. |
9296 | 3281 |
^ [:name :baseName | |
3282 |
name isHidden not and:[filterBlock value:name value:baseName]]. |
|
4018 | 3283 |
! |
3284 |
||
3285 |
shownFiles |
|
3286 |
||
3287 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 3288 |
! ! |
3289 |
||
3892 | 3290 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
3291 |
||
3292 |
dirHistory |
|
6369 | 3293 |
"obsolete" |
3294 |
^ self directoryHistory |
|
3295 |
! |
|
3296 |
||
3297 |
directoryHistory |
|
3952 | 3298 |
^ self class directoryHistory |
3892 | 3299 |
! |
3300 |
||
3301 |
enableBack |
|
3302 |
||
3303 |
^ self aspectFor:#enableBack ifAbsent:[false asValue] |
|
3304 |
! |
|
3305 |
||
3306 |
enableFileHistory |
|
3307 |
||
3308 |
^ self aspectFor:#enableFileHistory ifAbsent:[false asValue] |
|
3309 |
! |
|
3310 |
||
3311 |
enableForward |
|
3312 |
||
3313 |
^ self aspectFor:#enableForward ifAbsent:[false asValue] |
|
3314 |
! |
|
3315 |
||
3316 |
fileHistory |
|
3317 |
||
3318 |
^ self aspectFor:#fileHistory ifAbsent:[FilenameHistory new] |
|
3319 |
! ! |
|
3320 |
||
3321 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
3322 |
||
4345 | 3323 |
activityVisibilityChannel |
6284 | 3324 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 3325 |
|
3326 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ false asValue ]. |
|
3327 |
! |
|
3328 |
||
6602 | 3329 |
changeSetBrowserItemVisible |
3330 |
^ Screen current ctrlDown. |
|
3331 |
! |
|
3332 |
||
4110 | 3333 |
openAlwaysInTextEditor |
4201 | 3334 |
" aspect for open every file in TextEditor dont use e.g. HtmlEditor for *.html'" |
4110 | 3335 |
|
3336 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
|
3337 |
! |
|
3338 |
||
3892 | 3339 |
openMultipleApplicationsForType |
3340 |
||
4201 | 3341 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
3342 |
open TextEditor " |
|
3343 |
||
3892 | 3344 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
3345 |
! |
|
3346 |
||
4201 | 3347 |
showDirectoryTree |
3348 |
||
3349 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 3350 |
! |
3351 |
||
4554 | 3352 |
showDiskUsageHolder |
3353 |
|holder| |
|
3354 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3355 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 3356 |
holder addDependent:self. |
4554 | 3357 |
^ holder |
3358 |
! |
|
3359 |
||
3892 | 3360 |
showHiddenFiles |
3361 |
||
9118 | 3362 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ false asValue ]. |
3892 | 3363 |
! |
3364 |
||
9108 | 3365 |
showHiddenFiles:aHolder |
3366 |
self aspectFor:#showHiddenFiles put:aHolder. |
|
3367 |
! |
|
3368 |
||
3369 |
shownFiles:aHolder |
|
3370 |
self aspectFor:#shownFiles put:aHolder. |
|
3371 |
! |
|
3372 |
||
4648 | 3373 |
userContextAvailable |
3374 |
||
3375 |
" aspect for show group and user columns in contents view |
|
3376 |
windows provides no user context" |
|
3377 |
||
3378 |
^ OperatingSystem isMSWINDOWSlike not |
|
3379 |
! |
|
3380 |
||
3892 | 3381 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3382 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3383 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3384 |
^ self directoryContentsBrowser viewDescription |
3892 | 3385 |
! |
3386 |
||
3387 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3388 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 3389 |
" |
3892 | 3390 |
|
6121 | 3391 |
|directoryContentsBrowser| |
3392 |
||
3393 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
3394 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
3395 |
^ directoryContentsBrowser viewDetails |
|
3892 | 3396 |
! |
3397 |
||
3398 |
viewDirectoryDescription |
|
3399 |
||
4201 | 3400 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
3401 |
on change directory " |
|
3402 |
||
3892 | 3403 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
3404 |
! |
|
3405 |
||
4201 | 3406 |
viewDirsInContentsBrowser |
3407 |
||
3408 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
9319
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
3409 |
|
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
3410 |
" |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
3411 |
UserPreferences current viewDirsInContentsBrowser |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
3412 |
" |
4201 | 3413 |
! |
3414 |
||
5870 | 3415 |
viewFilesInContentsBrowser |
3416 |
||
3417 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
3418 |
! |
|
3419 |
||
3892 | 3420 |
viewFilesInDirectoryTree |
3421 |
||
4201 | 3422 |
" aspect for view files in tree view (not only directories) " |
3423 |
||
3892 | 3424 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
3425 |
! |
|
3426 |
||
3427 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3428 |
" aspect for show group information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3429 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3430 |
^ self directoryContentsBrowser viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3431 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3432 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3433 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3434 |
" aspect for show file-type icon in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3435 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3436 |
^ self directoryContentsBrowser viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3437 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3438 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3439 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3440 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3441 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3442 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 3443 |
! |
3444 |
||
3445 |
viewNoteBookApplicationHolder |
|
3446 |
||
3447 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
3448 |
! |
|
3449 |
||
3450 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3451 |
" aspect for show owner information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3452 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3453 |
^ self directoryContentsBrowser viewOwner |
3892 | 3454 |
! |
3455 |
||
3456 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3457 |
" aspect for show permission information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3458 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3459 |
^ self directoryContentsBrowser viewPermissions |
3892 | 3460 |
! |
3461 |
||
3462 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3463 |
" aspect for show image previev in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3464 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3465 |
^ self directoryContentsBrowser viewPreview |
3892 | 3466 |
! |
3467 |
||
3468 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3469 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3470 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3471 |
^ self directoryContentsBrowser viewSize |
3892 | 3472 |
! |
3473 |
||
4974 | 3474 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3475 |
" aspect for show size-in-bytes information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3476 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3477 |
^ self directoryContentsBrowser viewSizeInBytes |
4974 | 3478 |
! |
3479 |
||
5312 | 3480 |
viewSizeInKiloBytes |
3481 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
3482 |
||
3483 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
3484 |
! |
|
3485 |
||
3892 | 3486 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3487 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3488 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3489 |
^ self directoryContentsBrowser viewTime |
3892 | 3490 |
! |
3491 |
||
3492 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3493 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3494 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3495 |
^ self directoryContentsBrowser viewType |
3892 | 3496 |
! ! |
3497 |
||
3498 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
3499 |
||
3500 |
executeCommand:cmd |
|
3501 |
||
3502 |
self executeCommand:cmd inDirectory:nil |
|
3503 |
! |
|
3504 |
||
5880 | 3505 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 3506 |
| nameString executionBlock| |
3507 |
||
5880 | 3508 |
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
|
3509 |
nameString := 'Execute: ', cmd. |
3892 | 3510 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
3511 |
! |
|
3512 |
||
3513 |
getExecutionBlockForCommand:cmd |
|
3514 |
||
3515 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
3516 |
! |
|
3517 |
||
5880 | 3518 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
3519 |
| dir| |
|
3520 |
||
3521 |
dir := directoryOrNil. |
|
3522 |
directoryOrNil isNil ifTrue:[ |
|
3523 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6671 | 3524 |
dir isNil ifTrue:[ |
3525 |
Dialog warn:'Please select a single directory.'. |
|
3526 |
AbortSignal raise. |
|
3527 |
^ nil |
|
3528 |
]. |
|
3892 | 3529 |
]. |
4523 | 3530 |
|
3531 |
^ [:stream| |
|
3532 |
stream notNil ifTrue:[ |
|
4414 | 3533 |
OperatingSystem |
3534 |
executeCommand:cmd |
|
3535 |
inputFrom:nil |
|
3536 |
outputTo:stream |
|
3537 |
errorTo:stream |
|
3538 |
inDirectory:dir |
|
3539 |
onError:[:status| false]. |
|
3540 |
] |
|
4523 | 3541 |
]. |
3892 | 3542 |
! |
3543 |
||
3544 |
killAllRunningBackgroundProcesses |
|
3545 |
||
3546 |
self backgroundProcesses do:[ : process | |
|
4523 | 3547 |
self notify:'kill ', process name. |
4414 | 3548 |
process terminate. |
3892 | 3549 |
]. |
3550 |
! |
|
3551 |
||
3552 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
3553 |
| stream process appl nameString| |
|
3554 |
||
3555 |
appl := self openCommandResultApplication. |
|
3556 |
stream := appl resultStream. |
|
3557 |
nameString := aString ? 'Execution Result'. |
|
3558 |
appl changeTabTo:nameString. |
|
4523 | 3559 |
|
8355 | 3560 |
process := [ |
3561 |
[aBlock value:stream] |
|
4891
5422df926e2d
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
4881
diff
changeset
|
3562 |
ensure:[ |
4516
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3563 |
self backgroundProcesses remove:process ifAbsent:[]. |
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3564 |
appl process value:nil. |
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3565 |
|
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3566 |
"/ close automatically, if there was no output. |
4571 | 3567 |
"/ appl resultStream contents isEmpty ifTrue:[ |
3568 |
"/ appl doClose. |
|
3569 |
"/ ] |
|
8355 | 3570 |
stream nextPutLine:'Done.' |
4516
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3571 |
] |
dc3b7a89598a
close command view if no output was generated
Claus Gittinger <cg@exept.de>
parents:
4496
diff
changeset
|
3572 |
] newProcess. |
3892 | 3573 |
process priority:(Processor userBackgroundPriority). |
3574 |
process name:nameString. |
|
3575 |
self backgroundProcesses add:process. |
|
3576 |
appl process value:process. |
|
3577 |
process resume. |
|
3578 |
! ! |
|
3579 |
||
3580 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
3581 |
||
4915 | 3582 |
currentFileNameHolderChanged |
3583 |
"/ self currentFileNameHolderChangedForCommon |
|
3584 |
! |
|
3585 |
||
4577 | 3586 |
currentFileNameHolderChangedForCommon |
5476 | 3587 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3588 |
|
7560 | 3589 |
selection := self currentSelectedObjects. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3590 |
self class currentSelection:selection. |
4734 | 3591 |
|
5476 | 3592 |
selectionNotEmpty := selection notEmpty. |
3593 |
self hasSelection value:selectionNotEmpty. |
|
3594 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
4734 | 3595 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3596 |
newDirectories := self directoriesForFiles:selection. |
6725 | 3597 |
oldDirectories := self currentSelectedDirectories. |
4011 | 3598 |
oldDirectories ~= newDirectories ifTrue:[ |
4347 | 3599 |
self currentDirectories value:newDirectories. |
3600 |
size := newDirectories size. |
|
4774 | 3601 |
rootInTreeView := self |
3602 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 3603 |
ifPresentDo:[:appl | appl rootHolder]. |
3604 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
3605 |
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
|
3606 |
|
4347 | 3607 |
newDirectories notEmpty ifTrue:[ |
6369 | 3608 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 3609 |
]. |
5074 | 3610 |
self enableHome value:((newDirectories includes:(Filename homeDirectory asAbsoluteFilename))not). |
8168 | 3611 |
self enableGotoDesktop value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
6456 | 3612 |
self enableGotoDefaultDirectory value:((newDirectories includes:(Filename defaultDirectory asAbsoluteFilename))not). |
3613 |
self enableGotoSmalltalkDirectory value:((newDirectories includes:(self smalltalkDirectory asAbsoluteFilename))not). |
|
4011 | 3614 |
]. |
4022 | 3615 |
self enableForward value:self canForward. |
4734 | 3616 |
self enableBack value:self canBackward. |
6095 | 3617 |
|
3618 |
self updateCanMake. |
|
7560 | 3619 |
|
3620 |
"Modified: / 04-12-2006 / 13:14:36 / cg" |
|
4011 | 3621 |
! |
3622 |
||
3623 |
filterModelChanged |
|
3624 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3625 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 3626 |
! |
3627 |
||
3892 | 3628 |
update:something with:aParameter from:changedObject |
3629 |
||
3630 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
3631 |
and the things that have to be done if it runs standalone " |
|
3632 |
||
3633 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 3634 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3635 |
^ self |
3892 | 3636 |
]. |
3989 | 3637 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3638 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3639 |
^ self |
3989 | 3640 |
]. |
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
3641 |
changedObject == self sortBlockProperty ifTrue:[ |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
3642 |
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
|
3643 |
^ self |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
3644 |
]. |
4011 | 3645 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3646 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3647 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3648 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3649 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3650 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3651 |
^ self |
4004 | 3652 |
]. |
4781 | 3653 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 3654 |
self notify:nil. |
4781 | 3655 |
^ self |
3656 |
]. |
|
3989 | 3657 |
|
3892 | 3658 |
super update:something with:aParameter from:changedObject |
5543 | 3659 |
! |
3660 |
||
6095 | 3661 |
updateCanMake |
3662 |
|dir can| |
|
3663 |
||
3664 |
can := false. |
|
3665 |
dir := self currentDirectory. |
|
3666 |
dir notNil ifTrue:[ |
|
3667 |
can := (dir asFilename construct:'Makefile') exists. |
|
3668 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
3669 |
can ifFalse:[ |
|
3670 |
can := (self currentDirectory asFilename construct:'nt.mak') exists. |
|
3671 |
] |
|
3672 |
]. |
|
3673 |
]. |
|
3674 |
self canMake value:can. |
|
3675 |
! |
|
3676 |
||
5543 | 3677 |
updateListAfterDelete:colOfFiles |
3678 |
self updateCurrentDirectory |
|
3892 | 3679 |
! ! |
3680 |
||
3681 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
3682 |
||
3683 |
canPaste |
|
3684 |
||
3685 |
^ self aspectFor:#canPaste ifAbsent:[ false asValue ]. |
|
3686 |
! |
|
3687 |
||
3688 |
clipboard |
|
3689 |
||
3690 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
3691 |
! |
|
3692 |
||
3693 |
copyFilesToClipBoard:colOfFiles |
|
3694 |
self putInClipBoard:colOfFiles as:#copy. |
|
3695 |
! |
|
3696 |
||
3697 |
cutFilesToClipBoard:colOfFiles |
|
3698 |
"defete current selected files/directories |
|
3699 |
" |
|
3700 |
self putInClipBoard:colOfFiles as:#cut. |
|
3701 |
! |
|
3702 |
||
3703 |
emptyClipBoard |
|
3704 |
||
3705 |
self clipboard files:nil. |
|
3706 |
self canPaste value:false. |
|
3707 |
! |
|
3708 |
||
3709 |
putInClipBoard:colOfFiles as:aSymbol |
|
3710 |
| stream clp| |
|
3711 |
||
3712 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
3713 |
clp := self clipboard. |
|
3714 |
clp files:nil. |
|
3715 |
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
|
3716 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3717 |
stream := String writeStream. |
3892 | 3718 |
stream nextPutAll:aSymbol asString. |
3719 |
stream nextPutAll:' <'. |
|
3720 |
stream nextPutAll:colOfFiles first asString. |
|
3721 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 3722 |
stream nextPutAll:' ...'. |
3892 | 3723 |
]. |
3724 |
stream nextPutAll:'> to clipboard'. |
|
3725 |
||
4523 | 3726 |
self notify:stream contents. |
3892 | 3727 |
stream close. |
3728 |
clp files:colOfFiles. |
|
3729 |
self canPaste value:true. |
|
3730 |
! ! |
|
3731 |
||
3732 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
3733 |
||
3734 |
canDropFiles:dropedObjects for:filename |
|
6284 | 3735 |
|filenameDirString filenameDir| |
3892 | 3736 |
|
3737 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 3738 |
|
3892 | 3739 |
filenameDir := self getDirWithoutFileName:filename. |
7491 | 3740 |
filenameDir isNil ifTrue:[^ false ]. |
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6236
diff
changeset
|
3741 |
filenameDir isWritable ifFalse:[^ false]. |
6284 | 3742 |
|
3892 | 3743 |
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
|
3744 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
3745 |
dropedObjects do:[:aDropObject | |
6284 | 3746 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
3747 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
3748 |
"/ |
|
3749 |
"/ dropFileName := aDropObject theObject. |
|
3750 |
"/ dropFileNameString := dropFileName asString. |
|
3751 |
"/ dropFileName isDirectory ifTrue:[ |
|
3752 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
3753 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
3754 |
"/ ^ false |
|
3755 |
"/ ] |
|
3756 |
"/ ] ifFalse:[ |
|
3757 |
"/ physicalPathName := dropFileName physicalPathName. |
|
3758 |
"/ (filenameDirString = dropFileName directory asString |
|
3759 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
3760 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
3761 |
"/ self notify:'Cannot drop a file into same directory'. |
|
3762 |
"/ ^ false |
|
3763 |
"/ ] |
|
3764 |
"/ ] |
|
3765 |
]. |
|
3766 |
self notify:nil. |
|
3767 |
^ true |
|
3768 |
! |
|
3769 |
||
3770 |
canDropObject:aDropObject into:aDirectory |
|
3771 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
3772 |
||
3773 |
dropFileName := aDropObject theObject. |
|
3774 |
dropFileNameString := dropFileName asString. |
|
3775 |
dropFileName isDirectory ifTrue:[ |
|
3776 |
filenameDirString := aDirectory asString. |
|
3777 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
3778 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
3779 |
^ false |
|
4414 | 3780 |
] |
6284 | 3781 |
] ifFalse:[ |
3782 |
physicalPathName := dropFileName physicalPathName. |
|
3783 |
(aDirectory = dropFileName directory |
|
3784 |
or:[ aDropObject isFileInArchive not |
|
3785 |
and:[physicalPathName notNil |
|
3786 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
3787 |
self notify:'Cannot drop a file into same directory'. |
|
3788 |
^ false |
|
3789 |
] |
|
3790 |
]. |
|
3791 |
^ true. |
|
3892 | 3792 |
! |
3793 |
||
7406 | 3794 |
canDropObjects:aCollectionOfDropObjects in:aWidget |
3795 |
^ aCollectionOfDropObjects contains:[:dropObject | dropObject isFileObject] |
|
3796 |
||
3797 |
"Created: / 13-10-2006 / 15:52:49 / cg" |
|
3798 |
! |
|
3799 |
||
3892 | 3800 |
doStartDrag:aDropSource in:aView |
7829 | 3801 |
"set the cursors before starting the drag & drop operation" |
3802 |
||
3892 | 3803 |
|hdl| |
3804 |
||
3805 |
hdl := DragAndDropManager new. |
|
3806 |
||
4337
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
3807 |
hdl disabledCursor:self class disabledCursorImage. |
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
3808 |
hdl enabledCursor:self class enabledCursorImage. |
3892 | 3809 |
hdl alienCursor:nil. |
3810 |
||
4745 | 3811 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft. |
3812 |
||
7829 | 3813 |
"Modified: / 23-07-2007 / 23:00:38 / cg" |
6479 | 3814 |
! |
3815 |
||
7408 | 3816 |
dropObjects:aCollectionOfDropObjects in:aWidget at:position |
7990 | 3817 |
|fileEntryFieldHolder destDir dropObject fn d| |
3818 |
||
3819 |
fileEntryFieldHolder := self masterApplication notNil |
|
3820 |
ifTrue:[ self masterApplication fileEntryFieldHolder ] |
|
3821 |
ifFalse:[ self fileEntryFieldHolder ]. |
|
3822 |
||
3823 |
aWidget model == fileEntryFieldHolder ifTrue:[ |
|
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
3824 |
dropObject := aCollectionOfDropObjects first. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
3825 |
dropObject isFileObject ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
3826 |
fn := dropObject theObject asFilename. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
3827 |
dropObject isDirectory ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
3828 |
d := fn. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
3829 |
] ifFalse:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
3830 |
d := fn directory. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
3831 |
]. |
7990 | 3832 |
fileEntryFieldHolder value:d pathName. |
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
3833 |
]. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
3834 |
^ self. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
3835 |
]. |
6479 | 3836 |
|
3837 |
destDir := self currentDirectory. |
|
3838 |
destDir isNil ifTrue:[^ self]. |
|
3839 |
||
8601 | 3840 |
self withWaitCursorDo:[ |
3841 |
aCollectionOfDropObjects do:[:dropObject | |
|
3842 |
|fn| |
|
3843 |
||
3844 |
dropObject isFileObject ifTrue:[ |
|
3845 |
fn := dropObject theObject asFilename. |
|
3846 |
dropObject isDirectory ifTrue:[ |
|
8808
cb6476c0cd3a
oops - drop of directories was broken
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
3847 |
fn recursiveCopyTo:destDir |
8601 | 3848 |
] ifFalse:[ |
8950
48c69259d82d
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
8887
diff
changeset
|
3849 |
fn copyTo:(destDir / fn baseName ) |
8601 | 3850 |
] |
6479 | 3851 |
] |
8601 | 3852 |
]. |
3853 |
]. |
|
9268
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
3854 |
self directoryContentsBrowser notNil ifTrue:[ |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
3855 |
self directoryContentsBrowser |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
3856 |
directoryContentsChangeFlag:true; |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
3857 |
wakeUp |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
3858 |
]. |
7408 | 3859 |
|
3860 |
"Created: / 13-10-2006 / 18:26:41 / cg" |
|
3892 | 3861 |
! ! |
3862 |
||
3863 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
3864 |
||
3865 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 3866 |
"copy to" |
3867 |
||
7635 | 3868 |
^ self copyFile:aSourceFile to:aDestFile repairCorruptedFiles:false |
3869 |
||
3870 |
"Modified: / 07-02-2007 / 18:46:44 / cg" |
|
3871 |
! |
|
3872 |
||
3873 |
copyFile:aSourceFile to:aDestFile repairCorruptedFiles:repairCorruptedFiles |
|
3874 |
"copy to" |
|
3875 |
||
3876 |
|copyOperation msg| |
|
3877 |
||
3878 |
repairCorruptedFiles ifTrue:[ |
|
3879 |
copyOperation := FileOperation copyCorruptedFile:aSourceFile to:aDestFile |
|
3880 |
] ifFalse:[ |
|
3881 |
copyOperation := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
|
3882 |
]. |
|
3883 |
copyOperation result ifTrue:[ |
|
6190 | 3884 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 3885 |
] ifFalse:[ |
7635 | 3886 |
msg := copyOperation errorString. |
6190 | 3887 |
]. |
3888 |
self notify:msg. |
|
7635 | 3889 |
^ copyOperation result |
3890 |
||
3891 |
"Created: / 07-02-2007 / 18:46:34 / cg" |
|
3892 | 3892 |
! |
3893 |
||
3894 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
6374 | 3895 |
|copy result| |
3892 | 3896 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
3897 |
self withActivityIndicationDo:[ |
5961 | 3898 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
6374 | 3899 |
copy result ifTrue:[ |
3900 |
result := Dictionary withKeys:(copy collectionOfCopiedFiles) andValues:(copy collectionOfNewFiles). |
|
3901 |
] ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3902 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3903 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
3904 |
self updateCurrentDirectory. |
3892 | 3905 |
]. |
6374 | 3906 |
^ result |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
3907 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
3908 |
"Modified: / 25-07-2006 / 09:07:04 / cg" |
3892 | 3909 |
! |
3910 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3911 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3912 |
|size stream msg answer file| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3913 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3914 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3915 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3916 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3917 |
"/ 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
|
3918 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3919 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3920 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3921 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3922 |
"/ 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
|
3923 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3924 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3925 |
"/ 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
|
3926 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3927 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3928 |
"/ 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
|
3929 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3930 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3931 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3932 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3933 |
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
|
3934 |
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
|
3935 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3936 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3937 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3938 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3939 |
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
|
3940 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3941 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 3942 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3943 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3944 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3945 |
request:msg |
8127 | 3946 |
label:(resources string:'Copy or Move') |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
3947 |
image:(WarningBox iconBitmap) |
8127 | 3948 |
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
|
3949 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3950 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3951 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3952 |
^ answer. |
3892 | 3953 |
! |
3954 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3955 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 3956 |
"copy or move aColOfSourceFiles to aDirectory. |
3957 |
Asks the used if a move or a copy is wanted. |
|
3958 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
3959 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3960 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3961 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3962 |
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
|
3963 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3964 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3965 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3966 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3967 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3968 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3969 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3970 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3971 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3972 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3973 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3974 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 3975 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3976 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3977 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3978 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3979 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3980 |
|
4745 | 3981 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3982 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3983 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3984 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 3985 |
^ true. |
3892 | 3986 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3987 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
3988 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 3989 |
^ true. |
3892 | 3990 |
]. |
4745 | 3991 |
^ false. |
3892 | 3992 |
! |
3993 |
||
6107 | 3994 |
copySelectionTo |
3995 |
"copy the selected file(s) to another directory" |
|
3996 |
||
7635 | 3997 |
self copySelectionToRepairingCorruptedFiles:false |
3998 |
||
3999 |
"Modified: / 07-02-2007 / 18:42:48 / cg" |
|
4000 |
! |
|
4001 |
||
4002 |
copySelectionToRepairingCorruptedFiles |
|
4003 |
"copy the selected file(s) to another directory" |
|
4004 |
||
4005 |
self copySelectionToRepairingCorruptedFiles:true |
|
4006 |
||
4007 |
"Created: / 07-02-2007 / 18:42:59 / cg" |
|
4008 |
! |
|
4009 |
||
4010 |
copySelectionToRepairingCorruptedFiles:repairingCorruptedFiles |
|
4011 |
"copy the selected file(s) to another directory" |
|
4012 |
||
6299 | 4013 |
|selectedFiles msg destination directory| |
4014 |
||
7560 | 4015 |
selectedFiles := self currentSelectedObjects copy. |
6299 | 4016 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
4017 |
||
4018 |
msg := (selectedFiles size > 1) |
|
4019 |
ifTrue:[ 'Copy Selected Items To Directory:' ] |
|
4020 |
ifFalse:[ 'Copy "%1" To Directory:' ]. |
|
4021 |
||
4022 |
destination := Dialog |
|
7635 | 4023 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first pathName) |
4024 |
default:(LastMoveDestination ? self currentDirectory) |
|
4025 |
ok:(resources string:'Copy') |
|
4026 |
abort:nil. |
|
4027 |
||
6299 | 4028 |
destination isEmptyOrNil ifTrue:[^ self]. |
4029 |
destination := destination asFilename. |
|
4030 |
||
4031 |
destination isDirectory ifFalse:[ |
|
4032 |
selectedFiles size == 1 ifTrue:[ |
|
4033 |
directory := destination directory. |
|
4034 |
directory isDirectory ifTrue:[ |
|
4035 |
LastMoveDestination := directory. |
|
7635 | 4036 |
self copyFile:selectedFiles first to:destination repairCorruptedFiles:repairingCorruptedFiles. |
6299 | 4037 |
^ self. |
4038 |
] |
|
4039 |
] |
|
4040 |
]. |
|
4041 |
||
4042 |
LastMoveDestination := destination. |
|
7635 | 4043 |
repairingCorruptedFiles ifTrue:[ |
4044 |
selectedFiles do:[:eachFile | |
|
4045 |
self copyFile:eachFile to:destination repairCorruptedFiles:repairingCorruptedFiles. |
|
4046 |
]. |
|
4047 |
^ self. |
|
4048 |
] ifFalse:[ |
|
4049 |
self copyFiles:selectedFiles to:destination |
|
4050 |
] |
|
4051 |
||
4052 |
"Created: / 07-02-2007 / 18:42:35 / cg" |
|
6107 | 4053 |
! |
4054 |
||
3892 | 4055 |
deleteFile:aFile |
6373 | 4056 |
"delete the selected files/directories" |
3892 | 4057 |
|
4058 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
4059 |
! |
|
4060 |
||
4061 |
deleteFiles:colOfFiles |
|
6373 | 4062 |
"delete some files/directories" |
4063 |
||
5081 | 4064 |
^ self deleteFiles:colOfFiles confirm:true. |
4065 |
! |
|
4066 |
||
4067 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 4068 |
"delete some files/directories" |
4069 |
||
5673 | 4070 |
|delete result| |
3892 | 4071 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4072 |
self withActivityIndicationDo:[ |
5961 | 4073 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
5673 | 4074 |
result := delete result. |
4075 |
result notNil ifTrue:[ |
|
4076 |
result ifFalse:[ |
|
4077 |
self notify:delete errorString. |
|
5753 | 4078 |
] ifTrue:[ |
4079 |
self updateListAfterDelete:colOfFiles. |
|
4080 |
] |
|
4394 | 4081 |
]. |
5673 | 4082 |
]. |
4083 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4084 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4085 |
"Modified: / 25-07-2006 / 09:07:13 / cg" |
3892 | 4086 |
! |
4087 |
||
6169 | 4088 |
eraseFiles:colOfFiles |
6373 | 4089 |
"erase (clear and delete) some files/directories" |
4090 |
||
6169 | 4091 |
^ self eraseFiles:colOfFiles confirm:true. |
4092 |
! |
|
4093 |
||
4094 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 4095 |
"erase (clear and delete) some files/directories" |
4096 |
||
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
4097 |
|deleteOperation result fileSize| |
6169 | 4098 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4099 |
self withActivityIndicationDo:[ |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
4100 |
fileSize := colOfFiles first asFilename fileSize. |
8294 | 4101 |
deleteOperation := FileOperation eraseFiles:colOfFiles confirm:confirm. |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
4102 |
(colOfFiles size == 1 and:[ fileSize < (10*1024*1024) ]) |
8294 | 4103 |
ifTrue:[ |
4104 |
result := deleteOperation result. |
|
4105 |
] ifFalse:[ |
|
4106 |
ProgressIndicator |
|
4107 |
displayProgressNotifications:'Erasing' |
|
4108 |
abortable:true |
|
4109 |
at:nil |
|
4110 |
during:[ |
|
4111 |
result := deleteOperation result. |
|
4112 |
]. |
|
4113 |
]. |
|
4114 |
||
6169 | 4115 |
result notNil ifTrue:[ |
4116 |
result ifFalse:[ |
|
8294 | 4117 |
self notify:deleteOperation errorString. |
6169 | 4118 |
] ifTrue:[ |
4119 |
self updateListAfterDelete:colOfFiles. |
|
4120 |
] |
|
4121 |
]. |
|
4122 |
]. |
|
4123 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4124 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4125 |
"Modified: / 25-07-2006 / 09:07:16 / cg" |
6169 | 4126 |
! |
4127 |
||
3892 | 4128 |
moveFile:aSourceFile to:aDestFile |
6373 | 4129 |
"move a file/directory" |
3892 | 4130 |
|
4131 |
|move| |
|
4132 |
||
5961 | 4133 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 4134 |
move result ifTrue:[ |
4523 | 4135 |
self notify:('move ', aSourceFile asString, ' to ', aDestFile asString). |
3892 | 4136 |
] ifFalse:[ |
4523 | 4137 |
self notify:move errorString. |
3892 | 4138 |
]. |
4139 |
self updateCurrentDirectory. |
|
4140 |
^ move result |
|
4141 |
! |
|
4142 |
||
4143 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 4144 |
"move some files to aDirectory" |
4145 |
||
3892 | 4146 |
|move| |
4147 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4148 |
self withActivityIndicationDo:[ |
5961 | 4149 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4150 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4151 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4152 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4153 |
self updateCurrentDirectory. |
3892 | 4154 |
]. |
6373 | 4155 |
^ move collectionOfMovedFiles |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4156 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4157 |
"Modified: / 25-07-2006 / 09:07:32 / cg" |
3892 | 4158 |
! |
4159 |
||
6107 | 4160 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4161 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4162 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4163 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4164 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4165 |
destinationDirectory := Dialog |
6352 | 4166 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items To:') |
5789 | 4167 |
default:(LastMoveDestination ? self currentDirectory) |
6952 | 4168 |
ok:(resources string:'Move') |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4169 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4170 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4171 |
|
5789 | 4172 |
LastMoveDestination := destinationDirectory. |
7560 | 4173 |
self moveFiles:(self currentSelectedObjects copy) to:destinationDirectory asFilename |
4174 |
||
4175 |
"Modified: / 04-12-2006 / 13:15:12 / cg" |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4176 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4177 |
|
3892 | 4178 |
newDirectory |
4179 |
"ask for and create a new directory" |
|
4180 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4181 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4182 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4183 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4184 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4185 |
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
|
4186 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
4187 |
]. |
4521 | 4188 |
|
4189 |
"/ 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
|
4190 |
selectedFiles := self currentSelectedFiles. |
4521 | 4191 |
selectedFiles size == 1 ifTrue:[ |
4192 |
singleSelectedFile := selectedFiles first. |
|
4193 |
||
4194 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
4195 |
(mime notNil and:[mime isArchive]) ifTrue:[ |
|
4196 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
|
4197 |
||
4198 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
4982
c38742d99bfd
care for nil mime in newDirectory
Claus Gittinger <cg@exept.de>
parents:
4979
diff
changeset
|
4199 |
(mime notNil and:[mime isArchive]) ifTrue:[ |
4521 | 4200 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
4201 |
]. |
|
4202 |
]. |
|
4203 |
]. |
|
4204 |
||
5961 | 4205 |
|
4521 | 4206 |
defaultAnswer notNil ifTrue:[ |
5961 | 4207 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 4208 |
] ifFalse:[ |
5961 | 4209 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 4210 |
]. |
4211 |
createOp result ifFalse:[ ^ self]. |
|
4212 |
newFile := createOp createdFile. |
|
3892 | 4213 |
newFile notNil ifTrue:[ |
4414 | 4214 |
self updateCurrentDirectory. |
3892 | 4215 |
] |
4216 |
! |
|
4217 |
||
4218 |
newFile |
|
4219 |
"ask for and create a new file" |
|
4220 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4221 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4222 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4223 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4224 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4225 |
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
|
4226 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
4227 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4228 |
|
3982 | 4229 |
curFile := self firstSelectedFile. |
3892 | 4230 |
curFile notNil ifTrue:[ |
4414 | 4231 |
file := curFile. |
3892 | 4232 |
] ifFalse:[ |
4414 | 4233 |
file := directory. |
3892 | 4234 |
]. |
5961 | 4235 |
create := FileOperation createFileIn:file. |
3892 | 4236 |
create result ifFalse:[ ^ self]. |
4237 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
4238 |
! |
|
4239 |
||
4240 |
newHardLink |
|
4241 |
"ask for and create a hard link (unix only)" |
|
4242 |
||
6151 | 4243 |
self newLink:#hard. |
4244 |
! |
|
4245 |
||
4246 |
newLink:typeOfLink |
|
3892 | 4247 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
4248 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4249 |
| sel dir create createdFile| |
3892 | 4250 |
|
7560 | 4251 |
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
|
4252 |
(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
|
4253 |
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
|
4254 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
4255 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4256 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4257 |
|
6151 | 4258 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 4259 |
create result ifFalse:[ ^ self]. |
4260 |
createdFile := create createdFile. |
|
4261 |
createdFile notNil ifTrue:[ |
|
6151 | 4262 |
typeOfLink == #soft ifTrue:[ |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
4263 |
self updateCurrentDirectory. |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
4264 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
4265 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
4266 |
] |
3892 | 4267 |
]. |
7560 | 4268 |
|
4269 |
"Modified: / 04-12-2006 / 13:15:15 / cg" |
|
3892 | 4270 |
! |
4271 |
||
4272 |
newSoftLink |
|
4273 |
"ask for and create a soft link (unix only)" |
|
4274 |
||
6151 | 4275 |
self newLink:#soft. |
3892 | 4276 |
! |
4277 |
||
4278 |
pasteFiles |
|
6373 | 4279 |
"paste from clipBoard" |
4280 |
||
4281 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 4282 |
|
4283 |
files := self clipboard files. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
4284 |
files isEmptyOrNil ifTrue:[ ^ self ]. |
6373 | 4285 |
|
4286 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
4287 |
||
3892 | 4288 |
buffer := self clipboard copy. |
3982 | 4289 |
directories := self currentSelectedDirectories. |
5880 | 4290 |
directories size ~~ 1 ifTrue:[ |
4414 | 4291 |
|box dirStringCol| |
5880 | 4292 |
|
4414 | 4293 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
4294 |
box := ListSelectionBox new. |
|
6373 | 4295 |
box title:'Paste into which directory ?'. |
4414 | 4296 |
box list:dirStringCol. |
4297 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
4298 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
4299 |
box destroy. |
3892 | 4300 |
] ifFalse:[ |
5880 | 4301 |
destination := directories anElement. |
3892 | 4302 |
]. |
6373 | 4303 |
|
4304 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 4305 |
buffer files copy do:[:aFile| |
4306 |
aFile directory = destination ifTrue:[ |
|
4307 |
buffer files remove:aFile. |
|
4308 |
]. |
|
4309 |
]. |
|
4310 |
]. |
|
4311 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6374 | 4312 |
copiedFiles notEmptyOrNil ifTrue:[ |
4313 |
thisIsAFileMoveOperation ifTrue:[ |
|
4314 |
self deleteFiles:(copiedFiles keys) confirm:false. |
|
4315 |
]. |
|
4316 |
||
4317 |
"/ select those pasted files. |
|
4318 |
self updateCurrentDirectory:true. |
|
4319 |
self currentFileNameHolder value:copiedFiles values. |
|
4320 |
] |
|
3892 | 4321 |
! |
4322 |
||
4323 |
renameFile:aFile |
|
4324 |
"rename the selected file(s)" |
|
4325 |
||
4326 |
^ self renameFiles:(OrderedCollection with:aFile). |
|
4327 |
! |
|
4328 |
||
4230 | 4329 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 4330 |
"rename filename to newFileString" |
4331 |
||
4332 |
|rename| |
|
4333 |
||
5961 | 4334 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 4335 |
rename result ifTrue:[ |
4230 | 4336 |
aBoolean ifTrue:[ |
4337 |
self updateAndSelect:(rename renamedFiles). |
|
4338 |
]. |
|
3892 | 4339 |
] ifFalse:[ |
4523 | 4340 |
self notify:rename errorString. |
3892 | 4341 |
]. |
4342 |
^ rename result |
|
4343 |
! |
|
4344 |
||
4345 |
renameFiles:aColOfFiles |
|
6373 | 4346 |
"rename some file(s)" |
3892 | 4347 |
|
4348 |
|rename| |
|
4349 |
||
5961 | 4350 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 4351 |
rename result ifFalse:[ |
4523 | 4352 |
self notify:rename errorString |
3892 | 4353 |
] ifTrue:[ |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4354 |
self updateAndSelect:nil. "/ (rename renamedFiles) |
3892 | 4355 |
]. |
4356 |
^ rename result |
|
4357 |
! |
|
4358 |
||
4359 |
renameSelection |
|
4360 |
"rename the selected file(s)" |
|
4361 |
||
7560 | 4362 |
self renameFiles:(self currentSelectedObjects copy) |
4363 |
||
4364 |
"Modified: / 04-12-2006 / 13:15:24 / cg" |
|
3892 | 4365 |
! ! |
4366 |
||
4080 | 4367 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 4368 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
4369 |
bookmarksMenu |
3952 | 4370 |
<resource: #programMenu> |
4371 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
4372 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
4373 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
4374 |
menu := self class baseBookmarksMenuSpec decodeAsLiteralArray. |
7763 | 4375 |
|
4376 |
"/ add the bookmark items ... |
|
4377 |
bookmarks := self class directoryBookmarks. |
|
4378 |
bookmarks notEmptyOrNil ifTrue:[ |
|
4379 |
menu addItem:(MenuItem labeled:'-'). |
|
4380 |
bookmarks do:[:dirName | |
|
4381 |
menu addItem:((MenuItem label:dirName asString value:[ |
|
4382 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
|
4383 |
self setCurrentFileName:dirName. |
|
4384 |
]. |
|
4385 |
])). |
|
4386 |
]. |
|
4387 |
]. |
|
4080 | 4388 |
menu findGuiResourcesIn:self. |
7763 | 4389 |
^ menu |
4390 |
||
4391 |
"Modified: / 27-03-2007 / 10:55:08 / cg" |
|
4392 |
! |
|
4393 |
||
4394 |
canBackward |
|
4395 |
^ self directoryHistory canBackward. |
|
4396 |
||
4397 |
"Modified: / 27-03-2007 / 10:54:55 / cg" |
|
4398 |
! |
|
4399 |
||
4400 |
canForward |
|
4401 |
^ self directoryHistory canForward. |
|
4402 |
||
4403 |
"Modified: / 27-03-2007 / 10:54:57 / cg" |
|
4404 |
! |
|
4405 |
||
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
4406 |
gotoBookmarksMenu |
7763 | 4407 |
<resource: #programMenu> |
4408 |
||
4409 |
|menu bookmarks| |
|
4410 |
||
4411 |
menu := self class baseBookmarksMenuSpec2 decodeAsLiteralArray. |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4412 |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
4413 |
"/ add the bookmark items ... |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4414 |
bookmarks := self class directoryBookmarks. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4415 |
bookmarks notEmptyOrNil ifTrue:[ |
4414 | 4416 |
menu addItem:(MenuItem labeled:'-'). |
4417 |
bookmarks do:[:dirName | |
|
4418 |
menu addItem:((MenuItem label:dirName asString value:[ |
|
6725 | 4419 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
5959 | 4420 |
self setCurrentFileName:dirName. |
4414 | 4421 |
]. |
4422 |
])). |
|
4423 |
]. |
|
3952 | 4424 |
]. |
7763 | 4425 |
menu findGuiResourcesIn:self. |
3952 | 4426 |
^ menu |
4427 |
||
7763 | 4428 |
"Modified: / 27-03-2007 / 10:54:50 / cg" |
6099 | 4429 |
! |
4430 |
||
3892 | 4431 |
menuDirHistory:backOrForward |
7763 | 4432 |
"initialize the history menu" |
4433 |
||
3892 | 4434 |
<resource: #programMenu > |
4435 |
||
7763 | 4436 |
|hist menu pathList currentSel currentPath| |
4437 |
||
4438 |
hist := self directoryHistory. |
|
4439 |
hist isEmpty ifTrue:[^ nil]. |
|
4440 |
||
3892 | 4441 |
backOrForward == #back ifTrue:[ |
6725 | 4442 |
currentSel := self currentSelectedDirectories. |
4347 | 4443 |
currentSel size == 1 ifTrue:[ |
4444 |
currentPath := currentSel first asString. |
|
4445 |
] ifFalse:[ |
|
4446 |
currentPath := nil. |
|
4447 |
]. |
|
7763 | 4448 |
pathList := hist getBackCollection. |
3892 | 4449 |
] ifFalse:[ |
7763 | 4450 |
pathList := hist getForwardCollection. |
3892 | 4451 |
]. |
4022 | 4452 |
pathList isEmpty ifTrue:[ ^ nil]. |
7763 | 4453 |
|
6370 | 4454 |
pathList size > 30 ifTrue:[ |
4455 |
pathList := pathList copyTo:30 |
|
4456 |
]. |
|
7763 | 4457 |
|
4458 |
menu := Menu new. |
|
4459 |
||
3964 | 4460 |
pathList do:[:aPath| |
4347 | 4461 |
| menuItem | |
4462 |
menuItem := MenuItem new. |
|
4463 |
menuItem label:aPath. |
|
4464 |
menuItem value:[ |
|
5959 | 4465 |
self setCurrentFileName:(aPath asFilename). |
4347 | 4466 |
]. |
4467 |
menu addItem:menuItem. |
|
3952 | 4468 |
]. |
7763 | 4469 |
menu findGuiResourcesIn:self. |
3892 | 4470 |
^ menu |
7763 | 4471 |
|
4472 |
"Modified: / 27-03-2007 / 10:54:29 / cg" |
|
3892 | 4473 |
! |
4474 |
||
4475 |
menuDirHistoryBack |
|
4476 |
"initialize the directory menu |
|
4477 |
" |
|
4478 |
<resource: #programMenu > |
|
4479 |
||
4480 |
^ self menuDirHistory:#back. |
|
4481 |
! |
|
4482 |
||
4483 |
menuDirHistoryForward |
|
4484 |
"initialize the directory menu |
|
4485 |
" |
|
4486 |
<resource: #programMenu > |
|
4487 |
||
4488 |
^ self menuDirHistory:#forward. |
|
3906 | 4489 |
! |
4490 |
||
4491 |
menuFileHistory |
|
4492 |
"initialize the file history menu |
|
4493 |
" |
|
4494 |
<resource: #programMenu > |
|
4495 |
||
7763 | 4496 |
|menu hist text removeItem| |
3906 | 4497 |
|
4498 |
hist := self fileHistory. |
|
4499 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
4500 |
|
7763 | 4501 |
menu := Menu new. |
4502 |
||
4503 |
hist copy do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
4504 |
aFileItem fileName exists ifTrue:[ |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
4505 |
menu addItem:(MenuItem label: aFileItem fileName asString value:[ |
5959 | 4506 |
self setCurrentFileName:(aFileItem fileName). |
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
4507 |
self openApplByFileItem:aFileItem |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
4508 |
]). |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
4509 |
] ifFalse:[ |
7763 | 4510 |
"/ remove all not existing history entries |
4511 |
hist remove:aFileItem. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
4512 |
] |
3906 | 4513 |
]. |
7763 | 4514 |
menu addSeparator. |
4515 |
||
4080 | 4516 |
removeItem := MenuItem new. |
4517 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
4518 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
4519 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 4520 |
removeItem label:text. |
4521 |
removeItem value:[ |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
4522 |
self fileHistory removeAll. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
4523 |
self enableFileHistory value:false. |
3906 | 4524 |
]. |
4525 |
menu addItem:removeItem. |
|
7763 | 4526 |
menu findGuiResourcesIn:self. |
3906 | 4527 |
^ menu |
7763 | 4528 |
|
4529 |
"Modified: / 27-03-2007 / 10:52:40 / cg" |
|
3952 | 4530 |
! |
4531 |
||
4080 | 4532 |
sortMenu |
4533 |
<resource: #programMenu > |
|
4534 |
||
4535 |
|menu| |
|
4536 |
||
7763 | 4537 |
menu := Menu decodeFromLiteralArray:self class sortMenu. |
4080 | 4538 |
menu findGuiResourcesIn:self. |
4539 |
^ menu |
|
7763 | 4540 |
|
4541 |
"Modified: / 27-03-2007 / 10:47:42 / cg" |
|
4080 | 4542 |
! |
4543 |
||
4544 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4545 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4546 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4547 |
specHere := self class viewDetailsMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4548 |
itemsHere := specHere at:2. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4549 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4550 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4551 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4552 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4553 |
spec := specHere copy. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4554 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4555 |
^ spec |
4080 | 4556 |
! |
4557 |
||
4558 |
viewInContentsBrowserMenu |
|
5009 | 4559 |
self |
4560 |
applicationNamed:#DirectoryContentsBrowser |
|
4561 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
4562 |
||
4563 |
^ nil. |
|
4080 | 4564 |
! |
4565 |
||
3952 | 4566 |
visitedDirectoriesMenu |
4567 |
<resource: #programMenu > |
|
4568 |
||
4569 |
|menu histCopy text removeItem| |
|
4570 |
||
7763 | 4571 |
histCopy := self directoryHistory. |
4572 |
histCopy isEmpty ifTrue:[^ nil]. |
|
4573 |
||
3952 | 4574 |
menu := Menu new. |
7763 | 4575 |
|
4576 |
histCopy do:[:aFile| |
|
4577 |
menu addItem:(MenuItem label:aFile asString value:[ |
|
4578 |
self setCurrentFileName:(aFile path asFilename). |
|
4579 |
]). |
|
4580 |
]. |
|
4581 |
menu addSeparator. |
|
4582 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
4583 |
"/ 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
|
4584 |
text := (resources string:'Clear History'). |
3952 | 4585 |
removeItem := MenuItem new. |
4040 | 4586 |
removeItem translateLabel:true. |
3952 | 4587 |
removeItem label:text. |
4588 |
removeItem value:[ |
|
6369 | 4589 |
self directoryHistory removeAll. |
4347 | 4590 |
self enableForward value:self canForward. |
4591 |
self enableBack value:self canBackward. |
|
3952 | 4592 |
]. |
7763 | 4593 |
|
3952 | 4594 |
menu addItem:removeItem. |
7763 | 4595 |
menu findGuiResourcesIn:self. |
3952 | 4596 |
^ menu |
7763 | 4597 |
|
4598 |
"Modified: / 27-03-2007 / 10:50:39 / cg" |
|
3892 | 4599 |
! ! |
4600 |
||
5880 | 4601 |
!AbstractFileBrowser methodsFor:'menu actions'! |
4602 |
||
4603 |
doCompareTwoFiles |
|
4604 |
self openDiffView. |
|
4605 |
! |
|
4606 |
||
4607 |
doGoDirectoryUp |
|
5960 | 4608 |
| upDir directory rootInTreeView| |
5880 | 4609 |
|
4610 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
4611 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 4612 |
directory := self currentDirectory. |
4613 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 4614 |
] ifFalse:[ |
4615 |
rootInTreeView := self |
|
4616 |
applicationNamed:#DirectoryTreeBrowser |
|
4617 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 4618 |
directory := rootInTreeView value asFilename. |
4619 |
]. |
|
4620 |
upDir := directory directory. |
|
5959 | 4621 |
self setCurrentFileName:upDir. |
5880 | 4622 |
! |
4623 |
||
4624 |
doGotoDefaultDirectory |
|
4625 |
self gotoFile:(Filename defaultDirectory). |
|
4626 |
! |
|
4627 |
||
8091 | 4628 |
doGotoDesktopDirectory |
4629 |
self gotoFile:(Filename desktopDirectory). |
|
4630 |
! |
|
4631 |
||
5880 | 4632 |
doGotoHomeDirectory |
8091 | 4633 |
self gotoFile:(Filename homeDirectory). |
5880 | 4634 |
! |
4635 |
||
6434 | 4636 |
doGotoSmalltalkDirectory |
4637 |
self gotoFile:(self smalltalkDirectory). |
|
4638 |
! |
|
4639 |
||
5880 | 4640 |
fileGetInfo:longInfo |
4641 |
"get info on selected file - show it in a box" |
|
4642 |
||
4643 |
|string box updater| |
|
4644 |
||
4645 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
4646 |
string notNil ifTrue:[ |
|
4647 |
box := InfoBox title:string. |
|
4648 |
updater := [ |
|
4649 |
[true] whileTrue:[ |
|
4650 |
Delay waitForSeconds:2. |
|
4651 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
4652 |
string isNil ifTrue:[ ^ self]. |
|
4653 |
box title:string |
|
4654 |
] |
|
4655 |
] fork. |
|
4656 |
box show. |
|
4657 |
updater terminate. |
|
4658 |
box destroy |
|
4659 |
] |
|
6434 | 4660 |
! |
4661 |
||
4662 |
smalltalkDirectory |
|
8590 | 4663 |
|stxPath| |
6434 | 4664 |
|
4665 |
stxPath := OperatingSystem pathOfSTXExecutable. |
|
8590 | 4666 |
stxPath isNil ifTrue:[ |
4667 |
^ Filename currentDirectory |
|
4668 |
]. |
|
4669 |
^ stxPath asFilename directory. |
|
5880 | 4670 |
! ! |
4671 |
||
4849 | 4672 |
!AbstractFileBrowser methodsFor:'menu actions-cvs'! |
3892 | 4673 |
|
4674 |
cvsAddAndCommit |
|
4849 | 4675 |
self cvsAddAndCommitAsBinary:false |
4676 |
! |
|
4677 |
||
4678 |
cvsAddAndCommitAsBinary:asBinary |
|
8588 | 4679 |
|sel log logArg binArg cmd dir executionBlock nameString| |
3892 | 4680 |
|
4681 |
log := Dialog |
|
4849 | 4682 |
requestText:(resources string:'Enter initial log message') |
4414 | 4683 |
lines:10 |
4684 |
columns:70 |
|
4685 |
initialAnswer:nil. |
|
8322
cf10f08b6164
care for cancel in #cvsAddAndCommitAsBinary:
Claus Gittinger <cg@exept.de>
parents:
8294
diff
changeset
|
4686 |
log isNil ifTrue:[^ self]. |
3892 | 4687 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4688 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4689 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4690 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4691 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4692 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4693 |
|
8588 | 4694 |
binArg := ''. |
4695 |
asBinary ifTrue:[ |
|
4696 |
binArg := '-kb '. |
|
4697 |
]. |
|
3982 | 4698 |
sel := self currentSelectedFiles. |
3892 | 4699 |
executionBlock := [ : stream | |
4414 | 4700 |
log notNil ifTrue:[ |
4701 |
sel size > 0 ifTrue:[ |
|
4702 |
sel do:[:fn | |
|
8567
bcbadc9d40c3
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8563
diff
changeset
|
4703 |
|nameArg| |
bcbadc9d40c3
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8563
diff
changeset
|
4704 |
|
bcbadc9d40c3
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8563
diff
changeset
|
4705 |
nameArg := '"',fn baseName,'"'. |
bcbadc9d40c3
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8563
diff
changeset
|
4706 |
|
4414 | 4707 |
dir := self getDirWithoutFileName:fn. |
8588 | 4708 |
cmd := 'cvs add ',logArg,' ',binArg,nameArg. |
6204 | 4709 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
4849 | 4710 |
|
8567
bcbadc9d40c3
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8563
diff
changeset
|
4711 |
cmd := ('cvs commit -l ',logArg,' ',nameArg). |
6204 | 4712 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
8588 | 4713 |
"/ mhmh - it seems that only old CVS implementations (at least turqoise) |
4714 |
"/ support and need the 'admin -kb' command. |
|
4715 |
"/ 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
|
4716 |
asBinary ifTrue:[ |
8567
bcbadc9d40c3
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8563
diff
changeset
|
4717 |
cmd := ('cvs admin -kb ' , nameArg). |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4718 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4719 |
|
8567
bcbadc9d40c3
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8563
diff
changeset
|
4720 |
cmd := ('cvs upd ' , nameArg). |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4721 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4722 |
]. |
4414 | 4723 |
] |
4724 |
] |
|
4725 |
] |
|
3892 | 4726 |
]. |
4107 | 4727 |
nameString := 'Command> cvs add and commit'. |
3892 | 4728 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4729 |
! |
|
4730 |
||
4849 | 4731 |
cvsAddBinaryAndCommit |
4732 |
self cvsAddAndCommitAsBinary:true |
|
4733 |
! |
|
4734 |
||
3892 | 4735 |
cvsCommit |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4736 |
|nSel log logArg msg cmd selectedFiles sel executionBlock nameString| |
3892 | 4737 |
|
3982 | 4738 |
selectedFiles:= self currentSelectedFiles. |
3892 | 4739 |
nSel := selectedFiles size. |
4740 |
||
4741 |
nSel == 1 ifTrue:[ |
|
8440 | 4742 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(selectedFiles first baseName) |
3892 | 4743 |
] ifFalse:[ |
4414 | 4744 |
nSel > 1 ifTrue:[ |
6627 | 4745 |
msg := resources string:'Enter log message for %1 files to checkIn' with:nSel printString |
4414 | 4746 |
] ifFalse:[ |
6627 | 4747 |
msg := resources string:'Enter log message for checkIn' |
4414 | 4748 |
] |
3892 | 4749 |
]. |
4750 |
||
4751 |
log := Dialog |
|
4414 | 4752 |
requestText:msg |
4753 |
lines:10 |
|
4754 |
columns:70 |
|
4755 |
initialAnswer:nil. |
|
3892 | 4756 |
|
4663 | 4757 |
log isNil ifTrue:[^ self]. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4758 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4759 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4760 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4761 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4762 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4763 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4764 |
|
7560 | 4765 |
sel := self currentSelectedObjects. |
4663 | 4766 |
sel isEmpty ifTrue:[ ^ self ]. |
7560 | 4767 |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4768 |
executionBlock := [:stream | |
4663 | 4769 |
log notNil ifTrue:[ |
4770 |
sel size > 0 ifTrue:[ |
|
4771 |
sel do:[:fn | |
|
8568
fe221c53eead
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8567
diff
changeset
|
4772 |
| dir nameArg | |
fe221c53eead
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8567
diff
changeset
|
4773 |
|
fe221c53eead
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8567
diff
changeset
|
4774 |
nameArg := '"',fn baseName,'"'. |
4663 | 4775 |
dir := fn directory. |
8568
fe221c53eead
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8567
diff
changeset
|
4776 |
cmd := 'cvs commit ',logArg,' ' , nameArg. |
6204 | 4777 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
4663 | 4778 |
] |
4779 |
] |
|
4780 |
] |
|
4107 | 4781 |
]. |
4782 |
nameString := 'Command> cvs commit'. |
|
4783 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
7560 | 4784 |
|
4785 |
"Modified: / 04-12-2006 / 13:16:39 / cg" |
|
3892 | 4786 |
! |
4787 |
||
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
4788 |
cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
4789 |
|selectedFiles| |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
4790 |
|
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
4791 |
selectedFiles:= self currentSelectedFiles. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
4792 |
selectedFiles do:[:each | |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
4793 |
self halt. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
4794 |
]. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
4795 |
! |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
4796 |
|
3892 | 4797 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
4798 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
4799 |
||
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4800 |
|toRemove updateRunning executionBlock nameString| |
3892 | 4801 |
|
4802 |
updateRunning := self backgroundProcesses value notEmpty. |
|
4803 |
self killAllRunningBackgroundProcesses. |
|
4804 |
toRemove := OrderedCollection new. |
|
4805 |
||
4806 |
executionBlock := [ : stream | |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4807 |
|cmd logArg| |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4808 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4809 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4810 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4811 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4812 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4813 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4814 |
|
4414 | 4815 |
filesToRemove do:[:fileName | |
4816 |
OperatingSystem accessDeniedErrorSignal handle:[:ex| |
|
4817 |
"was not able to remove it" |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4818 |
| lastError msg | |
4414 | 4819 |
lastError := OperatingSystem lastErrorString. |
4820 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
4821 |
lastError isNil ifFalse:[ |
|
4822 |
msg := msg , '\\(' , lastError , ')' |
|
4823 |
]. |
|
4824 |
Dialog warn:msg withCRs |
|
4825 |
] do:[ |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6236
diff
changeset
|
4826 |
(fileName isSymbolicLink) ifFalse:[ |
4414 | 4827 |
fileName remove. |
8568
fe221c53eead
allow checkin of files with a space
Claus Gittinger <cg@exept.de>
parents:
8567
diff
changeset
|
4828 |
cmd := ('cvs remove -f "',fileName baseName,'"'). |
6204 | 4829 |
(self getExecutionBlockForCommand:cmd) value:stream. |
4414 | 4830 |
] |
4831 |
]. |
|
4832 |
]. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
4833 |
cmd := 'cvs commit -l ',logArg. |
6204 | 4834 |
(self getExecutionBlockForCommand:cmd) value:stream. |
3892 | 4835 |
]. |
4107 | 4836 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
3892 | 4837 |
filesToRemove size > 1 ifTrue:[ |
4414 | 4838 |
nameString := nameString, ' ...'. |
3892 | 4839 |
]. |
4840 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
4841 |
! |
|
4842 |
||
4843 |
cvsRemoveFileAndCVSContainer |
|
4844 |
|sel question aswer| |
|
4845 |
||
4294 | 4846 |
sel := self currentSelectedFiles copy. |
3892 | 4847 |
sel size > 0 ifTrue:[ |
4294 | 4848 |
sel size > 1 ifTrue:[ |
4849 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:(sel size) |
|
4850 |
] ifFalse:[ |
|
4851 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(sel first baseName allBold) |
|
4852 |
]. |
|
4853 |
||
4854 |
aswer := Dialog |
|
4855 |
confirm:question withCRs |
|
6627 | 4856 |
yesLabel:(resources string:'Remove') |
4857 |
noLabel:(resources string:'Cancel'). |
|
4294 | 4858 |
aswer ifTrue:[ |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4859 |
self withActivityIndicationDo:[ |
4294 | 4860 |
self cvsRemoveAndRemoveFromCVS:sel |
4861 |
] |
|
4862 |
] |
|
3892 | 4863 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4864 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4865 |
"Modified: / 25-07-2006 / 09:07:09 / cg" |
3892 | 4866 |
! |
4867 |
||
9338 | 4868 |
cvsRevisionLog |
4869 |
| cmd sel executionBlock nameString| |
|
4870 |
||
4871 |
sel := self currentSelectedObjects. |
|
4872 |
sel isEmpty ifTrue:[ ^ self ]. |
|
4873 |
||
4874 |
executionBlock := [:stream | |
|
4875 |
sel do:[:fn | |
|
4876 |
| dir nameArg | |
|
4877 |
||
4878 |
nameArg := '"',fn baseName,'"'. |
|
4879 |
dir := fn directory. |
|
4880 |
cmd := 'cvs log ' , nameArg. |
|
4881 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
4882 |
] |
|
4883 |
]. |
|
4884 |
nameString := 'Command> cvs log'. |
|
4885 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
4886 |
! |
|
4887 |
||
8562 | 4888 |
cvsTagSelection |
4889 |
|tag stream cmd| |
|
4890 |
||
4891 |
tag := Dialog request:(resources string:'Tag:'). |
|
4892 |
||
4893 |
CVSSourceCodeManager notNil ifTrue:[ |
|
4894 |
cmd := CVSSourceCodeManager cvsExecutable. |
|
4895 |
] ifFalse:[ |
|
4896 |
cmd := 'cvs'. |
|
4897 |
]. |
|
4898 |
||
4899 |
stream := WriteStream on:''. |
|
4900 |
stream |
|
4901 |
nextPutAll:cmd; |
|
4902 |
nextPutAll:' tag -F '; |
|
4903 |
nextPutAll:'"'; |
|
4904 |
nextPutAll:tag; |
|
8563 | 4905 |
nextPutAll:'" '; |
4906 |
nextPutAll:(self makeFileNameArgumentString). |
|
4907 |
||
8562 | 4908 |
self executeCommand:stream contents. |
4909 |
! |
|
4910 |
||
3892 | 4911 |
cvsUpdateAll |
4912 |
| cmd | |
|
4913 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4914 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4915 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4916 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4917 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4918 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4919 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4920 |
self executeCommand:(cmd, ' upd -l'). |
3892 | 4921 |
! |
4922 |
||
4923 |
cvsUpdateAllRecursive |
|
4924 |
| cmd | |
|
4925 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4926 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4927 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4928 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4929 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4930 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4931 |
self executeCommand:(cmd, ' upd -d'). |
3892 | 4932 |
! |
4933 |
||
4934 |
cvsUpdateSelection |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4935 |
|stream cmd| |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4936 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4937 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4938 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4939 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4940 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4941 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4942 |
|
3892 | 4943 |
stream := WriteStream on:''. |
8563 | 4944 |
stream |
4945 |
nextPutAll:cmd; |
|
4946 |
nextPutAll:' upd '; |
|
4947 |
nextPutAll:(self makeFileNameArgumentString). |
|
4948 |
||
4949 |
self executeCommand:stream contents. |
|
4950 |
! |
|
4951 |
||
4952 |
makeFileNameArgumentString |
|
4953 |
|stream| |
|
4954 |
||
4955 |
stream := WriteStream on:''. |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
4956 |
self currentSelectedFiles do:[: file | |
8563 | 4957 |
stream nextPut:$". |
4414 | 4958 |
stream nextPutAll:file baseName. |
8563 | 4959 |
stream nextPutAll:'" '. |
4960 |
]. |
|
4961 |
^ stream contents. |
|
3892 | 4962 |
! ! |
4963 |
||
6169 | 4964 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
3892 | 4965 |
|
4453
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4966 |
copyFiles |
6169 | 4967 |
self |
4968 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
4453
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4969 |
! |
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4970 |
|
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4971 |
cutFiles |
6169 | 4972 |
self |
4973 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
4453
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4974 |
! |
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4975 |
|
00e639bf2723
cut and copy files in toolbarmenu goes not to contentsbrowser only
penk
parents:
4432
diff
changeset
|
4976 |
deleteFiles |
6169 | 4977 |
self |
4978 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
4979 |
! |
|
4980 |
||
4981 |
eraseFiles |
|
4982 |
self |
|
4983 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
4940
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4984 |
! |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4985 |
|
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4986 |
openSettingsDialog |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4987 |
|dialog| |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4988 |
|
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4989 |
dialog := FileBrowserV2SettingsDialog new. |
5034 | 4990 |
dialog settingsDialog:self. |
4940
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4991 |
dialog allButOpen. |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4992 |
dialog doReload. |
4964068c4718
allow settings dialog to be opened from browser
Claus Gittinger <cg@exept.de>
parents:
4930
diff
changeset
|
4993 |
dialog openWindow |
6169 | 4994 |
! |
4995 |
||
4996 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
4997 |
|files dirs| |
|
4998 |
||
4999 |
files := self currentSelectedFiles. |
|
5000 |
files notEmpty ifTrue:[ |
|
5001 |
aBlock value:files. |
|
5002 |
] ifFalse:[ |
|
5003 |
dirs := self currentSelectedDirectories. |
|
5004 |
dirs notEmpty ifTrue:[ |
|
5005 |
aBlock value:dirs. |
|
5006 |
]. |
|
5007 |
]. |
|
3892 | 5008 |
! ! |
5009 |
||
4849 | 5010 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
5011 |
||
5012 |
openAboutThisApplication |
|
5013 |
"opens an about box for this application." |
|
5014 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5015 |
Dialog aboutClass:self class. |
4849 | 5016 |
! |
5017 |
||
5018 |
openHTMLDocument:relativeDocPath |
|
5019 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
5020 |
! ! |
|
5021 |
||
5022 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
|
3892 | 5023 |
|
8510 | 5024 |
allFilesInSelectedDirectoriesForWhich:aBlock |
5025 |
|directories allFiles| |
|
5026 |
||
5027 |
directories := self currentSelectedDirectories. |
|
5028 |
directories isEmpty ifTrue:[^ self]. |
|
5029 |
||
5030 |
allFiles := OrderedCollection new. |
|
5031 |
directories do:[:dir| |
|
5032 |
[ |
|
5033 |
|fileNames| |
|
5034 |
||
5035 |
fileNames := dir directoryContents. |
|
5036 |
fileNames notNil ifTrue:[ |
|
5037 |
fileNames := fileNames |
|
5038 |
collect:[:fn | dir construct:fn] |
|
5039 |
thenSelect:[:fn | fn isDirectory not and:[aBlock value:fn]]. |
|
5040 |
allFiles addAll:fileNames. |
|
5041 |
] |
|
5042 |
] on:FileStream openErrorSignal do:[:ex| |
|
5043 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
|
5044 |
with:ex pathName |
|
5045 |
with:ex description). |
|
5046 |
ex proceedWith:nil. |
|
5047 |
]. |
|
5048 |
]. |
|
5049 |
||
5050 |
^ allFiles |
|
5051 |
! |
|
5052 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5053 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5054 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5055 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5056 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5057 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5058 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5059 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5060 |
"/ 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
|
5061 |
"/ 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
|
5062 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5063 |
conv := OrderedCollection new. |
4722 | 5064 |
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
|
5065 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5066 |
outSuffix = 'png' ifTrue:[ |
4722 | 5067 |
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
|
5068 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5069 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5070 |
outSuffix = 'gif' ifTrue:[ |
4722 | 5071 |
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
|
5072 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5073 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5074 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 5075 |
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
|
5076 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5077 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5078 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 5079 |
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
|
5080 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5081 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5082 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5083 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5084 |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5085 |
convertImageFrom:fileName to:outFile onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5086 |
|writer image outSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5087 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5088 |
outSuffix := outFile suffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5089 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5090 |
((writer := MIMETypes imageReaderForSuffix:outSuffix) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5091 |
and:[ (image := Image fromFile:fileName) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5092 |
and:[ writer canRepresent:image ]]) ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5093 |
"/ can do it with Smalltalk tools |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5094 |
writer save:image onFile:outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5095 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5096 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5097 |
"/ use external tools (pbm-package, if available) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5098 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5099 |
convertImageUsingExternalFileToolsFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5100 |
toSuffix:outSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5101 |
onError:exceptionBlock. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5102 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5103 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5104 |
"Created: / 20-05-2010 / 11:12:36 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5105 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5106 |
|
4367 | 5107 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5108 |
self convertImageToSuffix:'gif' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5109 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5110 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5111 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5112 |
self convertImageToSuffix:'jpg' |
4531 | 5113 |
! |
5114 |
||
5115 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5116 |
self convertImageToSuffix:'png' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5117 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5118 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5119 |
convertImageToSuffix:outSuffix |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5120 |
|outFile filesToConvert| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5121 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5122 |
self withActivityIndicationDo:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5123 |
filesToConvert := self currentSelectedObjects copy. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5124 |
filesToConvert do:[:fileName | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5125 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5126 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5127 |
fileName isDirectory ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5128 |
|skip| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5129 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5130 |
skip := false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5131 |
outFile := fileName withSuffix:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5132 |
outFile exists ifTrue:[ |
4722 | 5133 |
|answer| |
5134 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5135 |
answer := Dialog |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5136 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5137 |
default:false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5138 |
answer isNil ifTrue:[AbortSignal raise]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5139 |
answer ifFalse:[ skip := true ]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5140 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5141 |
skip ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5142 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5143 |
convertImageFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5144 |
to:outFile |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5145 |
onError:[:errMsg | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5146 |
filesToConvert size == 1 ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5147 |
Dialog warn:errMsg |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5148 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5149 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5150 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5151 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5152 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5153 |
]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5154 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5155 |
self updateAndSelect:nil. |
4367 | 5156 |
] |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5157 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5158 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5159 |
self notify:nil. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5160 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5161 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5162 |
"Modified: / 20-05-2010 / 11:15:35 / cg" |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5163 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5164 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5165 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
5166 |
self convertImageToSuffix:'xpm' |
4367 | 5167 |
! |
5168 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5169 |
convertImageUsingExternalFileToolsFrom:fileName toSuffix:outSuffix onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5170 |
|inFile outFile chainOfConversions conversionStream tempFileTemplate |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5171 |
eachConversionSuffixCommandPair eachConversionCommand eachConversionSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5172 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5173 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5174 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5175 |
chainOfConversions isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5176 |
self warn:('Don''t know how to convert from %1 to %2' bindWith:fileName suffix with:outSuffix). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5177 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5178 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5179 |
conversionStream := chainOfConversions readStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5180 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5181 |
tempFileTemplate := Filename newTemporary. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5182 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5183 |
inFile := fileName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5184 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5185 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5186 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5187 |
eachConversionCommand == #readToXPM ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5188 |
|image tempFileXPM| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5189 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5190 |
image := Image fromFile:(inFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5191 |
image isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5192 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5193 |
^ false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5194 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5195 |
tempFileXPM := tempFileTemplate withSuffix:'xpm'. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5196 |
image saveOn:tempFileXPM using:XPMReader. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5197 |
inFile := tempFileXPM. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5198 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5199 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5200 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5201 |
[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5202 |
|command errOutput errMsg| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5203 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5204 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5205 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5206 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5207 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5208 |
self notify:(resources string:'Converting: %1 to %2...' with:fileName baseName with:eachConversionSuffix). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5209 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5210 |
outFile := tempFileTemplate withSuffix:eachConversionSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5211 |
command := eachConversionCommand |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5212 |
bindWith:(inFile pathName) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5213 |
with:(outFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5214 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5215 |
errOutput := String writeStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5216 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5217 |
(OperatingSystem executeCommand:command errorTo:errOutput) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5218 |
errMsg := resources |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5219 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5220 |
with:inFile baseName allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5221 |
with:eachConversionSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5222 |
with:eachConversionCommand allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5223 |
with:errOutput contents. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5224 |
exceptionBlock value:errMsg. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5225 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5226 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5227 |
outFile delete. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5228 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5229 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5230 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5231 |
inFile := outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5232 |
eachConversionSuffixCommandPair := conversionStream next |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5233 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5234 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5235 |
] ifCurtailed:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5236 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5237 |
outFile delete. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5238 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5239 |
^ true. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5240 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5241 |
"Created: / 20-05-2010 / 11:05:50 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5242 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
5243 |
|
3892 | 5244 |
createProjectAndOpenProjectBrowser |
5245 |
|nm f s directory| |
|
5246 |
||
5247 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 5248 |
directory := self currentDirectory. |
3892 | 5249 |
nm := directory baseName. |
5250 |
f := (directory construct:nm) withSuffix:'prj'. |
|
5251 |
f exists ifTrue:[ |
|
4414 | 5252 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
5253 |
^ self. |
|
3892 | 5254 |
]. |
5255 |
s := f writeStream. |
|
5256 |
s nextPutAll:' |
|
5257 |
name ''' , nm , ''' |
|
5258 |
type #classLibrary |
|
5259 |
package #''private:' , nm , ''' |
|
5260 |
prerequisites nil |
|
5261 |
||
5262 |
classes #( ) |
|
5263 |
'. |
|
5264 |
s close. |
|
5265 |
ProjectBrowser openOnFile:f. |
|
5266 |
! |
|
5267 |
||
5880 | 5268 |
doExecuteCommand |
5269 |
"execute an OperatingSystem-command" |
|
5270 |
||
5271 |
| action fileName| |
|
5272 |
||
5273 |
fileName := self firstSelectedFile. |
|
5274 |
action := [:command | |
|
5275 |
self addToCommandHistory:command for:fileName. |
|
5276 |
self executeCommand:command. |
|
5277 |
]. |
|
5278 |
self askForCommandFor:fileName thenDo:action |
|
5279 |
! |
|
5280 |
||
5281 |
doExecuteScript |
|
5282 |
"execute a smalltalk script" |
|
5283 |
||
5284 |
|textHolder dialog template dummyClass dummyInstance| |
|
5285 |
||
5286 |
template := |
|
5287 |
'"/ Smalltalk script: |
|
5288 |
||
5289 |
"/ the following variables are accessable: |
|
5290 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
|
5291 |
"/ selectedFiles (= ...) |
|
5292 |
"/ |
|
5293 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
5294 |
"/ |
|
5295 |
"/ Useful operations are: |
|
5296 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
5297 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
5298 |
"/ directory directory |
|
5299 |
"/ |
|
5300 |
"/ example: move all files which match a aarticular pattern to |
|
5301 |
"/ a separate directory: |
|
5302 |
"/ |
|
5303 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
5304 |
"/ |
|
5305 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
5306 |
"/ |
|
5307 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
5308 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
5309 |
"/ idx := eachBaseNameString indexOf:$_. |
|
5310 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
5311 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
5312 |
"/ newDir := directory construct:prefix. |
|
5313 |
"/ newDir exists ifFalse:[ |
|
5314 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
5315 |
"/ newDir makeDirectory. |
|
5316 |
"/ ]. |
|
5317 |
"/ ]. |
|
5318 |
"/ newDir exists ifTrue:[ |
|
5319 |
"/ oldFile := directory construct:eachBaseNameString. |
|
5320 |
"/ newFile := newDir construct:rest. |
|
5321 |
"/ oldFile moveTo:newFile |
|
5322 |
"/ ] |
|
5323 |
"/ ] |
|
5324 |
"/ ] |
|
5325 |
'. |
|
5326 |
||
5327 |
LastScriptBlockString isNil ifTrue:[ |
|
5328 |
LastScriptBlockString := template. |
|
5329 |
]. |
|
5330 |
||
5331 |
textHolder := ValueHolder new. |
|
5332 |
dialog := Dialog |
|
5333 |
forRequestText:(resources string:'Enter script') |
|
5334 |
editViewClass:CodeView |
|
5335 |
lines:25 |
|
5336 |
columns:70 |
|
5337 |
initialAnswer:LastScriptBlockString |
|
5338 |
model:textHolder. |
|
5339 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
5340 |
dialog open. |
|
5341 |
dialog accepted ifFalse:[^ self]. |
|
5342 |
||
5343 |
LastScriptBlockString := textHolder value. |
|
5344 |
||
5345 |
Class classConventionViolationConfirmationQuerySignal |
|
5346 |
answer:true |
|
5347 |
do:[ |
|
5348 |
dummyClass := Object class |
|
5349 |
name:#Dummy |
|
5350 |
inEnvironment:nil |
|
5351 |
subclassOf:Object |
|
5352 |
instanceVariableNames:'directory selectedFiles' |
|
5353 |
variable:false |
|
5354 |
words:true |
|
5355 |
pointers:true |
|
5356 |
classVariableNames:'' |
|
5357 |
poolDictionaries:'' |
|
5358 |
category:#dummyCategory |
|
5359 |
comment:nil |
|
5360 |
changed:true. |
|
5361 |
]. |
|
5362 |
||
5363 |
dummyInstance := dummyClass basicNew. |
|
5364 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
5365 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
5366 |
||
5367 |
Compiler |
|
5368 |
evaluate:textHolder value |
|
5369 |
in:nil |
|
5370 |
receiver:dummyInstance |
|
5371 |
notifying:nil |
|
5372 |
logged:false |
|
5373 |
ifFail:[] |
|
5374 |
compile:true. |
|
5375 |
||
5376 |
"/ fileName := self firstSelectedFile. |
|
5377 |
"/ action := [:command | |
|
5378 |
"/ self addToCommandHistory:command for:fileName. |
|
5379 |
"/ self executeCommand:command. |
|
5380 |
"/ ]. |
|
5381 |
"/ self askForCommandFor:fileName thenDo:action |
|
5382 |
! |
|
5383 |
||
4230 | 5384 |
doMake |
7938 | 5385 |
|dir cmd| |
4230 | 5386 |
|
5387 |
cmd := 'make'. |
|
7938 | 5388 |
dir := self theSingleSelectedDirectoryOrNil. |
5389 |
||
5390 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
5391 |
dir notNil ifTrue:[ |
|
5392 |
(dir construct:'bmake.bat') exists ifTrue:[ |
|
5393 |
cmd := 'bmake.bat'. |
|
5394 |
] |
|
5395 |
] |
|
5396 |
]. |
|
4230 | 5397 |
self executeCommand:cmd. |
5398 |
! |
|
5399 |
||
8256 | 5400 |
doOpenCBrowser |
5401 |
|destDir| |
|
5402 |
||
5403 |
destDir := self currentDirectory. |
|
5404 |
CBrowser::Browser openIn:destDir pathName |
|
5405 |
! |
|
5406 |
||
7829 | 5407 |
doOpenExplorer |
8882 | 5408 |
OperatingSystem isMSWINDOWSlike ifFalse:[ |
5409 |
self warn:'sorry - this operation is only available under windows'. |
|
5410 |
]. |
|
7829 | 5411 |
|
5412 |
OperatingSystem |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
5413 |
openApplicationForDocument:(self currentDirectory) |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
5414 |
operation:#explore. |
7829 | 5415 |
|
5416 |
"Modified: / 23-07-2007 / 23:01:22 / cg" |
|
5417 |
! |
|
5418 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
5419 |
doOpenSettings |
8168 | 5420 |
self openSettingsDialog |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
5421 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
5422 |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
5423 |
doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
5424 |
"open using win32-shell" |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
5425 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
5426 |
|fileName| |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
5427 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
5428 |
fileName := self firstSelectedFile. |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
5429 |
fileName notNil ifTrue:[ |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
5430 |
Win32OperatingSystem |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
5431 |
openApplicationForDocument:fileName pathName |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
5432 |
operation:#open |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
5433 |
] |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
5434 |
! |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
5435 |
|
7104 | 5436 |
editMode:aSymbol |
5437 |
self |
|
5438 |
applicationNamed:#FileApplicationNoteBook |
|
5439 |
ifPresentDo:[:appl | |
|
5440 |
|subApp| |
|
5441 |
||
5442 |
subApp := appl selectedApplication. |
|
5443 |
subApp notNil ifTrue:[ |
|
5444 |
^ subApp perform:aSymbol |
|
5445 |
] |
|
5446 |
]. |
|
5447 |
||
5448 |
"Created: / 11-09-2006 / 12:42:08 / cg" |
|
5449 |
! |
|
5450 |
||
5451 |
editModeInsert |
|
5452 |
self editMode:#editModeInsert |
|
5453 |
||
5454 |
"Created: / 11-09-2006 / 12:40:36 / cg" |
|
5455 |
! |
|
5456 |
||
5457 |
editModeInsertAndSelect |
|
5458 |
self editMode:#editModeInsertAndSelect |
|
5459 |
||
5460 |
"Created: / 11-09-2006 / 12:40:45 / cg" |
|
5461 |
! |
|
5462 |
||
5463 |
editModeOverwrite |
|
5464 |
self editMode:#editModeOverwrite |
|
5465 |
||
5466 |
"Modified: / 11-09-2006 / 12:42:26 / cg" |
|
5467 |
! |
|
5468 |
||
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5469 |
fileContentsAsByteArray |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5470 |
|file| |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5471 |
|
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5472 |
file := self firstSelectedFile. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5473 |
file isNil ifTrue:[^ self ]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5474 |
file asFilename fileSize > (1024*1024) ifTrue:[ |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5475 |
file asFilename fileSize > (128*1024*1024) ifTrue:[ |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5476 |
Dialog warn:'File is too big'. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5477 |
^ self. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5478 |
]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5479 |
(Dialog confirm:'File is big - proceed ?') ifFalse:[^ self]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5480 |
]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5481 |
file asFilename binaryContentsOfEntireFile inspect |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5482 |
! |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
5483 |
|
3892 | 5484 |
fileFileIn |
5485 |
"fileIn the selected file(s)" |
|
5486 |
||
5487 |
self fileFileInLazy:false |
|
5488 |
! |
|
5489 |
||
7324 | 5490 |
fileFileIn:aFilename lazy:lazy |
5491 |
"fileIn a file" |
|
5492 |
||
5493 |
self withActivityIndicationDo:[ |
|
5494 |
self notify:('File in:', aFilename asFilename baseName). |
|
5495 |
self singleFileFileIn:aFilename lazy:lazy. |
|
5496 |
self notify:nil. |
|
5497 |
] |
|
5498 |
||
5499 |
"Created: / 20-09-2006 / 14:28:35 / cg" |
|
5500 |
! |
|
5501 |
||
3892 | 5502 |
fileFileInLazy |
5503 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
5504 |
||
5505 |
self fileFileInLazy:true |
|
5506 |
! |
|
5507 |
||
5508 |
fileFileInLazy:lazy |
|
5509 |
"fileIn the selected file(s)" |
|
5510 |
||
7324 | 5511 |
self currentSelectedFiles do:[:fileName | |
5512 |
self fileIn:fileName lazy:lazy |
|
5513 |
]. |
|
5514 |
||
5515 |
"Modified: / 20-09-2006 / 14:29:24 / cg" |
|
3892 | 5516 |
! |
5517 |
||
5518 |
fileFileInToNameSpace |
|
5519 |
"fileIn the selected file(s)<into a nameSpace" |
|
5520 |
||
5521 |
|ns listOfKnownNameSpaces| |
|
5522 |
||
5523 |
listOfKnownNameSpaces := Set new. |
|
5524 |
NameSpace |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
5525 |
allNameSpaces |
4414 | 5526 |
do:[:eachNameSpace | |
5527 |
listOfKnownNameSpaces add:eachNameSpace name |
|
5528 |
]. |
|
3892 | 5529 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
5530 |
||
5531 |
ns := Dialog |
|
4414 | 5532 |
request:'During fileIn, new classes are created in nameSpace:' |
5533 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
5534 |
list:listOfKnownNameSpaces. |
|
3892 | 5535 |
ns isEmptyOrNil ifTrue:[^ self]. |
5536 |
||
5537 |
LastEnforcedNameSpace := ns. |
|
5538 |
ns := NameSpace name:ns. |
|
5539 |
||
5540 |
Class nameSpaceQuerySignal |
|
4414 | 5541 |
answer:ns |
5542 |
do:[ |
|
5543 |
self fileFileInLazy:false |
|
5544 |
] |
|
3892 | 5545 |
! |
5546 |
||
5547 |
fileFindAllDuplicates |
|
5548 |
"scan directory and all subdirs for duplicate files" |
|
5549 |
||
5550 |
|fileNames dir infoDir filesBySize |
|
5551 |
result info dirPrefix myName stream textBox maxLength directories| |
|
5552 |
||
5553 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5554 |
self withActivityIndicationDo:[ |
4414 | 5555 |
result := Dictionary new. |
5556 |
myName := self class name asString. |
|
5557 |
directories := self currentSelectedDirectories. |
|
5558 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 5559 |
|
4414 | 5560 |
dir := directories first. |
3892 | 5561 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5562 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5563 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5564 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 5565 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
5566 |
with:ex pathName |
|
5567 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5568 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5569 |
]. |
4765 | 5570 |
fileNames := fileNames |
5571 |
collect:[:fn | dir construct:fn] |
|
5572 |
thenSelect:[:fn | fn isDirectory not]. |
|
3892 | 5573 |
|
5574 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 5575 |
infoDir := Dictionary new. |
5576 |
fileNames do:[:fn | |
|
5577 |
infoDir at:fn put:(fn fileSize) |
|
5578 |
]. |
|
5579 |
||
5580 |
"/ for each, get the files size. |
|
5581 |
"/ in a first pass, look for files of the same size and |
|
5582 |
"/ compare them ... |
|
3892 | 5583 |
|
5584 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 5585 |
filesBySize := Dictionary new. |
5586 |
infoDir keysAndValuesDo:[:fn :sz | |
|
5587 |
|entry| |
|
5588 |
||
5589 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
5590 |
entry add:fn. |
|
5591 |
]. |
|
5592 |
||
5593 |
"/ any of same size ? |
|
3892 | 5594 |
|
5595 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 5596 |
filesBySize do:[:entry | |
5597 |
|files| |
|
5598 |
||
5599 |
entry size > 1 ifTrue:[ |
|
5600 |
files := entry asArray. |
|
5601 |
1 to:files size-1 do:[:idx1 | |
|
5602 |
idx1+1 to:files size do:[:idx2 | |
|
5603 |
|fn1 fn2| |
|
5604 |
||
5605 |
fn1 := files at:idx1. |
|
5606 |
fn2 := files at:idx2. |
|
3892 | 5607 |
|
5608 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 5609 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
5610 |
"/ compare the files |
|
5611 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 5612 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 5613 |
result at:fn1 put:fn2. |
5614 |
] |
|
5615 |
] |
|
5616 |
] |
|
5617 |
] |
|
5618 |
] |
|
5619 |
]. |
|
3892 | 5620 |
|
5621 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 5622 |
dirPrefix := dir pathName. |
5623 |
result := result associations. |
|
5624 |
result := result collect:[:assoc | |
|
5625 |
|f1 f2| |
|
5626 |
||
5627 |
f1 := assoc key name. |
|
5628 |
f2 := assoc value name. |
|
5629 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
5630 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
5631 |
]. |
|
5632 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
5633 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
5634 |
]. |
|
5635 |
f1 < f2 ifTrue:[ |
|
5636 |
f2 -> f1 |
|
5637 |
] ifFalse:[ |
|
5638 |
f1 -> f2 |
|
5639 |
] |
|
5640 |
]. |
|
5641 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
5642 |
||
5643 |
info := OrderedCollection new. |
|
5644 |
result do:[:assoc | |
|
5645 |
info add:(assoc key , ' same as ' , assoc value) |
|
5646 |
]. |
|
5647 |
info isEmpty ifTrue:[ |
|
5543 | 5648 |
Dialog information:'No duplicate files found.'. |
5649 |
^ self. |
|
4414 | 5650 |
]. |
3892 | 5651 |
]. |
5652 |
||
5653 |
stream := WriteStream on:''. |
|
5654 |
info do:[:el| |
|
4535 | 5655 |
stream nextPutLine:el. |
3892 | 5656 |
]. |
5542 | 5657 |
|
3892 | 5658 |
textBox := TextBox new. |
5659 |
textBox initialText:(stream contents). |
|
5542 | 5660 |
stream close. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5661 |
textBox title:'File duplicates in directory: ', dir asString. |
3892 | 5662 |
textBox readOnly:true. |
5663 |
textBox noCancel. |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5664 |
textBox label:'Duplicates in ', dir asString. |
3892 | 5665 |
maxLength := 10. |
5666 |
info do:[: el | |
|
4414 | 5667 |
maxLength := maxLength max:(el size). |
3892 | 5668 |
]. |
5669 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 5670 |
textBox maxExtent:Screen current extent. |
5671 |
textBox openModeless. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5672 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5673 |
"Modified: / 25-07-2006 / 09:07:22 / cg" |
3892 | 5674 |
! |
5675 |
||
5676 |
fileFindDuplicates |
|
5677 |
"scan directory for duplicate files" |
|
5678 |
||
8510 | 5679 |
|infoDir filesBySize result info stream textBox maxLength directories allFiles titleStream size| |
5680 |
||
5681 |
directories := self currentSelectedDirectories. |
|
3892 | 5682 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5683 |
self withActivityIndicationDo:[ |
4355 | 5684 |
result := Dictionary new. |
5685 |
||
5686 |
directories := self currentSelectedDirectories. |
|
5687 |
directories isEmpty ifTrue:[^ self]. |
|
5688 |
||
8510 | 5689 |
allFiles := self allFilesInSelectedDirectoriesForWhich:[:f | true]. |
4355 | 5690 |
|
5691 |
infoDir := Dictionary new. |
|
5692 |
allFiles do:[:fn | |
|
5693 |
infoDir at:fn put:(fn info) |
|
5694 |
]. |
|
5695 |
||
5696 |
"/ for each, get the files size. |
|
5697 |
"/ in a first pass, look for files of the same size and |
|
5698 |
"/ compare them ... |
|
5699 |
||
5700 |
filesBySize := Dictionary new. |
|
5701 |
infoDir keysAndValuesDo:[:fn :info | |
|
5702 |
|sz entry| |
|
5703 |
||
5704 |
sz := info size. |
|
5705 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
5706 |
entry add:fn. |
|
5707 |
]. |
|
5708 |
||
5709 |
"/ any of same size ? |
|
5710 |
||
5711 |
filesBySize do:[:entry | |
|
5712 |
|files| |
|
5713 |
||
5714 |
entry size > 1 ifTrue:[ |
|
5715 |
files := entry asArray. |
|
5716 |
1 to:files size-1 do:[:idx1 | |
|
5717 |
idx1+1 to:files size do:[:idx2 | |
|
5718 |
|fn1 fn2| |
|
5719 |
||
5720 |
fn1 := files at:idx1. |
|
5721 |
fn2 := files at:idx2. |
|
5722 |
||
5723 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
5724 |
"/ compare the files |
|
5725 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 5726 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4355 | 5727 |
result at:fn1 put:fn2. |
5728 |
] |
|
5729 |
] |
|
5730 |
] |
|
5731 |
] |
|
5732 |
] |
|
5733 |
]. |
|
5734 |
||
5735 |
result := result associations. |
|
5736 |
result := result collect:[:assoc | |
|
5737 |
|f1 f2| |
|
5738 |
||
5739 |
f1 := assoc key asString. |
|
5740 |
f2 := assoc value asString. |
|
5741 |
f1 < f2 ifTrue:[ |
|
5742 |
f2 -> f1 |
|
5743 |
] ifFalse:[ |
|
5744 |
f1 -> f2 |
|
5745 |
] |
|
5746 |
]. |
|
5789 | 5747 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
5748 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
4355 | 5749 |
|
5750 |
info := OrderedCollection new. |
|
5751 |
size := self getBestDirectory asString size. |
|
5752 |
result do:[:assoc | |
|
5753 |
|fn1 fn2| |
|
5754 |
||
5755 |
fn1 := assoc key. |
|
5756 |
fn2 := assoc value. |
|
5757 |
size > 1 ifTrue:[ |
|
5758 |
fn1 := ('..', (fn1 copyFrom:(size + 1))). |
|
5759 |
fn2 := ('..', (fn2 copyFrom:(size + 1))). |
|
5760 |
]. |
|
5761 |
(fn1 includes:Character space) ifTrue:[ |
|
5762 |
fn1 := '"' , fn1 , '"' |
|
5763 |
]. |
|
5764 |
(fn2 includes:Character space) ifTrue:[ |
|
5765 |
fn2 := '"' , fn2 , '"' |
|
5766 |
]. |
|
5767 |
info add:(fn1 , ' same as ' , fn2) |
|
5768 |
]. |
|
5769 |
info isEmpty ifTrue:[ |
|
5543 | 5770 |
Dialog information:'No duplicate files found.'. |
5771 |
^ self. |
|
4355 | 5772 |
]. |
3892 | 5773 |
]. |
5774 |
stream := WriteStream on:''. |
|
5775 |
info do:[:el| |
|
4535 | 5776 |
stream nextPutLine:el. |
3892 | 5777 |
]. |
5778 |
titleStream := WriteStream on:''. |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5779 |
titleStream nextPutAll:'File duplicates in director'. |
3892 | 5780 |
directories size == 1 ifTrue:[ |
4355 | 5781 |
titleStream nextPutAll:'y: ', directories first asString. |
3892 | 5782 |
] ifFalse:[ |
4535 | 5783 |
titleStream nextPutLine:'ies: '. |
4355 | 5784 |
directories do:[:dir| |
5785 |
size > 1 ifTrue:[ |
|
5786 |
titleStream nextPutAll:'..'. |
|
4535 | 5787 |
titleStream nextPutLine:((dir asString) copyFrom:(size + 1)). |
4355 | 5788 |
] ifFalse:[ |
4535 | 5789 |
titleStream nextPutLine:(dir asString). |
4355 | 5790 |
]. |
5791 |
] |
|
3892 | 5792 |
]. |
5543 | 5793 |
|
3892 | 5794 |
textBox := TextBox new. |
5795 |
textBox initialText:(stream contents). |
|
5796 |
textBox title:(titleStream contents). |
|
5797 |
textBox readOnly:true. |
|
5798 |
textBox noCancel. |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
5799 |
stream := WriteStream on:'Duplicates in '. |
4170 | 5800 |
directories do:[ :aDirectory | |
4355 | 5801 |
stream nextPutAll:aDirectory baseName. |
5802 |
stream space. |
|
4050 | 5803 |
]. |
4170 | 5804 |
textBox label:stream contents. |
3892 | 5805 |
maxLength := 10. |
5806 |
info do:[: el | |
|
4355 | 5807 |
maxLength := maxLength max:(el size). |
3892 | 5808 |
]. |
5092 | 5809 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
5810 |
textBox maxExtent:Screen current extent. |
|
4355 | 5811 |
textBox openModeless. "/ showAtPointer. |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5812 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5813 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
3892 | 5814 |
! |
5815 |
||
5816 |
fileFindFile |
|
5961 | 5817 |
|filename| |
5818 |
||
5819 |
filename := self firstSelectedFileName. |
|
5820 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
5821 |
filename := Filename homeDirectory. |
3892 | 5822 |
]. |
4101 | 5823 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 5824 |
! |
5825 |
||
8510 | 5826 |
fileFindSimilarImages |
5827 |
"scan directory for similar image files" |
|
5828 |
||
8512 | 5829 |
|result stream textBox directories imageFiles histogramsV histogramsH |
5830 |
similarV similarH similar alreadyPrinted| |
|
8510 | 5831 |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
5832 |
self withWaitCursorDo:[ |
8510 | 5833 |
self withActivityIndicationDo:[ |
5834 |
result := Dictionary new. |
|
5835 |
||
5836 |
directories := self currentSelectedDirectories. |
|
5837 |
directories isEmpty ifTrue:[^ self]. |
|
5838 |
||
5839 |
imageFiles := self allFilesInSelectedDirectoriesForWhich:[:f | f mimeTypeFromName isImage]. |
|
8511 | 5840 |
"/ imageFiles := imageFiles select:[:f | f baseName startsWith:'foo']. |
5841 |
imageFiles sort:[:a :b | a pathName < b pathName]. |
|
5842 |
||
8510 | 5843 |
"/ for each, get the color histogram |
5844 |
histogramsV := Dictionary new. |
|
5845 |
histogramsH := Dictionary new. |
|
5846 |
imageFiles do:[:fn | |
|
5847 |
|hist image| |
|
5848 |
||
5849 |
image := Image fromFile:fn. |
|
5850 |
Transcript showCR:'generating histogram for ',fn baseName. |
|
5851 |
hist := ImageColorHistogram new forImage:image. |
|
5852 |
histogramsV at:fn put:(hist histogramVectorV). |
|
5853 |
histogramsH at:fn put:(hist histogramVectorH). |
|
5854 |
]. |
|
5855 |
||
5856 |
similarH := Dictionary new. |
|
5857 |
similarV := Dictionary new. |
|
5858 |
similar := Dictionary new. |
|
5859 |
||
8512 | 5860 |
(self firstSelectedFile notNil |
5861 |
ifTrue:[ Array with:self firstSelectedFile ] |
|
5862 |
ifFalse:[ imageFiles ]) |
|
5863 |
do:[:eachFile1 | |
|
8510 | 5864 |
|setOfSimilar distancesV distancesH| |
5865 |
||
5866 |
distancesV := OrderedCollection new. |
|
5867 |
distancesH := OrderedCollection new. |
|
5868 |
setOfSimilar := OrderedCollection new. |
|
5869 |
||
5870 |
imageFiles do:[:eachFile2 | |
|
5871 |
|v1 v2 dV dH| |
|
5872 |
||
5873 |
eachFile1 ~= eachFile2 ifTrue:[ |
|
5874 |
v1 := histogramsV at:eachFile1. |
|
5875 |
v2 := histogramsV at:eachFile2. |
|
5876 |
dV := ImageColorHistogram distanceFrom:v1 to:v2. |
|
5877 |
distancesV add:(eachFile2 -> dV). |
|
5878 |
v1 := histogramsH at:eachFile1. |
|
5879 |
v2 := histogramsH at:eachFile2. |
|
5880 |
dH := ImageColorHistogram distanceFrom:v1 to:v2. |
|
5881 |
distancesH add:(eachFile2 -> dH). |
|
5882 |
(dV < 10000 and:[dH < 10000]) ifTrue:[ |
|
8512 | 5883 |
setOfSimilar add:eachFile2->(dV + dH). |
8510 | 5884 |
]. |
5885 |
] |
|
5886 |
]. |
|
5887 |
distancesV sort:[:a1 :a2 | a1 value < a2 value]. |
|
5888 |
distancesH sort:[:a1 :a2 | a1 value < a2 value]. |
|
5889 |
similarV at:eachFile1 put:distancesV. |
|
5890 |
similarH at:eachFile1 put:distancesH. |
|
5891 |
setOfSimilar notEmpty ifTrue:[ similar at:eachFile1 put:setOfSimilar ]. |
|
5892 |
]. |
|
5893 |
||
5894 |
similar isEmpty ifTrue:[ |
|
5895 |
Dialog information:'No similarities found.'. |
|
5896 |
^ self. |
|
5897 |
]. |
|
5898 |
]. |
|
5899 |
||
5900 |
stream := WriteStream on:''. |
|
8512 | 5901 |
alreadyPrinted := Set new. |
5902 |
||
5903 |
imageFiles do:[:eachFile | |
|
5904 |
|eachSet| |
|
5905 |
||
5906 |
(alreadyPrinted includes:eachFile) ifFalse:[ |
|
5907 |
eachSet := similar at:eachFile ifAbsent:nil. |
|
5908 |
eachSet notNil ifTrue:[ |
|
5909 |
stream nextPutLine:eachFile pathName. |
|
5910 |
eachSet do:[:info | |
|
5911 |
|fn2 dist| |
|
5912 |
||
5913 |
fn2 := info key. |
|
5914 |
dist := info value. |
|
5915 |
stream nextPutAll:' '. |
|
5916 |
stream nextPutAll:fn2 pathName. |
|
5917 |
stream nextPutLine:' (',dist printString,')'. |
|
5918 |
alreadyPrinted add:fn2. |
|
5919 |
]. |
|
5920 |
stream cr. |
|
5921 |
]. |
|
8510 | 5922 |
]. |
5923 |
]. |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
5924 |
]. |
8510 | 5925 |
|
5926 |
textBox := TextBox new. |
|
5927 |
textBox initialText:(stream contents). |
|
5928 |
textBox title:'File similarities:'. |
|
5929 |
textBox readOnly:true. |
|
5930 |
textBox noCancel. |
|
5931 |
||
5932 |
textBox label:'File similarities'. |
|
5933 |
textBox extent:(400@((similar size max:40)* 10)). |
|
5934 |
textBox maxExtent:Screen current extent. |
|
5935 |
textBox openModeless. "/ showAtPointer. |
|
5936 |
||
5937 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
|
5938 |
! |
|
5939 |
||
4618 | 5940 |
fileHexDump |
5941 |
||
5942 |
| file item| |
|
5943 |
||
5944 |
file := self firstSelectedFile. |
|
5945 |
file notNil ifTrue:[ |
|
5946 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 5947 |
self |
5948 |
applicationNamed:#FileApplicationNoteBook |
|
5949 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 5950 |
]. |
5951 |
! |
|
5952 |
||
7324 | 5953 |
fileIn:aFilename |
5954 |
"fileIn a file" |
|
5955 |
||
5956 |
self fileIn:aFilename lazy:false |
|
5957 |
||
5958 |
"Created: / 20-09-2006 / 14:30:06 / cg" |
|
5959 |
! |
|
5960 |
||
5961 |
fileIn:aFilename lazy:lazy |
|
5962 |
"fileIn a file" |
|
5963 |
||
5964 |
self withActivityIndicationDo:[ |
|
5965 |
self notify:('File in:', aFilename asFilename baseName). |
|
5966 |
self singleFileFileIn:aFilename lazy:lazy. |
|
5967 |
self notify:nil. |
|
5968 |
] |
|
5969 |
||
5970 |
"Created: / 20-09-2006 / 14:29:21 / cg" |
|
5971 |
! |
|
5972 |
||
4930 | 5973 |
filterSelectedFiles:whichFilter |
5974 |
|selectedFiles numFiles msg filterBlock| |
|
5975 |
||
7560 | 5976 |
selectedFiles := self currentSelectedObjects. |
4930 | 5977 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
5978 |
||
5979 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
5980 |
numFiles > 1 ifTrue:[ |
|
5981 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
5982 |
]. |
|
5983 |
||
5984 |
(Dialog |
|
6352 | 5985 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 5986 |
initialAnswer:false |
5987 |
) ifFalse:[ |
|
5988 |
^ self |
|
5989 |
]. |
|
5990 |
||
5991 |
whichFilter == #rot13 ifTrue:[ |
|
5992 |
filterBlock := [:charIn | charIn rot13 ]. |
|
5993 |
]. |
|
5994 |
"/ add more here... |
|
5995 |
||
5996 |
filterBlock isNil ifTrue:[ |
|
5997 |
self information:'No such filter: ' , whichFilter. |
|
5998 |
^ self. |
|
5999 |
]. |
|
6000 |
||
6001 |
selectedFiles do:[:fileName | |
|
6002 |
|s| |
|
6003 |
||
6004 |
self notify:('Processing:', fileName baseName). |
|
6005 |
fileName isDirectory ifFalse:[ |
|
6006 |
[ |
|
6007 |
|inFile outFile in out| |
|
6008 |
||
6009 |
inFile := fileName asFilename. |
|
6010 |
outFile := (fileName pathName , '.filter') asFilename. |
|
6011 |
||
6012 |
[ |
|
6013 |
|charIn charOut| |
|
6014 |
||
6015 |
in := inFile readStream. |
|
6016 |
out := outFile writeStream. |
|
6017 |
[in atEnd] whileFalse:[ |
|
6018 |
charIn := in next. |
|
6019 |
charOut := filterBlock value:charIn. |
|
6020 |
out nextPut:charOut. |
|
6021 |
]. |
|
6022 |
outFile renameTo:inFile. |
|
6023 |
] ensure:[ |
|
6024 |
out notNil ifTrue:[ out close ]. |
|
6025 |
in notNil ifTrue:[ in close ]. |
|
6026 |
outFile delete. |
|
6027 |
] |
|
6028 |
] on:FileStream openErrorSignal do:[:ex| |
|
6029 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
6030 |
]. |
|
6031 |
] |
|
6032 |
]. |
|
6190 | 6033 |
self notify:nil. |
7560 | 6034 |
|
6035 |
"Modified: / 04-12-2006 / 13:14:48 / cg" |
|
4930 | 6036 |
! |
6037 |
||
8832 | 6038 |
forEachSelectedFileIgnoringDirectories:ignoreDirs do:aBlock |
6039 |
|numItems path files| |
|
6040 |
||
6041 |
files := self currentSelectedFiles. |
|
6042 |
||
6043 |
(numItems := files size) > 2 ifTrue:[ |
|
6044 |
(self |
|
6045 |
confirm:(resources string:'Open for each of the %1 items ?' |
|
6046 |
with:numItems)) ifFalse:[^ self]. |
|
6047 |
]. |
|
6048 |
||
6049 |
self withActivityIndicationDo:[ |
|
6050 |
files do:[:fileName | |
|
6051 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
6052 |
fileName isAbsolute ifTrue:[ |
|
6053 |
path := fileName getName. |
|
6054 |
] ifFalse:[ |
|
6055 |
path := fileName pathName. |
|
6056 |
]. |
|
6057 |
aBlock value:path |
|
6058 |
] |
|
6059 |
]. |
|
6060 |
]. |
|
6061 |
! |
|
6062 |
||
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6063 |
generateDetachedSignaturesForSelectedFiles |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6064 |
"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
|
6065 |
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
|
6066 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6067 |
self withActivityIndicationDo:[ |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6068 |
self currentSelectedFiles do:[:fn | |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6069 |
|data hash signature signatureFile| |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6070 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6071 |
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
|
6072 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6073 |
data := fn contentsAsString. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6074 |
hash := SHA1Stream hashValueOf:data. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6075 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6076 |
signature := Expecco::KeyFileGenerator new signExpeccoCode:hash. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6077 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6078 |
signatureFile := fn addSuffix:'sig'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6079 |
signatureFile contents:signature. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6080 |
]. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6081 |
self notify:nil. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6082 |
] |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6083 |
! |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
6084 |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
6085 |
generateSignaturesForSelectedFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
6086 |
"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
|
6087 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
6088 |
self withActivityIndicationDo:[ |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
6089 |
self currentSelectedFiles do:[:fn | |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
6090 |
|pkcs7SignedData signatureFilename| |
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
6091 |
|
8646 | 6092 |
self notify:'Generating signed file from: ', (fn baseName), '...'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
6093 |
|
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
6094 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:fn contentsOfEntireFile. |
8646 | 6095 |
signatureFilename := fn addSuffix:'signed'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
6096 |
signatureFilename contents:pkcs7SignedData. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
6097 |
]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
6098 |
self notify:nil. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
6099 |
] |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
6100 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
6101 |
|
3892 | 6102 |
installAllAsAutoloaded |
6103 |
"install all classes found here as autoloaded classes" |
|
6104 |
||
4345 | 6105 |
[ |
6106 |
self withActivityIndicationDo:[ |
|
6725 | 6107 |
self currentSelectedDirectories do:[:dir| |
6523 | 6108 |
dir directoryContentsAsFilenamesDo:[:fn | |
6708 | 6109 |
(fn suffix = 'st') ifTrue:[ |
6523 | 6110 |
self notify:('Install as autoloaded:', fn baseName). |
6111 |
self installAsAutoloaded:fn. |
|
6112 |
] |
|
4343 | 6113 |
] |
6114 |
]. |
|
6190 | 6115 |
self notify:nil. |
4345 | 6116 |
] |
6117 |
] fork. |
|
3892 | 6118 |
! |
6119 |
||
6521 | 6120 |
installAllAsAutoloadedRecursive |
6121 |
"install all classes found here and in subdirectories as autoloaded classes" |
|
6122 |
||
6123 |
[ |
|
6124 |
self withActivityIndicationDo:[ |
|
6725 | 6125 |
self currentSelectedDirectories do:[:dir| |
6521 | 6126 |
dir recursiveDirectoryContentsDo:[:f | |
6708 | 6127 |
|fn| |
6521 | 6128 |
fn := dir construct:f. |
6708 | 6129 |
(fn suffix = 'st') ifTrue:[ |
6521 | 6130 |
self notify:('Install as autoloaded:', f). |
6131 |
self installAsAutoloaded:fn. |
|
6132 |
] |
|
6133 |
] |
|
6134 |
]. |
|
6135 |
self notify:nil. |
|
6136 |
] |
|
6137 |
] fork. |
|
6138 |
! |
|
6139 |
||
3892 | 6140 |
installAsAutoloaded:aFilename |
6141 |
"install aFilename as autoloaded class" |
|
6142 |
||
9455 | 6143 |
|chunks filename| |
5971
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
6144 |
|
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
6145 |
filename := aFilename asFilename. |
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
6146 |
|
9455 | 6147 |
filename readingFileDo:[:s| |
6148 |
chunks := ChangeSet fromStream:s. |
|
6149 |
]. |
|
3892 | 6150 |
chunks |
4414 | 6151 |
select:[:eachChunk | eachChunk isClassDefinitionChange] |
5971
af337e1a857f
Use #setFilename:forClass:package: to define an abbreviation
Stefan Vogel <sv@exept.de>
parents:
5967
diff
changeset
|
6152 |
thenDo:[:eachClassChunk | |
8039
732cbc4ea214
keep absolute-pathname including suffix as classFilename
Claus Gittinger <cg@exept.de>
parents:
8013
diff
changeset
|
6153 |
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
|
6154 |
]. |
3892 | 6155 |
! |
6156 |
||
4558 | 6157 |
joinSelectedFiles |
6264 | 6158 |
|selectedFiles numFiles msg outFileName outFile outStream| |
4558 | 6159 |
|
7560 | 6160 |
selectedFiles := self currentSelectedObjects. |
4558 | 6161 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
6162 |
||
6163 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
6352 | 6164 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 6165 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
6166 |
outFile := selectedFiles first directory construct:outFileName. |
|
4558 | 6167 |
|
6168 |
outStream := outFile writeStream. |
|
6169 |
||
6170 |
selectedFiles do:[:fileName | |
|
6171 |
|inStream| |
|
6172 |
||
6173 |
self notify:('Adding:', fileName baseName). |
|
6174 |
inStream := fileName readStream. |
|
6175 |
inStream copyToEndInto:outStream. |
|
6176 |
inStream close. |
|
6177 |
]. |
|
6178 |
outStream close. |
|
6190 | 6179 |
self notify:nil. |
7560 | 6180 |
|
6181 |
"Modified: / 04-12-2006 / 13:15:10 / cg" |
|
4558 | 6182 |
! |
6183 |
||
6292 | 6184 |
loadImageThenDo:aBlock |
3892 | 6185 |
|img path files| |
6186 |
||
3982 | 6187 |
files := self currentSelectedFiles. |
3892 | 6188 |
files isEmpty ifTrue:[ ^ self]. |
6189 |
files do:[:fileName | |
|
4414 | 6190 |
path := fileName. |
6191 |
path isDirectory ifFalse:[ |
|
6192 |
img := Image fromFile:(path pathName). |
|
6193 |
img notNil ifTrue:[ |
|
6292 | 6194 |
aBlock value:img |
4414 | 6195 |
] ifFalse:[ |
6292 | 6196 |
Dialog warn:'Unknown format: ' , fileName asString |
4414 | 6197 |
] |
6198 |
] |
|
3892 | 6199 |
]. |
6200 |
! |
|
6201 |
||
6202 |
openASN1Browser |
|
6203 |
||
6204 |
self openTool:OSI::ASN1Browser |
|
6205 |
! |
|
6206 |
||
6207 |
openAppletViewer |
|
6208 |
|numItems files| |
|
6209 |
||
3982 | 6210 |
files := self currentSelectedFiles. |
3892 | 6211 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 6212 |
(self |
6213 |
confirm:(resources string:'open for each of the %1 items ?' |
|
6214 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 6215 |
]. |
6216 |
||
6217 |
Java startupJavaSystem. |
|
6218 |
"/ Java markAllClassesUninitialized. |
|
6219 |
"/ Java initAllStaticFields. |
|
6220 |
"/ Java initAllClasses. |
|
6221 |
||
6222 |
files do:[:fileName | |
|
4414 | 6223 |
|p path| |
6224 |
||
6225 |
path := fileName. |
|
6226 |
path isDirectory ifFalse:[ |
|
6227 |
p := Java |
|
6228 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
6229 |
argumentString:path pathName. |
|
6230 |
p resume. |
|
6231 |
] |
|
3892 | 6232 |
]. |
6233 |
! |
|
6234 |
||
6235 |
openCBrowser |
|
6031 | 6236 |
|dir files| |
5880 | 6237 |
|
6238 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6239 |
dir isNil ifTrue:[ ^ self]. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
6240 |
self withActivityIndicationDo:[ |
7560 | 6241 |
files := self currentSelectedObjects. |
6031 | 6242 |
files notEmptyOrNil ifTrue:[ |
6243 |
CBrowser::Browser openOn:files first. |
|
6244 |
] ifFalse:[ |
|
6245 |
CBrowser::Browser openIn:dir. |
|
6246 |
] |
|
3892 | 6247 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
6248 |
|
7560 | 6249 |
"Modified: / 04-12-2006 / 13:15:19 / cg" |
3892 | 6250 |
! |
6251 |
||
4230 | 6252 |
openChangeSetBrowser |
6253 |
self |
|
6254 |
openTool:ChangeSetBrowser |
|
6255 |
with:#openOnFile: |
|
6256 |
ignoreDirectories:true |
|
6257 |
! |
|
6258 |
||
3892 | 6259 |
openChangesBrowser |
6260 |
"open a change browser on the selected file(s)" |
|
6261 |
||
6262 |
self openTool:(UserPreferences current changesBrowserClass) |
|
6263 |
! |
|
6264 |
||
6265 |
openDiffView |
|
6266 |
"open a diff-view" |
|
6267 |
||
6388 | 6268 |
|name1 name2 text1 text2 d err nm l1 files title |
6460 | 6269 |
defaultName lastFile sameContents msg| |
6270 |
||
6271 |
files := self currentSelectedObjects. |
|
3892 | 6272 |
files isEmpty ifTrue:[ |
6460 | 6273 |
Dialog warn:(resources string:'You have to select a file first'). |
4414 | 6274 |
^ self. |
3892 | 6275 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6276 |
|
3892 | 6277 |
(files size == 2) ifTrue:[ |
4414 | 6278 |
name1 := files last. |
6279 |
name2 := files first. |
|
3892 | 6280 |
] ifFalse:[ |
4414 | 6281 |
LastFileDiffFile notNil ifTrue:[ |
5960 | 6282 |
| directory | |
6283 |
directory := self currentDirectory. |
|
6284 |
directory notNil ifTrue:[ |
|
6285 |
lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
4414 | 6286 |
(lastFile exists and:[lastFile isReadable]) ifTrue:[ |
6287 |
name1 := lastFile. |
|
6288 |
] |
|
6289 |
] |
|
6290 |
]. |
|
6291 |
name2 := files first. |
|
6460 | 6292 |
title := resources string:'Show differences between "%1" and:' with:name2 baseName. |
4414 | 6293 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
6294 |
name1 := DialogBox |
|
6295 |
requestFileName:title |
|
6296 |
default:defaultName |
|
6460 | 6297 |
ok:(resources string:'OK') |
6298 |
abort:(resources string:'Compare against File List') |
|
4414 | 6299 |
pattern:'*' |
6300 |
fromDirectory:(name2 asFilename directory). |
|
3892 | 6301 |
]. |
6302 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6303 |
self withWaitCursorDo:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6304 |
(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
|
6305 |
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
|
6306 |
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
|
6307 |
name1 := nil. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6308 |
l1 := 'browser contents' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6309 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6310 |
name1 := name1 asFilename. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6311 |
LastFileDiffFile := name1. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6312 |
name1 isReadable ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6313 |
nm := name1. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6314 |
name1 exists ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6315 |
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
|
6316 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6317 |
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
|
6318 |
]. |
4414 | 6319 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6320 |
l1 := name1 pathName |
4414 | 6321 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6322 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6323 |
err isNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6324 |
name2 isReadable ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6325 |
nm := name2. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6326 |
name2 exists ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6327 |
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
|
6328 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6329 |
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
|
6330 |
]. |
4414 | 6331 |
]. |
6332 |
]. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6333 |
err notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6334 |
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
|
6335 |
^ self |
6176 | 6336 |
]. |
6337 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6338 |
self withActivityIndicationDo:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6339 |
((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
|
6340 |
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
|
6341 |
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
|
6342 |
ProgressIndicator |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6343 |
displayBusyIndicator:'Comparing...' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6344 |
at:(Screen default center) |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6345 |
during:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6346 |
sameContents := (name1 sameContentsAs:name2). |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6347 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6348 |
sameContents ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6349 |
self information:'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6350 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6351 |
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
|
6352 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6353 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6354 |
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
|
6355 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6356 |
^ self. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6357 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6358 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6359 |
name1 notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6360 |
name1 isDirectory ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6361 |
text1 := name1 directoryContents asString. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6362 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6363 |
text1 := name1 contents. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6364 |
] |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6365 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6366 |
name2 isDirectory ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6367 |
text2 := name2 directoryContents asString. |
6460 | 6368 |
] ifFalse:[ |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6369 |
text2 := name2 contents. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6370 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6371 |
text1 = text2 ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6372 |
(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
|
6373 |
msg := 'Same filename lists.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6374 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6375 |
msg := 'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6376 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6377 |
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
|
6378 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6379 |
d := DiffTextView |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6380 |
openOn:text1 label:l1 |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
6381 |
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
|
6382 |
d topView label:(resources string:'File Differences'). |
6460 | 6383 |
] |
4414 | 6384 |
] |
3892 | 6385 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
6386 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
6387 |
"Modified: / 25-07-2006 / 09:07:37 / cg" |
3892 | 6388 |
! |
6389 |
||
6390 |
openEditor |
|
6391 |
self openTool:EditTextView |
|
6392 |
! |
|
6393 |
||
4957 | 6394 |
openGV |
6395 |
self openOSCommandWithFiles:'gv' |
|
6396 |
! |
|
6397 |
||
3892 | 6398 |
openHTMLReader |
6399 |
||
6400 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
6401 |
! |
|
6402 |
||
6403 |
openImageEditor |
|
6292 | 6404 |
[ |
6405 |
self loadImageThenDo:[:img | img edit] |
|
6406 |
] fork |
|
3892 | 6407 |
! |
6408 |
||
6409 |
openImageInspector |
|
6292 | 6410 |
[ |
6411 |
self loadImageThenDo:[:img | img inspect] |
|
6412 |
] fork |
|
3892 | 6413 |
! |
6414 |
||
6415 |
openImagePreview |
|
5778 | 6416 |
[ |
6417 |
self |
|
6292 | 6418 |
loadImageThenDo: |
5778 | 6419 |
[:img | |
6420 |
|i top viewer| |
|
6421 |
||
6422 |
top := StandardSystemView new. |
|
6423 |
||
6424 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
6425 |
i := img. |
|
6426 |
top extent:200@200. |
|
6427 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
6428 |
top openAndWait. |
|
6429 |
||
6430 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
6431 |
i := i magnifiedPreservingRatioTo:200@200. |
|
6432 |
]. |
|
6433 |
viewer image:i. |
|
6434 |
]. |
|
3892 | 6435 |
] fork |
6436 |
! |
|
6437 |
||
6438 |
openMP3Player |
|
6439 |
|file| |
|
6440 |
||
3982 | 6441 |
file := self currentSelectedFiles. |
3892 | 6442 |
(file isEmpty) ifTrue:[ |
4414 | 6443 |
^ self. |
3892 | 6444 |
]. |
6445 |
file := file first. |
|
6446 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
6447 |
! |
|
6448 |
||
4957 | 6449 |
openOSCommandWithFiles:command |
6450 |
|files fileNames| |
|
6451 |
||
6452 |
files := self currentSelectedFiles. |
|
6453 |
(files isEmpty) ifTrue:[ |
|
6454 |
^ self. |
|
6455 |
]. |
|
6456 |
||
6457 |
fileNames := files collect:[:each | |
|
6458 |
'"' , each asFilename pathName , '"' |
|
6459 |
]. |
|
6460 |
||
6461 |
[ |
|
6462 |
OperatingSystem |
|
4959 | 6463 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
6464 |
inDirectory:(files first asFilename directory). |
|
4957 | 6465 |
] fork |
6466 |
! |
|
6467 |
||
4820 | 6468 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6469 |
|files fileNames cmd arg| |
4820 | 6470 |
|
6471 |
files := self currentSelectedFiles. |
|
6472 |
(files isEmpty) ifTrue:[ |
|
6473 |
^ self. |
|
6474 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6475 |
cmd := MIMETypes defaultCommandForMimeType:'application/pdf'. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6476 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6477 |
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
|
6478 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6479 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6480 |
|
4820 | 6481 |
fileNames := |
6482 |
files |
|
6483 |
collect: |
|
6484 |
[:each | |
|
6485 |
'"' , each asFilename pathName , '"' |
|
6486 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6487 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6488 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6489 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6490 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6491 |
]. |
4820 | 6492 |
|
4950 | 6493 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6494 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 6495 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6496 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
6497 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 6498 |
! |
6499 |
||
4958 | 6500 |
openRP |
6501 |
self openOSCommandWithFiles:'realplay' |
|
6502 |
! |
|
6503 |
||
8426 | 6504 |
openResourceFileEditor |
6505 |
||
6506 |
self |
|
6507 |
openTool: Tools::InternationalLanguageTranslationEditor |
|
6508 |
with: #openOnFile: |
|
6509 |
! |
|
6510 |
||
3892 | 6511 |
openSlideShow |
5880 | 6512 |
|dir| |
6513 |
||
6514 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6515 |
dir isNil ifTrue:[^ self]. |
|
6516 |
||
3892 | 6517 |
CodingExamples_GUI::SlideShow openIn:dir. |
6518 |
! |
|
6519 |
||
6520 |
openSnapshotImageBrowser |
|
4491 | 6521 |
"Sorry, for now, only the old browser can handle snapShotImages." |
6522 |
||
3892 | 6523 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
6524 |
! |
|
6525 |
||
6526 |
openTerminal |
|
5880 | 6527 |
|dir| |
6528 |
||
6529 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 6530 |
|
5300 | 6531 |
TerminalApplication notNil ifTrue:[ |
6532 |
TerminalApplication openIn:dir |
|
6533 |
] ifFalse:[ |
|
6534 |
VT100TerminalView openShellIn:dir. |
|
6535 |
]. |
|
3892 | 6536 |
! |
6537 |
||
6538 |
openTool:aToolClass |
|
6539 |
"open a tool on the selected file(s)" |
|
6540 |
||
6541 |
^ self openTool:aToolClass ignoreDirectories:true |
|
6542 |
! |
|
6543 |
||
6544 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
6545 |
"open a tool on the selected file(s)" |
|
6546 |
||
6547 |
^ self |
|
4414 | 6548 |
openTool:aToolClass |
6549 |
with:#openOn: |
|
6550 |
ignoreDirectories:ignoreDirs |
|
3892 | 6551 |
! |
6552 |
||
8426 | 6553 |
openTool:aToolClass with:aSelector |
6554 |
"open a tool on the selected file(s)" |
|
6555 |
||
6556 |
^ self openTool:aToolClass with:aSelector ignoreDirectories:true |
|
6557 |
! |
|
6558 |
||
3892 | 6559 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
6560 |
"open a tool on the selected file(s)" |
|
6561 |
||
8832 | 6562 |
|tool| |
3892 | 6563 |
|
6564 |
aToolClass isNil ifTrue:[ |
|
4414 | 6565 |
Dialog warn:'Sorry, that tool seems to be not available'. |
6566 |
^ nil. |
|
3892 | 6567 |
]. |
8832 | 6568 |
self forEachSelectedFileIgnoringDirectories:ignoreDirs do:[:path | |
6569 |
tool := aToolClass perform:aSelector with:path. |
|
3892 | 6570 |
]. |
6571 |
^ tool |
|
8832 | 6572 |
! |
6573 |
||
6574 |
openWebBrowser |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6575 |
self |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6576 |
forEachSelectedFileIgnoringDirectories:true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6577 |
do:[:path | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6578 |
Error |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6579 |
handle:[:ex | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6580 |
Dialog warn:'Shell execution failed: ',ex description |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6581 |
] do:[ |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6582 |
OperatingSystem openApplicationForDocument:path operation:#open. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6583 |
^ self. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6584 |
] |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6585 |
]. |
3892 | 6586 |
! |
6587 |
||
6022 | 6588 |
openWorkspace |
6589 |
self |
|
6590 |
openTool:WorkspaceApplication |
|
6591 |
with:#openOnFile: |
|
6592 |
ignoreDirectories:true |
|
6593 |
! |
|
6594 |
||
4950 | 6595 |
openXV |
4957 | 6596 |
self openOSCommandWithFiles:'xv' |
4950 | 6597 |
! |
6598 |
||
3892 | 6599 |
openZipTool |
5880 | 6600 |
|zipTool| |
3892 | 6601 |
|
6602 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 6603 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 6604 |
]. |
6605 |
! |
|
6606 |
||
7869 | 6607 |
parseXmlFile |
8617 | 6608 |
"Show an XML file - either in an XMLInspector or fall back to |
6609 |
a plain inspector on the XML tree" |
|
7869 | 6610 |
|
6611 |
self withActivityIndicationDo:[ |
|
6612 |
| selectedFiles xmlDocument | |
|
6613 |
||
6614 |
selectedFiles:= self currentSelectedFiles. |
|
6615 |
selectedFiles do:[:fileName | |
|
8617 | 6616 |
XML::XMLSignal handle:[:ex | |
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
6617 |
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
|
6618 |
^ self. |
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
6619 |
] do:[ |
9173 | 6620 |
|s d magic encoder document| |
6621 |
||
6622 |
s := fileName asFilename readStream. |
|
6623 |
s binary. |
|
6624 |
magic := (s next:2). |
|
6625 |
magic = #[254 255] ifTrue:[ |
|
6626 |
"/ UTF16BE |
|
6627 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16be. |
|
6628 |
] ifFalse:[ |
|
6629 |
magic = #[255 254] ifTrue:[ |
|
6630 |
"/ UTF16LE |
|
6631 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16le. |
|
6632 |
]. |
|
6633 |
]. |
|
6634 |
s close. |
|
6635 |
||
6636 |
document notNil ifTrue:[ |
|
6637 |
xmlDocument := XML::XMLParser |
|
6638 |
processDocumentString:document |
|
6639 |
beforeScanDo:[:parse| parse validate:false]. |
|
6640 |
] ifFalse:[ |
|
6641 |
xmlDocument := XML::XMLParser |
|
8617 | 6642 |
processDocumentInFilename:fileName |
6643 |
beforeScanDo:[:parse| parse validate:false]. |
|
9173 | 6644 |
] |
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
6645 |
]. |
8068
1cf9f1224bbc
changed #parseXmlFile - open XMLInspector (in exept:xml/inspector)
Stefan Vogel <sv@exept.de>
parents:
8042
diff
changeset
|
6646 |
XML::XMLInspector notNil ifTrue:[ |
1cf9f1224bbc
changed #parseXmlFile - open XMLInspector (in exept:xml/inspector)
Stefan Vogel <sv@exept.de>
parents:
8042
diff
changeset
|
6647 |
XML::XMLInspector openOn:xmlDocument. |
8617 | 6648 |
"/ XML::XMLInspector openWithoutDetailsOn:xmlDocument. |
8068
1cf9f1224bbc
changed #parseXmlFile - open XMLInspector (in exept:xml/inspector)
Stefan Vogel <sv@exept.de>
parents:
8042
diff
changeset
|
6649 |
] ifFalse:[ |
1cf9f1224bbc
changed #parseXmlFile - open XMLInspector (in exept:xml/inspector)
Stefan Vogel <sv@exept.de>
parents:
8042
diff
changeset
|
6650 |
"fall back..." |
1cf9f1224bbc
changed #parseXmlFile - open XMLInspector (in exept:xml/inspector)
Stefan Vogel <sv@exept.de>
parents:
8042
diff
changeset
|
6651 |
xmlDocument inspect. |
1cf9f1224bbc
changed #parseXmlFile - open XMLInspector (in exept:xml/inspector)
Stefan Vogel <sv@exept.de>
parents:
8042
diff
changeset
|
6652 |
] |
7869 | 6653 |
]. |
6654 |
] |
|
6655 |
! |
|
6656 |
||
3892 | 6657 |
readAbbrevFile |
6658 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
6659 |
||
5880 | 6660 |
|directories| |
3892 | 6661 |
|
3982 | 6662 |
directories := self currentSelectedDirectories. |
3892 | 6663 |
directories isEmpty ifTrue:[^ self]. |
6664 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
6665 |
self withActivityIndicationDo:[ |
5880 | 6666 |
directories do:[:eachDir | |
6667 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
6668 |
] |
|
5828 | 6669 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
6670 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
6671 |
"Modified: / 25-07-2006 / 09:07:43 / cg" |
3892 | 6672 |
! |
6673 |
||
6460 | 6674 |
readAndShowResources |
6675 |
self withActivityIndicationDo:[ |
|
6676 |
| selectedFiles| |
|
6677 |
||
6678 |
selectedFiles:= self currentSelectedFiles. |
|
6679 |
selectedFiles do:[:fileName | |
|
6680 |
resources := ResourcePack fromFile:fileName. |
|
6681 |
resources inspect. |
|
6682 |
]. |
|
6683 |
] |
|
6684 |
! |
|
6685 |
||
3892 | 6686 |
singleFileFileIn:fileName lazy:lazy |
6687 |
"fileIn the selected file(s)" |
|
6688 |
||
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6689 |
|aStream wasLazy notifyString dontAskSignals lang| |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6690 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6691 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6692 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6693 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6694 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6695 |
[ |
4345 | 6696 |
(ObjectFileLoader notNil |
5491 | 6697 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 6698 |
AbortOperationRequest catch:[ |
6699 |
|p| |
|
6700 |
||
6701 |
"/ |
|
6702 |
"/ look if already loaded ... then unload first |
|
6703 |
"/ |
|
6704 |
p := fileName pathName. |
|
6705 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
6706 |
(Dialog confirm:(resources |
|
6707 |
string:'%1 is already loaded; load anyway ?' |
|
6708 |
with:p)) ifFalse:[ |
|
6709 |
^ self |
|
6710 |
]. |
|
6711 |
notifyString := 'unloading old ' , p , ' ...'. |
|
6712 |
Transcript showCR:notifyString. |
|
4523 | 6713 |
self notify:notifyString. |
4345 | 6714 |
ObjectFileLoader unloadObjectFile:p. |
6715 |
]. |
|
6716 |
||
6717 |
notifyString := 'loading ' , p , ' ...'. |
|
6718 |
Transcript showCR:notifyString. |
|
4523 | 6719 |
self notify:notifyString. |
4345 | 6720 |
ObjectFileLoader loadObjectFile:p. |
6721 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
6722 |
] |
|
6723 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
6724 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
6725 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6726 |
aStream := fileName readStreamOrNil. |
4345 | 6727 |
aStream notNil ifTrue:[ |
6728 |
aStream fileInBinary. |
|
6729 |
] |
|
6730 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6731 |
((fileName hasSuffix:'class') or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 6732 |
"/ loading a java class file |
6733 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 6734 |
JavaClassReader loadFile:fileName |
4345 | 6735 |
] |
6736 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
6737 |
"/ loading a sif (smalltalk interchange format) file |
|
6738 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
6739 |
SmalltalkInterchangeFileManager newForFileIn |
|
6740 |
fileName: fileName pathName; |
|
6741 |
fileIn. |
|
6742 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
|
6743 |
Parcel isNil ifTrue:[ |
|
6744 |
Dialog warn:'Parcel support not loaded.' |
|
6745 |
] ifFalse:[ |
|
6746 |
Parcel loadParcelFrom: fileName pathName |
|
6747 |
] |
|
6748 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6749 |
"/ ask programming languages... |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6750 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6751 |
(lang notNil and:[lang ~= SmalltalkLanguage]) ifTrue:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6752 |
lang fileIn:fileName. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6753 |
] ifFalse:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6754 |
"/ loading a regular (chunk) or xml source file |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6755 |
Error handle:[:ex | |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6756 |
self errorNotify:'Error on file in: ', ex description. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6757 |
] do:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6758 |
aStream := fileName readStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6759 |
[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6760 |
Class withoutUpdatingChangesDo:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6761 |
wasLazy := Compiler compileLazy:lazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6762 |
Smalltalk fileInStream:aStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6763 |
]. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6764 |
Class addInfoRecord:('fileIn ' , fileName asString) |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6765 |
] ensure:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6766 |
Compiler compileLazy:wasLazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6767 |
aStream close |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6768 |
] |
4345 | 6769 |
] |
6770 |
] |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
6771 |
]]] |
4345 | 6772 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6773 |
] 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
|
6774 |
|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
|
6775 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6776 |
isRedef := false. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6777 |
sig := ex signal. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6778 |
(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
|
6779 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6780 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6781 |
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
|
6782 |
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
|
6783 |
, 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
|
6784 |
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
|
6785 |
redefKind := 'method'. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6786 |
isRedef := true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6787 |
] 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
|
6788 |
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
|
6789 |
, 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
|
6790 |
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
|
6791 |
redefKind := 'class'. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6792 |
isRedef := true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6793 |
] 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
|
6794 |
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
|
6795 |
sender := ex suspendedContext. |
7533 | 6796 |
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
|
6797 |
] ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6798 |
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
|
6799 |
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
|
6800 |
]]]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6801 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6802 |
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
|
6803 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6804 |
labels := #('Cancel' 'Skip' 'Debug' 'Compare Sources'). |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6805 |
values := #(abort skip debug compareSources). |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6806 |
|
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6807 |
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
|
6808 |
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
|
6809 |
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
|
6810 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6811 |
labels := labels , #('Keep Package' ). |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6812 |
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
|
6813 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6814 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6815 |
labels := labels , #( 'Continue' 'ContinueForAll'). |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6816 |
values := values , #( continue continueForAll). |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6817 |
|
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6818 |
AbortAllOperationRequest isHandled ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6819 |
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
|
6820 |
values := #(cancelAll) , values. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6821 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6822 |
|
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
6823 |
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
|
6824 |
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
|
6825 |
label:label |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6826 |
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
|
6827 |
labels:labels |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6828 |
values:values |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6829 |
default:#continue |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6830 |
onCancel:#abort. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6831 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6832 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6833 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6834 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6835 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6836 |
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
|
6837 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6838 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6839 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6840 |
(action == #compareSources) ifTrue:[ |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6841 |
DiffCodeView |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6842 |
openOn:(ex oldMethod source) label:'Old Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6843 |
and:(ex newMethod source) label:'New Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6844 |
title:ex description. |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6845 |
ex resignalAs:ex |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
6846 |
]. |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
6847 |
(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
|
6848 |
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
|
6849 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6850 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6851 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6852 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6853 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6854 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6855 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6856 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6857 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6858 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6859 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6860 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6861 |
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
|
6862 |
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
|
6863 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6864 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6865 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6866 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6867 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
6868 |
] |
7040 | 6869 |
|
7533 | 6870 |
"Modified: / 21-11-2006 / 15:53:03 / cg" |
4531 | 6871 |
! |
6872 |
||
4558 | 6873 |
splitFile:infile intoPiecesOfSize:kiloBytes |
6874 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
6875 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
6876 |
||
6877 |
bufferSize := 32*1024. |
|
6878 |
||
6879 |
inStream := infile readStream. |
|
6880 |
||
6881 |
bytesPerSplit := kiloBytes * 1024. |
|
6882 |
||
6883 |
remaining := infile fileSize. |
|
6884 |
splitIndex := 1. |
|
6885 |
[remaining > 0] whileTrue:[ |
|
6886 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
6887 |
outStream := outFile asFilename writeStream. |
|
6888 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
6889 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
6890 |
buffer := ByteArray new:bufferSize. |
|
6891 |
n := inStream |
|
6892 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
6893 |
into:buffer |
|
6894 |
startingAt:1. |
|
6895 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
6896 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
6897 |
remaining := remaining - n. |
|
6898 |
]. |
|
6899 |
outStream close. |
|
6900 |
splitIndex := splitIndex + 1. |
|
6901 |
]. |
|
6902 |
inStream close. |
|
6903 |
! |
|
6904 |
||
6905 |
splitSelectedFiles |
|
6264 | 6906 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 6907 |
|
7560 | 6908 |
selectedFiles := self currentSelectedObjects. |
4558 | 6909 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
6910 |
||
6265 | 6911 |
msg := (numFiles > 1) |
6912 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
6913 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 6914 |
|
6352 | 6915 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 6916 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
6917 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 6918 |
kiloBytes isNil ifTrue:[^ self]. |
6919 |
||
6920 |
selectedFiles do:[:fileName | |
|
6921 |
self notify:('Splitting:', fileName baseName). |
|
6922 |
fileName isDirectory ifFalse:[ |
|
6923 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
|
6924 |
] |
|
6925 |
]. |
|
6190 | 6926 |
self notify:nil. |
6265 | 6927 |
|
7560 | 6928 |
"Modified: / 04-12-2006 / 13:15:26 / cg" |
4558 | 6929 |
! |
6930 |
||
4531 | 6931 |
truncateSelectedFilesToZeroSize |
4554 | 6932 |
|selectedFiles numFiles msg| |
4531 | 6933 |
|
7560 | 6934 |
selectedFiles := self currentSelectedObjects. |
4554 | 6935 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
6936 |
||
4930 | 6937 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
4554 | 6938 |
numFiles > 1 ifTrue:[ |
4930 | 6939 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
4554 | 6940 |
]. |
4531 | 6941 |
|
6942 |
(Dialog |
|
6352 | 6943 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
4531 | 6944 |
initialAnswer:false |
6945 |
) ifFalse:[ |
|
6946 |
^ self |
|
6947 |
]. |
|
6948 |
||
6949 |
selectedFiles do:[:fileName | |
|
6950 |
|s| |
|
6951 |
||
6952 |
self notify:('Truncating:', fileName baseName). |
|
6953 |
fileName isDirectory ifFalse:[ |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6954 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6955 |
s := fileName writeStream. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6956 |
s close. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6957 |
] on:FileStream openErrorSignal do:[:ex| |
4531 | 6958 |
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
|
6959 |
]. |
4531 | 6960 |
] |
6961 |
]. |
|
6190 | 6962 |
self notify:nil. |
7560 | 6963 |
|
6964 |
"Modified: / 04-12-2006 / 13:15:28 / cg" |
|
3892 | 6965 |
! ! |
6966 |
||
4849 | 6967 |
!AbstractFileBrowser methodsFor:'menu queries-cvs'! |
3892 | 6968 |
|
6969 |
canCvsAddAndCommit |
|
6970 |
||
3982 | 6971 |
|selectedFiles| |
6972 |
||
6973 |
selectedFiles := self currentSelectedFiles. |
|
6974 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
3892 | 6975 |
! |
6976 |
||
6977 |
canRemoveCVSContainer |
|
5356
d08261ab1567
care for nonexisting bookmarks file in open
Claus Gittinger <cg@exept.de>
parents:
5334
diff
changeset
|
6978 |
^ self currentSelectedFiles |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6979 |
contains:[:fileName| |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6980 |
|dirOfFile cvsDir| |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6981 |
|
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6982 |
dirOfFile := self getDirWithoutFileName:fileName. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6983 |
cvsDir := dirOfFile construct:'CVS'. |
5318 | 6984 |
cvsDir isDirectory |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
6985 |
]. |
3892 | 6986 |
! ! |
6987 |
||
4849 | 6988 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 6989 |
|
6521 | 6990 |
anySTFilesOrDirectoriesPresent |
6991 |
^ self anyDirectoriesOrFilesPresentWithSuffix:'st' |
|
6992 |
! |
|
6993 |
||
3892 | 6994 |
anySTFilesPresent |
6995 |
^ self anyFilesPresentWithSuffix:'st' |
|
6996 |
! |
|
6997 |
||
6998 |
canCreateNewProject |
|
6999 |
||
3982 | 7000 |
| selectedFiles | |
3892 | 7001 |
|
7002 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
3982 | 7003 |
selectedFiles := self currentSelectedFiles. |
3892 | 7004 |
^ [ |
4414 | 7005 |
((selectedFiles detect:[:fileName| | suffix| |
7006 |
suffix := fileName suffix asLowercase. |
|
7007 |
(suffix = 'prj' or:[suffix = 'st']) |
|
7008 |
] ifNone:[nil]) notNil) |
|
3982 | 7009 |
] |
3892 | 7010 |
! |
7011 |
||
7012 |
canDoTerminal |
|
7013 |
||
7014 |
^ OperatingSystem isUNIXlike |
|
7015 |
or:[OperatingSystem isMSWINDOWSlike] |
|
7016 |
! |
|
7017 |
||
7018 |
canDoTerminalAndSystemIsDOS |
|
7019 |
||
7020 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
7021 |
! |
|
7022 |
||
7023 |
canDoTerminalAndSystemIsUnix |
|
7024 |
||
7025 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
7026 |
! |
|
7027 |
||
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7028 |
canGenerateSignatureFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7029 |
"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
|
7030 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7031 |
Expecco::KeyFileGenerator isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7032 |
Expecco::KeyFile isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7033 |
|
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7034 |
^ self currentSelectedFiles notEmptyOrNil |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7035 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7036 |
|
3892 | 7037 |
canReadAbbrevFile |
7038 |
||
5960 | 7039 |
|currentDirectory| |
3892 | 7040 |
|
7041 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 7042 |
currentDirectory := self currentDirectory. |
7043 |
^ currentDirectory notNil |
|
7044 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 7045 |
! |
7046 |
||
7047 |
canRemoveFromSourcePath |
|
7048 |
||
7049 |
^ false |
|
7050 |
! |
|
7051 |
||
7052 |
hasASN1 |
|
7053 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 7054 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 7055 |
|
7056 |
! |
|
7057 |
||
7058 |
hasASN1AndSelection |
|
7059 |
^ [ self hasSelection value |
|
4414 | 7060 |
and:[self currentSelectedFiles size > 0 |
7061 |
and:[OSI::ASN1Parser notNil |
|
7062 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
3892 | 7063 |
! |
7064 |
||
7065 |
hasCBrowser |
|
7066 |
^ [ CBrowser::Browser notNil ] |
|
7067 |
! |
|
7068 |
||
7069 |
hasJava |
|
7070 |
||
7071 |
^ [ JavaClassReader notNil |
|
4414 | 7072 |
and:[JavaClassReader isLoaded]] |
3892 | 7073 |
! |
7074 |
||
7075 |
hasJavaAndSelection |
|
7076 |
||
3982 | 7077 |
^ [ self currentSelectedFiles size > 0 |
4414 | 7078 |
and:[JavaClassReader notNil |
7079 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 7080 |
! |
7081 |
||
7082 |
hasMP3Player |
|
7083 |
||
7084 |
^ [ MP3PlayerApplication notNil |
|
4414 | 7085 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 7086 |
! |
7087 |
||
7088 |
hasMP3PlayerAndSelection |
|
7089 |
||
3982 | 7090 |
^ [ self currentSelectedFiles size > 0 |
4414 | 7091 |
and:[ self hasMP3Player value]] |
3892 | 7092 |
! |
7093 |
||
8426 | 7094 |
hasResourceFileSelected |
7095 |
||
7096 |
^ [ |
|
7097 |
|sel| |
|
7098 |
||
7099 |
sel := self currentSelectedFiles. |
|
7100 |
sel notEmptyOrNil ifTrue:[ |
|
7101 |
sel conform:[:fn | fn suffix asLowercase = 'rs']. |
|
7102 |
] ifFalse:[ |
|
7103 |
false |
|
7104 |
] |
|
7105 |
] |
|
7106 |
! |
|
7107 |
||
3892 | 7108 |
hasSlideShow |
7109 |
||
7110 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
7111 |
! |
|
7112 |
||
7113 |
hasSnapshotSelection |
|
7114 |
||
7115 |
^ [ |
|
4414 | 7116 |
| files | |
8426 | 7117 |
|
4414 | 7118 |
files := self currentSelectedFiles. |
7119 |
((files size == 1) |
|
7120 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 7121 |
] |
7122 |
! |
|
7123 |
||
7869 | 7124 |
hasXml |
9206 | 7125 |
^ [ XML::XMLParser notNil ] |
7869 | 7126 |
! |
7127 |
||
7128 |
hasXmlFileSelected |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
7129 |
"/ 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
|
7130 |
"/ then handle the error when it ever fails during xml-parsing. |
7869 | 7131 |
|
8426 | 7132 |
^ [ |
7133 |
|sel fileName| |
|
7869 | 7134 |
|
7135 |
sel := self currentSelectedFiles. |
|
7136 |
sel size == 1 ifTrue:[ |
|
7137 |
fileName := sel first. |
|
7138 |
fileName notNil ifTrue:[ |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
7139 |
#('xml' 'vdx') includes:fileName suffix asLowercase |
7869 | 7140 |
] ifFalse:[ |
7141 |
false |
|
7142 |
] |
|
7143 |
] ifFalse:[ |
|
7144 |
false |
|
7145 |
] |
|
7146 |
] |
|
7147 |
! |
|
7148 |
||
3892 | 7149 |
hasZipFileSelected |
7150 |
||
3982 | 7151 |
^ [|sel fileName fn suff| |
7152 |
||
4414 | 7153 |
sel := self currentSelectedFiles. |
7154 |
sel size == 1 ifTrue:[ |
|
7155 |
fileName := sel first. |
|
7156 |
fileName notNil ifTrue:[ |
|
7157 |
suff := fileName suffix asLowercase. |
|
7158 |
suff = 'zip' or:[suff = 'jar'] |
|
7159 |
] ifFalse:[ |
|
7160 |
false |
|
7161 |
] |
|
7162 |
] ifFalse:[ |
|
7163 |
false |
|
7164 |
] |
|
3892 | 7165 |
] |
7166 |
! |
|
7167 |
||
7168 |
javaSupportLoaded |
|
7169 |
||
7170 |
^ false |
|
7171 |
! ! |
|
7172 |
||
3906 | 7173 |
!AbstractFileBrowser methodsFor:'presentation'! |
7174 |
||
7175 |
getModeString:modeBits |
|
7176 |
"convert file-mode bits into a more user-friendly string. |
|
7177 |
This is wrong here - should be moved into OperatingSystem." |
|
7178 |
||
7179 |
^ self getModeString:modeBits |
|
4414 | 7180 |
with:#( 'owner:' $r $w $x |
7181 |
' group:' $r $w $x |
|
7182 |
' others:' $r $w $x ) |
|
3906 | 7183 |
! |
7184 |
||
7185 |
getModeString:modeBits with:texts |
|
7186 |
"convert file-mode bits into a more user-friendly string. |
|
7187 |
This is wrong here - should be moved into OperatingSystem." |
|
7188 |
||
7189 |
|bits modeString| |
|
7190 |
||
7191 |
bits := modeBits bitAnd:8r777. |
|
7192 |
modeString := ''. |
|
7193 |
||
7194 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
7195 |
with: texts do:[:bitMask :access | |
|
4414 | 7196 |
|ch| |
7197 |
||
7198 |
bitMask isNil ifTrue:[ |
|
7199 |
modeString := modeString , access |
|
7200 |
] ifFalse:[ |
|
7201 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
7202 |
ch := $- |
|
7203 |
] ifFalse:[ |
|
7204 |
ch := access |
|
7205 |
]. |
|
7206 |
modeString := modeString copyWith:ch |
|
7207 |
] |
|
3906 | 7208 |
]. |
7209 |
^ modeString |
|
7210 |
! ! |
|
7211 |
||
5880 | 7212 |
!AbstractFileBrowser methodsFor:'private'! |
7213 |
||
7214 |
theSingleSelectedDirectoryOrHomeDir |
|
7215 |
|dir| |
|
7216 |
||
5888 | 7217 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 7218 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
7219 |
^ dir. |
|
7220 |
! |
|
7221 |
||
7222 |
theSingleSelectedDirectoryOrNil |
|
7223 |
|dirs| |
|
7224 |
||
7225 |
dirs := self currentSelectedDirectories. |
|
7226 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
7227 |
^ dirs anElement. |
|
7228 |
! ! |
|
7229 |
||
3892 | 7230 |
!AbstractFileBrowser methodsFor:'queries'! |
7231 |
||
8256 | 7232 |
cBrowserLoaded |
7233 |
^ CBrowser::Browser notNil |
|
7234 |
! |
|
7235 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
7236 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
7237 |
"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
|
7238 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
7239 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
7240 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
7241 |
|
3906 | 7242 |
getFileInfoStringForFirstSelectedFile:longInfo |
7243 |
"get stat info on selected file - return a string which can be |
|
7244 |
shown in a box" |
|
7245 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
7246 |
|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
|
7247 |
sizeString fileSize tAccess tModification buffer| |
3906 | 7248 |
|
7560 | 7249 |
selFiles := self currentSelectedObjects. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7250 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 7251 |
filename := selFiles first. |
7252 |
||
8364 | 7253 |
info := filename linkInfo. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
7254 |
info isNil ifTrue:[ |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
7255 |
^ 'Cannot get fileInfo'. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
7256 |
^ nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
7257 |
]. |
8364 | 7258 |
|
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
7259 |
buffer := Text writeStream. |
4765 | 7260 |
|
7261 |
buffer |
|
7262 |
nextPutAll:'filename: '; |
|
7263 |
nextPutLine:filename asString. |
|
7264 |
||
8364 | 7265 |
OperatingSystem isMSDOSlike ifTrue: [ |
7266 |
(info alternativeName notNil |
|
7267 |
and:[ info alternativeName ~= info fullName ]) ifTrue:[ |
|
7268 |
buffer nextPutAll:'shortname: '. |
|
7269 |
buffer nextPutLine:info alternativeName. |
|
7270 |
] |
|
7271 |
]. |
|
7272 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7273 |
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
|
7274 |
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
|
7275 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7276 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7277 |
]. |
4765 | 7278 |
buffer |
7279 |
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
|
7280 |
nextPutLine:(info path ? '???'). |
3906 | 7281 |
] 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
|
7282 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7283 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7284 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7285 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7286 |
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
|
7287 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7288 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7289 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7290 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7291 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7292 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
7293 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
7294 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
7295 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
7296 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
7297 |
fileSize > 1024 ifTrue:[ |
8172 | 7298 |
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
|
7299 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
7300 |
]. |
4765 | 7301 |
buffer nextPutLine:sizeString. |
3906 | 7302 |
|
7303 |
modeBits := info mode. |
|
7304 |
modeString := self getModeString:modeBits. |
|
4765 | 7305 |
|
7306 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 7307 |
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
|
7308 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 7309 |
]. |
4765 | 7310 |
buffer |
7311 |
cr; |
|
7312 |
nextPutAll:'owner: '; |
|
7313 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
7314 |
||
3906 | 7315 |
longInfo ifTrue:[ |
4765 | 7316 |
buffer |
7317 |
nextPutAll:'group: '; |
|
7318 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
7319 |
||
7320 |
tAccess := info accessTime. |
|
7321 |
buffer |
|
7322 |
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
|
7323 |
nextPutAll:tAccess asDate printString; |
4765 | 7324 |
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
|
7325 |
nextPutLine:tAccess asTime printString. |
4765 | 7326 |
|
7327 |
tModification := info modificationTime. |
|
7328 |
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
|
7329 |
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
|
7330 |
nextPutAll:tModification asDate printString; |
4765 | 7331 |
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
|
7332 |
nextPutLine:tModification asTime printString. |
3906 | 7333 |
]. |
4765 | 7334 |
^ buffer contents |
7560 | 7335 |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
7336 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
3906 | 7337 |
! |
7338 |
||
8510 | 7339 |
hasImageColorHistogram |
7340 |
^ ImageColorHistogram notNil |
|
7341 |
! |
|
7342 |
||
3892 | 7343 |
initialCommandFor:fileName into:aBox |
7344 |
"set a useful initial command for execute box." |
|
7345 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
7346 |
self class initialCommandFor:fileName in:Filename currentDirectory intoBox:aBox |
3892 | 7347 |
! |
7348 |
||
7349 |
isAbstractFileBrowser |
|
7350 |
||
7351 |
^ true |
|
7352 |
! |
|
7353 |
||
7354 |
systemIsDOS |
|
7355 |
||
7356 |
^ OperatingSystem isMSDOSlike |
|
7357 |
! |
|
7358 |
||
7359 |
systemIsUnix |
|
7360 |
^ OperatingSystem isUNIXlike |
|
7361 |
! ! |
|
7362 |
||
7363 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
7364 |
||
7365 |
allItemsOfCurrentDirectory |
|
5009 | 7366 |
self |
4774 | 7367 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 7368 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
7369 |
||
7370 |
^ nil |
|
3892 | 7371 |
! |
7372 |
||
7373 |
anyFilesPresentWithSuffix:suffix |
|
6725 | 7374 |
self currentSelectedDirectories do:[:dir| |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7375 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
7376 |
(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
|
7377 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 7378 |
]. |
7379 |
^ false. |
|
7380 |
! |
|
7381 |
||
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
7382 |
commonPrefixOfSelectedFiles |
4773 | 7383 |
|selFiles stringCol firstPre| |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
7384 |
|
7560 | 7385 |
selFiles := self currentSelectedObjects. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
7386 |
selFiles isEmpty ifTrue:[^ nil]. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
7387 |
|
4772 | 7388 |
stringCol := selFiles collect:[:file | file asString]. |
4773 | 7389 |
firstPre := stringCol at:1. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
7390 |
stringCol from:2 do:[:el| |
4773 | 7391 |
firstPre := firstPre commonPrefixWith:el. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
7392 |
]. |
4773 | 7393 |
^ firstPre asFilename |
7560 | 7394 |
|
7395 |
"Modified: / 04-12-2006 / 13:14:25 / cg" |
|
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
7396 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
7397 |
|
3892 | 7398 |
currentFilesAreInSameDirectory |
7399 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
7400 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 7401 |
! |
7402 |
||
7403 |
currentFilesHasDirectories |
|
7404 |
||
6725 | 7405 |
^ self currentSelectedDirectories notEmpty. |
3892 | 7406 |
! |
7407 |
||
3982 | 7408 |
directoriesForFiles:aFileCol |
7409 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
7410 |
^ (aFileCol collect:[:file| self getDirWithoutFileName:file]) asSet. |
3982 | 7411 |
! |
7412 |
||
3892 | 7413 |
fileListIsEmpty |
5009 | 7414 |
self |
7415 |
applicationNamed:#DirectoryContentsBrowser |
|
7416 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
7417 |
||
7418 |
^ nil. |
|
3892 | 7419 |
! |
7420 |
||
7421 |
fileListIsNotEmpty |
|
7422 |
||
7423 |
^ self fileListIsEmpty not. |
|
7424 |
! |
|
7425 |
||
7426 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 7427 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 7428 |
|
7429 |
| file1 file2 | |
|
7430 |
||
6284 | 7431 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 7432 |
file1 := aFilename1 asFilename. |
7433 |
file2 := aFilename2 asFilename. |
|
6284 | 7434 |
|
3892 | 7435 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 7436 |
|
3892 | 7437 |
((file1 isDirectory) |
7438 |
and:[(file2 isDirectory) |
|
7439 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 7440 |
^ file1 baseName = file2 baseName |
3892 | 7441 |
]. |
3982 | 7442 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 7443 |
! |
7444 |
||
7445 |
getAllFilesAsStringCollection |
|
5009 | 7446 |
self |
7447 |
applicationNamed:#DirectoryContentsBrowser |
|
7448 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
7449 |
||
7450 |
^ nil |
|
3892 | 7451 |
! |
7452 |
||
7453 |
getBestDirectory |
|
7454 |
||
7455 |
|selFiles stringCol firstPre| |
|
7456 |
||
6725 | 7457 |
selFiles := self currentSelectedDirectories. |
3892 | 7458 |
selFiles isEmpty ifTrue:[^ nil]. |
7459 |
selFiles size == 1 ifTrue:[^ selFiles first]. |
|
4486 | 7460 |
stringCol := (selFiles collect:[:file| file asString]) asOrderedCollection. |
3892 | 7461 |
firstPre := stringCol at:1. |
7462 |
stringCol from:2 do:[:el| |
|
4414 | 7463 |
firstPre := firstPre commonPrefixWith:el. |
3892 | 7464 |
]. |
7465 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
4414 | 7466 |
firstPre removeLast. |
3892 | 7467 |
]. |
7468 |
^ firstPre asFilename |
|
7469 |
! |
|
7470 |
||
7471 |
getDirWithoutFileName:aFileName |
|
7472 |
||
7473 |
| dir | |
|
7474 |
aFileName isNil ifTrue:[ |
|
4414 | 7475 |
^ aFileName. |
3892 | 7476 |
]. |
7477 |
dir := aFileName asFilename. |
|
7478 |
dir isDirectory ifFalse:[ |
|
4414 | 7479 |
dir := dir directory. |
3892 | 7480 |
]. |
7481 |
^ dir. |
|
7482 |
! |
|
7483 |
||
7484 |
getInfoItem |
|
7485 |
"get filename of a description-file (.dir.info, README etc.); |
|
7486 |
This file is automatically shown when a directory is enterred. |
|
7487 |
You can add more names below if you like." |
|
7488 |
||
5880 | 7489 |
|dir| |
7490 |
||
7491 |
dir := self theSingleSelectedDirectoryOrNil. |
|
7492 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 7493 |
|
7494 |
#( |
|
7495 |
'.dir.info' |
|
7496 |
'README' |
|
7497 |
'ReadMe' |
|
7498 |
'Readme' |
|
7499 |
'readme' |
|
7500 |
'read.me' |
|
7501 |
'Read.me' |
|
7502 |
'READ.ME' |
|
7503 |
'README.TXT' |
|
7504 |
'readme.txt' |
|
7505 |
'Readme.txt' |
|
7506 |
'Info.txt' |
|
7507 |
'info.txt' |
|
7508 |
'INFO.TXT' |
|
7509 |
) do:[:f | |
|
5883 | 7510 |
|n| |
4414 | 7511 |
|
5880 | 7512 |
n := dir construct:f. |
4414 | 7513 |
(n isReadable and:[n isDirectory not]) ifTrue:[ |
7514 |
^ DirectoryContentsBrowser itemClass fileName:n |
|
7515 |
] |
|
3892 | 7516 |
]. |
7517 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
7518 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
7519 |
|
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
7520 |
parentDirectoriesOfCurrentFiles |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
7521 |
|
8251
9fd0533be7d9
changed #parentDirectoriesOfCurrentFiles
Claus Gittinger <cg@exept.de>
parents:
8192
diff
changeset
|
7522 |
^ (self currentSelectedObjects |
8253 | 7523 |
collect:[:file | file directory]) asSet |
7560 | 7524 |
|
7525 |
"Modified: / 04-12-2006 / 13:15:21 / cg" |
|
6521 | 7526 |
! |
7527 |
||
7528 |
recursiveAnyFilesPresentWithSuffix:suffix |
|
6652 | 7529 |
^ true. "/ the code below is too slow for a menu enabling operation |
7530 |
||
7531 |
"/ |directories| |
|
7532 |
"/ |
|
7533 |
"/ directories := self currentDirectories value. |
|
7534 |
"/ directories do:[:dir| |
|
7535 |
"/ [ |
|
7536 |
"/ dir recursiveDirectoryContentsDo:[:f | |
|
7537 |
"/ (f asFilename suffix = suffix) ifTrue:[ ^ true] |
|
7538 |
"/ ] |
|
7539 |
"/ ] on:FileStream openErrorSignal do:[:ex|]. |
|
7540 |
"/ ]. |
|
7541 |
"/ ^ false. |
|
6586 | 7542 |
! |
7543 |
||
7544 |
recursiveAnySTFilesPresent |
|
7545 |
^ self recursiveAnyFilesPresentWithSuffix:'st' |
|
3982 | 7546 |
! ! |
7547 |
||
7548 |
!AbstractFileBrowser methodsFor:'selection'! |
|
7549 |
||
7550 |
currentSelectedDirectories |
|
6725 | 7551 |
^ self currentDirectoriesValue. |
3982 | 7552 |
! |
7553 |
||
7554 |
currentSelectedFiles |
|
7560 | 7555 |
^ self currentSelectedObjects select:[:file | file isDirectory not]. |
7556 |
||
7557 |
"Modified: / 04-12-2006 / 13:14:39 / cg" |
|
3982 | 7558 |
! |
7559 |
||
6460 | 7560 |
currentSelectedObjects |
7561 |
^ self currentFileNameHolder value |
|
7562 |
! |
|
7563 |
||
3982 | 7564 |
firstSelectedFile |
7560 | 7565 |
^ self currentSelectedObjects |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7566 |
detect:[:file | file asFilename isDirectory not] |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7567 |
ifNone:[]. |
7560 | 7568 |
|
7569 |
"Modified: / 04-12-2006 / 13:14:50 / cg" |
|
4414 | 7570 |
! |
7571 |
||
9490 | 7572 |
hasOnlyDirectoriesSelected |
7573 |
^ self currentSelectedObjects conform:[:file | file isDirectory]. |
|
7574 |
||
7575 |
"Created: / 20-05-2010 / 10:45:03 / cg" |
|
7576 |
! |
|
7577 |
||
4414 | 7578 |
hasOnlyFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7579 |
|
7560 | 7580 |
^ self currentSelectedObjects conform:[:file | file isDirectory not]. |
7581 |
||
7582 |
"Modified: / 04-12-2006 / 13:15:01 / cg" |
|
4414 | 7583 |
! |
7584 |
||
9490 | 7585 |
hasTwoDirectoriesSelected |
7586 |
||
7587 |
^ self currentSelectedObjects size == 2 |
|
7588 |
and:[self hasOnlyDirectoriesSelected] |
|
7589 |
||
7590 |
"Created: / 20-05-2010 / 10:45:18 / cg" |
|
7591 |
! |
|
7592 |
||
4414 | 7593 |
hasTwoFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7594 |
|
7560 | 7595 |
^ self currentSelectedObjects size == 2 |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7596 |
and:[self hasOnlyFilesSelected] |
7560 | 7597 |
|
7598 |
"Modified: / 04-12-2006 / 13:15:04 / cg" |
|
3892 | 7599 |
! ! |
7600 |
||
3964 | 7601 |
!AbstractFileBrowser methodsFor:'sorting'! |
7602 |
||
3989 | 7603 |
currentSortOrder |
4027 | 7604 |
^ self aspectFor:#currentSortOrder ifAbsent:[ Dictionary new asValue ]. |
3989 | 7605 |
! |
7606 |
||
7607 |
sortBlockHolder |
|
7608 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 7609 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
7610 |
selector:#fileName |
|
7611 |
sortCaseless:self sortCaseless value |
|
7612 |
sortReverse:false) asValue. |
|
3989 | 7613 |
]. |
7614 |
! |
|
7615 |
||
7616 |
sortBlockProperty |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
7617 |
|v| |
4027 | 7618 |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
7619 |
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
|
7620 |
v addDependent:self. |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
7621 |
^ v. |
3989 | 7622 |
! |
7623 |
||
7624 |
sortCaseless |
|
4201 | 7625 |
" aspect for sort caseless " |
3989 | 7626 |
|
7627 |
^ self aspectFor:#sortCaseless ifAbsent:[ |
|
9393 | 7628 |
(Filename isCaseSensitive not) asValue. |
7629 |
] |
|
3989 | 7630 |
! |
7631 |
||
4074 | 7632 |
sortDirectoriesBeforeFiles |
7633 |
||
4201 | 7634 |
" aspect for sort directories always before files" |
4074 | 7635 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
7636 |
! |
|
7637 |
||
3989 | 7638 |
sortFileListsBy:instanceName |
7639 |
||
7640 |
self sortFileListsBy:instanceName withReverse:true |
|
7641 |
! |
|
7642 |
||
7643 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
7644 |
| aSymbol sortCaselessLocal currentSortOrder sorter isReverse| |
3964 | 7645 |
|
7646 |
aSymbol := instanceName asSymbol. |
|
4027 | 7647 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 7648 |
sortCaselessLocal := self sortCaseless value. |
4027 | 7649 |
currentSortOrder := self currentSortOrder value. |
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
7650 |
currentSortOrder isEmptyOrNil ifTrue:[ |
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
7651 |
self currentSortOrder value:(currentSortOrder := Dictionary new). |
4343 | 7652 |
currentSortOrder at:#column put:aSymbol. |
7653 |
currentSortOrder at:#reverse put:false. |
|
7654 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 7655 |
] ifFalse:[ |
4343 | 7656 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
7657 |
"/ sort caseless changed |
|
7658 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
7659 |
] ifFalse:[ |
|
7660 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
7661 |
"/ same column like before - change sort order ifReverse is true |
|
7662 |
aBoolean ifTrue:[ |
|
7663 |
isReverse := currentSortOrder at:#reverse. |
|
7664 |
currentSortOrder at:#reverse put:(isReverse not). |
|
7665 |
]. |
|
7666 |
] ifFalse:[ |
|
7667 |
"/ another column - remark column |
|
7668 |
currentSortOrder at:#column put:aSymbol. |
|
7669 |
] |
|
7670 |
] |
|
3964 | 7671 |
]. |
4027 | 7672 |
self currentSortOrder changed. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
7673 |
|
5383 | 7674 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
7675 |
selector:instanceName |
|
7676 |
sortCaseless:sortCaselessLocal |
|
7677 |
sortReverse:(currentSortOrder at:#reverse). |
|
7678 |
self sortBlockHolder value:sorter. |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
7679 |
|
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
7680 |
"Modified: / 18-09-2007 / 09:42:47 / cg" |
3964 | 7681 |
! ! |
7682 |
||
3892 | 7683 |
!AbstractFileBrowser methodsFor:'startup & release'! |
7684 |
||
7685 |
makeDependent |
|
4074 | 7686 |
self filterModel addDependent:self. |
4004 | 7687 |
self currentFileNameHolder addDependent:self. |
4074 | 7688 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 7689 |
self sortCaseless addDependent:self. |
4011 | 7690 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
7691 |
self rootHolder addDependent:self. |
3892 | 7692 |
! |
7693 |
||
7694 |
masterApplication:anApplication |
|
7695 |
||
7696 |
masterApplication isNil ifTrue:[ |
|
4414 | 7697 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
7698 |
aspects := anApplication aspects |
|
7699 |
] ifFalse:[ |
|
7700 |
aspects isNil ifTrue:[ |
|
7701 |
aspects := IdentityDictionary new. |
|
7702 |
aspects at:#applications put:(IdentityDictionary new). |
|
7703 |
] |
|
7704 |
]. |
|
7705 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
7706 |
"/ self makeDependent. |
3892 | 7707 |
]. |
3952 | 7708 |
^ super masterApplication:anApplication. |
3892 | 7709 |
! |
7710 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
7711 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
7712 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
7713 |
super postBuildWith:aBuilder. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
7714 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
7715 |
|
3892 | 7716 |
postOpenWith:aBuilder |
7717 |
||
7718 |
super postOpenWith:aBuilder. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7719 |
self windowGroup showWaitCursorWhenBusyForMillis:100. |
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7720 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7721 |
"Modified: / 25-07-2006 / 09:12:45 / cg" |
3892 | 7722 |
! ! |
7723 |
||
7724 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
7725 |
||
7726 |
files |
|
7727 |
"return the value of the instance variable 'files' (automatically generated)" |
|
7728 |
||
7729 |
^ files |
|
7730 |
! |
|
7731 |
||
7732 |
files:something |
|
7733 |
"set the value of the instance variable 'files' (automatically generated)" |
|
7734 |
||
7735 |
files := something. |
|
7736 |
! |
|
7737 |
||
7738 |
method |
|
7739 |
"return the value of the instance variable 'method' (automatically generated)" |
|
7740 |
||
7741 |
^ method |
|
7742 |
! |
|
7743 |
||
7744 |
method:something |
|
7745 |
"set the value of the instance variable 'method' (automatically generated)" |
|
7746 |
||
7747 |
method := something. |
|
7748 |
! ! |
|
7749 |
||
7750 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
7751 |
||
7752 |
locked |
|
7753 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
7754 |
||
7755 |
locked isNil ifTrue:[ |
|
4414 | 7756 |
locked := false. |
3892 | 7757 |
]. |
7758 |
^ locked |
|
7759 |
! ! |
|
7760 |
||
7761 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
7762 |
||
7763 |
doIfUnLocked:aBlock |
|
7764 |
||
7765 |
self locked ifFalse:[ |
|
4414 | 7766 |
aBlock value. |
3892 | 7767 |
]. |
7768 |
! |
|
7769 |
||
7770 |
doLocked:aBlock |
|
7771 |
||
7772 |
locked := true. |
|
4004 | 7773 |
aBlock ensure:[ |
4414 | 7774 |
locked := false. |
4004 | 7775 |
] |
3892 | 7776 |
! ! |
7777 |
||
3952 | 7778 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
7779 |
||
6369 | 7780 |
defaultHistorySize |
7781 |
^ 50 |
|
3892 | 7782 |
! ! |
7783 |
||
6371 | 7784 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 7785 |
|
7786 |
new |
|
6371 | 7787 |
^ (super new) initializeHistory. |
6369 | 7788 |
! ! |
7789 |
||
7790 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
7791 |
||
7792 |
historySize |
|
7793 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
7794 |
^ historySize |
|
7795 |
! |
|
7796 |
||
7797 |
historySize:aNumber |
|
7798 |
historySize := aNumber |
|
4032 | 7799 |
! ! |
7800 |
||
3892 | 7801 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
7802 |
||
3952 | 7803 |
addToHistory:aPath |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7804 |
| item pathToAdd | |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7805 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7806 |
pathToAdd := aPath. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7807 |
(pathToAdd endsWith:(Filename separator)) ifTrue:[ |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7808 |
pathToAdd asFilename isRootDirectory ifFalse:[ |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7809 |
pathToAdd := pathToAdd copyWithoutLast:(Filename separator asString size). |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7810 |
] |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7811 |
]. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7812 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7813 |
item := self getItemFor:pathToAdd. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7814 |
self backForwardListAdd:pathToAdd. |
3952 | 7815 |
item isNil ifTrue:[ |
4347 | 7816 |
" not already in history" |
6369 | 7817 |
self size >= self historySize ifTrue:[ |
4347 | 7818 |
self removeLast. |
7819 |
]. |
|
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7820 |
item := DirectoryHistoryItem path:pathToAdd. |
4347 | 7821 |
self addFirst:item |
3952 | 7822 |
] ifFalse:[ |
4347 | 7823 |
"already been there before; move the entry to |
7824 |
the beginning, so it will fall out later." |
|
7825 |
self remove:item. |
|
7826 |
self addFirst:item |
|
3892 | 7827 |
]. |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7828 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
7829 |
"Modified: / 06-12-2006 / 11:59:50 / cg" |
3952 | 7830 |
! |
7831 |
||
4347 | 7832 |
backForwardListAdd:aPath |
7833 |
|pathIndex| |
|
7834 |
||
7835 |
pathIndex := backForwardList indexOf:aPath. |
|
7836 |
pathIndex == 0 ifTrue:[ |
|
7837 |
" a new path comes in remove forward paths " |
|
7838 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
7839 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
7840 |
]. |
|
7841 |
] ifFalse:[ |
|
7842 |
backForwardList remove:aPath. |
|
7843 |
pathIndex <= backForwardIndex ifTrue:[ |
|
7844 |
backForwardIndex := backForwardIndex - 1. |
|
7845 |
] |
|
4022 | 7846 |
]. |
4347 | 7847 |
backForwardList add:aPath afterIndex:backForwardIndex. |
7848 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 7849 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 7850 |
backForwardList removeFirst. |
7851 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 7852 |
]. |
4347 | 7853 |
! |
7854 |
||
7855 |
goBackward |
|
4288 | 7856 |
"return the first path of the backward list; |
7857 |
remove it from the back list and add it ti the forward list." |
|
4022 | 7858 |
|
4347 | 7859 |
|retPath| |
7860 |
||
7861 |
self canBackward ifTrue:[ |
|
7862 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
7863 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 7864 |
]. |
4022 | 7865 |
^ retPath. |
7866 |
! |
|
7867 |
||
7868 |
goForward |
|
4288 | 7869 |
"return the first path of the forward list; |
7870 |
remove it from the list." |
|
4022 | 7871 |
|
4347 | 7872 |
|retPath| |
7873 |
||
7874 |
self canForward ifTrue:[ |
|
7875 |
retPath := backForwardList at:backForwardIndex + 1. |
|
7876 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 7877 |
]. |
4022 | 7878 |
^ retPath. |
7879 |
! |
|
7880 |
||
7881 |
resetForwardBackward |
|
7882 |
||
4347 | 7883 |
self initialize |
4022 | 7884 |
! |
7885 |
||
7886 |
setPosition:aPosition for:aPath |
|
7887 |
||
7888 |
self do:[:item| |
|
4414 | 7889 |
item path = aPath ifTrue:[ |
7890 |
item position:aPosition. |
|
7891 |
] |
|
4022 | 7892 |
]. |
3892 | 7893 |
! ! |
7894 |
||
4870 | 7895 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 7896 |
|
6371 | 7897 |
initializeHistory |
4032 | 7898 |
|
4347 | 7899 |
backForwardList := OrderedCollection new. |
7900 |
self reverseDo:[:el| |
|
7901 |
backForwardList add:el path. |
|
7902 |
]. |
|
7903 |
backForwardIndex := backForwardList size. |
|
4032 | 7904 |
! ! |
7905 |
||
3892 | 7906 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
7907 |
||
4288 | 7908 |
canBackward |
4347 | 7909 |
|
7910 |
^ backForwardIndex > 1 |
|
4288 | 7911 |
! |
7912 |
||
3892 | 7913 |
canForward |
4347 | 7914 |
|
7915 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
7916 |
! |
|
7917 |
||
7918 |
getBackCollection |
|
7919 |
||
7920 |
| backCol | |
|
7921 |
||
7922 |
backCol := OrderedCollection new. |
|
7923 |
self canBackward ifTrue:[ |
|
7924 |
| tmpCol | |
|
7925 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
7926 |
tmpCol reverseDo:[ :el| |
|
7927 |
backCol add:el. |
|
7928 |
] |
|
7929 |
]. |
|
7930 |
^ backCol |
|
3952 | 7931 |
! |
7932 |
||
7933 |
getForwardCollection |
|
7934 |
||
4347 | 7935 |
| forwCol | |
7936 |
||
7937 |
forwCol := OrderedCollection new. |
|
7938 |
self canForward ifTrue:[ |
|
7939 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
7940 |
]. |
|
7941 |
^ forwCol |
|
3952 | 7942 |
! |
7943 |
||
7944 |
getItemFor:aPath |
|
6627 | 7945 |
^ self detect:[:item| item path = aPath] ifNone:nil. |
7946 |
"/ self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
7947 |
"/ ^ nil. |
|
3952 | 7948 |
! |
7949 |
||
7950 |
getPositionFor:aPath |
|
7951 |
||
7952 |
|item| |
|
7953 |
||
7954 |
item := self getItemFor:aPath. |
|
7955 |
||
7956 |
item notNil ifTrue:[ |
|
4414 | 7957 |
^ item position. |
3952 | 7958 |
]. |
7959 |
^ nil |
|
7960 |
! |
|
7961 |
||
7962 |
includesPath:aPath |
|
6627 | 7963 |
^ self contains:[:item | item path = aPath]. |
7964 |
||
7965 |
"/ self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
7966 |
"/ ^ false. |
|
4347 | 7967 |
! |
7968 |
||
7969 |
nextBackwardItem |
|
7970 |
"return the first path of the backward list" |
|
7971 |
||
7972 |
|retPath| |
|
7973 |
||
7974 |
self canBackward ifTrue:[ |
|
7975 |
retPath := backForwardList at:backForwardIndex. |
|
7976 |
]. |
|
7977 |
^ retPath. |
|
7978 |
! |
|
7979 |
||
7980 |
nextForwardItem |
|
7981 |
"return the first path of the forward list" |
|
7982 |
||
7983 |
|retPath| |
|
7984 |
||
7985 |
self canForward ifTrue:[ |
|
7986 |
retPath := backForwardList at:backForwardIndex + 1. |
|
7987 |
]. |
|
7988 |
^ retPath. |
|
3952 | 7989 |
! ! |
7990 |
||
7991 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
7992 |
||
7993 |
path:aPath |
|
7994 |
||
7995 |
^ self new path:aPath |
|
7996 |
! ! |
|
7997 |
||
7998 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
7999 |
||
6433 | 8000 |
asFilename |
8001 |
^ path asFilename |
|
8002 |
! |
|
8003 |
||
3952 | 8004 |
path |
8005 |
"return the value of the instance variable 'path' (automatically generated)" |
|
8006 |
||
8007 |
^ path |
|
8008 |
! |
|
8009 |
||
8010 |
path:something |
|
8011 |
"set the value of the instance variable 'path' (automatically generated)" |
|
8012 |
||
8013 |
path := something. |
|
8014 |
! |
|
8015 |
||
8016 |
position |
|
8017 |
"return the value of the instance variable 'position' (automatically generated)" |
|
8018 |
||
8019 |
^ position |
|
8020 |
! |
|
8021 |
||
8022 |
position:something |
|
8023 |
"set the value of the instance variable 'position' (automatically generated)" |
|
8024 |
||
8025 |
position := something. |
|
8026 |
! |
|
8027 |
||
8028 |
printString |
|
8029 |
||
8030 |
^ self path asString |
|
3892 | 8031 |
! ! |
8032 |
||
4915 | 8033 |
!AbstractFileBrowser::FilenameHistory class methodsFor:'accessing-attributes'! |
3892 | 8034 |
|
4337
f2eed806e854
change first letter uppercase methods on class side to lowercase ones
penk
parents:
4317
diff
changeset
|
8035 |
filenameHistorySize |
3892 | 8036 |
|
8037 |
^ 20 |
|
8038 |
! ! |
|
8039 |
||
8040 |
!AbstractFileBrowser::FilenameHistory methodsFor:'adding & removing'! |
|
8041 |
||
5242
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
8042 |
add:aFileItem |
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
8043 |
(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
|
8044 |
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
|
8045 |
]. |
04616d3a672c
history fixed (only kept the oldest items, instead of the newest ones)
Claus Gittinger <cg@exept.de>
parents:
5162
diff
changeset
|
8046 |
self addFirst:aFileItem. |
3892 | 8047 |
! ! |
8048 |
||
8049 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
8050 |
||
8051 |
withValue:aValue isHolder:aBoolean |
|
8052 |
||
8053 |
| instance | |
|
8054 |
||
8055 |
instance := self basicNew. |
|
8056 |
instance value:aValue. |
|
8057 |
instance isHolder:aBoolean. |
|
8058 |
^ instance |
|
8059 |
! ! |
|
8060 |
||
8061 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
8062 |
||
8063 |
isHolder |
|
8064 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
8065 |
||
8066 |
^ isHolder |
|
8067 |
! |
|
8068 |
||
8069 |
isHolder:something |
|
8070 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
|
8071 |
||
8072 |
isHolder := something. |
|
8073 |
! |
|
8074 |
||
8075 |
value |
|
8076 |
"return the value of the instance variable 'value' (automatically generated)" |
|
8077 |
||
8078 |
^ value |
|
8079 |
! |
|
8080 |
||
8081 |
value:something |
|
8082 |
"set the value of the instance variable 'value' (automatically generated)" |
|
8083 |
||
8084 |
value := something. |
|
8085 |
! ! |
|
8086 |
||
8087 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
8088 |
||
8089 |
version |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
8090 |
^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.440 2010-05-20 09:18:17 cg Exp $' |
8832 | 8091 |
! |
8092 |
||
8093 |
version_CVS |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
8094 |
^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.440 2010-05-20 09:18:17 cg Exp $' |
3892 | 8095 |
! ! |