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