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