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