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