author | Claus Gittinger <cg@exept.de> |
Sat, 25 Nov 2017 17:44:20 +0100 | |
changeset 17790 | 77ef76b01d6b |
parent 17772 | 52be86700796 |
child 17818 | 045764df016c |
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 |
" |
|
15211 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
14 |
"{ NameSpace: Smalltalk }" |
|
15 |
||
16 |
ApplicationModel subclass:#AbstractFileBrowser |
|
17 |
instanceVariableNames:'aspects' |
|
16720 | 18 |
classVariableNames:'CommandHistory CommandHistorySize DefaultCommandPerSuffix |
19 |
DefaultFilters DirectoryBookmarks LastEnforcedNameSpace |
|
20 |
LastFileDiffDirectory LastFileDiffFile LastFileSelection |
|
21 |
LastMercurialRepository LastMoveDestination LastMustMatchPattern |
|
22 |
LastScriptBlockString RootHolder RuntimeAspects |
|
17768 | 23 |
VisitedDirectories MaxFileSizeShownWithoutAsking' |
15211 | 24 |
poolDictionaries:'' |
25 |
category:'Interface-Tools-File' |
|
26 |
! |
|
3892 | 27 |
|
28 |
AbstractFileBrowser class instanceVariableNames:'DisabledCursorImage EnabledCursorImage' |
|
29 |
||
30 |
" |
|
31 |
The following class instance variables are inherited by this class: |
|
32 |
||
14126 | 33 |
ApplicationModel - ClassResources |
34 |
Model - |
|
35 |
Object - |
|
3892 | 36 |
" |
37 |
! |
|
38 |
||
39 |
Object subclass:#Clipboard |
|
14126 | 40 |
instanceVariableNames:'method files' |
41 |
classVariableNames:'' |
|
42 |
poolDictionaries:'' |
|
43 |
privateIn:AbstractFileBrowser |
|
3892 | 44 |
! |
45 |
||
46 |
Object subclass:#CodeExecutionLock |
|
14126 | 47 |
instanceVariableNames:'locked' |
48 |
classVariableNames:'' |
|
49 |
poolDictionaries:'' |
|
50 |
privateIn:AbstractFileBrowser |
|
3892 | 51 |
! |
52 |
||
4366 | 53 |
List subclass:#DirectoryHistory |
14126 | 54 |
instanceVariableNames:'forwardList backList lastWasForwardPath lastBackPath lastAddPath |
55 |
backForwardList backForwardIndex historySize' |
|
56 |
classVariableNames:'HistorySize' |
|
57 |
poolDictionaries:'' |
|
58 |
privateIn:AbstractFileBrowser |
|
3952 | 59 |
! |
60 |
||
61 |
Object subclass:#DirectoryHistoryItem |
|
14126 | 62 |
instanceVariableNames:'path position' |
63 |
classVariableNames:'' |
|
64 |
poolDictionaries:'' |
|
65 |
privateIn:AbstractFileBrowser::DirectoryHistory |
|
3892 | 66 |
! |
67 |
||
68 |
Object subclass:#SaveAspectItem |
|
14126 | 69 |
instanceVariableNames:'value isHolder' |
70 |
classVariableNames:'' |
|
71 |
poolDictionaries:'' |
|
72 |
privateIn:AbstractFileBrowser |
|
3892 | 73 |
! |
74 |
||
5140 | 75 |
!AbstractFileBrowser class methodsFor:'documentation'! |
76 |
||
77 |
copyright |
|
78 |
" |
|
79 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
80 |
All Rights Reserved |
|
81 |
||
82 |
This software is furnished under a license and may be used |
|
83 |
only in accordance with the terms of that license and with the |
|
84 |
inclusion of the above copyright notice. This software may not |
|
85 |
be provided or otherwise made available to, or used by, any |
|
86 |
other person. No title to or ownership of the software is |
|
87 |
hereby transferred. |
|
88 |
" |
|
5967 | 89 |
! |
90 |
||
91 |
documentation |
|
92 |
" |
|
93 |
[Author:] |
|
94 |
Christian Penk |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
95 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
96 |
Notice: this certainly needs a redesign - all those abstract-abstract classes which |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
97 |
define stuff which is only needed in some parts makes this hard to understand. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
98 |
Especially the fact, that AbstractFileBrowser defines things both as abstract superclass |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
99 |
and as a container is almost incomprehensable... |
17768 | 100 |
|
101 |
[class variables:] |
|
102 |
CommandHistory |
|
103 |
CommandHistorySize |
|
104 |
DefaultCommandPerSuffix |
|
105 |
DefaultFilters |
|
106 |
DirectoryBookmarks |
|
107 |
LastEnforcedNameSpace |
|
108 |
LastFileDiffDirectory |
|
109 |
LastFileDiffFile |
|
110 |
LastFileSelection |
|
111 |
LastMercurialRepository |
|
112 |
LastMoveDestination |
|
113 |
LastMustMatchPattern |
|
114 |
LastScriptBlockString |
|
115 |
RootHolder |
|
116 |
RuntimeAspects |
|
117 |
VisitedDirectories |
|
118 |
MaxFileSizeShownWithoutAsking ..... for big files, I will ask if only the first part is |
|
119 |
to be shown. This number (if non-nil) suppresses this |
|
120 |
question for files smaller. |
|
121 |
The initial default is 1Mb (1024*1024) |
|
5967 | 122 |
" |
5140 | 123 |
! ! |
3892 | 124 |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
125 |
!AbstractFileBrowser class methodsFor:'accessing'! |
3952 | 126 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
127 |
currentSelection |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
128 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
129 |
LastFileSelection isNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
130 |
LastFileSelection := #(). |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
131 |
]. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
132 |
^ LastFileSelection |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
133 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
134 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
135 |
currentSelection:aFilenameCol |
6589 | 136 |
aFilenameCol notEmptyOrNil ifTrue:[ |
12102 | 137 |
LastFileSelection := aFilenameCol collect:[:file | (file ? '') asFilename] |
6589 | 138 |
] |
4368
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 |
|
3952 | 141 |
directoryHistory |
142 |
||
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
143 |
VisitedDirectories isNil ifTrue:[ |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
144 |
VisitedDirectories := self directoryHistoryClass new. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
145 |
"/ VisitedDirectories inspect. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
146 |
]. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
147 |
^ VisitedDirectories |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
148 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
149 |
"Modified: / 21-11-2012 / 08:45:49 / cg" |
3952 | 150 |
! |
151 |
||
17768 | 152 |
maxFileSizeShownWithoutAsking |
153 |
"the max. filesize which is loaded without asking if only the first |
|
154 |
part should be shown" |
|
155 |
||
156 |
^ MaxFileSizeShownWithoutAsking ? (1024*1024) |
|
157 |
||
158 |
"Created: / 19-11-2017 / 14:48:19 / cg" |
|
159 |
! |
|
160 |
||
161 |
maxFileSizeShownWithoutAsking:anIntegerOrNilForDefault |
|
162 |
"the max. filesize which is loaded without asking if only the first |
|
17769 | 163 |
part should be shown. |
164 |
Nil resets to the default (currently 1Mb)" |
|
17768 | 165 |
|
166 |
MaxFileSizeShownWithoutAsking := anIntegerOrNilForDefault |
|
167 |
||
17769 | 168 |
" |
169 |
self maxFileSizeShownWithoutAsking:nil |
|
170 |
" |
|
171 |
||
17768 | 172 |
"Created: / 19-11-2017 / 14:48:45 / cg" |
173 |
! |
|
174 |
||
3952 | 175 |
resetClassVars |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
176 |
VisitedDirectories := nil. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
177 |
LastFileSelection := nil. |
5936 | 178 |
|
179 |
" |
|
180 |
AbstractFileBrowser resetClassVars |
|
181 |
" |
|
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
182 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
183 |
"Modified: / 21-11-2012 / 08:45:53 / cg" |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
184 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
185 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
186 |
rootHolder |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
187 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
188 |
^ RootHolder |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
189 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
190 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
191 |
rootHolder:aRoot |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
192 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
193 |
RootHolder := aRoot |
3952 | 194 |
! ! |
195 |
||
4915 | 196 |
!AbstractFileBrowser class methodsFor:'accessing-bookmarks'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
197 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
198 |
addBookmark:aDirectoryPath |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
199 |
"add aDirectoryPath to the list of our known bookmarks. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
200 |
Do not add duplicates." |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
201 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
202 |
|bookmarks| |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
203 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
204 |
bookmarks := self directoryBookmarks. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
205 |
(bookmarks includes:aDirectoryPath) ifFalse:[ |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
206 |
bookmarks add:aDirectoryPath asFilename. |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
207 |
]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
208 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
209 |
|
8013 | 210 |
bookmarksFrom:aFileNameOrString |
12390 | 211 |
|bookmarks s fileName line| |
8013 | 212 |
|
213 |
fileName := aFileNameOrString asFilename. |
|
214 |
[ |
|
215 |
s := fileName readStream. |
|
216 |
] on:OpenError do:[:ex| |
|
217 |
^ nil. |
|
218 |
]. |
|
219 |
||
220 |
bookmarks := OrderedCollection new. |
|
221 |
[s atEnd] whileFalse:[ |
|
12390 | 222 |
line := s nextLine. |
223 |
(line startsWith:';') ifFalse:[ |
|
224 |
bookmarks add:(Base64Coder decode:line) asString. |
|
225 |
] |
|
8013 | 226 |
]. |
227 |
s close. |
|
228 |
||
229 |
^ bookmarks |
|
230 |
! |
|
231 |
||
4679 | 232 |
defaultBookMarksFileDirectory |
12390 | 233 |
"the directory, where the default bookmarks are stored (as defaultBookMarksFilename)" |
234 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
235 |
^ Filename homeDirectory |
4679 | 236 |
! |
237 |
||
238 |
defaultBookMarksFilename |
|
12390 | 239 |
"the filename, in which the default bookmarks are stored (in defaultBookMarksDirectory)" |
240 |
||
4679 | 241 |
^ '.fileBrowserBookmarks' |
242 |
! |
|
243 |
||
244 |
directoryBookmarks |
|
245 |
DirectoryBookmarks isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
246 |
self loadBookmarksFrom:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename). |
4679 | 247 |
|
248 |
DirectoryBookmarks isEmptyOrNil ifTrue:[ |
|
249 |
DirectoryBookmarks := OrderedCollection new. |
|
250 |
DirectoryBookmarks add:Filename homeDirectory asAbsoluteFilename. |
|
251 |
DirectoryBookmarks add:Filename currentDirectory asAbsoluteFilename. |
|
252 |
] |
|
253 |
]. |
|
254 |
^ DirectoryBookmarks |
|
255 |
||
256 |
" |
|
5438
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
257 |
DirectoryBookmarks := nil. |
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
258 |
self directoryBookmarks. |
4679 | 259 |
" |
260 |
! |
|
261 |
||
8013 | 262 |
directoryBookmarks: collectionOfFilenames |
263 |
||
264 |
DirectoryBookmarks := collectionOfFilenames. |
|
265 |
self saveBookmarksInDefaultBookmarksFile. |
|
266 |
! |
|
267 |
||
268 |
editBookmarksWithDefault: aFilenameOrNil |
|
269 |
| oldBookmarks newBookmarks | |
|
270 |
||
271 |
oldBookmarks := self directoryBookmarks copy. |
|
272 |
newBookmarks := BookmarksEditDialog openWith: oldBookmarks defaultBookmark: aFilenameOrNil. |
|
273 |
newBookmarks isNil ifTrue:[^ self]. |
|
274 |
self directoryBookmarks: newBookmarks. |
|
9681
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
275 |
|
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
276 |
"Modified: / 13-01-2011 / 12:52:28 / cg" |
8013 | 277 |
! |
278 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
279 |
hasBookmarks |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
280 |
^ self directoryBookmarks notEmptyOrNil |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
281 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
282 |
|
4679 | 283 |
loadBookmarksFrom:aFileNameOrString |
8013 | 284 |
|bookmarks| |
285 |
||
286 |
bookmarks := self bookmarksFrom: aFileNameOrString. |
|
287 |
bookmarks isNil ifTrue:[^ self]. |
|
4679 | 288 |
|
289 |
DirectoryBookmarks := OrderedCollection new. |
|
290 |
bookmarks do:[:eachPath | |
|
291 |
self addBookmark:eachPath asFilename |
|
292 |
]. |
|
293 |
! |
|
294 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
295 |
removeBookmark:aDirectoryPath |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
296 |
|bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
297 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
298 |
bookmarks := self directoryBookmarks. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
299 |
bookmarks isEmptyOrNil ifTrue:[ ^ self]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
300 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
301 |
bookmarks remove:aDirectoryPath ifAbsent:[]. |
4679 | 302 |
! |
303 |
||
304 |
saveBookmarks |
|
305 |
|fn| |
|
306 |
||
307 |
fn := Dialog |
|
9607 | 308 |
requestFileNameForSave:(self resources string:'Save Bookmarks') |
4679 | 309 |
default:(self defaultBookMarksFilename) |
310 |
fromDirectory:(self defaultBookMarksFileDirectory). |
|
311 |
fn isEmptyOrNil ifTrue:[^ self]. |
|
312 |
||
313 |
self saveBookmarksIn:fn |
|
9607 | 314 |
|
315 |
"Modified: / 27-10-2010 / 11:27:09 / cg" |
|
4679 | 316 |
! |
317 |
||
8013 | 318 |
saveBookmarks: bookmarks in:aFileNameOrString |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
319 |
"save the bokmarks in aFileNameOrString. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
320 |
Use Base64 coding" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
321 |
|
13683 | 322 |
|bookmarkStream fileName coder| |
4679 | 323 |
|
324 |
fileName := aFileNameOrString asFilename. |
|
325 |
fileName exists ifTrue:[ |
|
13683 | 326 |
fileName renameTo:(fileName addSuffix:'sav'). |
4679 | 327 |
]. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
328 |
bookmarkStream := fileName writeStream. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
329 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
330 |
"save each bookmark in one line" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
331 |
coder := (Base64Coder on:bookmarkStream) lineLimit:nil. |
4679 | 332 |
bookmarks do:[:eachPath | |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
333 |
eachPath asFilename pathName acceptVisitor:coder. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
334 |
coder flush. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
335 |
bookmarkStream cr. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
336 |
]. |
12391 | 337 |
bookmarkStream syncData; close. |
5960 | 338 |
! |
339 |
||
8013 | 340 |
saveBookmarksIn:aFileNameOrString |
341 |
"save the bokmarks in aFileNameOrString. |
|
342 |
Use Base64 coding" |
|
343 |
||
344 |
| bookmarks | |
|
345 |
||
346 |
bookmarks := self directoryBookmarks. |
|
347 |
self saveBookmarks: bookmarks in:aFileNameOrString |
|
348 |
! |
|
349 |
||
5960 | 350 |
saveBookmarksInDefaultBookmarksFile |
351 |
self saveBookmarksIn:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename) |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
352 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
353 |
|
4915 | 354 |
!AbstractFileBrowser class methodsFor:'accessing-classes'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
355 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
356 |
directoryHistoryClass |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
357 |
^ DirectoryHistory |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
358 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
359 |
"Modified: / 21-11-2012 / 08:46:34 / cg" |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
360 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
361 |
|
3892 | 362 |
!AbstractFileBrowser class methodsFor:'defaults'! |
363 |
||
364 |
commandHistory |
|
365 |
||
366 |
CommandHistory isNil ifTrue:[ |
|
4414 | 367 |
CommandHistory := OrderedCollection new. |
3892 | 368 |
]. |
369 |
^ CommandHistory |
|
370 |
! |
|
371 |
||
372 |
commandHistorySize |
|
4190 | 373 |
"max no of entries in the HistoryList " |
6369 | 374 |
|
3892 | 375 |
CommandHistorySize isNil ifTrue:[ |
6369 | 376 |
CommandHistorySize := 150 |
3892 | 377 |
]. |
378 |
^ CommandHistorySize |
|
379 |
! |
|
380 |
||
381 |
defaultFilterList |
|
382 |
||
383 |
DefaultFilters isNil ifTrue:[ |
|
4414 | 384 |
DefaultFilters := #( '*' |
385 |
'*.st' |
|
386 |
'*.[h,c]*' |
|
12760 | 387 |
'*.txt; *.htm*' |
388 |
'*.gif; *.xpm; *.jpg; *.png' |
|
389 |
'~*o; ~*.obj; ~*.dll;' |
|
4414 | 390 |
) |
3892 | 391 |
]. |
392 |
^ DefaultFilters. |
|
12760 | 393 |
|
394 |
" |
|
395 |
DefaultFilters := nil |
|
396 |
" |
|
3892 | 397 |
! |
398 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
399 |
initialCommandFor:fileName in:aDirectory intoBox:aBox |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
400 |
"set a useful initial command in an execute box." |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
401 |
|
4523 | 402 |
|mime cmd select path suffix baseName pathName| |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
403 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
404 |
path := aDirectory filenameFor:fileName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
405 |
baseName := path baseName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
406 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
407 |
|
16160 | 408 |
cmd := UserPreferences current defaultFileOpenCommandFor:suffix. |
409 |
cmd notNil ifTrue:[ |
|
410 |
aBox initialText:(cmd bindWith:fileName pathName). |
|
411 |
^ self |
|
412 |
]. |
|
413 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
414 |
mime := MIMETypes mimeTypeForSuffix:suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
415 |
"/ mime notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
416 |
"/ cmd := self initialCommandForMIME:mime file:path |
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 |
"/ 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
|
420 |
"/ XXX or from resources. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
421 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
422 |
(path type == #regular) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
423 |
path isExecutableProgram ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
424 |
aBox initialText:(path pathName , ' <arguments>'). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
425 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
426 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
427 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
428 |
select := true. |
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 |
"some heuristics - my personal preferences ... |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
431 |
(actually this should come from a configfile)" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
432 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
433 |
(baseName endsWith:'akefile') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
434 |
aBox initialText:'make target' selectFrom:6 to:11. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
435 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
436 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
437 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
438 |
cmd := MIMETypes defaultCommandPerMIME at:mime ifAbsent:nil. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
439 |
cmd notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
440 |
select := false |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
441 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
442 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
443 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
444 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
445 |
(suffix = 'C') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
446 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
447 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
448 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
449 |
suffix := suffix asLowercase. |
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 |
(suffix = 'taz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
452 |
aBox initialText:'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
453 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
454 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
455 |
(suffix = 'tar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
456 |
cmd := 'tar tvf %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
457 |
select := 7. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
458 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
459 |
(suffix = 'zoo') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
460 |
cmd := 'zoo -list %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
461 |
select := 9. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
462 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
463 |
(suffix = 'zip') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
464 |
cmd := 'unzip -l %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
465 |
select := 8. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
466 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
467 |
(suffix = 'jar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
468 |
cmd := 'unzip -l %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
469 |
select := 8. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
470 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
471 |
(suffix = 'z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
472 |
(baseName asLowercase endsWith:'tar.z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
473 |
cmd := 'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
474 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
475 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
476 |
cmd := 'uncompress %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
477 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
478 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
479 |
(suffix = 'gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
480 |
(baseName asLowercase endsWith:'tar.gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
481 |
cmd := ('gunzip < %1 | tar tvf -' ). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
482 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
483 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
484 |
cmd := 'gunzip %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
485 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
486 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
487 |
(suffix = 'html') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
488 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
489 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
490 |
(suffix = 'htm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
491 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
492 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
493 |
(suffix = 'uue') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
494 |
cmd := 'uudecode %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
495 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
496 |
(suffix = 'c') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
497 |
cmd := 'cc -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
498 |
select := 5. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
499 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
500 |
(suffix = 'cc') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
501 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
502 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
503 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
504 |
(suffix = 'xbm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
505 |
cmd := 'bitmap %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
506 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
507 |
(suffix = 'ps') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
508 |
cmd := 'ghostview %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
509 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
510 |
((suffix = '1') or:[suffix = 'man']) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
511 |
cmd := 'nroff -man %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
512 |
select := 10. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
513 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
514 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
515 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
516 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
517 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
518 |
DefaultCommandPerSuffix isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
519 |
cmd := '<cmd>' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
520 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
521 |
cmd := DefaultCommandPerSuffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
522 |
at:suffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
523 |
ifAbsent:'<cmd>'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
524 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
525 |
cmd := cmd , ' %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
526 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
527 |
|
4523 | 528 |
pathName := path pathName. |
529 |
OperatingSystem isUNIXlike ifTrue:[ |
|
530 |
pathName includesSeparator ifTrue:[ |
|
531 |
pathName := '"' , pathName , '"' |
|
532 |
] |
|
533 |
]. |
|
534 |
||
535 |
cmd := cmd bindWith:pathName. |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
536 |
select == false ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
537 |
aBox initialText:cmd |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
538 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
539 |
select class == Interval ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
540 |
aBox initialText:cmd selectFrom:select start to:select stop |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
541 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
542 |
select isInteger ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
543 |
select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
544 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
545 |
aBox initialText:cmd selectFrom:1 to:select |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
546 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
547 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
548 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
549 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
550 |
"Modified: / 24.9.1997 / 16:34:52 / stefan" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
551 |
"Modified: / 9.4.1998 / 17:15:57 / cg" |
3892 | 552 |
! |
553 |
||
5941 | 554 |
listOfRuntimeValuesToRemember |
555 |
" list of all aspects that will be remembered after closing a FileBrowserV2" |
|
556 |
||
557 |
^ #( |
|
558 |
"/ #filterModel |
|
559 |
#enableFileHistory |
|
560 |
#fileHistory |
|
561 |
#currentSortOrder |
|
562 |
#sortBlockProperty |
|
563 |
) |
|
3892 | 564 |
! |
565 |
||
566 |
resetAspects |
|
567 |
||
568 |
RuntimeAspects := nil. |
|
569 |
||
5941 | 570 |
" |
571 |
self resetAspects |
|
572 |
" |
|
3892 | 573 |
! |
574 |
||
575 |
runtimeAspects |
|
576 |
||
577 |
RuntimeAspects isNil ifTrue:[ |
|
4414 | 578 |
RuntimeAspects := Dictionary new. |
3892 | 579 |
]. |
580 |
^ RuntimeAspects |
|
581 |
! |
|
582 |
||
4201 | 583 |
userPreferencesAspectList |
584 |
" list of all aspects that will be saved with save settings |
|
585 |
that aspects will be image consistent if the settings are saved in Launcher |
|
11501 | 586 |
don't forget to add a access methods in UserPreferences if you add a aspect here |
4201 | 587 |
" |
588 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
589 |
^ Dictionary |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
590 |
withKeysAndValues:#( |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
591 |
viewDirsInContentsBrowser true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
592 |
showDirectoryTree true |
11501 | 593 |
showHiddenFiles true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
594 |
viewDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
595 |
viewDetails true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
596 |
viewDirectoryDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
597 |
viewFilesInDirectoryTree false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
598 |
viewGroup false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
599 |
viewOwner false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
600 |
viewPermissions false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
601 |
viewPreview false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
602 |
viewSize true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
603 |
viewSizeInKiloBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
604 |
viewSizeInBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
605 |
viewTime true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
606 |
viewType false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
607 |
openMultipleApplicationsForType false |
7788 | 608 |
filenameEntryFieldVisibleHolder true |
609 |
toolBarVisibleHolder true |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
610 |
sortDirectoriesBeforeFiles true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
611 |
openAlwaysInTextEditor false |
15111 | 612 |
alwaysUseSmalltalkTools true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
613 |
sortCaseless false |
13011 | 614 |
"/ useCodeView2InTools true -- vanishes |
14709
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
615 |
showDirectoriesOnTop false |
4201 | 616 |
) |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
617 |
|
11501 | 618 |
"Modified: / 11-05-2012 / 09:22:04 / cg" |
14709
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
619 |
"Modified: / 12-08-2014 / 13:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3892 | 620 |
! ! |
621 |
||
17202 | 622 |
!AbstractFileBrowser class methodsFor:'drag & drop'! |
623 |
||
624 |
doStartDrag:aDropSource in:aView |
|
625 |
"set the cursors before starting the drag & drop operation" |
|
626 |
||
627 |
|hdl| |
|
628 |
||
629 |
hdl := DragAndDropManager new. |
|
630 |
||
631 |
hdl disabledCursor:self disabledCursorIcon. |
|
632 |
hdl enabledCursor:self enabledCursorIcon. |
|
633 |
hdl alienCursor:nil. |
|
634 |
||
635 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft. |
|
636 |
||
637 |
"Modified: / 23-07-2007 / 23:00:38 / cg" |
|
638 |
! ! |
|
639 |
||
5398 | 640 |
!AbstractFileBrowser class methodsFor:'help specs'! |
641 |
||
8261 | 642 |
basicFlyByHelpSpec |
6099 | 643 |
<resource: #help> |
644 |
||
8261 | 645 |
^ super flyByHelpSpec addPairsFrom:#( |
6099 | 646 |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
647 |
#lockFileEncoding |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
648 |
'Do not guess the encoding from the file''s contents.' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
649 |
|
6100 | 650 |
#closeTabButton |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
651 |
'Close this tab' |
6100 | 652 |
|
6099 | 653 |
#addTerminal |
17182 | 654 |
'Add a shell terminal page' |
6099 | 655 |
|
656 |
#make |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
657 |
'Call the make command' |
6099 | 658 |
|
659 |
#searchFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
660 |
'Search a file' |
6099 | 661 |
|
662 |
#directoryUp |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
663 |
'Directory up' |
6099 | 664 |
|
665 |
#directoryBack |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
666 |
'Directory back' |
6099 | 667 |
|
668 |
#directoryForward |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
669 |
'Directory forward' |
6099 | 670 |
|
671 |
#directoryHistory |
|
672 |
'Directory' |
|
673 |
||
674 |
#copyFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
675 |
'Copy the selected file(s)' |
6099 | 676 |
|
677 |
#cutFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
678 |
'Cut the selected file(s)' |
6099 | 679 |
|
680 |
#editFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
681 |
'Edit the selected file' |
6099 | 682 |
|
683 |
#fileHome |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
684 |
'Goto home directory' |
6099 | 685 |
|
8093 | 686 |
#fileDesktop |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
687 |
'Goto desktop directory' |
8093 | 688 |
|
6099 | 689 |
#fileGotoDefault |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
690 |
'Goto default directory (ST/X start directory)' |
6099 | 691 |
|
6454 | 692 |
#fileGotoSmalltalkDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
693 |
'Goto Smalltalk directory (ST/X application)' |
6454 | 694 |
|
6456 | 695 |
#fileGotoDefaultDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
696 |
'Goto current directory' |
6456 | 697 |
|
6099 | 698 |
#pasteFile |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
699 |
'Paste file(s)' |
6099 | 700 |
|
701 |
#deleteFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
702 |
'Delete the selected file(s)' |
6099 | 703 |
|
704 |
#fileIn |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
705 |
'File in' |
6099 | 706 |
|
707 |
#fileHistory |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
708 |
'File history' |
6099 | 709 |
|
710 |
#fileGotoBookmark |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
711 |
'Goto bookmarked directory' |
6099 | 712 |
|
713 |
#hideToolBar |
|
13910 | 714 |
'Hide the toolbar (show again via "View"-menu)' |
6099 | 715 |
|
716 |
#hideFilenameEntryField |
|
13910 | 717 |
'Hide filename & filter fields (show again via "View"-menu)' |
718 |
||
719 |
#hideBookmarks |
|
720 |
'Hide the bookmarks (show again via "View"-menu)' |
|
6099 | 721 |
|
722 |
#openChangeBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
723 |
'Open a Changebrowser on file' |
6099 | 724 |
|
725 |
#showFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
726 |
'Show file details' |
6099 | 727 |
|
728 |
#hideFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
729 |
'Hide file details' |
6099 | 730 |
|
731 |
#toggleDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
732 |
'Show/hide file details' |
6099 | 733 |
|
734 |
#viewDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
735 |
'Show/hide file details' |
6099 | 736 |
|
737 |
#selectDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
738 |
'Select file details to be shown' |
6099 | 739 |
|
8088 | 740 |
#showDifferences |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
741 |
'Show differences between file and editor versions' |
8088 | 742 |
|
743 |
#toggleHexDisplay |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
744 |
'Toggle between hexadecimal and textual representation' |
8088 | 745 |
|
746 |
#findInBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
747 |
'Navigate the browser''s file list to the edited file' |
8088 | 748 |
|
749 |
#saveFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
750 |
'Save the editor''s contents into the file' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
751 |
|
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
752 |
#saveFileAs |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
753 |
'Save the editor''s contents into another file' |
8088 | 754 |
|
755 |
#reloadFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
756 |
'Reload from the file' |
8088 | 757 |
|
758 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
759 |
'Send to the printer' |
8088 | 760 |
|
6099 | 761 |
). |
762 |
||
8261 | 763 |
" |
764 |
self flyByHelpSpec |
|
765 |
" |
|
766 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
767 |
"Modified: / 06-10-2011 / 14:55:27 / cg" |
8261 | 768 |
! |
769 |
||
770 |
flyByHelpSpec |
|
771 |
<resource: #programHelp> |
|
772 |
||
773 |
|spec hist resources| |
|
774 |
||
775 |
spec := self basicFlyByHelpSpec. |
|
776 |
||
777 |
"/ add help items for the history |
|
6099 | 778 |
hist := self directoryHistory. |
779 |
hist notNil ifTrue:[ |
|
780 |
resources := self classResources. |
|
781 |
hist canForward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
782 |
spec at:#directoryForward put:[ resources string:'Forward to: %1' with:hist nextForwardItem ]. |
6099 | 783 |
]. |
784 |
hist canBackward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
785 |
spec at:#directoryBack put:[ resources string:'Back to: %1' with:hist nextBackwardItem ]. |
6099 | 786 |
]. |
787 |
]. |
|
788 |
^ spec. |
|
789 |
||
790 |
" |
|
791 |
self flyByHelpSpec |
|
792 |
" |
|
793 |
||
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
794 |
"Modified: / 03-11-2007 / 12:05:01 / cg" |
5398 | 795 |
! ! |
796 |
||
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
797 |
!AbstractFileBrowser class methodsFor:'image specs'! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
798 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
799 |
clearHistoryIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
800 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
801 |
|
17413 | 802 |
^ ToolbarIconLibrary deleteIcon |
803 |
"/ ^ Icon deleteIcon |
|
804 |
||
805 |
"Modified: / 15-02-2017 / 19:45:24 / cg" |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
806 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
807 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
808 |
copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
809 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
810 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
811 |
^ ToolbarIconLibrary copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
812 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
813 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
814 |
cutIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
815 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
816 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
817 |
^ ToolbarIconLibrary cut20x20Icon2 "cut28x28Icon" |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
818 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
819 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
820 |
deleteIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
821 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
822 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
823 |
^ ToolbarIconLibrary erase20x20Icon "/ delete28x28Icon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
824 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
825 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
826 |
directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
827 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
828 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
829 |
^ ToolbarIconLibrary directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
830 |
! |
3892 | 831 |
|
15211 | 832 |
disabledCursorIcon |
833 |
"This resource specification was automatically generated |
|
834 |
by the ImageEditor of ST/X." |
|
835 |
||
836 |
"Do not manually edit this!! If it is corrupted, |
|
837 |
the ImageEditor may not be able to read the specification." |
|
838 |
||
839 |
" |
|
17202 | 840 |
self disabledCursorIcon inspect |
841 |
ImageEditor openOnClass:self andSelector:#disabledCursorIcon |
|
15211 | 842 |
Icon flushCachedIcons |
843 |
" |
|
844 |
||
845 |
<resource: #image> |
|
846 |
||
847 |
^Icon |
|
848 |
constantNamed:#'AbstractFileBrowser class disabledCursorIcon' |
|
849 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
850 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@XF@@@H@P@@DOB@@BLLP@AA@"@@RHD @H1AD@BRHI@@$QBP@IBH$@BPQI@@"BLP@D QH@ADBB@@H0Q@@AC |
|
851 |
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:' |
|
852 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@_>@@@O?0@@G?>@@C<O0@A?@>@@_8G @O?A<@C38O@@<_C0@OC8<@C0_O@@>C?0@G _8@A<C>@@O0_@@A? |
|
853 |
? @@O?0@@A?8@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
854 |
! |
|
6337 | 855 |
|
15211 | 856 |
enabledCursorIcon |
857 |
"This resource specification was automatically generated |
|
858 |
by the ImageEditor of ST/X." |
|
859 |
||
860 |
"Do not manually edit this!! If it is corrupted, |
|
861 |
the ImageEditor may not be able to read the specification." |
|
862 |
||
863 |
" |
|
17202 | 864 |
self enabledCursorIcon inspect |
865 |
ImageEditor openOnClass:self andSelector:#enabledCursorIcon |
|
15211 | 866 |
Icon flushCachedIcons |
867 |
" |
|
868 |
||
869 |
<resource: #image> |
|
870 |
||
871 |
^Icon |
|
872 |
constantNamed:#'AbstractFileBrowser class enabledCursorIcon' |
|
873 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
874 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@@@@@?0_0@@@@@@C?A?@@@@@@@@AP@@@@T@@@@E@@@@A |
|
875 |
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:' |
|
876 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@?8?0@O>O<@C?#?@@@G@@@@A0@@@@\@@@@G@@@@A |
|
877 |
0@@@@\@@@@G@@@@A0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
878 |
! |
|
6337 | 879 |
|
3892 | 880 |
fileInIcon |
881 |
<resource: #programImage> |
|
882 |
||
6116 | 883 |
^ ToolbarIconLibrary fileInIcon |
3892 | 884 |
! |
885 |
||
6079 | 886 |
historyBackIcon |
887 |
<resource: #programImage> |
|
888 |
||
889 |
^ ToolbarIconLibrary historyBackIcon |
|
890 |
! |
|
891 |
||
892 |
historyForwardIcon |
|
893 |
<resource: #programImage> |
|
894 |
||
895 |
^ ToolbarIconLibrary historyForwardIcon |
|
896 |
! |
|
897 |
||
3892 | 898 |
homeIcon |
899 |
<resource: #programImage> |
|
900 |
||
6079 | 901 |
^ ToolbarIconLibrary homeIcon |
3892 | 902 |
! |
903 |
||
6074 | 904 |
homeIcon2 |
6079 | 905 |
<resource: #programImage> |
906 |
||
907 |
^ ToolbarIconLibrary homeIcon2 |
|
6074 | 908 |
! |
909 |
||
910 |
htmlReloadIcon |
|
911 |
<resource: #programImage> |
|
912 |
||
913 |
^ ToolbarIconLibrary reload22x22Icon |
|
914 |
! |
|
915 |
||
15211 | 916 |
leftDownIcon |
917 |
<resource: #image> |
|
918 |
"This resource specification was automatically generated |
|
919 |
by the ImageEditor of ST/X." |
|
920 |
"Do not manually edit this!! If it is corrupted, |
|
921 |
the ImageEditor may not be able to read the specification." |
|
922 |
" |
|
923 |
self leftDownIcon inspect |
|
924 |
ImageEditor openOnClass:self andSelector:#leftDownIcon" |
|
925 |
||
926 |
^ Icon constantNamed:#'AbstractFileBrowser class leftDownIcon' |
|
927 |
ifAbsentPut:[ |
|
928 |
(Depth2Image new) |
|
929 |
width:28; |
|
930 |
height:28; |
|
931 |
photometric:(#palette); |
|
932 |
bitsPerSample:(#( 2 )); |
|
933 |
samplesPerPixel:(1); |
|
934 |
bits:(ByteArray |
|
935 |
fromPackedString:' |
|
936 |
UUUUUUUUUUUPAUUUUUUUP@UUUUUUUPB!!UUUUUU@B*AUUUUU@B*(UUUUUPB** UUUUPB***AUUUTB***(EUUUB****%UUUR*****UUUUU@*%UUUUUUPJ)UUUU |
|
937 |
UUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*$@@@@AUPJ*****)UTB******UU@******%UPJ*****)UTAUUUU |
|
938 |
UUUU@@@@@@@AUUUUUUUUUP@a'); |
|
939 |
colorMapFromArray:#[ 255 255 255 0 0 0 40 40 100 255 0 0 ]; |
|
940 |
mask:((ImageMask new) |
|
941 |
width:28; |
|
942 |
height:28; |
|
943 |
bits:(ByteArray |
|
944 |
fromPackedString:' |
|
945 |
@@@@@@@@@@@@ @@@@\@@@@O @@@G<@@@C? @@A?<@@@?? @@_?<@@G?? @@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C??? @???8@O? |
|
946 |
?>@C??? @???8@O??>@@@@@@@@@@@@@a'); |
|
947 |
yourself); |
|
948 |
yourself |
|
949 |
] |
|
950 |
! |
|
951 |
||
952 |
menuHistoryList9x20Icon |
|
953 |
<resource: #image> |
|
954 |
"This resource specification was automatically generated |
|
955 |
by the ImageEditor of ST/X." |
|
956 |
"Do not manually edit this!! If it is corrupted, |
|
957 |
the ImageEditor may not be able to read the specification." |
|
958 |
" |
|
959 |
self menuHistoryList9x20Icon inspect |
|
960 |
ImageEditor openOnClass:self andSelector:#menuHistoryList9x20Icon |
|
961 |
Icon flushCachedIcons" |
|
962 |
||
963 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryList9x20Icon' |
|
964 |
ifAbsentPut:[ |
|
965 |
(Depth1Image new) |
|
966 |
width:9; |
|
967 |
height:20; |
|
968 |
photometric:(#palette); |
|
969 |
bitsPerSample:(#( 1 )); |
|
970 |
samplesPerPixel:(1); |
|
971 |
bits:(ByteArray |
|
972 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
973 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
974 |
mask:((ImageMask new) |
|
975 |
width:9; |
|
976 |
height:20; |
|
977 |
bits:(ByteArray |
|
978 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
979 |
yourself); |
|
980 |
yourself |
|
981 |
] |
|
982 |
! |
|
983 |
||
984 |
menuHistoryListIcon |
|
985 |
<resource: #image> |
|
986 |
"This resource specification was automatically generated |
|
987 |
by the ImageEditor of ST/X." |
|
988 |
"Do not manually edit this!! If it is corrupted, |
|
989 |
the ImageEditor may not be able to read the specification." |
|
990 |
" |
|
991 |
self menuHistoryListIcon inspect |
|
992 |
ImageEditor openOnClass:self andSelector:#menuHistoryListIcon" |
|
993 |
||
994 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryListIcon' |
|
995 |
ifAbsentPut:[ |
|
996 |
(Depth1Image new) |
|
997 |
width:12; |
|
998 |
height:12; |
|
999 |
photometric:(#palette); |
|
1000 |
bitsPerSample:(#( 1 )); |
|
1001 |
samplesPerPixel:(1); |
|
1002 |
bits:(ByteArray fromPackedString:'??S?<O?0??C?<O?0??/?=_?0??C?<O?0'); |
|
1003 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
1004 |
mask:((ImageMask new) |
|
1005 |
width:12; |
|
1006 |
height:12; |
|
1007 |
bits:(ByteArray fromPackedString:'@@@O@@<@C0A?8C?@G8@O@@X@@@A?8@@@'); |
|
1008 |
yourself); |
|
1009 |
yourself |
|
1010 |
] |
|
1011 |
! |
|
3892 | 1012 |
|
6087 | 1013 |
newDirectoryIcon |
6074 | 1014 |
<resource: #programImage> |
1015 |
||
6087 | 1016 |
^ ToolbarIconLibrary newDirectoryIcon |
3923 | 1017 |
! |
1018 |
||
6091 | 1019 |
removeTabIcon |
1020 |
<resource: #programImage> |
|
1021 |
||
1022 |
^ ToolbarIconLibrary removeTabIcon |
|
1023 |
! |
|
1024 |
||
3892 | 1025 |
vt100Terminal |
1026 |
<resource: #programImage> |
|
1027 |
||
1028 |
^ ToolbarIconLibrary shell20x20Icon |
|
1029 |
! ! |
|
1030 |
||
5528 | 1031 |
!AbstractFileBrowser class methodsFor:'interface specs'! |
1032 |
||
15211 | 1033 |
encodingDialogSpec |
1034 |
"This resource specification was automatically generated |
|
1035 |
by the UIPainter of ST/X." |
|
1036 |
||
1037 |
"Do not manually edit this!! If it is corrupted, |
|
1038 |
the UIPainter may not be able to read the specification." |
|
1039 |
||
1040 |
" |
|
1041 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#encodingDialogSpec |
|
1042 |
AbstractFileBrowser new openInterface:#encodingDialogSpec |
|
1043 |
" |
|
1044 |
||
1045 |
<resource: #canvas> |
|
1046 |
||
1047 |
^ |
|
1048 |
#(FullSpec |
|
1049 |
name: encodingDialogSpec |
|
1050 |
window: |
|
1051 |
(WindowSpec |
|
1052 |
label: 'File Encoding' |
|
1053 |
name: 'File Encoding' |
|
1054 |
min: (Point 10 10) |
|
1055 |
bounds: (Rectangle 0 0 379 590) |
|
1056 |
) |
|
1057 |
component: |
|
1058 |
(SpecCollection |
|
1059 |
collection: ( |
|
1060 |
(LabelSpec |
|
1061 |
label: 'Select the External (File-) Encoding:' |
|
1062 |
name: 'Label1' |
|
1063 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1064 |
translateLabel: true |
|
1065 |
adjust: left |
|
1066 |
) |
|
1067 |
(DataSetSpec |
|
1068 |
name: 'Table1' |
|
1069 |
layout: (LayoutFrame 0 0 30 0 0 1 -60 1) |
|
1070 |
model: selectedEncoding |
|
1071 |
hasHorizontalScrollBar: true |
|
1072 |
hasVerticalScrollBar: true |
|
1073 |
dataList: encodingList |
|
1074 |
has3Dseparators: true |
|
1075 |
columns: |
|
1076 |
(Array |
|
1077 |
||
1078 |
(DataSetColumnSpec |
|
1079 |
label: 'Encoding' |
|
1080 |
labelButtonType: Button |
|
1081 |
height: heightOfFirstRow |
|
1082 |
model: at: |
|
1083 |
canSelect: false |
|
1084 |
isResizeable: false |
|
1085 |
showRowSeparator: false |
|
1086 |
showColSeparator: false |
|
1087 |
) |
|
1088 |
(DataSetColumnSpec |
|
1089 |
label: 'Description' |
|
1090 |
labelButtonType: Button |
|
1091 |
height: heightOfFirstRow |
|
1092 |
model: at: |
|
1093 |
canSelect: false |
|
1094 |
isResizeable: false |
|
1095 |
showRowSeparator: false |
|
1096 |
showColSeparator: false |
|
1097 |
) |
|
1098 |
) |
|
1099 |
doubleClickChannel: accept |
|
1100 |
) |
|
1101 |
(CheckBoxSpec |
|
1102 |
label: 'Lock Encoding' |
|
1103 |
name: 'LockEncodingCheckBox' |
|
1104 |
layout: (LayoutFrame 3 0 -60 1 217 0 -30 1) |
|
1105 |
activeHelpKey: lockFileEncoding |
|
1106 |
model: lockFileEncoding |
|
1107 |
translateLabel: true |
|
1108 |
) |
|
1109 |
(HorizontalPanelViewSpec |
|
1110 |
name: 'ButtonPanel' |
|
1111 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1112 |
horizontalLayout: fitSpace |
|
1113 |
verticalLayout: center |
|
1114 |
horizontalSpace: 3 |
|
1115 |
verticalSpace: 3 |
|
1116 |
reverseOrderIfOKAtLeft: true |
|
1117 |
component: |
|
1118 |
(SpecCollection |
|
1119 |
collection: ( |
|
1120 |
(ActionButtonSpec |
|
1121 |
label: 'Cancel' |
|
1122 |
name: 'Button2' |
|
1123 |
translateLabel: true |
|
1124 |
model: cancel |
|
1125 |
extent: (Point 183 22) |
|
1126 |
) |
|
1127 |
(ActionButtonSpec |
|
1128 |
label: 'OK' |
|
1129 |
name: 'Button1' |
|
1130 |
translateLabel: true |
|
1131 |
model: accept |
|
1132 |
isDefault: true |
|
1133 |
extent: (Point 184 22) |
|
1134 |
) |
|
1135 |
) |
|
1136 |
||
1137 |
) |
|
1138 |
) |
|
1139 |
) |
|
1140 |
||
1141 |
) |
|
1142 |
) |
|
1143 |
! |
|
1144 |
||
1145 |
lineEndConventionDialogSpec |
|
1146 |
"This resource specification was automatically generated |
|
1147 |
by the UIPainter of ST/X." |
|
1148 |
||
1149 |
"Do not manually edit this!! If it is corrupted, |
|
1150 |
the UIPainter may not be able to read the specification." |
|
1151 |
||
1152 |
" |
|
1153 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#lineEndConventionDialogSpec |
|
1154 |
AbstractFileBrowser new openInterface:#lineEndConventionDialogSpec |
|
1155 |
" |
|
1156 |
||
1157 |
<resource: #canvas> |
|
1158 |
||
1159 |
^ |
|
15212 | 1160 |
#(FullSpec |
1161 |
name: lineEndConventionDialogSpec |
|
1162 |
window: |
|
1163 |
(WindowSpec |
|
1164 |
label: 'Line-End Convention' |
|
1165 |
name: 'Line-End Convention' |
|
1166 |
min: (Point 10 10) |
|
1167 |
bounds: (Rectangle 0 0 379 239) |
|
1168 |
) |
|
1169 |
component: |
|
1170 |
(SpecCollection |
|
1171 |
collection: ( |
|
1172 |
(LabelSpec |
|
1173 |
label: 'Select the Line-End Convention (used when saving files):' |
|
1174 |
name: 'Label1' |
|
1175 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1176 |
translateLabel: true |
|
1177 |
adjust: left |
|
1178 |
) |
|
1179 |
(VerticalPanelViewSpec |
|
1180 |
name: 'VerticalPanel1' |
|
1181 |
layout: (LayoutFrame 20 0 40 0 0 1 -30 1) |
|
1182 |
horizontalLayout: fit |
|
1183 |
verticalLayout: topSpace |
|
1184 |
horizontalSpace: 3 |
|
1185 |
verticalSpace: 3 |
|
1186 |
component: |
|
1187 |
(SpecCollection |
|
1188 |
collection: ( |
|
1189 |
(RadioButtonSpec |
|
1190 |
label: 'NL (Unix)' |
|
1191 |
name: 'RadioButton1' |
|
1192 |
translateLabel: true |
|
1193 |
model: lineEndConvention |
|
1194 |
isTriggerOnDown: true |
|
1195 |
select: nl |
|
1196 |
extent: (Point 359 22) |
|
1197 |
) |
|
1198 |
(RadioButtonSpec |
|
1199 |
label: 'CR-NL (MSDOS)' |
|
1200 |
name: 'RadioButton4' |
|
1201 |
translateLabel: true |
|
1202 |
model: lineEndConvention |
|
1203 |
isTriggerOnDown: true |
|
1204 |
select: crlf |
|
1205 |
extent: (Point 359 22) |
|
1206 |
) |
|
1207 |
(RadioButtonSpec |
|
1208 |
label: 'CR (VMS and pre OSX mac)' |
|
1209 |
name: 'RadioButton5' |
|
1210 |
translateLabel: true |
|
1211 |
model: lineEndConvention |
|
1212 |
isTriggerOnDown: true |
|
1213 |
select: cr |
|
1214 |
extent: (Point 359 22) |
|
15211 | 1215 |
) |
15212 | 1216 |
(RadioButtonSpec |
1217 |
label: 'ETX (some modem protocols and mainframe files)' |
|
1218 |
name: 'RadioButton6' |
|
1219 |
translateLabel: true |
|
1220 |
model: lineEndConvention |
|
1221 |
isTriggerOnDown: true |
|
1222 |
select: etx |
|
1223 |
extent: (Point 359 22) |
|
1224 |
) |
|
1225 |
(RadioButtonSpec |
|
1226 |
label: 'EOT (some modem protocols and mainframe files)' |
|
1227 |
name: 'RadioButton7' |
|
1228 |
translateLabel: true |
|
1229 |
model: lineEndConvention |
|
1230 |
isTriggerOnDown: true |
|
1231 |
select: eot |
|
1232 |
extent: (Point 359 22) |
|
15211 | 1233 |
) |
15212 | 1234 |
) |
1235 |
||
1236 |
) |
|
15211 | 1237 |
) |
15212 | 1238 |
(HorizontalPanelViewSpec |
1239 |
name: 'ButtonPanel' |
|
1240 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1241 |
horizontalLayout: fitSpace |
|
1242 |
verticalLayout: center |
|
1243 |
horizontalSpace: 3 |
|
1244 |
verticalSpace: 3 |
|
1245 |
reverseOrderIfOKAtLeft: true |
|
1246 |
component: |
|
1247 |
(SpecCollection |
|
1248 |
collection: ( |
|
1249 |
(ActionButtonSpec |
|
1250 |
label: 'Cancel' |
|
1251 |
name: 'Button2' |
|
1252 |
translateLabel: true |
|
1253 |
model: cancel |
|
1254 |
extent: (Point 185 22) |
|
1255 |
) |
|
1256 |
(ActionButtonSpec |
|
1257 |
label: 'OK' |
|
1258 |
name: 'Button1' |
|
1259 |
translateLabel: true |
|
1260 |
model: accept |
|
1261 |
isDefault: true |
|
1262 |
extent: (Point 185 22) |
|
1263 |
) |
|
1264 |
) |
|
1265 |
||
1266 |
) |
|
1267 |
) |
|
1268 |
) |
|
1269 |
||
1270 |
) |
|
1271 |
) |
|
15211 | 1272 |
! |
1273 |
||
1274 |
tabStopConversionDialogSpec |
|
1275 |
"This resource specification was automatically generated |
|
1276 |
by the UIPainter of ST/X." |
|
1277 |
||
1278 |
"Do not manually edit this!! If it is corrupted, |
|
1279 |
the UIPainter may not be able to read the specification." |
|
1280 |
||
1281 |
" |
|
1282 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#tabStopConversionDialogSpec |
|
1283 |
AbstractFileBrowser new openInterface:#tabStopConversionDialogSpec |
|
1284 |
" |
|
1285 |
||
1286 |
<resource: #canvas> |
|
1287 |
||
1288 |
^ |
|
1289 |
#(FullSpec |
|
1290 |
name: 'tabStopConversionDialogSpec' |
|
1291 |
window: |
|
1292 |
(WindowSpec |
|
1293 |
label: 'Tab-Stop Conversion' |
|
1294 |
name: 'Tab-Stop Conversion' |
|
1295 |
min: (Point 10 10) |
|
1296 |
bounds: (Rectangle 0 0 379 239) |
|
1297 |
) |
|
1298 |
component: |
|
1299 |
(SpecCollection |
|
1300 |
collection: ( |
|
1301 |
(LabelSpec |
|
1302 |
label: 'Select the Tab-Stop Conversion (used when saving files):' |
|
1303 |
name: 'Label1' |
|
1304 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1305 |
translateLabel: true |
|
1306 |
adjust: left |
|
1307 |
) |
|
1308 |
(VerticalPanelViewSpec |
|
1309 |
name: 'VerticalPanel1' |
|
1310 |
layout: (LayoutFrame 0 0 30 0 0 1 -30 1) |
|
1311 |
horizontalLayout: center |
|
1312 |
verticalLayout: center |
|
1313 |
horizontalSpace: 3 |
|
1314 |
verticalSpace: 3 |
|
1315 |
component: |
|
1316 |
(SpecCollection |
|
1317 |
collection: ( |
|
1318 |
(RadioButtonSpec |
|
1319 |
label: '4' |
|
1320 |
name: 'RadioButton1' |
|
1321 |
translateLabel: true |
|
1322 |
model: tabStops |
|
1323 |
isTriggerOnDown: true |
|
1324 |
select: 4 |
|
1325 |
extent: (Point 136 22) |
|
1326 |
) |
|
1327 |
(RadioButtonSpec |
|
1328 |
label: '8' |
|
1329 |
name: 'RadioButton4' |
|
1330 |
translateLabel: true |
|
1331 |
model: tabStops |
|
1332 |
isTriggerOnDown: true |
|
1333 |
select: 8 |
|
1334 |
extent: (Point 136 22) |
|
1335 |
) |
|
1336 |
) |
|
1337 |
||
1338 |
) |
|
1339 |
) |
|
1340 |
(HorizontalPanelViewSpec |
|
1341 |
name: 'ButtonPanel' |
|
1342 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1343 |
horizontalLayout: fitSpace |
|
1344 |
verticalLayout: center |
|
1345 |
horizontalSpace: 3 |
|
1346 |
verticalSpace: 3 |
|
1347 |
reverseOrderIfOKAtLeft: true |
|
1348 |
component: |
|
1349 |
(SpecCollection |
|
1350 |
collection: ( |
|
1351 |
(ActionButtonSpec |
|
1352 |
label: 'Cancel' |
|
1353 |
name: 'Button2' |
|
1354 |
translateLabel: true |
|
1355 |
model: cancel |
|
1356 |
extent: (Point 185 22) |
|
1357 |
) |
|
1358 |
(ActionButtonSpec |
|
1359 |
label: 'OK' |
|
1360 |
name: 'Button1' |
|
1361 |
translateLabel: true |
|
1362 |
model: accept |
|
1363 |
isDefault: true |
|
1364 |
extent: (Point 185 22) |
|
1365 |
) |
|
1366 |
) |
|
1367 |
||
1368 |
) |
|
1369 |
) |
|
1370 |
) |
|
1371 |
||
1372 |
) |
|
1373 |
) |
|
1374 |
||
1375 |
"Modified: / 28-02-2012 / 11:12:38 / cg" |
|
1376 |
! ! |
|
5528 | 1377 |
|
3892 | 1378 |
!AbstractFileBrowser class methodsFor:'menu specs'! |
1379 |
||
15211 | 1380 |
baseBookmarksMenuSpec |
1381 |
"This resource specification was automatically generated |
|
1382 |
by the MenuEditor of ST/X." |
|
1383 |
||
1384 |
"Do not manually edit this!! If it is corrupted, |
|
1385 |
the MenuEditor may not be able to read the specification." |
|
1386 |
||
1387 |
" |
|
1388 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec |
|
1389 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec)) startUp |
|
1390 |
" |
|
1391 |
||
1392 |
<resource: #menu> |
|
1393 |
||
1394 |
^ |
|
1395 |
#(Menu |
|
1396 |
( |
|
1397 |
(MenuItem |
|
1398 |
enabled: currentFilesHasDirectories |
|
1399 |
label: 'Add Bookmark' |
|
1400 |
itemValue: addBookmark |
|
1401 |
translateLabel: true |
|
1402 |
) |
|
1403 |
(MenuItem |
|
1404 |
enabled: hasBookmarksToRemove |
|
1405 |
label: 'Remove Bookmark' |
|
1406 |
itemValue: removeBookmark |
|
1407 |
translateLabel: true |
|
1408 |
) |
|
1409 |
(MenuItem |
|
1410 |
label: 'Save Bookmarks In...' |
|
1411 |
itemValue: saveBookmarks |
|
1412 |
translateLabel: true |
|
1413 |
) |
|
1414 |
) |
|
1415 |
nil |
|
1416 |
nil |
|
1417 |
) |
|
1418 |
! |
|
1419 |
||
1420 |
baseBookmarksMenuSpec2 |
|
1421 |
"This resource specification was automatically generated |
|
1422 |
by the MenuEditor of ST/X." |
|
1423 |
||
1424 |
"Do not manually edit this!! If it is corrupted, |
|
1425 |
the MenuEditor may not be able to read the specification." |
|
1426 |
||
1427 |
" |
|
1428 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec2 |
|
1429 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec2)) startUp |
|
1430 |
" |
|
1431 |
||
1432 |
<resource: #menu> |
|
1433 |
||
1434 |
^ |
|
1435 |
#(Menu |
|
1436 |
( |
|
1437 |
(MenuItem |
|
1438 |
label: 'Edit Bookmarks' |
|
1439 |
itemValue: editBookmarks |
|
1440 |
translateLabel: true |
|
1441 |
) |
|
1442 |
(MenuItem |
|
1443 |
label: '-' |
|
1444 |
) |
|
1445 |
(MenuItem |
|
1446 |
enabled: currentFilesHasDirectories |
|
1447 |
label: 'Add Bookmark' |
|
1448 |
itemValue: addBookmark |
|
1449 |
translateLabel: true |
|
1450 |
) |
|
1451 |
) |
|
1452 |
nil |
|
1453 |
nil |
|
1454 |
) |
|
1455 |
! |
|
1456 |
||
1457 |
browserMenu |
|
1458 |
"This resource specification was automatically generated |
|
1459 |
by the MenuEditor of ST/X." |
|
1460 |
||
1461 |
"Do not manually edit this!! If it is corrupted, |
|
1462 |
the MenuEditor may not be able to read the specification." |
|
1463 |
||
1464 |
||
1465 |
" |
|
1466 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#browserMenu |
|
1467 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser browserMenu)) startUp |
|
1468 |
" |
|
1469 |
||
1470 |
<resource: #menu> |
|
1471 |
||
1472 |
^ |
|
1473 |
#(Menu |
|
1474 |
( |
|
1475 |
(MenuItem |
|
1476 |
label: 'Spawn Filebrowser' |
|
1477 |
itemValue: doSpawn |
|
1478 |
translateLabel: true |
|
1479 |
shortcutKey: Ctrln |
|
1480 |
) |
|
1481 |
(MenuItem |
|
1482 |
label: 'Windows Explorer' |
|
1483 |
itemValue: doOpenExplorer |
|
1484 |
translateLabel: true |
|
17724 | 1485 |
isVisible: systemIsOSX |
15211 | 1486 |
) |
1487 |
(MenuItem |
|
1488 |
label: 'Open Finder' |
|
1489 |
itemValue: doOpenFinder |
|
1490 |
translateLabel: true |
|
1491 |
isVisible: systemIsOSX |
|
1492 |
) |
|
1493 |
(MenuItem |
|
1494 |
label: 'C Browser' |
|
1495 |
itemValue: doOpenCBrowser |
|
1496 |
translateLabel: true |
|
1497 |
isVisible: cBrowserMenuItemVisible |
|
1498 |
) |
|
1499 |
(MenuItem |
|
1500 |
label: '-' |
|
1501 |
) |
|
1502 |
(MenuItem |
|
1503 |
label: 'Add Text Editor Page' |
|
1504 |
itemValue: newTextEditor |
|
1505 |
translateLabel: true |
|
1506 |
shortcutKey: Ctrlt |
|
1507 |
) |
|
1508 |
(MenuItem |
|
1509 |
label: 'Add Shell Terminal Page' |
|
1510 |
itemValue: doAddTerminal |
|
1511 |
translateLabel: true |
|
1512 |
) |
|
1513 |
(MenuItem |
|
1514 |
label: 'Add Archiver Page' |
|
1515 |
itemValue: doAddArchiver |
|
1516 |
translateLabel: true |
|
1517 |
) |
|
1518 |
(MenuItem |
|
1519 |
label: 'Add Search Page' |
|
1520 |
itemValue: doOpenSearchFile |
|
1521 |
translateLabel: true |
|
1522 |
) |
|
1523 |
(MenuItem |
|
1524 |
label: '-' |
|
1525 |
isVisible: false |
|
1526 |
) |
|
1527 |
(MenuItem |
|
1528 |
label: 'Settings...' |
|
1529 |
itemValue: doOpenSettings |
|
1530 |
translateLabel: true |
|
1531 |
isVisible: false |
|
1532 |
) |
|
1533 |
(MenuItem |
|
1534 |
label: 'Encoding...' |
|
1535 |
itemValue: fileEncodingDialog |
|
1536 |
translateLabel: true |
|
1537 |
isVisible: false |
|
1538 |
) |
|
1539 |
(MenuItem |
|
1540 |
label: 'Line End Convention...' |
|
1541 |
itemValue: lineEndConventionDialog |
|
1542 |
translateLabel: true |
|
1543 |
isVisible: false |
|
1544 |
) |
|
1545 |
(MenuItem |
|
1546 |
label: 'Tab Stop Conversion...' |
|
1547 |
itemValue: tabStopConversionDialog |
|
1548 |
translateLabel: true |
|
1549 |
isVisible: false |
|
1550 |
) |
|
1551 |
(MenuItem |
|
1552 |
label: '-' |
|
1553 |
) |
|
1554 |
(MenuItem |
|
1555 |
label: 'Exit' |
|
1556 |
itemValue: closeRequest |
|
1557 |
translateLabel: true |
|
1558 |
) |
|
1559 |
) |
|
1560 |
nil |
|
1561 |
nil |
|
1562 |
) |
|
1563 |
||
17724 | 1564 |
"Modified: / 29-10-2017 / 11:13:49 / cg" |
15211 | 1565 |
! |
1566 |
||
1567 |
directoryMenu |
|
1568 |
"This resource specification was automatically generated |
|
1569 |
by the MenuEditor of ST/X." |
|
1570 |
||
1571 |
"Do not manually edit this!! If it is corrupted, |
|
1572 |
the MenuEditor may not be able to read the specification." |
|
1573 |
||
1574 |
||
1575 |
" |
|
1576 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#directoryMenu |
|
1577 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser directoryMenu)) startUp |
|
1578 |
" |
|
1579 |
||
1580 |
<resource: #menu> |
|
1581 |
||
1582 |
^ |
|
1583 |
#(Menu |
|
1584 |
( |
|
1585 |
(MenuItem |
|
1586 |
label: 'Bookmarks' |
|
1587 |
submenuChannel: bookmarksMenu |
|
1588 |
) |
|
1589 |
(MenuItem |
|
1590 |
label: 'Visited Directories' |
|
1591 |
submenuChannel: visitedDirectoriesMenu |
|
1592 |
) |
|
1593 |
(MenuItem |
|
1594 |
label: '-' |
|
1595 |
) |
|
1596 |
(MenuItem |
|
1597 |
label: 'Up' |
|
1598 |
itemValue: doGoDirectoryUp |
|
1599 |
) |
|
1600 |
(MenuItem |
|
1601 |
activeHelpKey: directoryBack |
|
1602 |
enabled: enableBack |
|
1603 |
label: 'Back' |
|
1604 |
itemValue: doBack |
|
1605 |
) |
|
1606 |
(MenuItem |
|
1607 |
activeHelpKey: directoryBack |
|
1608 |
enabled: enableForward |
|
1609 |
label: 'Forward' |
|
1610 |
itemValue: doForward |
|
1611 |
) |
|
1612 |
(MenuItem |
|
1613 |
label: '-' |
|
1614 |
) |
|
1615 |
(MenuItem |
|
1616 |
enabled: enableHome |
|
1617 |
label: 'Home Directory' |
|
1618 |
itemValue: doGotoHomeDirectory |
|
1619 |
) |
|
1620 |
(MenuItem |
|
1621 |
enabled: enableGotoDesktopDirectory |
|
1622 |
label: 'Desktop' |
|
1623 |
itemValue: doGotoDesktopDirectory |
|
1624 |
) |
|
1625 |
(MenuItem |
|
1626 |
enabled: enableGotoDefaultDirectory |
|
1627 |
label: 'Default (Current) Directory' |
|
1628 |
itemValue: doGotoDefaultDirectory |
|
1629 |
) |
|
1630 |
(MenuItem |
|
1631 |
enabled: enableGotoSmalltalkDirectory |
|
1632 |
label: 'Smalltalk (Application) Directory' |
|
1633 |
itemValue: doGotoSmalltalkDirectory |
|
1634 |
) |
|
1635 |
(MenuItem |
|
17187 | 1636 |
enabled: enableGotoSmalltalkWorkspaceDirectory |
1637 |
label: 'Smalltalk Workspace Directory' |
|
1638 |
itemValue: doGotoSmalltalkWorkspaceDirectory |
|
1639 |
) |
|
1640 |
(MenuItem |
|
15211 | 1641 |
enabled: enableGotoTempDirectory |
1642 |
label: 'Smalltalk Temp Directory' |
|
1643 |
itemValue: doGotoTempDirectory |
|
1644 |
) |
|
1645 |
(MenuItem |
|
1646 |
label: '-' |
|
17582 | 1647 |
isVisible: false |
15211 | 1648 |
) |
1649 |
(MenuItem |
|
1650 |
enabled: enableMakeCurrentDirectory |
|
1651 |
label: 'Make this the Default (Current) Directory' |
|
1652 |
itemValue: doMakeCurrentDirectory |
|
17582 | 1653 |
isVisible: false |
15211 | 1654 |
) |
1655 |
) |
|
1656 |
nil |
|
1657 |
nil |
|
1658 |
) |
|
17582 | 1659 |
|
1660 |
"Modified: / 17-07-2017 / 10:08:31 / cg" |
|
15211 | 1661 |
! |
1662 |
||
1663 |
editMenu |
|
1664 |
"This resource specification was automatically generated |
|
1665 |
by the MenuEditor of ST/X." |
|
1666 |
||
1667 |
"Do not manually edit this!! If it is corrupted, |
|
1668 |
the MenuEditor may not be able to read the specification." |
|
1669 |
||
1670 |
" |
|
1671 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#editMenu |
|
1672 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser editMenu)) startUp |
|
1673 |
" |
|
1674 |
||
1675 |
<resource: #menu> |
|
1676 |
||
1677 |
^ |
|
1678 |
#(Menu |
|
1679 |
( |
|
1680 |
(MenuItem |
|
1681 |
enabled: hasFileSelection |
|
1682 |
label: 'Copy Selected Filenames to Clipboard' |
|
1683 |
itemValue: copySelectedFilenames |
|
1684 |
translateLabel: true |
|
1685 |
) |
|
1686 |
(MenuItem |
|
1687 |
enabled: fileListIsNotEmpty |
|
1688 |
label: 'Copy all Filenames to Clipboard' |
|
1689 |
itemValue: copyFileList |
|
1690 |
translateLabel: true |
|
1691 |
) |
|
1692 |
) |
|
1693 |
nil |
|
1694 |
nil |
|
1695 |
) |
|
1696 |
! |
|
1697 |
||
1698 |
emptyMenuSpec |
|
1699 |
"This resource specification was automatically generated |
|
1700 |
by the MenuEditor of ST/X." |
|
1701 |
||
1702 |
"Do not manually edit this!! If it is corrupted, |
|
1703 |
the MenuEditor may not be able to read the specification." |
|
1704 |
||
1705 |
" |
|
1706 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#emptyMenuSpec |
|
1707 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser emptyMenuSpec)) startUp |
|
1708 |
" |
|
1709 |
||
1710 |
<resource: #menu> |
|
1711 |
||
1712 |
^ |
|
1713 |
#(#Menu |
|
1714 |
#( |
|
1715 |
) |
|
1716 |
nil |
|
1717 |
nil |
|
1718 |
) |
|
1719 |
! |
|
1720 |
||
1721 |
extraMenu |
|
1722 |
"This resource specification was automatically generated |
|
1723 |
by the MenuEditor of ST/X." |
|
1724 |
||
1725 |
"Do not manually edit this!! If it is corrupted, |
|
1726 |
the MenuEditor may not be able to read the specification." |
|
1727 |
||
1728 |
||
1729 |
" |
|
1730 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#extraMenu |
|
1731 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser extraMenu)) startUp |
|
1732 |
" |
|
1733 |
||
1734 |
<resource: #menu> |
|
1735 |
||
1736 |
^ |
|
1737 |
#(Menu |
|
1738 |
( |
|
1739 |
(MenuItem |
|
1740 |
label: 'Encoding...' |
|
1741 |
itemValue: fileEncodingDialog |
|
1742 |
translateLabel: true |
|
1743 |
) |
|
1744 |
(MenuItem |
|
1745 |
label: 'Line End Convention...' |
|
1746 |
itemValue: lineEndConventionDialog |
|
1747 |
translateLabel: true |
|
1748 |
) |
|
1749 |
(MenuItem |
|
1750 |
label: 'Tab Stop Conversion...' |
|
1751 |
itemValue: tabStopConversionDialog |
|
1752 |
translateLabel: true |
|
1753 |
) |
|
1754 |
(MenuItem |
|
1755 |
label: '-' |
|
1756 |
) |
|
1757 |
(MenuItem |
|
1758 |
label: 'Settings...' |
|
1759 |
itemValue: doOpenSettings |
|
1760 |
translateLabel: true |
|
1761 |
labelImage: (ResourceRetriever ToolbarIconLibrary settings16x16Icon 'Settings...') |
|
1762 |
) |
|
1763 |
) |
|
1764 |
nil |
|
1765 |
nil |
|
1766 |
) |
|
1767 |
! |
|
1768 |
||
1769 |
fileMenu |
|
1770 |
"This resource specification was automatically generated |
|
1771 |
by the MenuEditor of ST/X." |
|
1772 |
||
1773 |
"Do not manually edit this!! If it is corrupted, |
|
1774 |
the MenuEditor may not be able to read the specification." |
|
1775 |
||
1776 |
||
1777 |
" |
|
1778 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileMenu |
|
1779 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileMenu)) startUp |
|
1780 |
" |
|
1781 |
||
1782 |
<resource: #menu> |
|
1783 |
||
1784 |
^ |
|
1785 |
#(Menu |
|
1786 |
( |
|
1787 |
(MenuItem |
|
1788 |
enabled: enableFileHistory |
|
1789 |
label: 'File History' |
|
1790 |
submenuChannel: menuFileHistory |
|
1791 |
) |
|
1792 |
(MenuItem |
|
1793 |
label: '-' |
|
1794 |
) |
|
1795 |
(MenuItem |
|
1796 |
label: 'Open' |
|
1797 |
itemValue: doShowFileContents |
|
1798 |
) |
|
1799 |
(MenuItem |
|
1800 |
label: '-' |
|
1801 |
) |
|
1802 |
(MenuItem |
|
1803 |
enabled: hasFileSelection |
|
1804 |
label: 'FileIn' |
|
1805 |
itemValue: fileFileIn |
|
1806 |
) |
|
1807 |
(MenuItem |
|
1808 |
enabled: hasFileSelection |
|
1809 |
label: 'FileIn to Namespace...' |
|
1810 |
itemValue: fileFileInToNameSpace |
|
1811 |
) |
|
1812 |
(MenuItem |
|
1813 |
enabled: hasPackageDirectorySelected |
|
1814 |
label: 'Load Package from Here' |
|
1815 |
itemValue: fileFileInPackage |
|
1816 |
) |
|
1817 |
(MenuItem |
|
1818 |
label: '-' |
|
1819 |
) |
|
1820 |
(MenuItem |
|
1821 |
label: 'New' |
|
1822 |
submenuChannel: newMenu |
|
1823 |
keepLinkedMenu: true |
|
1824 |
) |
|
1825 |
(MenuItem |
|
1826 |
label: '-' |
|
1827 |
) |
|
1828 |
(MenuItem |
|
1829 |
enabled: hasSelection |
|
1830 |
label: 'Cut' |
|
1831 |
itemValue: cutFiles |
|
1832 |
) |
|
1833 |
(MenuItem |
|
1834 |
enabled: hasSelection |
|
1835 |
label: 'Copy' |
|
1836 |
itemValue: copyFiles |
|
1837 |
) |
|
1838 |
(MenuItem |
|
1839 |
enabled: canPaste |
|
1840 |
label: 'Paste' |
|
1841 |
itemValue: pasteFiles |
|
1842 |
) |
|
1843 |
(MenuItem |
|
1844 |
enabled: hasSelection |
|
1845 |
label: 'Delete' |
|
1846 |
itemValue: deleteFiles |
|
1847 |
) |
|
1848 |
(MenuItem |
|
1849 |
enabled: hasSelection |
|
1850 |
label: 'Erase' |
|
1851 |
itemValue: eraseFiles |
|
1852 |
) |
|
1853 |
(MenuItem |
|
1854 |
label: '-' |
|
1855 |
) |
|
1856 |
(MenuItem |
|
1857 |
enabled: hasSelection |
|
1858 |
label: 'Rename...' |
|
1859 |
itemValue: renameSelection |
|
1860 |
shortcutKey: Rename |
|
1861 |
) |
|
1862 |
(MenuItem |
|
1863 |
enabled: hasSelection |
|
1864 |
label: 'Move To...' |
|
1865 |
itemValue: moveSelectionTo |
|
1866 |
) |
|
1867 |
(MenuItem |
|
1868 |
enabled: hasSelection |
|
1869 |
label: 'Copy To...' |
|
1870 |
itemValue: copySelectionTo |
|
1871 |
) |
|
1872 |
(MenuItem |
|
1873 |
enabled: hasSelection |
|
1874 |
label: 'Properties...' |
|
1875 |
itemValue: doShowProperties |
|
1876 |
) |
|
1877 |
(MenuItem |
|
1878 |
label: '-' |
|
1879 |
isVisible: javaSupportLoaded |
|
1880 |
) |
|
1881 |
(MenuItem |
|
1882 |
enabled: canAddToClassPath |
|
1883 |
label: 'Add to Java Class Path' |
|
1884 |
isVisible: javaSupportLoaded |
|
1885 |
) |
|
1886 |
(MenuItem |
|
1887 |
enabled: canRemoveFromClassPath |
|
1888 |
label: 'Remove from Java Class Path' |
|
1889 |
isVisible: javaSupportLoaded |
|
1890 |
) |
|
1891 |
(MenuItem |
|
1892 |
enabled: canAddToSourcePath |
|
1893 |
label: 'Add to Java Source Path' |
|
1894 |
isVisible: javaSupportLoaded |
|
1895 |
) |
|
1896 |
(MenuItem |
|
1897 |
enabled: canRemoveFromSourcePath |
|
1898 |
label: 'Remove from Java Source Path' |
|
1899 |
isVisible: javaSupportLoaded |
|
1900 |
) |
|
1901 |
) |
|
1902 |
nil |
|
1903 |
nil |
|
1904 |
) |
|
1905 |
! |
|
1906 |
||
1907 |
fileOpMenu |
|
1908 |
"This resource specification was automatically generated |
|
1909 |
by the MenuEditor of ST/X." |
|
1910 |
||
1911 |
"Do not manually edit this!! If it is corrupted, |
|
1912 |
the MenuEditor may not be able to read the specification." |
|
1913 |
||
1914 |
||
1915 |
" |
|
1916 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileOpMenu |
|
1917 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileOpMenu)) startUp |
|
1918 |
" |
|
1919 |
||
1920 |
<resource: #menu> |
|
1921 |
||
1922 |
^ |
|
1923 |
#(Menu |
|
1924 |
( |
|
1925 |
(MenuItem |
|
1926 |
enabled: hasFileSelection |
|
15906 | 1927 |
label: 'Split (by size)...' |
15211 | 1928 |
itemValue: splitSelectedFiles |
1929 |
) |
|
1930 |
(MenuItem |
|
1931 |
enabled: hasFileSelection |
|
15906 | 1932 |
label: 'Split (by #lines)...' |
1933 |
itemValue: splitSelectedFilesByLines |
|
1934 |
) |
|
1935 |
(MenuItem |
|
1936 |
enabled: hasFileSelection |
|
15211 | 1937 |
label: 'Join...' |
1938 |
itemValue: joinSelectedFiles |
|
1939 |
) |
|
1940 |
(MenuItem |
|
1941 |
enabled: hasFileSelection |
|
1942 |
label: 'Copy Corrupted File To...' |
|
1943 |
itemValue: copySelectionToRepairingCorruptedFiles |
|
1944 |
) |
|
1945 |
(MenuItem |
|
15569 | 1946 |
label: 'Copy Corrupted File From -> To...' |
1947 |
itemValue: copyFromToRepairingCorruptedFiles |
|
1948 |
) |
|
1949 |
(MenuItem |
|
15211 | 1950 |
label: '-' |
1951 |
) |
|
1952 |
(MenuItem |
|
1953 |
enabled: hasFileSelection |
|
1954 |
label: 'Rot13...' |
|
1955 |
itemValue: filterSelectedFiles: |
|
1956 |
argument: rot13 |
|
1957 |
) |
|
1958 |
(MenuItem |
|
1959 |
label: '-' |
|
1960 |
) |
|
1961 |
(MenuItem |
|
1962 |
enabled: hasFileSelection |
|
1963 |
label: 'Truncate...' |
|
1964 |
itemValue: truncateSelectedFilesToZeroSize |
|
1965 |
) |
|
1966 |
(MenuItem |
|
1967 |
label: '-' |
|
1968 |
) |
|
1969 |
(MenuItem |
|
1970 |
label: 'Load Signature Support Package' |
|
1971 |
itemValue: loadSignatureSupport |
|
1972 |
isVisible: cannotGenerateSignatureFiles |
|
1973 |
) |
|
1974 |
(MenuItem |
|
1975 |
enabled: canGenerateSignatureFiles |
|
1976 |
label: 'Generate Signed Files' |
|
1977 |
itemValue: generateSignaturesForSelectedFiles |
|
1978 |
) |
|
1979 |
(MenuItem |
|
1980 |
enabled: canGenerateSignatureFiles |
|
1981 |
label: 'Generate Detached Signature Files (use for dll)' |
|
1982 |
itemValue: generateDetachedSignaturesForSelectedFiles |
|
1983 |
) |
|
1984 |
(MenuItem |
|
1985 |
enabled: canGenerateSignatureFiles |
|
1986 |
label: 'Generate Patch Installer for File(s)' |
|
1987 |
itemValue: generatePatchInstallerForSelectedFiles |
|
1988 |
) |
|
1989 |
(MenuItem |
|
1990 |
label: '-' |
|
1991 |
) |
|
1992 |
(MenuItem |
|
1993 |
enabled: hasFileSelection |
|
1994 |
label: 'File Differences' |
|
1995 |
itemValue: openDiffView |
|
1996 |
isVisible: hasTwoFilesSelectedHolder |
|
1997 |
) |
|
1998 |
(MenuItem |
|
1999 |
enabled: hasFileSelection |
|
2000 |
label: 'File Differences...' |
|
2001 |
itemValue: openDiffView |
|
2002 |
isVisible: hasNotTwoFilesSelectedHolder |
|
2003 |
) |
|
2004 |
(MenuItem |
|
2005 |
enabled: hasSelection |
|
2006 |
label: 'Directory Differences' |
|
2007 |
itemValue: openDirectoryDiffView |
|
2008 |
isVisible: hasTwoDirectoriesSelectedHolder |
|
2009 |
) |
|
2010 |
(MenuItem |
|
2011 |
enabled: hasSelection |
|
2012 |
label: 'Directory Differences...' |
|
2013 |
itemValue: openDirectoryDiffView |
|
2014 |
isVisible: hasNotTwoDirectoriesSelectedHolder |
|
2015 |
) |
|
2016 |
) |
|
2017 |
nil |
|
2018 |
nil |
|
2019 |
) |
|
2020 |
! |
|
2021 |
||
2022 |
newMenu |
|
2023 |
"This resource specification was automatically generated |
|
2024 |
by the MenuEditor of ST/X." |
|
2025 |
||
2026 |
"Do not manually edit this!! If it is corrupted, |
|
2027 |
the MenuEditor may not be able to read the specification." |
|
2028 |
||
2029 |
" |
|
2030 |
MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#newMenu |
|
2031 |
(Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser newMenu)) startUp |
|
2032 |
" |
|
2033 |
||
2034 |
<resource: #menu> |
|
2035 |
||
2036 |
^ |
|
2037 |
#(#Menu |
|
2038 |
#( |
|
2039 |
#(#MenuItem |
|
2040 |
#label: 'Directory...' |
|
2041 |
#translateLabel: true |
|
2042 |
#value: #newDirectory |
|
2043 |
) |
|
2044 |
#(#MenuItem |
|
2045 |
#label: 'File...' |
|
2046 |
#translateLabel: true |
|
2047 |
#value: #newFile |
|
2048 |
) |
|
2049 |
#(#MenuItem |
|
2050 |
#label: 'Hard Link...' |
|
2051 |
#translateLabel: true |
|
2052 |
#value: #newHardLink |
|
2053 |
) |
|
2054 |
#(#MenuItem |
|
2055 |
#label: 'Symbolic Link...' |
|
2056 |
#translateLabel: true |
|
2057 |
#value: #newSoftLink |
|
2058 |
) |
|
2059 |
) |
|
2060 |
nil |
|
2061 |
nil |
|
2062 |
) |
|
2063 |
! |
|
2064 |
||
2065 |
scmMenuSlice |
|
2066 |
"This resource specification was automatically generated |
|
2067 |
by the MenuEditor of ST/X." |
|
2068 |
||
2069 |
"Do not manually edit this!! If it is corrupted, |
|
2070 |
the MenuEditor may not be able to read the specification." |
|
2071 |
||
2072 |
||
2073 |
" |
|
2074 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#scmMenuSlice |
|
2075 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser scmMenuSlice)) startUp |
|
2076 |
" |
|
2077 |
||
2078 |
<resource: #menu> |
|
2079 |
||
2080 |
^ |
|
2081 |
#(Menu |
|
2082 |
( |
|
2083 |
(MenuItem |
|
2084 |
label: 'CVS' |
|
2085 |
isVisible: cvsMenusAreShown |
|
2086 |
submenuChannel: cvsMenu |
|
2087 |
) |
|
2088 |
(MenuItem |
|
2089 |
label: 'SVN' |
|
2090 |
isVisible: svnMenusAreShown |
|
2091 |
submenuChannel: svnMenu |
|
2092 |
) |
|
2093 |
(MenuItem |
|
2094 |
label: 'Mercurial' |
|
2095 |
isVisible: mercurialMenusAreShown |
|
2096 |
submenuChannel: mercurialMenu |
|
2097 |
) |
|
2098 |
(MenuItem |
|
2099 |
label: 'HG' |
|
2100 |
isVisible: hgMenusAreShown |
|
2101 |
submenuChannel: hgMenu |
|
2102 |
) |
|
2103 |
(MenuItem |
|
2104 |
label: 'Perforce' |
|
2105 |
isVisible: perforceMenusAreShown |
|
2106 |
submenuChannel: perforceMenu |
|
2107 |
) |
|
2108 |
) |
|
2109 |
nil |
|
2110 |
nil |
|
2111 |
) |
|
2112 |
! |
|
2113 |
||
2114 |
showMenuSpec |
|
2115 |
"This resource specification was automatically generated |
|
2116 |
by the MenuEditor of ST/X." |
|
2117 |
||
2118 |
"Do not manually edit this!! If it is corrupted, |
|
2119 |
the MenuEditor may not be able to read the specification." |
|
2120 |
||
2121 |
" |
|
2122 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpec |
|
2123 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpec)) startUp |
|
2124 |
" |
|
2125 |
||
2126 |
<resource: #menu> |
|
2127 |
||
2128 |
^ |
|
2129 |
#(Menu |
|
2130 |
( |
|
2131 |
(MenuItem |
|
2132 |
label: 'Hidden Files' |
|
2133 |
translateLabel: true |
|
2134 |
hideMenuOnActivated: false |
|
2135 |
indication: showHiddenFiles |
|
2136 |
) |
|
2137 |
(MenuItem |
|
2138 |
label: '-' |
|
2139 |
) |
|
2140 |
(MenuItem |
|
2141 |
label: 'Directory Tree' |
|
2142 |
translateLabel: true |
|
2143 |
hideMenuOnActivated: false |
|
2144 |
indication: showDirectoryTree |
|
2145 |
) |
|
2146 |
(MenuItem |
|
2147 |
label: 'Regular Files in TreeView (Left)' |
|
2148 |
translateLabel: true |
|
2149 |
hideMenuOnActivated: false |
|
2150 |
indication: viewFilesInDirectoryTree |
|
2151 |
) |
|
2152 |
(MenuItem |
|
2153 |
label: 'Directories in ContentsView (Right)' |
|
2154 |
translateLabel: true |
|
2155 |
hideMenuOnActivated: false |
|
2156 |
indication: viewDirsInContentsBrowser |
|
2157 |
) |
|
2158 |
(MenuItem |
|
2159 |
enabled: enableViewNoteBookApplication |
|
2160 |
label: 'File Applications' |
|
2161 |
translateLabel: true |
|
2162 |
hideMenuOnActivated: false |
|
2163 |
indication: viewNoteBookApplicationHolder |
|
2164 |
) |
|
2165 |
(MenuItem |
|
2166 |
label: '-' |
|
2167 |
) |
|
2168 |
(MenuItem |
|
2169 |
label: 'DiskUsage' |
|
2170 |
translateLabel: true |
|
2171 |
hideMenuOnActivated: false |
|
2172 |
indication: showDiskUsageHolder |
|
2173 |
) |
|
2174 |
) |
|
2175 |
nil |
|
2176 |
nil |
|
2177 |
) |
|
2178 |
! |
|
2179 |
||
2180 |
showMenuSpecForDialog |
|
2181 |
"This resource specification was automatically generated |
|
2182 |
by the MenuEditor of ST/X." |
|
2183 |
||
2184 |
"Do not manually edit this!! If it is corrupted, |
|
2185 |
the MenuEditor may not be able to read the specification." |
|
2186 |
||
2187 |
" |
|
2188 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpecForDialog |
|
2189 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpecForDialog)) startUp |
|
2190 |
" |
|
2191 |
||
2192 |
<resource: #menu> |
|
2193 |
||
2194 |
^ |
|
2195 |
#(Menu |
|
2196 |
( |
|
2197 |
(MenuItem |
|
2198 |
label: 'Hidden Files' |
|
2199 |
translateLabel: true |
|
2200 |
hideMenuOnActivated: false |
|
2201 |
indication: showHiddenFiles |
|
2202 |
) |
|
2203 |
) |
|
2204 |
nil |
|
2205 |
nil |
|
2206 |
) |
|
2207 |
! |
|
2208 |
||
2209 |
sortMenu |
|
2210 |
"This resource specification was automatically generated |
|
2211 |
by the MenuEditor of ST/X." |
|
2212 |
||
2213 |
"Do not manually edit this!! If it is corrupted, |
|
2214 |
the MenuEditor may not be able to read the specification." |
|
2215 |
||
2216 |
" |
|
2217 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#sortMenu |
|
2218 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser sortMenu)) startUp |
|
2219 |
" |
|
2220 |
||
2221 |
<resource: #menu> |
|
2222 |
||
2223 |
^ |
|
2224 |
#(#Menu |
|
2225 |
#( |
|
2226 |
#(#MenuItem |
|
2227 |
#label: 'By Filename' |
|
2228 |
#translateLabel: true |
|
2229 |
#hideMenuOnActivated: false |
|
2230 |
#choice: #sortBlockProperty |
|
2231 |
#choiceValue: #baseName |
|
2232 |
) |
|
2233 |
#(#MenuItem |
|
2234 |
#label: 'By Extension' |
|
2235 |
#translateLabel: true |
|
2236 |
#hideMenuOnActivated: false |
|
2237 |
#choice: #sortBlockProperty |
|
2238 |
#choiceValue: #suffix |
|
2239 |
) |
|
2240 |
#(#MenuItem |
|
2241 |
#label: 'By Permissions' |
|
2242 |
#translateLabel: true |
|
2243 |
#hideMenuOnActivated: false |
|
2244 |
#choice: #sortBlockProperty |
|
2245 |
#choiceValue: #permissions |
|
2246 |
) |
|
2247 |
#(#MenuItem |
|
2248 |
#label: 'By Owner' |
|
2249 |
#translateLabel: true |
|
2250 |
#isVisible: #viewOwner |
|
2251 |
#hideMenuOnActivated: false |
|
2252 |
#choice: #sortBlockProperty |
|
2253 |
#choiceValue: #owner |
|
2254 |
) |
|
2255 |
#(#MenuItem |
|
2256 |
#label: 'By Group' |
|
2257 |
#translateLabel: true |
|
2258 |
#isVisible: #viewOwner |
|
2259 |
#hideMenuOnActivated: false |
|
2260 |
#choice: #sortBlockProperty |
|
2261 |
#choiceValue: #group |
|
2262 |
) |
|
2263 |
#(#MenuItem |
|
2264 |
#label: 'By Size' |
|
2265 |
#translateLabel: true |
|
2266 |
#hideMenuOnActivated: false |
|
2267 |
#choice: #sortBlockProperty |
|
2268 |
#choiceValue: #fileSize |
|
2269 |
) |
|
2270 |
#(#MenuItem |
|
2271 |
#label: 'By Date && Time' |
|
2272 |
#translateLabel: true |
|
2273 |
#hideMenuOnActivated: false |
|
2274 |
#choice: #sortBlockProperty |
|
2275 |
#choiceValue: #modificationTime |
|
2276 |
) |
|
2277 |
#(#MenuItem |
|
2278 |
#label: '-' |
|
2279 |
) |
|
2280 |
#(#MenuItem |
|
2281 |
#label: 'Ignore Case in Sort' |
|
2282 |
#translateLabel: true |
|
2283 |
#hideMenuOnActivated: false |
|
2284 |
#indication: #sortCaseless |
|
2285 |
) |
|
2286 |
#(#MenuItem |
|
2287 |
#label: 'Directories before Files' |
|
2288 |
#translateLabel: true |
|
2289 |
#hideMenuOnActivated: false |
|
2290 |
#indication: #sortDirectoriesBeforeFiles |
|
2291 |
) |
|
2292 |
) |
|
2293 |
nil |
|
2294 |
nil |
|
2295 |
) |
|
2296 |
! |
|
2297 |
||
2298 |
toolsMenuSpec |
|
2299 |
"This resource specification was automatically generated |
|
2300 |
by the MenuEditor of ST/X." |
|
2301 |
||
2302 |
"Do not manually edit this!! If it is corrupted, |
|
2303 |
the MenuEditor may not be able to read the specification." |
|
2304 |
||
2305 |
||
2306 |
" |
|
2307 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec |
|
2308 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp |
|
2309 |
" |
|
2310 |
||
2311 |
<resource: #menu> |
|
2312 |
||
2313 |
^ |
|
2314 |
#(Menu |
|
2315 |
( |
|
2316 |
(MenuItem |
|
2317 |
label: 'Open (Win32-Shell)' |
|
2318 |
itemValue: doOpenWithShellCommand |
|
2319 |
isVisible: systemIsDOS |
|
2320 |
) |
|
2321 |
(MenuItem |
|
2322 |
label: 'Execute UNIX Command...' |
|
2323 |
itemValue: doExecuteCommand |
|
2324 |
isVisible: systemIsUnix |
|
2325 |
) |
|
2326 |
(MenuItem |
|
2327 |
label: 'Execute DOS Command...' |
|
2328 |
itemValue: doExecuteCommand |
|
2329 |
isVisible: systemIsDOS |
|
2330 |
) |
|
2331 |
(MenuItem |
|
2332 |
label: 'Execute Script...' |
|
2333 |
itemValue: doExecuteScript |
|
2334 |
) |
|
2335 |
(MenuItem |
|
2336 |
enabled: canDoTerminal |
|
2337 |
label: 'Shell Terminal' |
|
2338 |
itemValue: openTerminal |
|
2339 |
isVisible: canDoTerminalAndSystemIsUnix |
|
2340 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'Shell Terminal') |
|
2341 |
) |
|
2342 |
(MenuItem |
|
2343 |
enabled: canDoTerminal |
|
2344 |
label: 'DOS Terminal' |
|
2345 |
itemValue: openTerminal |
|
2346 |
isVisible: canDoTerminalAndSystemIsDOS |
|
2347 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'DOS Terminal') |
|
2348 |
) |
|
2349 |
(MenuItem |
|
2350 |
label: '-' |
|
2351 |
) |
|
2352 |
(MenuItem |
|
2353 |
enabled: hasFileSelection |
|
2354 |
label: 'Changes Browser' |
|
2355 |
itemValue: openChangesBrowser |
|
2356 |
) |
|
2357 |
(MenuItem |
|
2358 |
enabled: hasFileSelection |
|
2359 |
label: 'ChangeSet Browser' |
|
2360 |
itemValue: openChangeSetBrowser |
|
2361 |
isVisible: changeSetBrowserItemVisible |
|
2362 |
) |
|
2363 |
(MenuItem |
|
2364 |
enabled: hasFileSelection |
|
2365 |
label: 'Workspace' |
|
2366 |
itemValue: openWorkspace |
|
2367 |
) |
|
2368 |
(MenuItem |
|
2369 |
label: '-' |
|
2370 |
) |
|
2371 |
(MenuItem |
|
2372 |
enabled: canReadAbbrevFile |
|
2373 |
label: 'Install Autoloaded' |
|
2374 |
itemValue: readAbbrevFile |
|
2375 |
) |
|
2376 |
(MenuItem |
|
2377 |
enabled: anySTFilesPresent |
|
2378 |
label: 'Install all ST-Files as Autoloaded' |
|
2379 |
itemValue: installAllAsAutoloaded |
|
2380 |
) |
|
2381 |
(MenuItem |
|
2382 |
enabled: recursiveAnySTFilesPresent |
|
2383 |
label: 'Recursive Install all ST-Files as Autoloaded' |
|
2384 |
itemValue: installAllAsAutoloadedRecursive |
|
2385 |
) |
|
2386 |
(MenuItem |
|
2387 |
label: '-' |
|
2388 |
) |
|
2389 |
(MenuItem |
|
2390 |
enabled: hasJava |
|
2391 |
label: 'Add Directory to Java Source Path (stx:libjava)' |
|
2392 |
itemValue: addDirToJavaSourcePath |
|
2393 |
) |
|
2394 |
(MenuItem |
|
2395 |
enabled: hasJava |
|
2396 |
label: 'Add Selected Files to Java Source Path (stx:libjava)' |
|
2397 |
itemValue: fileAddToJavaSourcePath |
|
2398 |
) |
|
2399 |
(MenuItem |
|
2400 |
label: '-' |
|
2401 |
) |
|
2402 |
(MenuItem |
|
2403 |
label: 'File Operations' |
|
2404 |
submenuChannel: fileOpMenu |
|
2405 |
) |
|
2406 |
(MenuItem |
|
2407 |
label: 'File Utilities' |
|
2408 |
submenu: |
|
2409 |
(Menu |
|
2410 |
( |
|
2411 |
(MenuItem |
|
2412 |
enabled: hasFileSelection |
|
2413 |
label: 'Editor' |
|
2414 |
itemValue: openEditor |
|
2415 |
) |
|
2416 |
(MenuItem |
|
2417 |
enabled: hasFileSelection |
|
2418 |
label: 'HTML Reader' |
|
2419 |
itemValue: openHTMLReader |
|
2420 |
) |
|
2421 |
(MenuItem |
|
2422 |
enabled: hasFileSelection |
|
2423 |
label: 'Web Browser' |
|
2424 |
itemValue: openWebBrowser |
|
2425 |
) |
|
2426 |
(MenuItem |
|
2427 |
label: 'XML Inspector' |
|
2428 |
itemValue: inspectXmlFile |
|
2429 |
isVisible: hasXml |
|
2430 |
showBusyCursorWhilePerforming: true |
|
2431 |
) |
|
2432 |
(MenuItem |
|
2433 |
enabled: hasFileSelection |
|
2434 |
label: 'Acroread (PDF Viewer)' |
|
2435 |
itemValue: openPDFViewer |
|
2436 |
) |
|
2437 |
(MenuItem |
|
2438 |
enabled: hasASN1AndSelection |
|
2439 |
label: 'ASN1 Browser' |
|
2440 |
itemValue: openASN1Browser |
|
2441 |
isVisible: hasASN1 |
|
2442 |
) |
|
2443 |
(MenuItem |
|
2444 |
enabled: hasCBrowser |
|
2445 |
label: 'C Browser' |
|
2446 |
itemValue: openCBrowser |
|
2447 |
isVisible: hasCBrowser |
|
2448 |
) |
|
2449 |
(MenuItem |
|
2450 |
enabled: canOpenMonticelloBrowser |
|
2451 |
label: 'Monticello Browser' |
|
2452 |
itemValue: doOpenMonticelloBrowser |
|
2453 |
) |
|
2454 |
(MenuItem |
|
2455 |
enabled: hasJavaAndSelection |
|
2456 |
label: 'Applet Viewer' |
|
2457 |
itemValue: openAppletViewer |
|
2458 |
isVisible: hasJava |
|
2459 |
) |
|
2460 |
(MenuItem |
|
2461 |
enabled: hasMP3PlayerAndSelection |
|
2462 |
label: 'MP3 Player' |
|
2463 |
itemValue: openMP3Player |
|
2464 |
isVisible: hasMP3Player |
|
2465 |
) |
|
2466 |
(MenuItem |
|
2467 |
enabled: hasFileSelection |
|
2468 |
label: 'xv (Image Viewer)' |
|
2469 |
itemValue: openXV |
|
2470 |
isVisible: systemIsUnix |
|
2471 |
) |
|
2472 |
(MenuItem |
|
2473 |
enabled: currentFilesAreInSameDirectory |
|
2474 |
label: 'Slide Show' |
|
2475 |
itemValue: openSlideShow |
|
2476 |
isVisible: hasSlideShow |
|
2477 |
) |
|
2478 |
(MenuItem |
|
2479 |
enabled: hasFileSelection |
|
2480 |
label: 'gv (Postscript Viewer)' |
|
2481 |
itemValue: openGV |
|
2482 |
isVisible: systemIsUnix |
|
2483 |
) |
|
2484 |
(MenuItem |
|
2485 |
enabled: hasMP3PlayerAndSelection |
|
2486 |
label: 'MP3 Player' |
|
2487 |
itemValue: openMP3Player |
|
2488 |
isVisible: hasMP3Player |
|
2489 |
) |
|
2490 |
(MenuItem |
|
2491 |
enabled: hasFileSelection |
|
2492 |
label: 'Realplay (avi viewer)' |
|
2493 |
itemValue: openRP |
|
2494 |
isVisible: systemIsUnix |
|
2495 |
) |
|
2496 |
(MenuItem |
|
2497 |
label: '-' |
|
2498 |
) |
|
2499 |
(MenuItem |
|
2500 |
label: 'Smalltalk' |
|
2501 |
submenu: |
|
2502 |
(Menu |
|
2503 |
( |
|
2504 |
(MenuItem |
|
2505 |
enabled: hasSnapshotSelection |
|
2506 |
label: 'Snapshot Image Browser' |
|
2507 |
itemValue: openSnapshotImageBrowser |
|
2508 |
) |
|
2509 |
(MenuItem |
|
2510 |
enabled: canCreateNewProject |
|
2511 |
label: 'Create Smalltalk Project' |
|
2512 |
itemValue: createProjectAndOpenProjectBrowser |
|
2513 |
) |
|
2514 |
(MenuItem |
|
2515 |
label: '-' |
|
2516 |
) |
|
2517 |
(MenuItem |
|
2518 |
enabled: hasResourceFileSelected |
|
2519 |
label: 'Show Contents of Resourcefile' |
|
2520 |
itemValue: readAndShowResources |
|
2521 |
) |
|
2522 |
(MenuItem |
|
2523 |
enabled: hasResourceFileSelected |
|
2524 |
label: 'Resource File Editor' |
|
2525 |
itemValue: openResourceFileEditor |
|
2526 |
showBusyCursorWhilePerforming: true |
|
2527 |
) |
|
2528 |
(MenuItem |
|
2529 |
label: '-' |
|
2530 |
) |
|
2531 |
(MenuItem |
|
2532 |
enabled: hasFileSelection |
|
2533 |
label: 'Contents as ByteArray' |
|
2534 |
itemValue: fileContentsAsByteArray |
|
2535 |
) |
|
2536 |
) |
|
2537 |
nil |
|
2538 |
nil |
|
2539 |
) |
|
2540 |
) |
|
2541 |
(MenuItem |
|
2542 |
label: 'Image' |
|
2543 |
submenu: |
|
2544 |
(Menu |
|
2545 |
( |
|
2546 |
(MenuItem |
|
2547 |
enabled: hasFileSelection |
|
2548 |
label: 'Image Editor' |
|
2549 |
itemValue: openImageEditor |
|
2550 |
) |
|
2551 |
(MenuItem |
|
2552 |
enabled: hasFileSelection |
|
2553 |
label: 'Image Preview' |
|
2554 |
itemValue: openImagePreview |
|
2555 |
) |
|
2556 |
(MenuItem |
|
2557 |
enabled: hasFileSelection |
|
2558 |
label: 'Image Inspector' |
|
2559 |
itemValue: openImageInspector |
|
2560 |
) |
|
2561 |
(MenuItem |
|
2562 |
label: '-' |
|
2563 |
) |
|
2564 |
(MenuItem |
|
2565 |
enabled: hasFileSelection |
|
2566 |
label: 'Convert to GIF' |
|
2567 |
itemValue: convertImageToGIF |
|
2568 |
) |
|
2569 |
(MenuItem |
|
2570 |
enabled: hasFileSelection |
|
2571 |
label: 'Convert to PNG' |
|
2572 |
itemValue: convertImageToPNG |
|
2573 |
) |
|
2574 |
(MenuItem |
|
2575 |
enabled: hasFileSelection |
|
2576 |
label: 'Convert to XPM' |
|
2577 |
itemValue: convertImageToXPM |
|
2578 |
) |
|
2579 |
(MenuItem |
|
2580 |
enabled: hasFileSelection |
|
2581 |
label: 'Convert to JPG' |
|
2582 |
itemValue: convertImageToJPG |
|
2583 |
) |
|
2584 |
) |
|
2585 |
nil |
|
2586 |
nil |
|
2587 |
) |
|
2588 |
) |
|
2589 |
(MenuItem |
|
15528 | 2590 |
label: 'Web' |
2591 |
submenu: |
|
2592 |
(Menu |
|
2593 |
( |
|
2594 |
(MenuItem |
|
2595 |
label: 'Fetch File by URL...' |
|
2596 |
itemValue: fetchFileByURL |
|
2597 |
) |
|
2598 |
) |
|
2599 |
nil |
|
2600 |
nil |
|
2601 |
) |
|
2602 |
) |
|
2603 |
(MenuItem |
|
15211 | 2604 |
enabled: hasZipFileSelectedHolder |
2605 |
label: 'ZipFile Tool' |
|
2606 |
itemValue: openZipTool |
|
2607 |
) |
|
2608 |
(MenuItem |
|
2609 |
enabled: hasFileSelection |
|
2610 |
label: 'Hex Dump' |
|
2611 |
itemValue: fileHexDump |
|
2612 |
) |
|
2613 |
) |
|
2614 |
nil |
|
2615 |
nil |
|
2616 |
) |
|
2617 |
) |
|
2618 |
(MenuItem |
|
2619 |
label: 'Find' |
|
2620 |
submenu: |
|
2621 |
(Menu |
|
2622 |
( |
|
2623 |
(MenuItem |
|
2624 |
label: 'File...' |
|
2625 |
itemValue: fileFindFile |
|
2626 |
) |
|
2627 |
(MenuItem |
|
2628 |
enabled: hasFileSelection |
|
2629 |
label: 'Same Contents as Selected...' |
|
2630 |
itemValue: fileFindDuplicateFile |
|
2631 |
) |
|
2632 |
(MenuItem |
|
2633 |
label: 'Duplicate Files' |
|
2634 |
itemValue: fileFindDuplicates |
|
2635 |
) |
|
2636 |
(MenuItem |
|
2637 |
enabled: hasSelection |
|
2638 |
label: 'All Duplicate Files (Recursive)' |
|
2639 |
itemValue: fileFindAllDuplicates |
|
2640 |
) |
|
2641 |
(MenuItem |
|
17686 | 2642 |
label: 'Similar Image Files (by Colors)' |
15211 | 2643 |
itemValue: fileFindSimilarImages |
2644 |
isVisible: hasImageColorHistogram |
|
2645 |
) |
|
17686 | 2646 |
(MenuItem |
2647 |
label: 'Similar Image Files (by Form)' |
|
2648 |
itemValue: fileFindSimilarImagesByForm |
|
2649 |
isVisible: hasImageHistogram |
|
2650 |
) |
|
15211 | 2651 |
) |
2652 |
nil |
|
2653 |
nil |
|
2654 |
) |
|
2655 |
) |
|
2656 |
) |
|
2657 |
nil |
|
2658 |
nil |
|
2659 |
) |
|
17686 | 2660 |
|
2661 |
"Modified: / 10-09-2017 / 16:50:09 / cg" |
|
15211 | 2662 |
! |
2663 |
||
2664 |
viewDetailsMenuSpec |
|
2665 |
"This resource specification was automatically generated |
|
2666 |
by the MenuEditor of ST/X." |
|
2667 |
||
2668 |
"Do not manually edit this!! If it is corrupted, |
|
2669 |
the MenuEditor may not be able to read the specification." |
|
2670 |
||
2671 |
" |
|
2672 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#viewDetailsMenuSpec |
|
2673 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser viewDetailsMenuSpec)) startUp |
|
2674 |
" |
|
2675 |
||
2676 |
<resource: #menu> |
|
2677 |
||
2678 |
^ |
|
2679 |
#(#Menu |
|
2680 |
#( |
|
2681 |
#(#MenuItem |
|
2682 |
#label: '-' |
|
2683 |
) |
|
2684 |
#(#MenuItem |
|
2685 |
#label: 'Hidden Files' |
|
2686 |
#translateLabel: true |
|
2687 |
#indication: #showHiddenFiles |
|
2688 |
) |
|
2689 |
) |
|
2690 |
nil |
|
2691 |
nil |
|
2692 |
) |
|
2693 |
! ! |
|
3892 | 2694 |
|
11144 | 2695 |
!AbstractFileBrowser class methodsFor:'menu specs-scm'! |
2696 |
||
15211 | 2697 |
cvsMenu |
2698 |
"This resource specification was automatically generated |
|
2699 |
by the MenuEditor of ST/X." |
|
2700 |
||
2701 |
"Do not manually edit this!! If it is corrupted, |
|
2702 |
the MenuEditor may not be able to read the specification." |
|
2703 |
||
2704 |
||
2705 |
" |
|
2706 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#cvsMenu |
|
2707 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser cvsMenu)) startUp |
|
2708 |
" |
|
2709 |
||
2710 |
<resource: #menu> |
|
2711 |
||
2712 |
^ |
|
2713 |
#(Menu |
|
2714 |
( |
|
2715 |
(MenuItem |
|
2716 |
label: 'Commit (CVS)...' |
|
2717 |
itemValue: cvsCommit |
|
2718 |
translateLabel: true |
|
2719 |
) |
|
2720 |
(MenuItem |
|
2721 |
enabled: canCvsAddAndCommit |
|
2722 |
label: 'Add && Commit...' |
|
2723 |
itemValue: cvsAddAndCommit |
|
2724 |
translateLabel: true |
|
2725 |
) |
|
2726 |
(MenuItem |
|
2727 |
enabled: canCvsAddAndCommit |
|
2728 |
label: 'Add as Binary && Commit...' |
|
2729 |
itemValue: cvsAddBinaryAndCommit |
|
2730 |
translateLabel: true |
|
2731 |
) |
|
2732 |
(MenuItem |
|
2733 |
label: 'Commit Folder (CVS)...' |
|
2734 |
itemValue: cvsCommitFolder |
|
2735 |
translateLabel: true |
|
2736 |
) |
|
2737 |
(MenuItem |
|
2738 |
label: '-' |
|
2739 |
) |
|
2740 |
(MenuItem |
|
2741 |
enabled: hasSelection |
|
2742 |
label: 'Update selected Files/Directories' |
|
2743 |
itemValue: cvsUpdateSelection |
|
2744 |
translateLabel: true |
|
2745 |
) |
|
2746 |
(MenuItem |
|
2747 |
label: 'Update Directory Local' |
|
2748 |
itemValue: cvsUpdateAll |
|
2749 |
translateLabel: true |
|
2750 |
) |
|
2751 |
(MenuItem |
|
2752 |
label: 'Update Directory Recursive' |
|
2753 |
itemValue: cvsUpdateAllRecursive |
|
2754 |
translateLabel: true |
|
2755 |
) |
|
2756 |
(MenuItem |
|
2757 |
label: '-' |
|
2758 |
) |
|
2759 |
(MenuItem |
|
2760 |
enabled: hasSelection |
|
2761 |
label: 'Tag...' |
|
2762 |
itemValue: cvsTagSelection |
|
2763 |
translateLabel: true |
|
2764 |
) |
|
2765 |
(MenuItem |
|
2766 |
enabled: hasSelection |
|
2767 |
label: 'Revision Log' |
|
2768 |
itemValue: cvsRevisionLog |
|
2769 |
translateLabel: true |
|
2770 |
) |
|
2771 |
(MenuItem |
|
2772 |
enabled: hasSelection |
|
2773 |
label: 'Compare with newest in Repository' |
|
2774 |
itemValue: cvsCompareWithNewest |
|
2775 |
translateLabel: true |
|
2776 |
) |
|
2777 |
(MenuItem |
|
2778 |
label: '-' |
|
2779 |
) |
|
2780 |
(MenuItem |
|
2781 |
enabled: canRemoveCVSContainer |
|
2782 |
label: 'Remove File && CVS Container...' |
|
2783 |
itemValue: cvsRemoveFileAndCVSContainer |
|
2784 |
translateLabel: true |
|
2785 |
) |
|
2786 |
) |
|
2787 |
nil |
|
2788 |
nil |
|
2789 |
) |
|
2790 |
! |
|
2791 |
||
2792 |
mercurialMenu |
|
2793 |
"This resource specification was automatically generated |
|
2794 |
by the MenuEditor of ST/X." |
|
2795 |
||
2796 |
"Do not manually edit this!! If it is corrupted, |
|
2797 |
the MenuEditor may not be able to read the specification." |
|
2798 |
||
2799 |
||
2800 |
" |
|
2801 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#mercurialMenu |
|
2802 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser mercurialMenu)) startUp |
|
2803 |
" |
|
2804 |
||
2805 |
<resource: #menu> |
|
2806 |
||
2807 |
^ |
|
2808 |
#(Menu |
|
2809 |
( |
|
2810 |
(MenuItem |
|
2811 |
label: 'Add' |
|
2812 |
itemValue: mercurialAdd |
|
2813 |
translateLabel: true |
|
2814 |
) |
|
2815 |
(MenuItem |
|
2816 |
label: 'Commit Changes' |
|
2817 |
itemValue: mercurialCommit |
|
2818 |
translateLabel: true |
|
2819 |
) |
|
2820 |
(MenuItem |
|
2821 |
label: 'Push...' |
|
2822 |
itemValue: mercurialPush |
|
2823 |
translateLabel: true |
|
2824 |
) |
|
2825 |
(MenuItem |
|
2826 |
label: 'Status' |
|
2827 |
itemValue: mercurialStatus |
|
2828 |
translateLabel: true |
|
2829 |
) |
|
2830 |
(MenuItem |
|
2831 |
label: '-' |
|
2832 |
) |
|
2833 |
(MenuItem |
|
2834 |
label: 'Init' |
|
2835 |
itemValue: mercurialInit |
|
2836 |
translateLabel: true |
|
2837 |
) |
|
2838 |
) |
|
2839 |
nil |
|
2840 |
nil |
|
2841 |
) |
|
2842 |
||
2843 |
"Modified: / 17-01-2012 / 15:57:40 / cg" |
|
2844 |
! |
|
2845 |
||
2846 |
perforceMenu |
|
2847 |
"This resource specification was automatically generated |
|
2848 |
by the MenuEditor of ST/X." |
|
2849 |
||
2850 |
"Do not manually edit this!! If it is corrupted, |
|
2851 |
the MenuEditor may not be able to read the specification." |
|
2852 |
||
2853 |
||
2854 |
" |
|
2855 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#perforceMenu |
|
2856 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser perforceMenu)) startUp |
|
2857 |
" |
|
2858 |
||
2859 |
<resource: #menu> |
|
2860 |
||
2861 |
^ |
|
2862 |
#(Menu |
|
2863 |
( |
|
2864 |
(MenuItem |
|
2865 |
label: 'Commit' |
|
2866 |
itemValue: perforceCommit |
|
2867 |
translateLabel: true |
|
2868 |
) |
|
2869 |
) |
|
2870 |
nil |
|
2871 |
nil |
|
2872 |
) |
|
2873 |
||
2874 |
"Created: / 15-01-2012 / 13:12:30 / cg" |
|
2875 |
! ! |
|
11144 | 2876 |
|
3892 | 2877 |
!AbstractFileBrowser class methodsFor:'misc'! |
2878 |
||
2879 |
newLock |
|
2880 |
^ CodeExecutionLock new |
|
2881 |
! ! |
|
2882 |
||
17288 | 2883 |
!AbstractFileBrowser class methodsFor:'queries'! |
2884 |
||
2885 |
isAbstract |
|
2886 |
^ self == AbstractFileBrowser |
|
2887 |
! ! |
|
2888 |
||
5644
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2889 |
!AbstractFileBrowser class methodsFor:'resources'! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2890 |
|
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2891 |
classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2892 |
^ FileBrowser classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2893 |
! ! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2894 |
|
17746 | 2895 |
!AbstractFileBrowser class methodsFor:'utilities - dump'! |
4610 | 2896 |
|
17744 | 2897 |
contentsOfBytesAsDump:data base:numberBase numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
2898 |
"utility helper: generate a hexDump with addresses; |
|
2899 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
2900 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
2901 |
to support display of alien encoded binary data." |
|
2902 |
||
2903 |
|lines nHexLines replacementForUnprintable colsPerByte characterDecoder| |
|
2904 |
||
2905 |
(characterEncodingSymbol isNil or:[characterEncodingSymbol == #'iso8859-1']) ifFalse:[ |
|
2906 |
characterDecoder := CharacterEncoder encoderToEncodeFrom:characterEncodingSymbol into:#unicode. |
|
2907 |
]. |
|
17252 | 2908 |
|
2909 |
"/ used to be: |
|
2910 |
"/ replacementForUnprintable := $. |
|
2911 |
replacementForUnprintable := Character value:16rB7. "/ a centered dot. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2912 |
|
17744 | 2913 |
"/ cols needed per byte in the hex dump |
2914 |
colsPerByte := ((255 printStringRadix:numberBase) size). |
|
2915 |
||
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2916 |
"generate a virtual collection which evaluates and returns lines on-demand" |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2917 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2918 |
nHexLines := (data size + 15) // 16. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2919 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2920 |
lines := VirtualArray new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2921 |
lines setSize:nHexLines + (nHexLines // 16). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2922 |
lines |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2923 |
generator:[:lineNr | |
17744 | 2924 |
|blockNr lineNrInBlock startOffset lineStream asciiLineStream byte line |
2925 |
decodedChar charPrinted| |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2926 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2927 |
blockNr := (lineNr - 1) // 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2928 |
lineNrInBlock := (lineNr - 1) \\ 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2929 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2930 |
lineNrInBlock == 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2931 |
line := '' |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2932 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2933 |
startOffset := ((blockNr * 16) + lineNrInBlock) * 16. |
17744 | 2934 |
|
2935 |
"/ two streams; one for the hex bytes, one for the ascii-interpretation |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2936 |
lineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2937 |
asciiLineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2938 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2939 |
lineStream nextPutAll:((startOffset+virtualStart) hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2940 |
lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2941 |
1 to:16 do:[:i | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2942 |
i ~~ 1 ifTrue:[ lineStream space ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2943 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2944 |
(startOffset + i) > data size ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2945 |
asciiLineStream nextPut:(Character space). |
17744 | 2946 |
lineStream spaces:colsPerByte. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2947 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2948 |
byte := data at:startOffset + i. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2949 |
|
17746 | 2950 |
lineStream nextPutAll:(byte printStringRadix:numberBase size:colsPerByte fill:$0). |
17744 | 2951 |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2952 |
|
17744 | 2953 |
decodedChar := byte. |
2954 |
characterDecoder notNil ifTrue:[ |
|
2955 |
decodedChar := characterDecoder encode:byte. |
|
2956 |
]. |
|
2957 |
||
2958 |
charPrinted := replacementForUnprintable. |
|
2959 |
decodedChar notNil ifTrue:[ |
|
2960 |
((decodedChar between:32 and:127) or:[(decodedChar between:(128+32) and:(128+127))]) ifTrue:[ |
|
2961 |
charPrinted := Character value:decodedChar. |
|
16188 | 2962 |
] ifFalse:[ |
17744 | 2963 |
(decodedChar between:0 and:31) ifTrue:[ |
2964 |
"/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400 |
|
2965 |
"/ are perfect here, but usually not available in the font |
|
2966 |
"/ and we have currently no way of knowing if they are... |
|
2967 |
"/ (could let the font draw into a bitmap and check if there is something...) |
|
2968 |
"/ For now, write a dot.· |
|
2969 |
"/ charPrinted := (Character value:(byte + 16r2400)) |
|
2970 |
]. |
|
16188 | 2971 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2972 |
]. |
17744 | 2973 |
asciiLineStream nextPut:charPrinted. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2974 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2975 |
]. |
17744 | 2976 |
line := (lineStream contents paddedTo:(addrDigits + 1 + ((colsPerByte+1)*16) + 6)) |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2977 |
, asciiLineStream contents. |
11262 | 2978 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2979 |
line |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2980 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2981 |
^ lines. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2982 |
|
17744 | 2983 |
"Created: / 12-11-2017 / 11:24:29 / cg" |
17750 | 2984 |
"Modified: / 12-11-2017 / 14:17:59 / cg" |
17744 | 2985 |
! |
2986 |
||
17753 | 2987 |
contentsOfBytesAsHexDump:data numberOfAddressDigits:addrDigits addressStart:virtualStart |
17744 | 2988 |
"utility helper: generate a hexDump with addresses; the character columns at the right show |
2989 |
the iso8859-1 characters" |
|
17753 | 2990 |
|
2991 |
^ self |
|
17744 | 2992 |
contentsOfBytesAsDump:data base:16 |
2993 |
numberOfAddressDigits:addrDigits |
|
2994 |
addressStart:virtualStart |
|
17753 | 2995 |
characterEncoding:#'iso8859-1' |
11262 | 2996 |
|
2997 |
"Created: / 13-02-2012 / 15:01:46 / cg" |
|
17744 | 2998 |
"Modified: / 12-11-2017 / 12:07:12 / cg" |
17753 | 2999 |
"Modified: / 14-11-2017 / 17:48:19 / mawalch" |
17744 | 3000 |
! |
3001 |
||
3002 |
contentsOfBytesAsHexDump:data numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
|
3003 |
"utility helper: generate a hexDump with addresses; |
|
3004 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
3005 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
3006 |
to support display of alien encoded binary data." |
|
3007 |
||
3008 |
^ self |
|
3009 |
contentsOfBytesAsDump:data base:16 |
|
3010 |
numberOfAddressDigits:addrDigits |
|
3011 |
addressStart:virtualStart |
|
3012 |
characterEncoding:characterEncodingSymbol |
|
3013 |
||
3014 |
"Created: / 12-11-2017 / 11:21:44 / cg" |
|
3015 |
! |
|
3016 |
||
3017 |
contentsOfFileAsDump:f base:numberBase withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3018 |
"opens the file, get its contents and generates a dump for it" |
|
3019 |
||
4610 | 3020 |
|resources fileName stream data offs |
17768 | 3021 |
addrDigits lines answer sizeLimit showLastPart setNewLimit thisFileSizeString| |
4610 | 3022 |
|
3023 |
resources := self classResources. |
|
3024 |
||
3025 |
fileName := f baseName. |
|
3026 |
f isDirectory ifTrue:[ |
|
3027 |
Dialog warn:(resources string:'%1 is a directory.' with:fileName). |
|
3028 |
^ nil |
|
3029 |
]. |
|
3030 |
f exists ifFalse:[ |
|
3031 |
Dialog warn:(resources string:'oops, ''%1'' is gone or unreadable.' with:fileName). |
|
3032 |
^ nil |
|
3033 |
]. |
|
3034 |
f isReadable ifFalse:[ |
|
3035 |
Dialog warn:(resources string:'''%1'' is unreadable.' with:fileName). |
|
3036 |
^ nil |
|
3037 |
]. |
|
17768 | 3038 |
f fileSize > (self maxFileSizeShownWithoutAsking) ifTrue:[ |
8472 | 3039 |
limitOrNil notNil ifTrue:[ |
3040 |
sizeLimit := limitOrNil. |
|
3041 |
showLastPart := showLastPartOrNil |
|
3042 |
] ifFalse:[ |
|
17768 | 3043 |
setNewLimit := false. |
3044 |
thisFileSizeString := (UnitConverter fileSizeStringFor:f fileSize). |
|
3045 |
||
3046 |
Dialog |
|
3047 |
withOptoutOption:[ setNewLimit := true ] |
|
3048 |
labelled:(resources string:'No longer ask for files smaller than %1' with:thisFileSizeString) |
|
3049 |
do:[ |
|
3050 |
answer := Dialog |
|
3051 |
confirmWithCancel:(resources |
|
3052 |
stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' |
|
3053 |
with:(fileName contractTo:40) allBold |
|
3054 |
with:thisFileSizeString) |
|
3055 |
labels:#('Cancel' 'Show All' 'Show First Part' ). |
|
3056 |
]. |
|
8472 | 3057 |
answer isNil ifTrue:[^ nil]. |
3058 |
answer ifTrue:[ |
|
17769 | 3059 |
sizeLimit := (4 * 1024 * 1024) "max:self maxFileSizeShownWithoutAsking". |
17768 | 3060 |
] ifFalse:[ |
3061 |
setNewLimit ifTrue:[ |
|
3062 |
self maxFileSizeShownWithoutAsking:(self maxFileSizeShownWithoutAsking max:f fileSize). |
|
3063 |
]. |
|
3064 |
]. |
|
8436 | 3065 |
]. |
4610 | 3066 |
]. |
3067 |
||
3068 |
stream := f readStream binary. |
|
8436 | 3069 |
sizeLimit notNil ifTrue:[ |
8472 | 3070 |
showLastPart == true ifTrue:[ |
3071 |
stream position:(f fileSize - sizeLimit). |
|
3072 |
]. |
|
8436 | 3073 |
data := stream nextBytes:sizeLimit. |
3074 |
] ifFalse:[ |
|
3075 |
data := stream contents. |
|
3076 |
]. |
|
4610 | 3077 |
stream close. |
3078 |
||
3079 |
offs := 0. |
|
3080 |
lines := StringCollection new. |
|
3081 |
||
3082 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
3083 |
||
11262 | 3084 |
^ self |
17744 | 3085 |
contentsOfBytesAsDump:data base:numberBase |
11262 | 3086 |
numberOfAddressDigits:addrDigits |
3087 |
addressStart:0 |
|
17744 | 3088 |
characterEncoding:characterEncoding |
3089 |
||
3090 |
"Created: / 12-11-2017 / 12:08:10 / cg" |
|
17769 | 3091 |
"Modified: / 19-11-2017 / 15:01:34 / cg" |
17744 | 3092 |
! |
3093 |
||
3094 |
contentsOfFileAsHexDump:f |
|
3095 |
"opens the file, get its contents and generates a dump for it" |
|
3096 |
||
3097 |
^ self |
|
3098 |
contentsOfFileAsHexDump:f |
|
3099 |
withLimit:nil |
|
3100 |
lastPart:nil |
|
3101 |
characterEncoding:#'iso8859-1' |
|
3102 |
||
3103 |
"Modified (comment): / 12-11-2017 / 12:09:30 / cg" |
|
3104 |
! |
|
3105 |
||
3106 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil |
|
3107 |
"opens the file, get its contents and generates a dump for it" |
|
3108 |
||
3109 |
^ self |
|
3110 |
contentsOfFileAsHexDump:f |
|
3111 |
withLimit:limitOrNil |
|
3112 |
lastPart:showLastPartOrNil |
|
3113 |
characterEncoding:#'iso-8859-1' |
|
3114 |
||
3115 |
"Modified (comment): / 12-11-2017 / 12:09:34 / cg" |
|
3116 |
! |
|
3117 |
||
3118 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3119 |
"opens the file, get its contents and generates a dump for it" |
|
3120 |
||
3121 |
^ self |
|
3122 |
contentsOfFileAsDump:f base:16 |
|
3123 |
withLimit:limitOrNil |
|
3124 |
lastPart:showLastPartOrNil |
|
3125 |
characterEncoding:characterEncoding |
|
3126 |
||
3127 |
"Created: / 12-11-2017 / 12:02:05 / cg" |
|
4610 | 3128 |
! ! |
3129 |
||
3892 | 3130 |
!AbstractFileBrowser methodsFor:'actions'! |
3131 |
||
3132 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 3133 |
"setup and launch a querybox to ask for a unix command. |
3892 | 3134 |
Then evaluate aBlock passing the command-string as argument." |
3135 |
||
16160 | 3136 |
|box osName commandString alwaysOpenLikeThisHolder openCmd suffix| |
3892 | 3137 |
|
3138 |
osName := OperatingSystem platformName. |
|
3139 |
||
3140 |
box := FilenameEnterBox |
|
4414 | 3141 |
title:(resources string:'Execute %1 command:' with:osName) |
3142 |
okText:(resources string:'Execute') |
|
4523 | 3143 |
action:[:cmd | commandString := cmd]. |
3892 | 3144 |
|
3145 |
fileName notNil ifTrue:[ |
|
4414 | 3146 |
self initialCommandFor:fileName into:box. |
3892 | 3147 |
]. |
16160 | 3148 |
alwaysOpenLikeThisHolder := false asValue. |
3149 |
box verticalPanel add:((CheckBox label:'Always use this command for this file type') model:alwaysOpenLikeThisHolder). |
|
3892 | 3150 |
box directory:(self getDirWithoutFileName:fileName). |
16160 | 3151 |
box open. |
3152 |
||
3153 |
"/ box destroy. |
|
3154 |
alwaysOpenLikeThisHolder value ifTrue:[ |
|
3155 |
openCmd := commandString upTo:$". |
|
3156 |
suffix := fileName suffix. |
|
16306 | 3157 |
UserPreferences current |
3158 |
defaultFileOpenCommandFor:suffix put:(openCmd,' "%1"'); |
|
3159 |
beModified. |
|
3160 |
self breakPoint:#cg. |
|
16160 | 3161 |
]. |
3162 |
||
4523 | 3163 |
commandString notNil ifTrue:[ |
3164 |
aBlock value:commandString |
|
3165 |
]. |
|
3166 |
||
3892 | 3167 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
3168 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
3169 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
3170 |
! |
|
3171 |
||
3172 |
changeFileBrowserTitleTo:aString |
|
4774 | 3173 |
self |
3174 |
applicationNamed:#FileBrowserV2 |
|
5009 | 3175 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 3176 |
! |
3177 |
||
3178 |
copyFileList |
|
4774 | 3179 |
"copy the fileList to the clipBoard" |
3180 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3181 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3182 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3183 |
fileList := self |
4774 | 3184 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3185 |
ifPresentDo:[:app | app browserFileList]. |
3186 |
||
3187 |
fileList notNil ifTrue:[ |
|
3188 |
self copyFileListToClipBoard:fileList. |
|
3189 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3190 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3191 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3192 |
copyFileListToClipBoard:fileList |
4774 | 3193 |
"copy the itemList to the clipBoard" |
3194 |
||
3195 |
|stream| |
|
3196 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3197 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 3198 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3199 |
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
|
3200 |
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
|
3201 |
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
|
3202 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3203 |
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
|
3204 |
(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
|
3205 |
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
|
3206 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3207 |
]. |
3892 | 3208 |
]. |
6034 | 3209 |
self window setClipboardText:stream contents. |
3892 | 3210 |
! |
3211 |
||
3212 |
copySelectedFilenames |
|
4774 | 3213 |
"copy the selected fileNames to the clipBoard" |
3214 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3215 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3216 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3217 |
fileList := self |
4774 | 3218 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3219 |
ifPresentDo:[:appl | appl selectedFileNames]. |
3220 |
fileList notNil ifTrue:[ |
|
3221 |
self copyFileListToClipBoard:fileList. |
|
3222 |
]. |
|
3892 | 3223 |
! |
3224 |
||
10923 | 3225 |
doAddArchiver |
3226 |
|files| |
|
3227 |
||
3228 |
files := self currentSelectedFiles. |
|
3229 |
files size == 1 ifFalse:[ |
|
3230 |
Dialog information:'Select exactly one archive.'. |
|
3231 |
^ self |
|
3232 |
]. |
|
3233 |
||
3234 |
self |
|
3235 |
applicationNamed:#FileApplicationNoteBook |
|
3236 |
ifPresentDo:[:appl | appl doAddArchiverOn:files first]. |
|
3237 |
||
3238 |
"Created: / 29-11-2011 / 19:01:31 / cg" |
|
3239 |
! |
|
3240 |
||
3892 | 3241 |
doAddTerminal |
5960 | 3242 |
|dir| |
3243 |
||
3244 |
dir := self currentDirectory. |
|
3892 | 3245 |
|
5960 | 3246 |
dir isNil ifTrue:[ |
4414 | 3247 |
dir := Filename homeDirectory |
3892 | 3248 |
]. |
4774 | 3249 |
|
5009 | 3250 |
self |
3251 |
applicationNamed:#FileApplicationNoteBook |
|
3252 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
3892 | 3253 |
! |
3254 |
||
3255 |
doOpenSearchFile |
|
5961 | 3256 |
|item file| |
3257 |
||
3258 |
file := self firstSelectedFileName. |
|
3259 |
file isNil ifTrue:[ |
|
3260 |
file := Filename homeDirectory asAbsoluteFilename. |
|
3261 |
]. |
|
3262 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 3263 |
self openSearchFileOn:item. |
3264 |
! |
|
3265 |
||
3266 |
doShowFileContents |
|
5009 | 3267 |
self |
3268 |
applicationNamed:#DirectoryContentsBrowser |
|
3269 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
3270 |
||
3271 |
^ nil |
|
3892 | 3272 |
! |
3273 |
||
3274 |
doShowProperties |
|
3275 |
"show long stat (file)-info" |
|
3276 |
||
3277 |
self fileGetInfo:true |
|
3278 |
! |
|
3279 |
||
14577 | 3280 |
enterAction |
3281 |
self |
|
3282 |
applicationNamed:#DirectoryContentsBrowser |
|
3283 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl enterAction ]]. |
|
3284 |
! |
|
3285 |
||
5528 | 3286 |
fileEncodingDialog |
14497 | 3287 |
"open a dialog to allow change of the file's character encoding. |
5528 | 3288 |
Files are converted to internal encoding when read, and converted back |
3289 |
to this encoding when saved. |
|
3290 |
Notice: currently, not too many encodings are supported by the system." |
|
3291 |
||
3292 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
3293 |
||
3294 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
3295 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
3296 |
||
3297 |
bindings := IdentityDictionary new. |
|
3298 |
bindings at:#encodingList put:encodingDescr. |
|
3299 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 3300 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
3301 |
||
5528 | 3302 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
3303 |
ifTrue:[ |
|
3304 |
idx := (bindings at:#selectedEncoding) value. |
|
3305 |
selectedEncoding := encodings at:idx. |
|
3306 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 3307 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 3308 |
]. |
5737 | 3309 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 3310 |
]. |
3311 |
||
3312 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
3313 |
! |
|
3314 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3315 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3316 |
"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
|
3317 |
|
5959 | 3318 |
|currentFileNameHolder currentSel| |
3319 |
||
3320 |
currentFileNameHolder := self currentFileNameHolder. |
|
3321 |
||
3322 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3323 |
(currentSel includes:aFilename) ifFalse:[ |
9677 | 3324 |
self withWaitCursorDo:[ |
3325 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
|
3326 |
] |
|
3327 |
]. |
|
3328 |
||
3329 |
"Modified: / 29-12-2010 / 11:04:29 / cg" |
|
3892 | 3330 |
! |
3331 |
||
11053 | 3332 |
lineEndConventionDialog |
3333 |
"open a dialog to allow change of the line end conventions |
|
3334 |
(when writing files)" |
|
3335 |
||
3336 |
|bindings| |
|
3337 |
||
3338 |
bindings := IdentityDictionary new. |
|
3339 |
bindings at:#lineEndConvention put:(self lineEndConvention asValue). |
|
3340 |
||
3341 |
(self openDialogInterface:#lineEndConventionDialogSpec withBindings:bindings) |
|
3342 |
ifTrue:[ |
|
15208 | 3343 |
self lineEndConventionHolder value:(bindings at:#lineEndConvention) value asSymbol |
11053 | 3344 |
]. |
3345 |
||
3346 |
"Created: / 06-01-2012 / 15:34:51 / cg" |
|
3347 |
! |
|
3348 |
||
4392 | 3349 |
newTextEditor |
5009 | 3350 |
self |
3351 |
applicationNamed:#FileApplicationNoteBook |
|
15936 | 3352 |
ifPresentDo:[:appl | |
3353 |
|editor files item| |
|
3354 |
||
3355 |
editor := appl newTextEditor. |
|
3356 |
(files := self currentSelectedFiles) size == 1 ifTrue:[ |
|
3357 |
item := DirectoryContentsBrowser itemClass fileName:files first. |
|
3358 |
editor item:item. |
|
3359 |
]. |
|
3360 |
^ editor |
|
3361 |
]. |
|
5009 | 3362 |
|
3363 |
^ nil. |
|
3364 |
! |
|
3365 |
||
3366 |
openApplByFileItem:anItem |
|
8490 | 3367 |
"/ q: is the following always wanted ? |
9267 | 3368 |
self window sensor shiftDown ifFalse:[ |
17715 | 3369 |
((anItem mimeType startsWith:'application/x-expecco-') |
3370 |
and:[(Smalltalk at:#ExpeccoStartup) notNil]) ifTrue:[ |
|
3371 |
(Smalltalk at:#ExpeccoStartup) main:{anItem fileName asString}. |
|
3372 |
^ self. |
|
3373 |
]. |
|
3374 |
||
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3375 |
"/ cg: no - batch and shell scripts are to be |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3376 |
"/ anItem fileName isExecutableProgram ifTrue:[ |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3377 |
"/ self executeCommand:anItem fileName pathName. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3378 |
"/ ^ self. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3379 |
"/ ]. |
9267 | 3380 |
|
8490 | 3381 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
3382 |
"/ Error handle:[:ex | |
|
3383 |
"/ ] do:[ |
|
3384 |
"/ OperatingSystem |
|
3385 |
"/ shellExecute:nil |
|
3386 |
"/ lpOperation:'open' |
|
3387 |
"/ lpFile:(anItem fileName pathName) |
|
3388 |
"/ lpParameters:nil |
|
3389 |
"/ lpDirectory:(self directory pathName) |
|
3390 |
"/ nShowCmd:#SW_SHOWNORMAL. |
|
3391 |
"/ ^ self. |
|
3392 |
"/ ] |
|
3393 |
"/ ] |
|
9267 | 3394 |
]. |
5306 | 3395 |
^ self |
5009 | 3396 |
applicationNamed:#FileApplicationNoteBook |
5306 | 3397 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3398 |
|
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3399 |
"Modified: / 06-09-2011 / 11:11:15 / cg" |
17715 | 3400 |
"Modified: / 18-10-2017 / 10:15:15 / stefan" |
3892 | 3401 |
! |
3402 |
||
4392 | 3403 |
openApplForFile:aFilename |
5306 | 3404 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 3405 |
! |
3406 |
||
3892 | 3407 |
openCommandResultApplication |
3408 |
||
5009 | 3409 |
self |
3410 |
applicationNamed:#FileApplicationNoteBook |
|
3411 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
3412 |
||
3413 |
^ nil |
|
3892 | 3414 |
! |
3415 |
||
5010 | 3416 |
openNewTextEditorOn:anItem |
5009 | 3417 |
self |
3418 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3419 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 3420 |
|
3421 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3422 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3423 |
|
5010 | 3424 |
openSearchFileOn:anItem |
5009 | 3425 |
self |
3426 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3427 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 3428 |
|
3429 |
^ nil. |
|
3892 | 3430 |
! |
3431 |
||
5162 | 3432 |
openTextEditorForFile:aFilename |
3433 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
3434 |
! |
|
3435 |
||
5010 | 3436 |
openTextEditorOn:anItem |
5009 | 3437 |
self |
3438 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3439 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 3440 |
|
3441 |
^ nil. |
|
3892 | 3442 |
! |
3443 |
||
5010 | 3444 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 3445 |
self |
3446 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3447 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 3448 |
|
3449 |
^ nil. |
|
4618 | 3450 |
! |
3451 |
||
5959 | 3452 |
setCurrentFileName:aFilename |
3453 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
3454 |
! |
|
3455 |
||
3456 |
setCurrentFileNames:aCollectionOfFilenames |
|
3457 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
3458 |
! |
|
3459 |
||
11053 | 3460 |
tabStopConversionDialog |
3461 |
"open a dialog to allow change of the tab stop conversion (when reading/writing files)" |
|
3462 |
||
3463 |
|bindings| |
|
3464 |
||
3465 |
bindings := IdentityDictionary new. |
|
3466 |
bindings at:#tabStops put:(self inputTabColumnConversion asValue). |
|
3467 |
||
3468 |
(self openDialogInterface:#tabStopConversionDialogSpec withBindings:bindings) |
|
3469 |
ifTrue:[ |
|
3470 |
self inputTabColumnConversionHolder value:(bindings at:#tabStops) value |
|
3471 |
]. |
|
3472 |
||
3473 |
"Created: / 06-01-2012 / 15:36:06 / cg" |
|
3474 |
! |
|
3475 |
||
3892 | 3476 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3477 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3478 |
aColOfFiles notNil ifTrue:[ |
5959 | 3479 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3480 |
]. |
3892 | 3481 |
! |
3482 |
||
3483 |
updateCurrentDirectory |
|
5739 | 3484 |
self updateCurrentDirectory:false |
3485 |
! |
|
3486 |
||
3487 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3488 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3489 |
|
5009 | 3490 |
self |
3491 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 3492 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 3493 |
self |
3494 |
applicationNamed:#DirectoryTreeBrowser |
|
3495 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 3496 |
! |
3497 |
||
5739 | 3498 |
updateCurrentDirectoryWithReread |
3499 |
self updateCurrentDirectory:true |
|
3500 |
! |
|
3501 |
||
4345 | 3502 |
withActivityIndicationDo:aBlock |
3503 |
||
3504 |
self activityVisibilityChannel value:true. |
|
3505 |
[ |
|
9361 | 3506 |
self withWaitCursorDo:[ |
3507 |
aBlock value. |
|
3508 |
] |
|
4345 | 3509 |
] ensure:[ |
3510 |
self activityVisibilityChannel value:false. |
|
3511 |
] |
|
3892 | 3512 |
! ! |
3513 |
||
3514 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
3515 |
||
3516 |
addBookmark |
|
3517 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
6725 | 3518 |
self addBookmarks:(self currentSelectedDirectories). |
5960 | 3519 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 3520 |
! |
3521 |
||
3522 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3523 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3524 |
self class addBookmark:path |
3892 | 3525 |
]. |
3526 |
! |
|
3527 |
||
8013 | 3528 |
editBookmarks |
3529 |
||
3530 |
| default selectedDirectories | |
|
3531 |
||
3532 |
selectedDirectories := self currentSelectedDirectories. |
|
3533 |
selectedDirectories notEmpty ifTrue:[default := selectedDirectories first]. |
|
3534 |
self class editBookmarksWithDefault: default. |
|
3535 |
! |
|
3536 |
||
3892 | 3537 |
hasBookmarks |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3538 |
^ self class hasBookmarks |
3892 | 3539 |
! |
3540 |
||
3541 |
hasBookmarksToRemove |
|
3542 |
|bookmarks directories| |
|
3543 |
||
3982 | 3544 |
directories := self currentSelectedDirectories. |
3892 | 3545 |
bookmarks := self class directoryBookmarks. |
17416 | 3546 |
^ (bookmarks notEmptyOrNil and:[directories notEmpty]) |
3547 |
||
3548 |
"Modified: / 17-02-2017 / 08:25:22 / cg" |
|
3892 | 3549 |
! |
3550 |
||
3551 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3552 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3553 |
self class removeBookmark:dir |
3892 | 3554 |
]. |
4679 | 3555 |
! |
3556 |
||
3557 |
saveBookmarks |
|
3558 |
self class saveBookmarks |
|
3892 | 3559 |
! ! |
3560 |
||
3561 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
3562 |
||
3563 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 3564 |
|cmd suffix cmdHist historySize| |
3892 | 3565 |
|
3566 |
cmdHist := self class commandHistory. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
3567 |
(aCommandString notEmptyOrNil) ifTrue:[ |
4414 | 3568 |
cmdHist notNil ifTrue:[ |
3569 |
cmdHist addFirst:aCommandString. |
|
6369 | 3570 |
historySize := self class commandHistorySize. |
3571 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 3572 |
cmdHist removeLast |
3573 |
] |
|
3574 |
]. |
|
3575 |
aFilename notNil ifTrue:[ |
|
3576 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
3577 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
3578 |
DefaultCommandPerSuffix := Dictionary new. |
|
3579 |
]. |
|
3580 |
suffix := aFilename asFilename suffix. |
|
3581 |
suffix notNil ifTrue:[ |
|
3582 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
3583 |
] |
|
3584 |
] |
|
3892 | 3585 |
] |
3586 |
! |
|
3587 |
||
3588 |
doBack |
|
6286 | 3589 |
"go backward in the history" |
3892 | 3590 |
|
4022 | 3591 |
| fileName| |
3592 |
||
6369 | 3593 |
fileName := self directoryHistory goBackward. |
3892 | 3594 |
fileName notNil ifTrue:[ |
4347 | 3595 |
self gotoFile:(fileName asFilename). |
3892 | 3596 |
] |
3597 |
! |
|
3598 |
||
3599 |
doForward |
|
6286 | 3600 |
"go forward in the history" |
3892 | 3601 |
|
3964 | 3602 |
| fileName| |
3603 |
||
6369 | 3604 |
fileName := self directoryHistory goForward. |
3892 | 3605 |
fileName notNil ifTrue:[ |
4414 | 3606 |
self gotoFile:(fileName asFilename). |
4022 | 3607 |
] ifFalse:[ |
4414 | 3608 |
self enableForward value:false. |
4022 | 3609 |
|
3610 |
]. |
|
3892 | 3611 |
! ! |
3612 |
||
3613 |
!AbstractFileBrowser methodsFor:'applications'! |
|
3614 |
||
5009 | 3615 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
3616 |
|appl| |
|
3617 |
||
3618 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
3619 |
appl notNil ifTrue:[ |
|
3620 |
^ aBlock value:appl |
|
3621 |
]. |
|
3622 |
^ nil. |
|
3623 |
! |
|
3624 |
||
4004 | 3625 |
directoryContentsBrowser |
3626 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 3627 |
! ! |
3628 |
||
3629 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
3630 |
||
3631 |
applications |
|
3632 |
^ aspects at:#applications |
|
3633 |
! |
|
3634 |
||
3635 |
backgroundProcesses |
|
3636 |
||
3637 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
3638 |
! |
|
3639 |
||
4230 | 3640 |
canMake |
15259 | 3641 |
^ self aspectFor:#canMake ifAbsent:[ ValueHolder with:false ]. |
4230 | 3642 |
! |
3643 |
||
3892 | 3644 |
currentDirectories |
6725 | 3645 |
" returns a holder on a Collection of all currently selected directories |
3646 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3892 | 3647 |
" |
3648 |
||
3649 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
3650 |
! |
|
3651 |
||
6725 | 3652 |
currentDirectoriesValue |
3653 |
" returns a Collection of all currently selected directories |
|
3654 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3655 |
" |
|
3656 |
||
3657 |
^ self currentDirectories value |
|
3658 |
! |
|
3659 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3660 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3661 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3662 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3663 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3664 |
|
6725 | 3665 |
directories := self currentSelectedDirectories. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3666 |
(directories size ~= 1) ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3667 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3668 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3669 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3670 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3671 |
|
13856 | 3672 |
currentDirectoryDisplayed |
3673 |
"Return a directory as Filename that is currently displayed in the browser" |
|
3674 |
||
3675 |
^self subclassResponsibility |
|
3676 |
||
3677 |
"Created: / 14-01-2013 / 11:57:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3678 |
! |
|
3679 |
||
3892 | 3680 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3681 |
"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
|
3682 |
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
|
3683 |
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
|
3684 |
|
6589 | 3685 |
^ self aspectFor:#currentFileNameHolder |
3686 |
ifAbsent:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3687 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3688 |
|
4692 | 3689 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3690 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3691 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3692 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3693 |
currentSel asValue |
6589 | 3694 |
] |
3695 |
notPresentDo:[:holder| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3696 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3697 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3698 |
newFilenames := Set new. |
6589 | 3699 |
filenames do:[:eachFilename| |
3700 |
|existingFilename| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3701 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3702 |
existingFilename notNil ifTrue:[ |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3703 |
[existingFilename isRootDirectory or:[existingFilename exists]] whileFalse:[ |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3704 |
existingFilename := existingFilename directory. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3705 |
]. |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3706 |
existingFilename exists ifTrue:[ |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3707 |
newFilenames add:existingFilename. |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3708 |
]. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3709 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3710 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3711 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3712 |
] |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3713 |
|
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3714 |
"Modified: / 27-11-2010 / 15:42:45 / cg" |
3892 | 3715 |
! |
3716 |
||
5528 | 3717 |
defaultFileEncoding |
3718 |
^ #'iso8859-1' "/ #'utf-8' |
|
3719 |
! |
|
3720 |
||
3892 | 3721 |
enableDirectoryUp |
3722 |
||
15259 | 3723 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[ValueHolder with:false] |
3892 | 3724 |
! |
3725 |
||
6456 | 3726 |
enableGotoDefaultDirectory |
15259 | 3727 |
^ self aspectFor:#enableGotoDefaultDirectory ifAbsent:[ ValueHolder with:true ]. |
4593 | 3728 |
! |
3729 |
||
8168 | 3730 |
enableGotoDesktop |
14308 | 3731 |
"/ backward compatibility |
3732 |
^ self enableGotoDesktopDirectory. |
|
8168 | 3733 |
! |
3734 |
||
9572 | 3735 |
enableGotoDesktopDirectory |
15259 | 3736 |
^ self aspectFor:#enableGotoDesktopDirectory ifAbsent:[ ValueHolder with:true ]. |
9572 | 3737 |
|
3738 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3739 |
! |
|
3740 |
||
6434 | 3741 |
enableGotoSmalltalkDirectory |
6456 | 3742 |
^ self aspectFor:#enableGotoSmalltalkDirectory ifAbsent:[ true asValue ]. |
6434 | 3743 |
! |
3744 |
||
17187 | 3745 |
enableGotoSmalltalkWorkspaceDirectory |
3746 |
^ self aspectFor:#enableGotoSmalltalkWorkspaceDirectory ifAbsent:[ true asValue ]. |
|
3747 |
! |
|
3748 |
||
9677 | 3749 |
enableGotoTempDirectory |
3750 |
^ self aspectFor:#enableGotoTempDirectory ifAbsent:[ true asValue ]. |
|
3751 |
||
3752 |
"Created: / 29-12-2010 / 11:01:17 / cg" |
|
3753 |
! |
|
3754 |
||
3892 | 3755 |
enableHome |
3756 |
||
3757 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
3758 |
! |
|
3759 |
||
9596 | 3760 |
enableMakeCurrentDirectory |
3761 |
^ self aspectFor:#enableMakeCurrentDirectory ifAbsent:[ true asValue ]. |
|
3762 |
||
3763 |
"Created: / 26-10-2010 / 17:17:58 / cg" |
|
3764 |
! |
|
3765 |
||
3892 | 3766 |
enableViewNoteBookApplication |
3767 |
||
3768 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
3769 |
! |
|
3770 |
||
5528 | 3771 |
fileEncoding |
3772 |
^ self fileEncodingHolder value |
|
3773 |
! |
|
3774 |
||
3775 |
fileEncoding:newEncoding |
|
5533 | 3776 |
self fileEncodingHolder value:newEncoding. |
3777 |
||
3778 |
self |
|
3779 |
applicationNamed:#FileApplicationNoteBook |
|
3780 |
ifPresentDo:[:nb | |
|
3781 |
|appl| |
|
3782 |
||
3783 |
appl := nb selectedApplication. |
|
5535 | 3784 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 3785 |
appl fileEncoding:newEncoding |
3786 |
] |
|
3787 |
]. |
|
5528 | 3788 |
! |
3789 |
||
5737 | 3790 |
fileEncodingHolder |
3791 |
^ self |
|
3792 |
aspectFor:#fileEncodingHolder |
|
3793 |
ifAbsent:[ |
|
3794 |
self |
|
3795 |
applicationNamed:#FileApplicationNoteBook |
|
3796 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
3797 |
] |
|
3798 |
! |
|
3799 |
||
17485 | 3800 |
fileEntryFieldHolder |
3801 |
^ self subclassResponsibility. |
|
3802 |
||
3803 |
"Created: / 31-03-2017 / 11:36:49 / stefan" |
|
3804 |
! |
|
3805 |
||
5961 | 3806 |
firstSelectedFileName |
3807 |
|files| |
|
3808 |
||
7560 | 3809 |
files := self currentSelectedObjects. |
5961 | 3810 |
files notEmpty ifTrue:[ |
3811 |
^ files first |
|
3812 |
]. |
|
3813 |
^ nil |
|
7560 | 3814 |
|
3815 |
"Modified: / 04-12-2006 / 13:14:53 / cg" |
|
5961 | 3816 |
! |
3817 |
||
6456 | 3818 |
gotoDefaultDirectoryIsVisible |
9596 | 3819 |
^ true. |
3820 |
"/ ^ (Filename defaultDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
3821 |
||
3822 |
"Modified: / 26-10-2010 / 17:23:51 / cg" |
|
6456 | 3823 |
! |
3824 |
||
9572 | 3825 |
gotoDesktopDirectoryIsVisible |
3826 |
Filename desktopDirectory = Filename homeDirectory ifTrue:[^ false]. |
|
3827 |
||
3828 |
^ (Filename desktopDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
3829 |
||
3830 |
"Created: / 01-10-2010 / 16:26:27 / cg" |
|
3831 |
! |
|
3832 |
||
4618 | 3833 |
hasFileSelection |
3834 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
3835 |
! |
|
3836 |
||
9490 | 3837 |
hasNotTwoDirectoriesSelectedHolder |
3838 |
^ self |
|
3839 |
aspectFor:#hasNotTwoDirectoriesSelectedHolder |
|
3840 |
ifAbsent:[ |
|
3841 |
BlockValue |
|
3842 |
with:[:m | self hasTwoDirectoriesSelected not] |
|
3843 |
argument:self currentFileNameHolder |
|
3844 |
]. |
|
3845 |
||
3846 |
"Created: / 20-05-2010 / 10:45:50 / cg" |
|
3847 |
! |
|
3848 |
||
5830 | 3849 |
hasNotTwoFilesSelectedHolder |
9490 | 3850 |
^ self |
3851 |
aspectFor:#hasNotTwoFilesSelectedHolder |
|
5830 | 3852 |
ifAbsent:[ |
3853 |
BlockValue |
|
3854 |
with:[:m | self hasTwoFilesSelected not] |
|
3855 |
argument:self currentFileNameHolder |
|
3856 |
]. |
|
9490 | 3857 |
|
3858 |
"Modified: / 20-05-2010 / 10:46:01 / cg" |
|
5830 | 3859 |
! |
3860 |
||
3892 | 3861 |
hasSelection |
3862 |
||
3863 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
3864 |
! |
|
3865 |
||
9490 | 3866 |
hasTwoDirectoriesSelectedHolder |
3867 |
^ self |
|
3868 |
aspectFor:#hasTwoDirectoriesSelectedHolder |
|
3869 |
ifAbsent:[ |
|
3870 |
BlockValue |
|
3871 |
with:[:m | self hasTwoDirectoriesSelected] |
|
3872 |
argument:self currentFileNameHolder |
|
3873 |
]. |
|
3874 |
||
3875 |
"Created: / 20-05-2010 / 10:45:41 / cg" |
|
3876 |
! |
|
3877 |
||
4414 | 3878 |
hasTwoFilesSelectedHolder |
9490 | 3879 |
^ self |
3880 |
aspectFor:#hasTwoFilesSelectedHolder |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3881 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3882 |
BlockValue |
5830 | 3883 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3884 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3885 |
]. |
9490 | 3886 |
|
3887 |
"Modified: / 20-05-2010 / 10:46:08 / cg" |
|
4414 | 3888 |
! |
3889 |
||
11053 | 3890 |
inputTabColumnConversion |
3891 |
^ self inputTabColumnConversionHolder value |
|
3892 |
||
3893 |
"Created: / 06-01-2012 / 15:25:56 / cg" |
|
3894 |
! |
|
3895 |
||
3896 |
inputTabColumnConversionHolder |
|
3897 |
^ self |
|
3898 |
aspectFor:#inputTabColumnConversionHolder |
|
3899 |
ifAbsent:[ |
|
3900 |
self |
|
3901 |
applicationNamed:#FileApplicationNoteBook |
|
3902 |
ifPresentDo:[:appl | appl inputTabColumnConversionHolder]. |
|
3903 |
] |
|
3904 |
||
3905 |
"Created: / 06-01-2012 / 15:26:16 / cg" |
|
3906 |
! |
|
3907 |
||
3908 |
lineEndConvention |
|
15208 | 3909 |
^ self lineEndConventionHolder value asSymbol |
11053 | 3910 |
|
3911 |
"Created: / 06-01-2012 / 13:05:14 / cg" |
|
3912 |
! |
|
3913 |
||
11591 | 3914 |
lineEndConvention: aSymbol |
15208 | 3915 |
self lineEndConventionHolder value: aSymbol asSymbol |
11591 | 3916 |
|
3917 |
"Created: / 11-07-2012 / 19:51:58 / cg" |
|
3918 |
! |
|
3919 |
||
11053 | 3920 |
lineEndConventionHolder |
3921 |
^ self |
|
3922 |
aspectFor:#lineEndConventionHolder |
|
3923 |
ifAbsent:[ |
|
3924 |
self |
|
3925 |
applicationNamed:#FileApplicationNoteBook |
|
3926 |
ifPresentDo:[:appl | appl lineEndConventionHolder]. |
|
3927 |
] |
|
3928 |
||
3929 |
"Created: / 06-01-2012 / 13:02:51 / cg" |
|
3930 |
! |
|
3931 |
||
5737 | 3932 |
lockFileEncoding:aBoolean |
3933 |
self lockFileEncodingHolder value:aBoolean. |
|
3934 |
||
3935 |
self |
|
3936 |
applicationNamed:#FileApplicationNoteBook |
|
3937 |
ifPresentDo:[:nb | |
|
3938 |
|appl| |
|
3939 |
||
3940 |
appl := nb selectedApplication. |
|
3941 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
3942 |
appl lockFileEncoding:aBoolean |
|
3943 |
] |
|
3944 |
]. |
|
3945 |
! |
|
3946 |
||
3947 |
lockFileEncodingHolder |
|
3948 |
^ self |
|
3949 |
aspectFor:#lockFileEncodingHolder |
|
3950 |
ifAbsent:[ |
|
3951 |
self |
|
3952 |
applicationNamed:#FileApplicationNoteBook |
|
3953 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
3954 |
] |
|
3955 |
! |
|
3956 |
||
13856 | 3957 |
makeCommandHolder |
3958 |
^ self aspectFor:#makeCommandHolder ifAbsent:[ nil asValue ]. |
|
3959 |
||
3960 |
"Created: / 13-04-2012 / 17:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3961 |
! |
|
3962 |
||
4523 | 3963 |
notify:aString |
11108 | 3964 |
"aString is shown in the lower pane" |
3965 |
||
4523 | 3966 |
self notifyChannel value:aString |
11108 | 3967 |
|
3968 |
"Modified (comment): / 11-01-2012 / 21:46:55 / cg" |
|
4523 | 3969 |
! |
3970 |
||
3892 | 3971 |
notifyChannel |
3972 |
||
3973 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 3974 |
! |
3975 |
||
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3976 |
progressPercentageHolder |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3977 |
^ self aspectFor:#progressPercentageHolder ifAbsent:[ nil asValue ]. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3978 |
|
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3979 |
"Created: / 11-10-2010 / 12:54:46 / cg" |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3980 |
! |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3981 |
|
4071 | 3982 |
rootHolder |
3983 |
"holder, which keeps the rootHolder of the treeView |
|
3984 |
" |
|
3985 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3986 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3987 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3988 |
]. |
8192
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3989 |
! |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3990 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3991 |
rootHolder:aHolder |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3992 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3993 |
self aspectFor:#rootHolder put:aHolder |
3892 | 3994 |
! ! |
3995 |
||
3996 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
3997 |
||
3998 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 3999 |
"returns the model for an aspect; these are stored in a common dictionary" |
4000 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4001 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 4002 |
! |
4003 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4004 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 4005 |
"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
|
4006 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4007 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4008 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4009 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4010 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4011 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4012 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4013 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4014 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4015 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4016 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4017 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4018 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4019 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4020 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4021 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4022 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4023 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4024 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4025 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4026 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4027 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4028 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4029 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4030 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4031 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4032 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4033 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4034 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4035 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4036 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4037 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4038 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4039 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4040 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4041 |
aspectFor:something put:aValueHolder |
6284 | 4042 |
"stores the model for an aspect; these are stored in a common dictionary" |
4043 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4044 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4045 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4046 |
|
3892 | 4047 |
aspects |
6284 | 4048 |
"returns the common aspect dictionary" |
4049 |
||
3892 | 4050 |
^ aspects |
4051 |
! |
|
4052 |
||
4053 |
runtimeAspectValueFor:something |
|
4054 |
"returns the default aspect item from the class variable RuntimeAspects |
|
4055 |
" |
|
4056 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
4057 |
! |
|
4058 |
||
4201 | 4059 |
saveAspectValues |
16306 | 4060 |
|prefs saveAspects aspectValue| |
4061 |
||
4062 |
prefs := UserPreferences current. |
|
4063 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4064 |
saveAspects := self class userPreferencesAspectList keys. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4065 |
saveAspects do:[ :aspectKey | |
4201 | 4066 |
aspectValue := (self perform:aspectKey) value. |
16306 | 4067 |
prefs |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4068 |
at: ('fileBrowser_',aspectKey asString) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4069 |
put: aspectValue. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4070 |
]. |
16306 | 4071 |
prefs beModified. |
4072 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4073 |
"Modified: / 04-09-2006 / 10:02:41 / cg" |
4201 | 4074 |
! |
4075 |
||
3892 | 4076 |
saveRuntimeAspectValues |
4077 |
|savedAspects dictionary value isHolder aspect| |
|
4078 |
||
5941 | 4079 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 4080 |
dictionary := Dictionary new. |
5941 | 4081 |
savedAspects do:[:aspectKey | |
4414 | 4082 |
aspect := self perform:aspectKey. |
4083 |
isHolder := aspect isValueModel. |
|
5941 | 4084 |
isHolder ifTrue:[ |
4085 |
value := aspect value |
|
4086 |
] ifFalse:[ |
|
4087 |
value := aspect |
|
4088 |
]. |
|
4089 |
dictionary at:aspectKey |
|
4090 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
4091 |
]. |
|
4092 |
RuntimeAspects := dictionary. |
|
3892 | 4093 |
! |
4094 |
||
4201 | 4095 |
userPreferencesAspectValueFor:something |
4096 |
"returns the default aspect from the Userpreferences |
|
3892 | 4097 |
" |
4201 | 4098 |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4099 |
(self class userPreferencesAspectList includesKey:something) ifFalse:[ ^ nil]. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4100 |
^ UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4101 |
at:('fileBrowser_',something) asSymbol |
9579
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4102 |
ifAbsent:nil "(self class userPreferencesAspectList at:something)". |
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4103 |
|
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4104 |
"Modified: / 14-10-2010 / 19:16:38 / cg" |
3892 | 4105 |
! ! |
4106 |
||
4011 | 4107 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
4108 |
||
9015 | 4109 |
filter:aString |
4110 |
self filterModel value:aString |
|
4111 |
! |
|
4112 |
||
4018 | 4113 |
filterBackgroundColor |
4114 |
||
4115 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
4116 |
! |
|
4117 |
||
4011 | 4118 |
filterBlockHolder |
4119 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4120 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 4121 |
! |
4122 |
||
4123 |
filterListModel |
|
4124 |
||
4125 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
4126 |
! |
|
4127 |
||
4128 |
filterModel |
|
5941 | 4129 |
|m| |
4130 |
||
4131 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
4132 |
^ m |
|
4011 | 4133 |
! |
4134 |
||
8185
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4135 |
filterModel:aHolder |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4136 |
self aspectFor:#filterModel put:aHolder. |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4137 |
! |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4138 |
|
4018 | 4139 |
filterValueBox |
4140 |
||
4141 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
4142 |
! |
|
4143 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4144 |
makeFilterBlock |
14497 | 4145 |
"return a two-arg filterblock on the file's path- and base-name. This block should return true for files |
9102 | 4146 |
to be shown" |
4147 |
||
17481 | 4148 |
| filterString filterStrings filters notFilters showHidden filterBlock caseSensitive| |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4149 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4150 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4151 |
filterString = '' ifTrue:[filterString := '*']. |
17481 | 4152 |
caseSensitive := "ignoreCaseInPattern ?" Filename isCaseSensitive. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4153 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4154 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
12760 | 4155 |
filterStrings := filterStrings |
4156 |
select:[:eachFilter | eachFilter withoutSeparators notEmpty]. |
|
4157 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4158 |
filters := filterStrings |
12760 | 4159 |
reject:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
4160 |
thenCollect: |
|
4161 |
[:eachPattern | |
|
4162 |
|pattern| |
|
4163 |
||
4164 |
pattern := eachPattern withoutSeparators. |
|
15597 | 4165 |
pattern includesMatchCharacters ifFalse:[ |
4166 |
"JV@2012-03-05: Add implict star at the beginning and at the end of pattern, |
|
4167 |
that's how most of the other applications behave - do what most users expect" |
|
17772 | 4168 |
"/ pattern first == $* ifFalse:[pattern := '*' , pattern]. |
4169 |
"/ pattern last == $* ifFalse:[pattern := pattern , '*']. |
|
4170 |
[:name :baseName | baseName asLowercase includesString:pattern caseSensitive:caseSensitive] |
|
4171 |
] ifTrue:[ |
|
4172 |
pattern = '*' ifTrue:[ |
|
4173 |
[:name :baseName | true]. |
|
4174 |
] ifFalse:[ |
|
4175 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
|
4176 |
]. |
|
15597 | 4177 |
]. |
12760 | 4178 |
]. |
4179 |
||
4180 |
notFilters := filterStrings |
|
4181 |
select:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
|
4182 |
thenCollect: |
|
4183 |
[:eachPattern | |
|
9296 | 4184 |
|pattern| |
4185 |
||
4186 |
pattern := eachPattern withoutSeparators. |
|
12760 | 4187 |
pattern := (pattern copyFrom:2) withoutSeparators. |
17481 | 4188 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
9296 | 4189 |
]. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4190 |
|
12760 | 4191 |
|
4192 |
(filters size == 1 and:[notFilters isEmpty]) ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4193 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4194 |
] ifFalse:[ |
12760 | 4195 |
filters isEmpty ifTrue:[ |
4196 |
filterBlock := [:name :baseName | |
|
4197 |
(notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not |
|
4198 |
]. |
|
4199 |
] ifFalse:[ |
|
4200 |
notFilters isEmpty ifTrue:[ |
|
4201 |
filterBlock := [:name :baseName | |
|
4202 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4203 |
]. |
|
4204 |
] ifFalse:[ |
|
4205 |
filterBlock := [:name :baseName | |
|
4206 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4207 |
and:[ (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not ] |
|
4208 |
]. |
|
4209 |
] |
|
4210 |
] |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4211 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4212 |
|
4011 | 4213 |
showHidden := self showHiddenFiles value. |
4214 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4215 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4216 |
]. |
9296 | 4217 |
^ [:name :baseName | |
4218 |
name isHidden not and:[filterBlock value:name value:baseName]]. |
|
13856 | 4219 |
|
4220 |
"Modified: / 05-02-2012 / 01:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17481 | 4221 |
"Modified: / 27-03-2017 / 12:52:08 / stefan" |
17772 | 4222 |
"Modified: / 20-11-2017 / 22:02:04 / cg" |
4018 | 4223 |
! |
4224 |
||
4225 |
shownFiles |
|
4226 |
||
4227 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 4228 |
! ! |
4229 |
||
14126 | 4230 |
|
3892 | 4231 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
4232 |
||
4233 |
dirHistory |
|
6369 | 4234 |
"obsolete" |
4235 |
^ self directoryHistory |
|
4236 |
! |
|
4237 |
||
4238 |
directoryHistory |
|
3952 | 4239 |
^ self class directoryHistory |
3892 | 4240 |
! |
4241 |
||
4242 |
enableBack |
|
4243 |
||
15259 | 4244 |
^ self aspectFor:#enableBack ifAbsent:[ValueHolder with:false] |
3892 | 4245 |
! |
4246 |
||
4247 |
enableFileHistory |
|
4248 |
||
15259 | 4249 |
^ self aspectFor:#enableFileHistory ifAbsent:[ValueHolder with:false] |
3892 | 4250 |
! |
4251 |
||
4252 |
enableForward |
|
4253 |
||
15259 | 4254 |
^ self aspectFor:#enableForward ifAbsent:[ValueHolder with:false] |
3892 | 4255 |
! |
4256 |
||
4257 |
fileHistory |
|
9820
07b7d7929e3e
variable renamed in: #fileHistory
Stefan Vogel <sv@exept.de>
parents:
9793
diff
changeset
|
4258 |
^ self aspectFor:#fileHistory ifAbsent:[OrderedSet new] |
3892 | 4259 |
! ! |
4260 |
||
4261 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
4262 |
||
4345 | 4263 |
activityVisibilityChannel |
6284 | 4264 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 4265 |
|
15259 | 4266 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ ValueHolder with:false ]. |
4345 | 4267 |
! |
4268 |
||
15111 | 4269 |
alwaysUseSmalltalkTools |
4270 |
" aspect to prevent os tools to be opened on double click" |
|
4271 |
||
15259 | 4272 |
^ self aspectFor:#alwaysUseSmalltalkTools ifAbsent:[ ValueHolder with:true ]. |
15111 | 4273 |
! |
4274 |
||
6602 | 4275 |
changeSetBrowserItemVisible |
4276 |
^ Screen current ctrlDown. |
|
4277 |
! |
|
4278 |
||
11135 | 4279 |
cvsMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4280 |
^ ConfigurableFeatures includesFeature: #CVSSupportEnabled |
11135 | 4281 |
|
4282 |
"Created: / 15-01-2012 / 13:00:05 / cg" |
|
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4283 |
"Modified: / 19-01-2012 / 10:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4284 |
! |
4285 |
||
13856 | 4286 |
hgMenusAreShown |
4287 |
^ (ConfigurableFeatures includesFeature: #HGSupportEnabled) |
|
4288 |
||
4289 |
"Created: / 14-01-2013 / 11:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4290 |
! |
|
4291 |
||
11135 | 4292 |
mercurialMenusAreShown |
11147 | 4293 |
^ ConfigurableFeatures hasMercurialSupportEnabled |
11135 | 4294 |
|
4295 |
"Created: / 15-01-2012 / 13:00:00 / cg" |
|
4296 |
! |
|
4297 |
||
4110 | 4298 |
openAlwaysInTextEditor |
17024 | 4299 |
" aspect for open every file in TextEditor don't use e.g. HtmlEditor for *.html'" |
4110 | 4300 |
|
15111 | 4301 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
4110 | 4302 |
! |
4303 |
||
3892 | 4304 |
openMultipleApplicationsForType |
4305 |
||
4201 | 4306 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
4307 |
open TextEditor " |
|
4308 |
||
3892 | 4309 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
4310 |
! |
|
4311 |
||
11137 | 4312 |
perforceMenusAreShown |
11996
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4313 |
^ (ConfigurableFeatures includesFeature: #PerforceSupportEnabled) |
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4314 |
and:[ ConfigurableFeatures hasPerforceSupportEnabled ] |
11137 | 4315 |
|
4316 |
"Created: / 15-01-2012 / 13:12:11 / cg" |
|
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4317 |
"Modified: / 19-01-2012 / 10:43:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11996
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4318 |
"Modified: / 02-11-2012 / 11:19:59 / cg" |
11137 | 4319 |
! |
4320 |
||
14709
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
4321 |
showDirectoriesOnTop |
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
4322 |
|
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
4323 |
^ self aspectFor:#showDirectoriesOnTop ifAbsent:[ false asValue ] |
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
4324 |
|
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
4325 |
"Created: / 12-08-2014 / 13:02:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
4326 |
! |
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
4327 |
|
4201 | 4328 |
showDirectoryTree |
4329 |
||
4330 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 4331 |
! |
4332 |
||
4554 | 4333 |
showDiskUsageHolder |
4334 |
|holder| |
|
4335 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
4336 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 4337 |
holder addDependent:self. |
4554 | 4338 |
^ holder |
4339 |
! |
|
4340 |
||
3892 | 4341 |
showHiddenFiles |
4342 |
||
9582 | 4343 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
4344 |
||
4345 |
"Modified: / 15-10-2010 / 10:28:17 / cg" |
|
3892 | 4346 |
! |
4347 |
||
9108 | 4348 |
showHiddenFiles:aHolder |
4349 |
self aspectFor:#showHiddenFiles put:aHolder. |
|
4350 |
! |
|
4351 |
||
4352 |
shownFiles:aHolder |
|
4353 |
self aspectFor:#shownFiles put:aHolder. |
|
4354 |
! |
|
4355 |
||
11135 | 4356 |
svnMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4357 |
^ ConfigurableFeatures includesFeature: #SubversionSupportEnabled |
11135 | 4358 |
|
4359 |
"Created: / 15-01-2012 / 13:02:03 / cg" |
|
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4360 |
"Modified: / 19-01-2012 / 10:43:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4361 |
! |
4362 |
||
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4363 |
tagsBrowserVisibleHolder |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4364 |
masterApplication notNil ifTrue:[ |
11162
faf8af233ac0
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
11156
diff
changeset
|
4365 |
^ masterApplication perform:#tagsBrowserVisibleHolder ifNotUnderstood:false |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4366 |
]. |
10762
311190be6490
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
10757
diff
changeset
|
4367 |
^ self aspectFor:#tagsBrowserVisibleHolder ifAbsent:[ FileApplicationNoteBook::TextEditor defaultTagsBrowserVisible asValue ]. |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4368 |
|
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4369 |
"Created: / 27-06-2011 / 16:02:59 / cg" |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4370 |
! |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4371 |
|
10757
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4372 |
useCodeView2InTools |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4373 |
^ self aspectFor:#useCodeView2InTools ifAbsent:[ UserPreferences current useCodeView2InTools asValue ]. |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4374 |
|
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4375 |
"Created: / 06-10-2011 / 11:45:58 / cg" |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4376 |
! |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4377 |
|
4648 | 4378 |
userContextAvailable |
4379 |
||
4380 |
" aspect for show group and user columns in contents view |
|
4381 |
windows provides no user context" |
|
4382 |
||
4383 |
^ OperatingSystem isMSWINDOWSlike not |
|
4384 |
! |
|
4385 |
||
3892 | 4386 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4387 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4388 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4389 |
^ self directoryContentsBrowser viewDescription |
3892 | 4390 |
! |
4391 |
||
4392 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4393 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 4394 |
" |
3892 | 4395 |
|
6121 | 4396 |
|directoryContentsBrowser| |
4397 |
||
4398 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
4399 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
4400 |
^ directoryContentsBrowser viewDetails |
|
3892 | 4401 |
! |
4402 |
||
4403 |
viewDirectoryDescription |
|
4404 |
||
4201 | 4405 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
4406 |
on change directory " |
|
4407 |
||
3892 | 4408 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
4409 |
! |
|
4410 |
||
4201 | 4411 |
viewDirsInContentsBrowser |
4412 |
||
4413 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
9319
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4414 |
|
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4415 |
" |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4416 |
UserPreferences current viewDirsInContentsBrowser |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4417 |
" |
4201 | 4418 |
! |
4419 |
||
5870 | 4420 |
viewFilesInContentsBrowser |
4421 |
||
4422 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
4423 |
! |
|
4424 |
||
3892 | 4425 |
viewFilesInDirectoryTree |
4426 |
||
4201 | 4427 |
" aspect for view files in tree view (not only directories) " |
4428 |
||
3892 | 4429 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
4430 |
! |
|
4431 |
||
4432 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4433 |
" aspect for show group information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4434 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4435 |
^ self directoryContentsBrowser viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4436 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4437 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4438 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4439 |
" aspect for show file-type icon in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4440 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4441 |
^ self directoryContentsBrowser viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4442 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4443 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4444 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4445 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4446 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4447 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 4448 |
! |
4449 |
||
4450 |
viewNoteBookApplicationHolder |
|
4451 |
||
4452 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
4453 |
! |
|
4454 |
||
4455 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4456 |
" aspect for show owner information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4457 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4458 |
^ self directoryContentsBrowser viewOwner |
3892 | 4459 |
! |
4460 |
||
4461 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4462 |
" aspect for show permission information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4463 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4464 |
^ self directoryContentsBrowser viewPermissions |
3892 | 4465 |
! |
4466 |
||
4467 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4468 |
" aspect for show image previev in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4469 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4470 |
^ self directoryContentsBrowser viewPreview |
3892 | 4471 |
! |
4472 |
||
4473 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4474 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4475 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4476 |
^ self directoryContentsBrowser viewSize |
3892 | 4477 |
! |
4478 |
||
4974 | 4479 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4480 |
" aspect for show size-in-bytes information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4481 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4482 |
^ self directoryContentsBrowser viewSizeInBytes |
4974 | 4483 |
! |
4484 |
||
5312 | 4485 |
viewSizeInKiloBytes |
4486 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
4487 |
||
4488 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
4489 |
! |
|
4490 |
||
3892 | 4491 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4492 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4493 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4494 |
^ self directoryContentsBrowser viewTime |
3892 | 4495 |
! |
4496 |
||
4497 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4498 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4499 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4500 |
^ self directoryContentsBrowser viewType |
3892 | 4501 |
! ! |
4502 |
||
4503 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
4504 |
||
4505 |
executeCommand:cmd |
|
4506 |
||
4507 |
self executeCommand:cmd inDirectory:nil |
|
4508 |
! |
|
4509 |
||
5880 | 4510 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 4511 |
| nameString executionBlock| |
4512 |
||
5880 | 4513 |
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
|
4514 |
nameString := 'Execute: ', cmd. |
3892 | 4515 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4516 |
! |
|
4517 |
||
4518 |
getExecutionBlockForCommand:cmd |
|
4519 |
||
4520 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
4521 |
! |
|
4522 |
||
5880 | 4523 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
4524 |
| dir| |
|
4525 |
||
4526 |
dir := directoryOrNil. |
|
4527 |
directoryOrNil isNil ifTrue:[ |
|
4528 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6671 | 4529 |
dir isNil ifTrue:[ |
12493 | 4530 |
Dialog warn:(resources string:'Please select a single directory.'). |
16732 | 4531 |
AbortOperationRequest raise. |
6671 | 4532 |
^ nil |
4533 |
]. |
|
3892 | 4534 |
]. |
4523 | 4535 |
|
4536 |
^ [:stream| |
|
4537 |
stream notNil ifTrue:[ |
|
4414 | 4538 |
OperatingSystem |
4539 |
executeCommand:cmd |
|
4540 |
inputFrom:nil |
|
4541 |
outputTo:stream |
|
4542 |
errorTo:stream |
|
4543 |
inDirectory:dir |
|
16732 | 4544 |
lineWise:true |
16825 | 4545 |
showWindow:false |
4414 | 4546 |
onError:[:status| false]. |
4547 |
] |
|
4523 | 4548 |
]. |
3892 | 4549 |
! |
4550 |
||
4551 |
killAllRunningBackgroundProcesses |
|
4552 |
||
4553 |
self backgroundProcesses do:[ : process | |
|
4523 | 4554 |
self notify:'kill ', process name. |
4414 | 4555 |
process terminate. |
3892 | 4556 |
]. |
4557 |
! |
|
4558 |
||
4559 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
4560 |
| stream process appl nameString| |
|
4561 |
||
4562 |
appl := self openCommandResultApplication. |
|
4563 |
stream := appl resultStream. |
|
4564 |
nameString := aString ? 'Execution Result'. |
|
4565 |
appl changeTabTo:nameString. |
|
4523 | 4566 |
|
16102 | 4567 |
process := |
4568 |
[ |
|
4569 |
[aBlock value:stream] |
|
4570 |
ensure:[ |
|
4571 |
self backgroundProcesses remove:process ifAbsent:[]. |
|
4572 |
appl process value:nil. |
|
4573 |
||
4574 |
"/ close automatically, if there was no output. |
|
4571 | 4575 |
"/ appl resultStream contents isEmpty ifTrue:[ |
4576 |
"/ appl doClose. |
|
4577 |
"/ ] |
|
16102 | 4578 |
stream nextPutLine:'Done.'. |
4579 |
self enqueueMessage:#updateCurrentDirectory. |
|
4580 |
] |
|
4581 |
] newProcess. |
|
3892 | 4582 |
process priority:(Processor userBackgroundPriority). |
4583 |
process name:nameString. |
|
4584 |
self backgroundProcesses add:process. |
|
4585 |
appl process value:process. |
|
4586 |
process resume. |
|
4587 |
! ! |
|
4588 |
||
4589 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
4590 |
||
4915 | 4591 |
currentFileNameHolderChanged |
4592 |
"/ self currentFileNameHolderChangedForCommon |
|
4593 |
! |
|
4594 |
||
4577 | 4595 |
currentFileNameHolderChangedForCommon |
5476 | 4596 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4597 |
|
7560 | 4598 |
selection := self currentSelectedObjects. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4599 |
self class currentSelection:selection. |
4734 | 4600 |
|
13521 | 4601 |
selectionNotEmpty := selection notEmptyOrNil. |
5476 | 4602 |
self hasSelection value:selectionNotEmpty. |
4603 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
4734 | 4604 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4605 |
newDirectories := self directoriesForFiles:selection. |
6725 | 4606 |
oldDirectories := self currentSelectedDirectories. |
4011 | 4607 |
oldDirectories ~= newDirectories ifTrue:[ |
4347 | 4608 |
self currentDirectories value:newDirectories. |
4609 |
size := newDirectories size. |
|
4774 | 4610 |
rootInTreeView := self |
4611 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 4612 |
ifPresentDo:[:appl | appl rootHolder]. |
4613 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
4614 |
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
|
4615 |
|
4347 | 4616 |
newDirectories notEmpty ifTrue:[ |
6369 | 4617 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 4618 |
]. |
5074 | 4619 |
self enableHome value:((newDirectories includes:(Filename homeDirectory asAbsoluteFilename))not). |
14308 | 4620 |
"/ self enableGotoDesktop value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
6456 | 4621 |
self enableGotoDefaultDirectory value:((newDirectories includes:(Filename defaultDirectory asAbsoluteFilename))not). |
4622 |
self enableGotoSmalltalkDirectory value:((newDirectories includes:(self smalltalkDirectory asAbsoluteFilename))not). |
|
9572 | 4623 |
self enableGotoDesktopDirectory value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
9677 | 4624 |
self enableGotoTempDirectory value:((newDirectories includes:(self tempDirectory asAbsoluteFilename))not). |
4011 | 4625 |
]. |
9599
6ffff091db22
changed: #currentFileNameHolderChangedForCommon
Claus Gittinger <cg@exept.de>
parents:
9596
diff
changeset
|
4626 |
self enableGotoDefaultDirectory value:(self currentDirectory isNil or:[self currentDirectory pathName ~= OperatingSystem getCurrentDirectory]). |
9596 | 4627 |
self enableMakeCurrentDirectory value:(newDirectories size == 1 |
4628 |
and:[ newDirectories first asFilename pathName ~= OperatingSystem getCurrentDirectory ]). |
|
4022 | 4629 |
self enableForward value:self canForward. |
4734 | 4630 |
self enableBack value:self canBackward. |
6095 | 4631 |
|
13856 | 4632 |
self updateCanMake. |
7560 | 4633 |
|
9677 | 4634 |
"Modified: / 29-12-2010 / 11:01:52 / cg" |
13856 | 4635 |
"Modified: / 17-12-2013 / 08:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4011 | 4636 |
! |
4637 |
||
4638 |
filterModelChanged |
|
4639 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4640 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 4641 |
! |
4642 |
||
3892 | 4643 |
update:something with:aParameter from:changedObject |
4644 |
||
4645 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
4646 |
and the things that have to be done if it runs standalone " |
|
4647 |
||
4648 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 4649 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4650 |
^ self |
3892 | 4651 |
]. |
3989 | 4652 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4653 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4654 |
^ self |
3989 | 4655 |
]. |
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4656 |
changedObject == self sortBlockProperty ifTrue:[ |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4657 |
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
|
4658 |
^ self |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4659 |
]. |
4011 | 4660 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4661 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4662 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4663 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4664 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4665 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4666 |
^ self |
4004 | 4667 |
]. |
4781 | 4668 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 4669 |
self notify:nil. |
4781 | 4670 |
^ self |
4671 |
]. |
|
3989 | 4672 |
|
3892 | 4673 |
super update:something with:aParameter from:changedObject |
5543 | 4674 |
! |
4675 |
||
6095 | 4676 |
updateCanMake |
4677 |
|dir can| |
|
4678 |
||
4679 |
can := false. |
|
4680 |
dir := self currentDirectory. |
|
4681 |
dir notNil ifTrue:[ |
|
13856 | 4682 |
"/ Check for make |
6095 | 4683 |
can := (dir asFilename construct:'Makefile') exists. |
13856 | 4684 |
can ifFalse:[ |
4685 |
can := (dir asFilename construct:'makefile') exists. |
|
4686 |
]. |
|
6095 | 4687 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
4688 |
can ifFalse:[ |
|
13856 | 4689 |
can := (self currentDirectory asFilename construct:'bc.mak') exists. |
6095 | 4690 |
] |
4691 |
]. |
|
13856 | 4692 |
can ifTrue:[ |
4693 |
self makeCommandHolder value: 'make'. |
|
4694 |
self canMake value: true. |
|
4695 |
^ self |
|
4696 |
]. |
|
4697 |
||
4698 |
"/Check for Apache ant |
|
4699 |
(OperatingSystem canExecuteCommand: 'ant') ifTrue:[ |
|
4700 |
can := (dir asFilename construct:'build.xml') exists. |
|
4701 |
can ifTrue:[ |
|
4702 |
self makeCommandHolder value: 'ant'. |
|
4703 |
self canMake value: true. |
|
4704 |
^ self |
|
4705 |
]. |
|
4706 |
]. |
|
4707 |
||
4708 |
"/Add more here... |
|
4709 |
||
6095 | 4710 |
]. |
4711 |
self canMake value:can. |
|
13856 | 4712 |
|
4713 |
"Modified: / 17-12-2013 / 08:13:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6095 | 4714 |
! |
4715 |
||
5543 | 4716 |
updateListAfterDelete:colOfFiles |
4717 |
self updateCurrentDirectory |
|
3892 | 4718 |
! ! |
4719 |
||
4720 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
4721 |
||
4722 |
canPaste |
|
4723 |
||
15259 | 4724 |
^ self aspectFor:#canPaste ifAbsent:[ ValueHolder with:false ]. |
3892 | 4725 |
! |
4726 |
||
4727 |
clipboard |
|
4728 |
||
4729 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
4730 |
! |
|
4731 |
||
4732 |
copyFilesToClipBoard:colOfFiles |
|
4733 |
self putInClipBoard:colOfFiles as:#copy. |
|
4734 |
! |
|
4735 |
||
4736 |
cutFilesToClipBoard:colOfFiles |
|
4737 |
"defete current selected files/directories |
|
4738 |
" |
|
4739 |
self putInClipBoard:colOfFiles as:#cut. |
|
4740 |
! |
|
4741 |
||
4742 |
emptyClipBoard |
|
4743 |
||
4744 |
self clipboard files:nil. |
|
4745 |
self canPaste value:false. |
|
4746 |
! |
|
4747 |
||
4748 |
putInClipBoard:colOfFiles as:aSymbol |
|
4749 |
| stream clp| |
|
4750 |
||
4751 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
4752 |
clp := self clipboard. |
|
4753 |
clp files:nil. |
|
4754 |
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
|
4755 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
4756 |
stream := String writeStream. |
3892 | 4757 |
stream nextPutAll:aSymbol asString. |
4758 |
stream nextPutAll:' <'. |
|
4759 |
stream nextPutAll:colOfFiles first asString. |
|
4760 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 4761 |
stream nextPutAll:' ...'. |
3892 | 4762 |
]. |
4763 |
stream nextPutAll:'> to clipboard'. |
|
4764 |
||
4523 | 4765 |
self notify:stream contents. |
3892 | 4766 |
clp files:colOfFiles. |
4767 |
self canPaste value:true. |
|
4768 |
! ! |
|
4769 |
||
4770 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
4771 |
||
4772 |
canDropFiles:dropedObjects for:filename |
|
6284 | 4773 |
|filenameDirString filenameDir| |
3892 | 4774 |
|
4775 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 4776 |
|
3892 | 4777 |
filenameDir := self getDirWithoutFileName:filename. |
7491 | 4778 |
filenameDir isNil ifTrue:[^ false ]. |
13232 | 4779 |
filenameDir isWritableDirectory ifFalse:[^ false]. |
6284 | 4780 |
|
3892 | 4781 |
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
|
4782 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
4783 |
dropedObjects do:[:aDropObject | |
6284 | 4784 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
4785 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
4786 |
"/ |
|
4787 |
"/ dropFileName := aDropObject theObject. |
|
4788 |
"/ dropFileNameString := dropFileName asString. |
|
4789 |
"/ dropFileName isDirectory ifTrue:[ |
|
4790 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
4791 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
4792 |
"/ ^ false |
|
4793 |
"/ ] |
|
4794 |
"/ ] ifFalse:[ |
|
4795 |
"/ physicalPathName := dropFileName physicalPathName. |
|
4796 |
"/ (filenameDirString = dropFileName directory asString |
|
4797 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
4798 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
4799 |
"/ self notify:'Cannot drop a file into same directory'. |
|
4800 |
"/ ^ false |
|
4801 |
"/ ] |
|
4802 |
"/ ] |
|
4803 |
]. |
|
4804 |
self notify:nil. |
|
4805 |
^ true |
|
4806 |
! |
|
4807 |
||
4808 |
canDropObject:aDropObject into:aDirectory |
|
4809 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
4810 |
||
4811 |
dropFileName := aDropObject theObject. |
|
4812 |
dropFileNameString := dropFileName asString. |
|
4813 |
dropFileName isDirectory ifTrue:[ |
|
4814 |
filenameDirString := aDirectory asString. |
|
4815 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
4816 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
4817 |
^ false |
|
4414 | 4818 |
] |
6284 | 4819 |
] ifFalse:[ |
4820 |
physicalPathName := dropFileName physicalPathName. |
|
4821 |
(aDirectory = dropFileName directory |
|
4822 |
or:[ aDropObject isFileInArchive not |
|
4823 |
and:[physicalPathName notNil |
|
4824 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
4825 |
self notify:'Cannot drop a file into same directory'. |
|
4826 |
^ false |
|
4827 |
] |
|
4828 |
]. |
|
4829 |
^ true. |
|
3892 | 4830 |
! |
4831 |
||
7406 | 4832 |
canDropObjects:aCollectionOfDropObjects in:aWidget |
4833 |
^ aCollectionOfDropObjects contains:[:dropObject | dropObject isFileObject] |
|
4834 |
||
4835 |
"Created: / 13-10-2006 / 15:52:49 / cg" |
|
4836 |
! |
|
4837 |
||
17202 | 4838 |
doStartDrag:arg1 in:arg2 |
4839 |
^ self class doStartDrag:arg1 in:arg2 |
|
6479 | 4840 |
! |
4841 |
||
7408 | 4842 |
dropObjects:aCollectionOfDropObjects in:aWidget at:position |
7990 | 4843 |
|fileEntryFieldHolder destDir dropObject fn d| |
4844 |
||
4845 |
fileEntryFieldHolder := self masterApplication notNil |
|
4846 |
ifTrue:[ self masterApplication fileEntryFieldHolder ] |
|
4847 |
ifFalse:[ self fileEntryFieldHolder ]. |
|
4848 |
||
4849 |
aWidget model == fileEntryFieldHolder ifTrue:[ |
|
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4850 |
dropObject := aCollectionOfDropObjects first. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4851 |
dropObject isFileObject ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4852 |
fn := dropObject theObject asFilename. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4853 |
dropObject isDirectory ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4854 |
d := fn. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4855 |
] ifFalse:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4856 |
d := fn directory. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4857 |
]. |
7990 | 4858 |
fileEntryFieldHolder value:d pathName. |
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4859 |
]. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4860 |
^ self. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4861 |
]. |
6479 | 4862 |
|
4863 |
destDir := self currentDirectory. |
|
4864 |
destDir isNil ifTrue:[^ self]. |
|
4865 |
||
8601 | 4866 |
self withWaitCursorDo:[ |
4867 |
aCollectionOfDropObjects do:[:dropObject | |
|
4868 |
|fn| |
|
4869 |
||
4870 |
dropObject isFileObject ifTrue:[ |
|
4871 |
fn := dropObject theObject asFilename. |
|
4872 |
dropObject isDirectory ifTrue:[ |
|
8808
cb6476c0cd3a
oops - drop of directories was broken
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
4873 |
fn recursiveCopyTo:destDir |
8601 | 4874 |
] ifFalse:[ |
8950
48c69259d82d
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
8887
diff
changeset
|
4875 |
fn copyTo:(destDir / fn baseName ) |
8601 | 4876 |
] |
6479 | 4877 |
] |
8601 | 4878 |
]. |
4879 |
]. |
|
9268
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4880 |
self directoryContentsBrowser notNil ifTrue:[ |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4881 |
self directoryContentsBrowser |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4882 |
directoryContentsChangeFlag:true; |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4883 |
wakeUp |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4884 |
]. |
7408 | 4885 |
|
4886 |
"Created: / 13-10-2006 / 18:26:41 / cg" |
|
3892 | 4887 |
! ! |
4888 |
||
4889 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
4890 |
||
4891 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 4892 |
"copy to" |
4893 |
||
7635 | 4894 |
^ self copyFile:aSourceFile to:aDestFile repairCorruptedFiles:false |
4895 |
||
4896 |
"Modified: / 07-02-2007 / 18:46:44 / cg" |
|
4897 |
! |
|
4898 |
||
4899 |
copyFile:aSourceFile to:aDestFile repairCorruptedFiles:repairCorruptedFiles |
|
4900 |
"copy to" |
|
4901 |
||
4902 |
|copyOperation msg| |
|
4903 |
||
4904 |
repairCorruptedFiles ifTrue:[ |
|
4905 |
copyOperation := FileOperation copyCorruptedFile:aSourceFile to:aDestFile |
|
4906 |
] ifFalse:[ |
|
4907 |
copyOperation := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
|
4908 |
]. |
|
4909 |
copyOperation result ifTrue:[ |
|
6190 | 4910 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 4911 |
] ifFalse:[ |
7635 | 4912 |
msg := copyOperation errorString. |
6190 | 4913 |
]. |
4914 |
self notify:msg. |
|
7635 | 4915 |
^ copyOperation result |
4916 |
||
4917 |
"Created: / 07-02-2007 / 18:46:34 / cg" |
|
3892 | 4918 |
! |
4919 |
||
4920 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
6374 | 4921 |
|copy result| |
3892 | 4922 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4923 |
self withActivityIndicationDo:[ |
5961 | 4924 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
6374 | 4925 |
copy result ifTrue:[ |
4926 |
result := Dictionary withKeys:(copy collectionOfCopiedFiles) andValues:(copy collectionOfNewFiles). |
|
4927 |
] ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4928 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4929 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4930 |
self updateCurrentDirectory. |
3892 | 4931 |
]. |
6374 | 4932 |
^ result |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4933 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4934 |
"Modified: / 25-07-2006 / 09:07:04 / cg" |
3892 | 4935 |
! |
4936 |
||
15569 | 4937 |
copyFromToRepairingCorruptedFiles |
4938 |
"ask for source and destination and copy the entered file. |
|
4939 |
Especially useful for raw devices to copy corrupted disks/files |
|
4940 |
" |
|
4941 |
||
4942 |
|source destination| |
|
4943 |
||
4944 |
source := Dialog |
|
4945 |
requestDirectoryName:(resources string:'Copy from:') |
|
4946 |
default:(LastMoveDestination ? self currentDirectory) |
|
4947 |
ok:(resources string:'Continue') |
|
4948 |
abort:nil. |
|
4949 |
||
4950 |
source isEmptyOrNil ifTrue:[^ self]. |
|
4951 |
source := source asFilename. |
|
4952 |
||
4953 |
destination := Dialog |
|
4954 |
requestDirectoryName:(resources string:'Copy "%1" to:' with:source) |
|
4955 |
default:(LastMoveDestination ? self currentDirectory) |
|
4956 |
ok:(resources string:'Copy') |
|
4957 |
abort:nil. |
|
4958 |
||
4959 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
4960 |
destination := destination asFilename. |
|
4961 |
||
4962 |
self copyFile:source to:destination repairCorruptedFiles:true. |
|
4963 |
! |
|
4964 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4965 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
12850 | 4966 |
|size msg answer file| |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4967 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4968 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4969 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4970 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4971 |
"/ 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
|
4972 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4973 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4974 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4975 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4976 |
"/ 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
|
4977 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4978 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4979 |
"/ 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
|
4980 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4981 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4982 |
"/ 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
|
4983 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4984 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4985 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4986 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4987 |
stringWithCRs:'Copy or move\\%1:\ %2\to:\ %3 ?' |
17762 | 4988 |
with:(resources string: |
4989 |
(file type == #regular |
|
4990 |
ifTrue:'file' |
|
4991 |
ifFalse:[ |
|
4992 |
file isDirectory |
|
4993 |
ifTrue:'directory' |
|
4994 |
ifFalse:'object'])) |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4995 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4996 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4997 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4998 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4999 |
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
|
5000 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5001 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 5002 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5003 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5004 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5005 |
request:msg |
8127 | 5006 |
label:(resources string:'Copy or Move') |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
5007 |
image:(WarningBox iconBitmap) |
8127 | 5008 |
buttonLabels:(resources array:#('Cancel' 'Move' 'Copy' 'Copy As...')) |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5009 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5010 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5011 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5012 |
^ answer. |
17762 | 5013 |
|
5014 |
"Modified: / 17-11-2017 / 13:16:42 / cg" |
|
3892 | 5015 |
! |
5016 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5017 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 5018 |
"copy or move aColOfSourceFiles to aDirectory. |
5019 |
Asks the used if a move or a copy is wanted. |
|
5020 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
5021 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5022 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5023 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5024 |
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
|
5025 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5026 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5027 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5028 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5029 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5030 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5031 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5032 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5033 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5034 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5035 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5036 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 5037 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5038 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5039 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5040 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5041 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5042 |
|
4745 | 5043 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5044 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5045 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5046 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5047 |
^ true. |
3892 | 5048 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5049 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5050 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5051 |
^ true. |
3892 | 5052 |
]. |
4745 | 5053 |
^ false. |
3892 | 5054 |
! |
5055 |
||
6107 | 5056 |
copySelectionTo |
5057 |
"copy the selected file(s) to another directory" |
|
5058 |
||
13704 | 5059 |
self copySelectionToRepairingCorruptedFiles:false. |
5060 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5061 |
|
5062 |
"Modified: / 07-02-2007 / 18:42:48 / cg" |
|
5063 |
! |
|
5064 |
||
5065 |
copySelectionToRepairingCorruptedFiles |
|
5066 |
"copy the selected file(s) to another directory" |
|
5067 |
||
13704 | 5068 |
self copySelectionToRepairingCorruptedFiles:true. |
5069 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5070 |
|
5071 |
"Created: / 07-02-2007 / 18:42:59 / cg" |
|
5072 |
! |
|
5073 |
||
5074 |
copySelectionToRepairingCorruptedFiles:repairingCorruptedFiles |
|
5075 |
"copy the selected file(s) to another directory" |
|
5076 |
||
6299 | 5077 |
|selectedFiles msg destination directory| |
5078 |
||
7560 | 5079 |
selectedFiles := self currentSelectedObjects copy. |
6299 | 5080 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
5081 |
||
5082 |
msg := (selectedFiles size > 1) |
|
14588 | 5083 |
ifTrue:[ 'Copy Selected Items to Directory:' ] |
5084 |
ifFalse:[ 'Copy "%1" to Directory:' ]. |
|
6299 | 5085 |
|
5086 |
destination := Dialog |
|
14588 | 5087 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first baseName) |
7635 | 5088 |
default:(LastMoveDestination ? self currentDirectory) |
5089 |
ok:(resources string:'Copy') |
|
5090 |
abort:nil. |
|
5091 |
||
6299 | 5092 |
destination isEmptyOrNil ifTrue:[^ self]. |
5093 |
destination := destination asFilename. |
|
5094 |
||
5095 |
destination isDirectory ifFalse:[ |
|
5096 |
selectedFiles size == 1 ifTrue:[ |
|
5097 |
directory := destination directory. |
|
5098 |
directory isDirectory ifTrue:[ |
|
5099 |
LastMoveDestination := directory. |
|
7635 | 5100 |
self copyFile:selectedFiles first to:destination repairCorruptedFiles:repairingCorruptedFiles. |
6299 | 5101 |
^ self. |
5102 |
] |
|
5103 |
] |
|
5104 |
]. |
|
5105 |
||
5106 |
LastMoveDestination := destination. |
|
7635 | 5107 |
repairingCorruptedFiles ifTrue:[ |
5108 |
selectedFiles do:[:eachFile | |
|
5109 |
self copyFile:eachFile to:destination repairCorruptedFiles:repairingCorruptedFiles. |
|
5110 |
]. |
|
5111 |
^ self. |
|
5112 |
] ifFalse:[ |
|
5113 |
self copyFiles:selectedFiles to:destination |
|
5114 |
] |
|
5115 |
||
5116 |
"Created: / 07-02-2007 / 18:42:35 / cg" |
|
6107 | 5117 |
! |
5118 |
||
3892 | 5119 |
deleteFile:aFile |
6373 | 5120 |
"delete the selected files/directories" |
3892 | 5121 |
|
5122 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
5123 |
! |
|
5124 |
||
5125 |
deleteFiles:colOfFiles |
|
6373 | 5126 |
"delete some files/directories" |
5127 |
||
5081 | 5128 |
^ self deleteFiles:colOfFiles confirm:true. |
5129 |
! |
|
5130 |
||
5131 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 5132 |
"delete some files/directories" |
5133 |
||
5673 | 5134 |
|delete result| |
3892 | 5135 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5136 |
self withActivityIndicationDo:[ |
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5137 |
ProgressNotification handle:[:info | |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5138 |
self progressPercentageHolder value:info progressValue. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5139 |
info proceed |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5140 |
] do:[ |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5141 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5142 |
result := delete result. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5143 |
]. |
5673 | 5144 |
result notNil ifTrue:[ |
5145 |
result ifFalse:[ |
|
5146 |
self notify:delete errorString. |
|
5753 | 5147 |
] ifTrue:[ |
5148 |
self updateListAfterDelete:colOfFiles. |
|
5149 |
] |
|
4394 | 5150 |
]. |
5673 | 5151 |
]. |
5152 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5153 |
|
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5154 |
"Modified: / 11-10-2010 / 13:08:24 / cg" |
3892 | 5155 |
! |
5156 |
||
6169 | 5157 |
eraseFiles:colOfFiles |
6373 | 5158 |
"erase (clear and delete) some files/directories" |
5159 |
||
6169 | 5160 |
^ self eraseFiles:colOfFiles confirm:true. |
5161 |
! |
|
5162 |
||
5163 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 5164 |
"erase (clear and delete) some files/directories" |
5165 |
||
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5166 |
|deleteOperation result fileSize| |
6169 | 5167 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5168 |
self withActivityIndicationDo:[ |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5169 |
fileSize := colOfFiles first asFilename fileSize. |
8294 | 5170 |
deleteOperation := FileOperation eraseFiles:colOfFiles confirm:confirm. |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5171 |
(colOfFiles size == 1 and:[ fileSize < (10*1024*1024) ]) |
8294 | 5172 |
ifTrue:[ |
5173 |
result := deleteOperation result. |
|
5174 |
] ifFalse:[ |
|
5175 |
ProgressIndicator |
|
5176 |
displayProgressNotifications:'Erasing' |
|
5177 |
abortable:true |
|
5178 |
at:nil |
|
5179 |
during:[ |
|
5180 |
result := deleteOperation result. |
|
5181 |
]. |
|
5182 |
]. |
|
5183 |
||
6169 | 5184 |
result notNil ifTrue:[ |
5185 |
result ifFalse:[ |
|
8294 | 5186 |
self notify:deleteOperation errorString. |
6169 | 5187 |
] ifTrue:[ |
5188 |
self updateListAfterDelete:colOfFiles. |
|
5189 |
] |
|
5190 |
]. |
|
5191 |
]. |
|
5192 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5193 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5194 |
"Modified: / 25-07-2006 / 09:07:16 / cg" |
6169 | 5195 |
! |
5196 |
||
3892 | 5197 |
moveFile:aSourceFile to:aDestFile |
6373 | 5198 |
"move a file/directory" |
3892 | 5199 |
|
5200 |
|move| |
|
5201 |
||
5961 | 5202 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 5203 |
move result ifTrue:[ |
15346 | 5204 |
self notify:(resources string: 'move "%1" to "%2"' with:aSourceFile asString with:aDestFile asString). |
3892 | 5205 |
] ifFalse:[ |
4523 | 5206 |
self notify:move errorString. |
3892 | 5207 |
]. |
5208 |
self updateCurrentDirectory. |
|
5209 |
^ move result |
|
5210 |
! |
|
5211 |
||
5212 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 5213 |
"move some files to aDirectory" |
5214 |
||
3892 | 5215 |
|move| |
5216 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5217 |
self withActivityIndicationDo:[ |
5961 | 5218 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5219 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5220 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5221 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5222 |
self updateCurrentDirectory. |
3892 | 5223 |
]. |
6373 | 5224 |
^ move collectionOfMovedFiles |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5225 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5226 |
"Modified: / 25-07-2006 / 09:07:32 / cg" |
3892 | 5227 |
! |
5228 |
||
6107 | 5229 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5230 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5231 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5232 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5233 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5234 |
destinationDirectory := Dialog |
14588 | 5235 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items to Directory:') |
5789 | 5236 |
default:(LastMoveDestination ? self currentDirectory) |
6952 | 5237 |
ok:(resources string:'Move') |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5238 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5239 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5240 |
|
5789 | 5241 |
LastMoveDestination := destinationDirectory. |
13704 | 5242 |
self moveFiles:(self currentSelectedObjects copy) to:destinationDirectory asFilename. |
5243 |
self updateCurrentDirectoryWithReread. |
|
5244 |
||
7560 | 5245 |
|
5246 |
"Modified: / 04-12-2006 / 13:15:12 / cg" |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5247 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5248 |
|
3892 | 5249 |
newDirectory |
5250 |
"ask for and create a new directory" |
|
5251 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5252 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5253 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5254 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5255 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5256 |
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
|
5257 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5258 |
]. |
4521 | 5259 |
|
5260 |
"/ 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
|
5261 |
selectedFiles := self currentSelectedFiles. |
4521 | 5262 |
selectedFiles size == 1 ifTrue:[ |
5263 |
singleSelectedFile := selectedFiles first. |
|
5264 |
||
5265 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
13714 | 5266 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5267 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
5268 |
||
5269 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
13714 | 5270 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5271 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
5272 |
]. |
|
5273 |
]. |
|
5274 |
]. |
|
5275 |
||
5961 | 5276 |
|
4521 | 5277 |
defaultAnswer notNil ifTrue:[ |
5961 | 5278 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 5279 |
] ifFalse:[ |
5961 | 5280 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 5281 |
]. |
5282 |
createOp result ifFalse:[ ^ self]. |
|
5283 |
newFile := createOp createdFile. |
|
3892 | 5284 |
newFile notNil ifTrue:[ |
4414 | 5285 |
self updateCurrentDirectory. |
3892 | 5286 |
] |
5287 |
! |
|
5288 |
||
5289 |
newFile |
|
5290 |
"ask for and create a new file" |
|
5291 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5292 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5293 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5294 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5295 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5296 |
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
|
5297 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5298 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5299 |
|
3982 | 5300 |
curFile := self firstSelectedFile. |
3892 | 5301 |
curFile notNil ifTrue:[ |
4414 | 5302 |
file := curFile. |
3892 | 5303 |
] ifFalse:[ |
4414 | 5304 |
file := directory. |
3892 | 5305 |
]. |
5961 | 5306 |
create := FileOperation createFileIn:file. |
3892 | 5307 |
create result ifFalse:[ ^ self]. |
5308 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
5309 |
! |
|
5310 |
||
5311 |
newHardLink |
|
5312 |
"ask for and create a hard link (unix only)" |
|
5313 |
||
6151 | 5314 |
self newLink:#hard. |
5315 |
! |
|
5316 |
||
5317 |
newLink:typeOfLink |
|
3892 | 5318 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
5319 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5320 |
| sel dir create createdFile| |
3892 | 5321 |
|
7560 | 5322 |
sel := self currentSelectedObjects. |
4979
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5323 |
(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
|
5324 |
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
|
5325 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5326 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5327 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5328 |
|
6151 | 5329 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 5330 |
create result ifFalse:[ ^ self]. |
5331 |
createdFile := create createdFile. |
|
5332 |
createdFile notNil ifTrue:[ |
|
6151 | 5333 |
typeOfLink == #soft ifTrue:[ |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5334 |
self updateCurrentDirectory. |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5335 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5336 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5337 |
] |
3892 | 5338 |
]. |
7560 | 5339 |
|
5340 |
"Modified: / 04-12-2006 / 13:15:15 / cg" |
|
3892 | 5341 |
! |
5342 |
||
5343 |
newSoftLink |
|
5344 |
"ask for and create a soft link (unix only)" |
|
5345 |
||
6151 | 5346 |
self newLink:#soft. |
3892 | 5347 |
! |
5348 |
||
5349 |
pasteFiles |
|
6373 | 5350 |
"paste from clipBoard" |
5351 |
||
5352 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 5353 |
|
5354 |
files := self clipboard files. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
5355 |
files isEmptyOrNil ifTrue:[ ^ self ]. |
6373 | 5356 |
|
5357 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
5358 |
||
3892 | 5359 |
buffer := self clipboard copy. |
3982 | 5360 |
directories := self currentSelectedDirectories. |
5880 | 5361 |
directories size ~~ 1 ifTrue:[ |
4414 | 5362 |
|box dirStringCol| |
5880 | 5363 |
|
4414 | 5364 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
5365 |
box := ListSelectionBox new. |
|
6373 | 5366 |
box title:'Paste into which directory ?'. |
4414 | 5367 |
box list:dirStringCol. |
5368 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5369 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5370 |
box destroy. |
3892 | 5371 |
] ifFalse:[ |
5880 | 5372 |
destination := directories anElement. |
3892 | 5373 |
]. |
6373 | 5374 |
|
5375 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 5376 |
buffer files copy do:[:aFile| |
5377 |
aFile directory = destination ifTrue:[ |
|
5378 |
buffer files remove:aFile. |
|
5379 |
]. |
|
5380 |
]. |
|
5381 |
]. |
|
5382 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6374 | 5383 |
copiedFiles notEmptyOrNil ifTrue:[ |
5384 |
thisIsAFileMoveOperation ifTrue:[ |
|
5385 |
self deleteFiles:(copiedFiles keys) confirm:false. |
|
5386 |
]. |
|
5387 |
||
5388 |
"/ select those pasted files. |
|
5389 |
self updateCurrentDirectory:true. |
|
5390 |
self currentFileNameHolder value:copiedFiles values. |
|
5391 |
] |
|
3892 | 5392 |
! |
5393 |
||
5394 |
renameFile:aFile |
|
5395 |
"rename the selected file(s)" |
|
5396 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5397 |
^ self renameFiles:(Array with:aFile). |
3892 | 5398 |
! |
5399 |
||
4230 | 5400 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 5401 |
"rename filename to newFileString" |
5402 |
||
5403 |
|rename| |
|
5404 |
||
5961 | 5405 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 5406 |
rename result ifTrue:[ |
4230 | 5407 |
aBoolean ifTrue:[ |
5408 |
self updateAndSelect:(rename renamedFiles). |
|
5409 |
]. |
|
3892 | 5410 |
] ifFalse:[ |
4523 | 5411 |
self notify:rename errorString. |
3892 | 5412 |
]. |
5413 |
^ rename result |
|
5414 |
! |
|
5415 |
||
5416 |
renameFiles:aColOfFiles |
|
6373 | 5417 |
"rename some file(s)" |
3892 | 5418 |
|
5419 |
|rename| |
|
5420 |
||
5961 | 5421 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 5422 |
rename result ifFalse:[ |
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5423 |
self notify:rename errorString. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5424 |
^ nil. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5425 |
]. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5426 |
^ rename |
3892 | 5427 |
! |
5428 |
||
5429 |
renameSelection |
|
5430 |
"rename the selected file(s)" |
|
5431 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5432 |
|renamed| |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5433 |
|
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5434 |
renamed := self renameFiles:(self currentSelectedObjects copy). |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5435 |
renamed notNil ifTrue:[ |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5436 |
self updateAndSelect:renamed renamedFiles. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5437 |
]. |
7560 | 5438 |
|
5439 |
"Modified: / 04-12-2006 / 13:15:24 / cg" |
|
3892 | 5440 |
! ! |
5441 |
||
4080 | 5442 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 5443 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5444 |
bookmarksMenu |
3952 | 5445 |
<resource: #programMenu> |
5446 |
||
14941 | 5447 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec. |
5448 |
! |
|
5449 |
||
5450 |
bookmarksMenuForBaseSpec:aBaseMenuSpec |
|
5451 |
<resource: #programMenu> |
|
5452 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5453 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5454 |
|
14941 | 5455 |
menu := aBaseMenuSpec decodeAsLiteralArray. |
7763 | 5456 |
|
5457 |
"/ add the bookmark items ... |
|
5458 |
bookmarks := self class directoryBookmarks. |
|
5459 |
bookmarks notEmptyOrNil ifTrue:[ |
|
14604 | 5460 |
menu addSeparator. |
7763 | 5461 |
bookmarks do:[:dirName | |
12963 | 5462 |
menu addItem:(MenuItem |
5463 |
label:dirName asString |
|
5464 |
itemValue:[ |
|
5465 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
|
5466 |
self setCurrentFileName:dirName. |
|
5467 |
]. |
|
5468 |
]). |
|
7763 | 5469 |
]. |
5470 |
]. |
|
4080 | 5471 |
menu findGuiResourcesIn:self. |
7763 | 5472 |
^ menu |
5473 |
||
11135 | 5474 |
"Modified: / 14-01-2012 / 21:14:03 / cg" |
7763 | 5475 |
! |
5476 |
||
5477 |
canBackward |
|
5478 |
^ self directoryHistory canBackward. |
|
5479 |
||
5480 |
"Modified: / 27-03-2007 / 10:54:55 / cg" |
|
5481 |
! |
|
5482 |
||
5483 |
canForward |
|
5484 |
^ self directoryHistory canForward. |
|
5485 |
||
5486 |
"Modified: / 27-03-2007 / 10:54:57 / cg" |
|
5487 |
! |
|
5488 |
||
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5489 |
gotoBookmarksMenu |
7763 | 5490 |
<resource: #programMenu> |
5491 |
||
14941 | 5492 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec2. |
6099 | 5493 |
! |
5494 |
||
3892 | 5495 |
menuDirHistory:backOrForward |
7763 | 5496 |
"initialize the history menu" |
5497 |
||
3892 | 5498 |
<resource: #programMenu > |
5499 |
||
7763 | 5500 |
|hist menu pathList currentSel currentPath| |
5501 |
||
5502 |
hist := self directoryHistory. |
|
5503 |
hist isEmpty ifTrue:[^ nil]. |
|
5504 |
||
3892 | 5505 |
backOrForward == #back ifTrue:[ |
6725 | 5506 |
currentSel := self currentSelectedDirectories. |
4347 | 5507 |
currentSel size == 1 ifTrue:[ |
5508 |
currentPath := currentSel first asString. |
|
5509 |
] ifFalse:[ |
|
5510 |
currentPath := nil. |
|
5511 |
]. |
|
7763 | 5512 |
pathList := hist getBackCollection. |
3892 | 5513 |
] ifFalse:[ |
7763 | 5514 |
pathList := hist getForwardCollection. |
3892 | 5515 |
]. |
4022 | 5516 |
pathList isEmpty ifTrue:[ ^ nil]. |
7763 | 5517 |
|
6370 | 5518 |
pathList size > 30 ifTrue:[ |
5519 |
pathList := pathList copyTo:30 |
|
5520 |
]. |
|
7763 | 5521 |
|
5522 |
menu := Menu new. |
|
5523 |
||
3964 | 5524 |
pathList do:[:aPath| |
14593 | 5525 |
menu addItem:(MenuItem |
5526 |
label:aPath |
|
5527 |
itemValue:[ self setCurrentFileName:(aPath asFilename) ] |
|
5528 |
translateLabel:false). |
|
3952 | 5529 |
]. |
7763 | 5530 |
menu findGuiResourcesIn:self. |
3892 | 5531 |
^ menu |
7763 | 5532 |
|
11783 | 5533 |
"Modified: / 09-09-2012 / 13:07:22 / cg" |
3892 | 5534 |
! |
5535 |
||
5536 |
menuDirHistoryBack |
|
5537 |
"initialize the directory menu |
|
5538 |
" |
|
5539 |
<resource: #programMenu > |
|
5540 |
||
5541 |
^ self menuDirHistory:#back. |
|
5542 |
! |
|
5543 |
||
5544 |
menuDirHistoryForward |
|
5545 |
"initialize the directory menu |
|
5546 |
" |
|
5547 |
<resource: #programMenu > |
|
5548 |
||
5549 |
^ self menuDirHistory:#forward. |
|
3906 | 5550 |
! |
5551 |
||
5552 |
menuFileHistory |
|
5553 |
"initialize the file history menu |
|
5554 |
" |
|
5555 |
<resource: #programMenu > |
|
5556 |
||
7763 | 5557 |
|menu hist text removeItem| |
3906 | 5558 |
|
5559 |
hist := self fileHistory. |
|
5560 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5561 |
|
7763 | 5562 |
menu := Menu new. |
5563 |
||
5564 |
hist copy do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5565 |
aFileItem fileName exists ifTrue:[ |
12963 | 5566 |
menu addItem:(MenuItem |
5567 |
label: aFileItem fileName asString |
|
14593 | 5568 |
itemValue: |
5569 |
[ |
|
5570 |
self setCurrentFileName:(aFileItem fileName). |
|
5571 |
self openApplByFileItem:aFileItem |
|
5572 |
] |
|
5573 |
translateLabel:false). |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5574 |
] ifFalse:[ |
7763 | 5575 |
"/ remove all not existing history entries |
5576 |
hist remove:aFileItem. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5577 |
] |
3906 | 5578 |
]. |
7763 | 5579 |
menu addSeparator. |
5580 |
||
4080 | 5581 |
removeItem := MenuItem new. |
5582 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5583 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5584 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 5585 |
removeItem label:text. |
11783 | 5586 |
removeItem |
5587 |
itemValue:[ |
|
5588 |
self fileHistory removeAll. |
|
5589 |
self enableFileHistory value:false. |
|
5590 |
]. |
|
3906 | 5591 |
menu addItem:removeItem. |
7763 | 5592 |
menu findGuiResourcesIn:self. |
3906 | 5593 |
^ menu |
7763 | 5594 |
|
11783 | 5595 |
"Modified (format): / 09-09-2012 / 13:07:36 / cg" |
3952 | 5596 |
! |
5597 |
||
4080 | 5598 |
sortMenu |
5599 |
<resource: #programMenu > |
|
5600 |
||
5601 |
|menu| |
|
5602 |
||
7763 | 5603 |
menu := Menu decodeFromLiteralArray:self class sortMenu. |
4080 | 5604 |
menu findGuiResourcesIn:self. |
5605 |
^ menu |
|
7763 | 5606 |
|
5607 |
"Modified: / 27-03-2007 / 10:47:42 / cg" |
|
4080 | 5608 |
! |
5609 |
||
5610 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5611 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5612 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5613 |
specHere := self class viewDetailsMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5614 |
itemsHere := specHere at:2. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5615 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5616 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5617 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5618 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5619 |
spec := specHere copy. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5620 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5621 |
^ spec |
4080 | 5622 |
! |
5623 |
||
5624 |
viewInContentsBrowserMenu |
|
5009 | 5625 |
self |
5626 |
applicationNamed:#DirectoryContentsBrowser |
|
5627 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
5628 |
||
5629 |
^ nil. |
|
4080 | 5630 |
! |
5631 |
||
3952 | 5632 |
visitedDirectoriesMenu |
5633 |
<resource: #programMenu > |
|
5634 |
||
5635 |
|menu histCopy text removeItem| |
|
5636 |
||
7763 | 5637 |
histCopy := self directoryHistory. |
5638 |
histCopy isEmpty ifTrue:[^ nil]. |
|
5639 |
||
3952 | 5640 |
menu := Menu new. |
7763 | 5641 |
|
5642 |
histCopy do:[:aFile| |
|
12963 | 5643 |
menu addItem:(MenuItem |
5644 |
label:aFile asString |
|
5645 |
itemValue:[ |
|
5646 |
self setCurrentFileName:(aFile path asFilename). |
|
5647 |
]). |
|
7763 | 5648 |
]. |
5649 |
menu addSeparator. |
|
5650 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5651 |
"/ 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
|
5652 |
text := (resources string:'Clear History'). |
3952 | 5653 |
removeItem := MenuItem new. |
4040 | 5654 |
removeItem translateLabel:true. |
3952 | 5655 |
removeItem label:text. |
11783 | 5656 |
removeItem |
5657 |
itemValue:[ |
|
5658 |
self directoryHistory removeAll. |
|
5659 |
self enableForward value:self canForward. |
|
5660 |
self enableBack value:self canBackward. |
|
5661 |
]. |
|
7763 | 5662 |
|
3952 | 5663 |
menu addItem:removeItem. |
7763 | 5664 |
menu findGuiResourcesIn:self. |
3952 | 5665 |
^ menu |
7763 | 5666 |
|
11783 | 5667 |
"Modified: / 09-09-2012 / 13:07:45 / cg" |
3892 | 5668 |
! ! |
5669 |
||
5880 | 5670 |
!AbstractFileBrowser methodsFor:'menu actions'! |
5671 |
||
5672 |
doCompareTwoFiles |
|
5673 |
self openDiffView. |
|
5674 |
! |
|
5675 |
||
5676 |
doGoDirectoryUp |
|
5960 | 5677 |
| upDir directory rootInTreeView| |
5880 | 5678 |
|
5679 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
5680 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 5681 |
directory := self currentDirectory. |
5682 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 5683 |
] ifFalse:[ |
5684 |
rootInTreeView := self |
|
5685 |
applicationNamed:#DirectoryTreeBrowser |
|
5686 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 5687 |
directory := rootInTreeView value asFilename. |
5688 |
]. |
|
5689 |
upDir := directory directory. |
|
5959 | 5690 |
self setCurrentFileName:upDir. |
5880 | 5691 |
! |
5692 |
||
5693 |
doGotoDefaultDirectory |
|
5694 |
self gotoFile:(Filename defaultDirectory). |
|
5695 |
! |
|
5696 |
||
8091 | 5697 |
doGotoDesktopDirectory |
5698 |
self gotoFile:(Filename desktopDirectory). |
|
5699 |
! |
|
5700 |
||
5880 | 5701 |
doGotoHomeDirectory |
8091 | 5702 |
self gotoFile:(Filename homeDirectory). |
5880 | 5703 |
! |
5704 |
||
6434 | 5705 |
doGotoSmalltalkDirectory |
5706 |
self gotoFile:(self smalltalkDirectory). |
|
5707 |
! |
|
5708 |
||
17187 | 5709 |
doGotoSmalltalkWorkspaceDirectory |
5710 |
self gotoFile:(UserPreferences current workspaceDirectory). |
|
5711 |
! |
|
5712 |
||
9677 | 5713 |
doGotoTempDirectory |
5714 |
self gotoFile:(self tempDirectory). |
|
5715 |
||
5716 |
"Created: / 29-12-2010 / 11:03:17 / cg" |
|
5717 |
! |
|
5718 |
||
9596 | 5719 |
doMakeCurrentDirectory |
17582 | 5720 |
<resource: #obsolete> |
5721 |
||
5722 |
"/ no longer |
|
5723 |
^ self |
|
5724 |
"/ OperatingSystem setCurrentDirectory:(self currentDirectory pathName). |
|
5725 |
"/ self currentFileNameHolderChangedForCommon. |
|
9596 | 5726 |
|
5727 |
"Created: / 26-10-2010 / 17:21:19 / cg" |
|
17582 | 5728 |
"Modified (format): / 17-07-2017 / 10:09:39 / cg" |
9596 | 5729 |
! |
5730 |
||
5880 | 5731 |
fileGetInfo:longInfo |
5732 |
"get info on selected file - show it in a box" |
|
5733 |
||
5734 |
|string box updater| |
|
5735 |
||
5736 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
5737 |
string notNil ifTrue:[ |
|
5738 |
box := InfoBox title:string. |
|
5739 |
updater := [ |
|
5740 |
[true] whileTrue:[ |
|
5741 |
Delay waitForSeconds:2. |
|
5742 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
5743 |
string isNil ifTrue:[ ^ self]. |
|
5744 |
box title:string |
|
5745 |
] |
|
5746 |
] fork. |
|
5747 |
box show. |
|
5748 |
updater terminate. |
|
5749 |
box destroy |
|
5750 |
] |
|
6434 | 5751 |
! |
5752 |
||
17686 | 5753 |
showDeltaBetweenTwoImageFiles |
5754 |
|i1 i2 delta| |
|
5755 |
||
5756 |
i1 := Image fromFile:(self selectedFileNames first). |
|
5757 |
i2 := Image fromFile:(self selectedFileNames second). |
|
5758 |
delta := ImageAlgorithms new differenceImageBetween:i1 and:i2. |
|
5759 |
ImageView openOn:delta. |
|
5760 |
||
5761 |
"Created: / 10-09-2017 / 16:59:08 / cg" |
|
5762 |
! |
|
5763 |
||
6434 | 5764 |
smalltalkDirectory |
8590 | 5765 |
|stxPath| |
6434 | 5766 |
|
5767 |
stxPath := OperatingSystem pathOfSTXExecutable. |
|
8590 | 5768 |
stxPath isNil ifTrue:[ |
5769 |
^ Filename currentDirectory |
|
5770 |
]. |
|
5771 |
^ stxPath asFilename directory. |
|
9677 | 5772 |
! |
5773 |
||
5774 |
tempDirectory |
|
5775 |
^ Filename tempDirectory. |
|
5776 |
||
5777 |
"Created: / 29-12-2010 / 11:03:00 / cg" |
|
5880 | 5778 |
! ! |
5779 |
||
11139 | 5780 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
5781 |
||
14262 | 5782 |
addDirToJavaSourcePath |
5783 |
"add the current path to java's sourcePath |
|
5784 |
(only available with ST/J System" |
|
5785 |
||
5786 |
Java addToSourcePath:self currentDirectory pathName |
|
5787 |
||
5788 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
5789 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
5790 |
! |
|
5791 |
||
11139 | 5792 |
copyFiles |
5793 |
self |
|
5794 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
5795 |
! |
|
5796 |
||
5797 |
cutFiles |
|
5798 |
self |
|
5799 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
5800 |
! |
|
5801 |
||
5802 |
deleteFiles |
|
5803 |
self |
|
5804 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
5805 |
! |
|
5806 |
||
5807 |
eraseFiles |
|
5808 |
self |
|
5809 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
5810 |
! |
|
5811 |
||
14262 | 5812 |
fileAddToJavaSourcePath |
5813 |
"add the current path to java's sourcePath |
|
5814 |
(only available with ST/J System" |
|
5815 |
||
5816 |
self currentSelectedObjects do:[:each | |
|
5817 |
Java addToSourcePath:(each pathName) |
|
5818 |
]. |
|
5819 |
||
5820 |
"Created: / 9.11.1998 / 05:41:34 / cg" |
|
5821 |
"Modified: / 9.11.1998 / 05:56:00 / cg" |
|
5822 |
! |
|
5823 |
||
11139 | 5824 |
openSettingsDialog |
5825 |
|dialog| |
|
5826 |
||
5827 |
dialog := FileBrowserV2SettingsDialog new. |
|
5828 |
dialog settingsDialog:self. |
|
5829 |
dialog allButOpen. |
|
5830 |
dialog doReload. |
|
5831 |
dialog openWindow |
|
5832 |
! |
|
5833 |
||
5834 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
5835 |
|files dirs| |
|
5836 |
||
5837 |
files := self currentSelectedFiles. |
|
5838 |
files notEmpty ifTrue:[ |
|
5839 |
aBlock value:files. |
|
5840 |
] ifFalse:[ |
|
5841 |
dirs := self currentSelectedDirectories. |
|
5842 |
dirs notEmpty ifTrue:[ |
|
5843 |
aBlock value:dirs. |
|
5844 |
]. |
|
5845 |
]. |
|
5846 |
! ! |
|
5847 |
||
5848 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
|
5849 |
||
5850 |
openAboutThisApplication |
|
5851 |
"opens an about box for this application." |
|
5852 |
||
5853 |
Dialog aboutClass:self class. |
|
5854 |
! |
|
5855 |
||
5856 |
openHTMLDocument:relativeDocPath |
|
5857 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
5858 |
! ! |
|
5859 |
||
5860 |
!AbstractFileBrowser methodsFor:'menu actions-scm-cvs'! |
|
3892 | 5861 |
|
15905 | 5862 |
canCvsAddAndCommit |
5863 |
||
5864 |
|selectedFiles| |
|
5865 |
||
5866 |
selectedFiles := self currentSelectedObjects. |
|
5867 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
5868 |
! |
|
5869 |
||
5870 |
canRemoveCVSContainer |
|
5871 |
^ self currentSelectedFiles |
|
5872 |
contains:[:fileName| |
|
5873 |
|dirOfFile cvsDir| |
|
5874 |
||
5875 |
dirOfFile := self getDirWithoutFileName:fileName. |
|
5876 |
cvsDir := dirOfFile construct:'CVS'. |
|
5877 |
cvsDir isDirectory |
|
5878 |
]. |
|
5879 |
! |
|
5880 |
||
12777 | 5881 |
commitFilesToCVS:files |
5882 |
|numFiles| |
|
5883 |
||
5884 |
(numFiles := files size) > 0 ifTrue:[ |
|
5885 |
self withActivityIndicationDo:[ |
|
5886 |
self cvsCommitFiles:files |
|
5887 |
] |
|
5888 |
] |
|
5889 |
! |
|
5890 |
||
3892 | 5891 |
cvsAddAndCommit |
4849 | 5892 |
self cvsAddAndCommitAsBinary:false |
5893 |
! |
|
5894 |
||
5895 |
cvsAddAndCommitAsBinary:asBinary |
|
8588 | 5896 |
|sel log logArg binArg cmd dir executionBlock nameString| |
3892 | 5897 |
|
5898 |
log := Dialog |
|
11139 | 5899 |
requestText:(resources string:'Enter initial log message:') |
4414 | 5900 |
lines:10 |
5901 |
columns:70 |
|
5902 |
initialAnswer:nil. |
|
8322
cf10f08b6164
care for cancel in #cvsAddAndCommitAsBinary:
Claus Gittinger <cg@exept.de>
parents:
8294
diff
changeset
|
5903 |
log isNil ifTrue:[^ self]. |
3892 | 5904 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5905 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5906 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5907 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5908 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5909 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5910 |
|
8588 | 5911 |
binArg := ''. |
5912 |
asBinary ifTrue:[ |
|
5913 |
binArg := '-kb '. |
|
5914 |
]. |
|
3982 | 5915 |
sel := self currentSelectedFiles. |
11139 | 5916 |
executionBlock := |
5917 |
[:stream | |
|
5918 |
log notNil ifTrue:[ |
|
17416 | 5919 |
sel notEmptyOrNil ifTrue:[ |
11139 | 5920 |
sel do:[:fn | |
5921 |
|nameArg| |
|
5922 |
||
5923 |
nameArg := '"',fn baseName,'"'. |
|
5924 |
||
5925 |
dir := self getDirWithoutFileName:fn. |
|
5926 |
cmd := 'cvs add ',logArg,' ',binArg,nameArg. |
|
5927 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5928 |
||
5929 |
cmd := ('cvs commit -l ',logArg,' ',nameArg). |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5930 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
11139 | 5931 |
"/ mhmh - it seems that only old CVS implementations (at least turqoise) |
5932 |
"/ support and need the 'admin -kb' command. |
|
5933 |
"/ newer ones use the '-kb' option in the 'cvs add' command |
|
5934 |
asBinary ifTrue:[ |
|
5935 |
cmd := ('cvs admin -kb ' , nameArg). |
|
5936 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5937 |
||
5938 |
cmd := ('cvs upd ' , nameArg). |
|
5939 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5940 |
]. |
|
5941 |
] |
|
5942 |
] |
|
5943 |
] |
|
5944 |
]. |
|
4107 | 5945 |
nameString := 'Command> cvs add and commit'. |
3892 | 5946 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
11139 | 5947 |
|
17416 | 5948 |
"Modified: / 17-02-2017 / 08:25:16 / cg" |
3892 | 5949 |
! |
5950 |
||
4849 | 5951 |
cvsAddBinaryAndCommit |
5952 |
self cvsAddAndCommitAsBinary:true |
|
5953 |
! |
|
5954 |
||
3892 | 5955 |
cvsCommit |
12777 | 5956 |
|selectedFiles| |
3892 | 5957 |
|
3982 | 5958 |
selectedFiles:= self currentSelectedFiles. |
12777 | 5959 |
self cvsCommitFiles:selectedFiles |
5960 |
! |
|
5961 |
||
5962 |
cvsCommitFiles:files |
|
5963 |
|nFiles log logTmp s logArg msg executionBlock nameString | |
|
5964 |
||
5965 |
nFiles := files size. |
|
5966 |
nFiles == 0 ifTrue:[^ self]. |
|
5967 |
||
5968 |
nFiles == 1 ifTrue:[ |
|
5969 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(files first baseName) |
|
3892 | 5970 |
] ifFalse:[ |
12777 | 5971 |
nFiles > 1 ifTrue:[ |
5972 |
msg := resources string:'Enter log message for %1 files to checkIn' with:nFiles printString |
|
4414 | 5973 |
] ifFalse:[ |
6627 | 5974 |
msg := resources string:'Enter log message for checkIn' |
4414 | 5975 |
] |
3892 | 5976 |
]. |
5977 |
||
5978 |
log := Dialog |
|
4414 | 5979 |
requestText:msg |
5980 |
lines:10 |
|
5981 |
columns:70 |
|
5982 |
initialAnswer:nil. |
|
3892 | 5983 |
|
4663 | 5984 |
log isNil ifTrue:[^ self]. |
12777 | 5985 |
log := log replChar:$" withString:'\"'. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5986 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5987 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
12777 | 5988 |
"/ save the log message into another tempFile ... |
13121 | 5989 |
s := FileStream newTemporary. |
5990 |
logTmp := s fileName. |
|
12777 | 5991 |
s nextPutAll:log. |
5992 |
s close. |
|
5993 |
||
5994 |
logArg := '-F "', logTmp pathName, '"'. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5995 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5996 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5997 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5998 |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
5999 |
executionBlock := [:stream | |
12777 | 6000 |
[ |
6001 |
files do:[:fn | |
|
6002 |
| dir nameArg cmd | |
|
6003 |
||
6004 |
nameArg := '"',fn baseName,'"'. |
|
6005 |
dir := fn directory. |
|
6006 |
cmd := 'cvs commit ',logArg,' ' , nameArg. |
|
6007 |
stream showCR:fn pathName. |
|
6008 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
4663 | 6009 |
] |
12777 | 6010 |
] ensure:[ |
6011 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6012 |
]. |
|
4107 | 6013 |
]. |
6014 |
nameString := 'Command> cvs commit'. |
|
6015 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 6016 |
! |
6017 |
||
14527 | 6018 |
cvsCommitFolder |
6019 |
|dir log logTmp s logArg msg executionBlock nameString | |
|
6020 |
||
6021 |
(dir := self currentDirectory) isNil ifTrue:[ ^ self ]. |
|
6022 |
||
6023 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(dir baseName). |
|
6024 |
log := Dialog |
|
6025 |
requestText:msg |
|
6026 |
lines:10 |
|
6027 |
columns:70 |
|
6028 |
initialAnswer:nil. |
|
6029 |
||
6030 |
log isNil ifTrue:[^ self]. |
|
6031 |
log := log replChar:$" withString:'\"'. |
|
6032 |
||
6033 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6034 |
"/ save the log message into another tempFile ... |
|
6035 |
s := FileStream newTemporary. |
|
6036 |
logTmp := s fileName. |
|
6037 |
s nextPutAll:log. |
|
6038 |
s close. |
|
6039 |
||
6040 |
logArg := '-F "', logTmp pathName, '"'. |
|
6041 |
] ifFalse:[ |
|
6042 |
logArg := '-m ''' , log , ''''. |
|
6043 |
]. |
|
6044 |
||
6045 |
executionBlock := [:stream | |
|
6046 |
[ |
|
6047 |
|cmd| |
|
6048 |
||
6049 |
cmd := 'cvs commit ',logArg. |
|
6050 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6051 |
] ensure:[ |
|
6052 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6053 |
]. |
|
6054 |
]. |
|
6055 |
||
6056 |
nameString := 'Command> cvs commit'. |
|
6057 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6058 |
! |
|
6059 |
||
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6060 |
cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6061 |
|selectedFiles| |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6062 |
|
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6063 |
selectedFiles:= self currentSelectedFiles. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6064 |
selectedFiles do:[:each | |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6065 |
|out diffs| |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6066 |
|
15589 | 6067 |
out := CharacterWriteStream new:100. |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6068 |
OperatingSystem |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6069 |
executeCommand:'cvs diff -b ',each baseName |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6070 |
outputTo:out |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6071 |
inDirectory:each directoryName. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6072 |
diffs := out contents. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6073 |
TextView openWith:diffs. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6074 |
]. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6075 |
|
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6076 |
"Modified: / 23-01-2012 / 14:08:28 / cg" |
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6077 |
! |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6078 |
|
15211 | 6079 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
6080 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
6081 |
||
6082 |
|toRemove updateRunning executionBlock nameString| |
|
6083 |
||
6084 |
updateRunning := self backgroundProcesses value notEmpty. |
|
6085 |
self killAllRunningBackgroundProcesses. |
|
6086 |
toRemove := OrderedCollection new. |
|
6087 |
||
6088 |
executionBlock := |
|
6089 |
[:stream | |
|
6090 |
|cmd logArg prevDir prevFiles| |
|
6091 |
||
6092 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6093 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
|
6094 |
] ifFalse:[ |
|
6095 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
|
6096 |
]. |
|
6097 |
prevFiles := ''. |
|
6098 |
||
6099 |
filesToRemove do:[:fileName | |
|
6100 |
|dir file| |
|
6101 |
||
6102 |
dir := fileName directory. |
|
6103 |
(prevDir notNil and:[prevDir ~= dir]) ifTrue:[ |
|
6104 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6105 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6106 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6107 |
prevFiles := ''. |
|
6108 |
]. |
|
6109 |
||
17116 | 6110 |
OsError handle:[:ex| |
15211 | 6111 |
"was not able to remove it" |
6112 |
| lastError msg | |
|
6113 |
lastError := OperatingSystem lastErrorString. |
|
6114 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
6115 |
lastError isNil ifFalse:[ |
|
6116 |
msg := msg , '\\(' , lastError , ')' |
|
6117 |
]. |
|
6118 |
Dialog warn:msg withCRs |
|
6119 |
] do:[ |
|
6120 |
(fileName isSymbolicLink) ifFalse:[ |
|
6121 |
fileName remove. |
|
6122 |
file := fileName baseName. |
|
6123 |
cmd := ('cvs remove -f "',file,'"'). |
|
6124 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6125 |
"/ Transcript show:dir; space; showCR:cmd. |
|
6126 |
] |
|
6127 |
]. |
|
6128 |
prevDir := dir. |
|
6129 |
prevFiles := prevFiles,' ',file. |
|
6130 |
]. |
|
6131 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6132 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6133 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6134 |
]. |
|
6135 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
|
6136 |
filesToRemove size > 1 ifTrue:[ |
|
6137 |
nameString := nameString, ' ...'. |
|
6138 |
]. |
|
6139 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6140 |
! |
|
3892 | 6141 |
|
6142 |
cvsRemoveFileAndCVSContainer |
|
12493 | 6143 |
|files| |
6144 |
||
6145 |
files := self currentSelectedFiles copy. |
|
6146 |
self removeFilesAndCVSContainers:files |
|
3892 | 6147 |
! |
6148 |
||
9338 | 6149 |
cvsRevisionLog |
6150 |
| cmd sel executionBlock nameString| |
|
6151 |
||
6152 |
sel := self currentSelectedObjects. |
|
6153 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6154 |
||
6155 |
executionBlock := [:stream | |
|
6156 |
sel do:[:fn | |
|
6157 |
| dir nameArg | |
|
6158 |
||
6159 |
nameArg := '"',fn baseName,'"'. |
|
6160 |
dir := fn directory. |
|
6161 |
cmd := 'cvs log ' , nameArg. |
|
6162 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6163 |
] |
|
6164 |
]. |
|
6165 |
nameString := 'Command> cvs log'. |
|
6166 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6167 |
! |
|
6168 |
||
8562 | 6169 |
cvsTagSelection |
12856 | 6170 |
|tag tags cmd| |
6171 |
||
6172 |
tag := Dialog |
|
6173 |
request:(resources string:'Tag (possibly multiple, separated by ";"):') |
|
6174 |
initialAnswer:(CVSSourceCodeManager recentTag). |
|
6175 |
tag isEmptyOrNil ifTrue:[^ self ]. |
|
6176 |
||
6177 |
CVSSourceCodeManager recentTag:tag. |
|
8562 | 6178 |
|
6179 |
CVSSourceCodeManager notNil ifTrue:[ |
|
6180 |
cmd := CVSSourceCodeManager cvsExecutable. |
|
6181 |
] ifFalse:[ |
|
6182 |
cmd := 'cvs'. |
|
6183 |
]. |
|
6184 |
||
12856 | 6185 |
tags := tag asCollectionOfSubstringsSeparatedByAny:',;'. |
6186 |
tags do:[:eachTag | |
|
6187 |
self executeCommand:('%1 tag -F "%2" %3' |
|
6188 |
bindWith:cmd |
|
12858 | 6189 |
with:(eachTag withoutSeparators) |
12856 | 6190 |
with:(self makeFileNameArgumentString)) |
6191 |
]. |
|
8562 | 6192 |
! |
6193 |
||
3892 | 6194 |
cvsUpdateAll |
6195 |
| cmd | |
|
6196 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6197 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6198 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6199 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6200 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6201 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6202 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6203 |
self executeCommand:(cmd, ' upd -l'). |
3892 | 6204 |
! |
6205 |
||
6206 |
cvsUpdateAllRecursive |
|
6207 |
| cmd | |
|
6208 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6209 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6210 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6211 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6212 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6213 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6214 |
self executeCommand:(cmd, ' upd -d'). |
3892 | 6215 |
! |
6216 |
||
6217 |
cvsUpdateSelection |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6218 |
|stream cmd| |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6219 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6220 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6221 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6222 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6223 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6224 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6225 |
|
15589 | 6226 |
stream := CharacterWriteStream new. |
8563 | 6227 |
stream |
6228 |
nextPutAll:cmd; |
|
6229 |
nextPutAll:' upd '; |
|
6230 |
nextPutAll:(self makeFileNameArgumentString). |
|
6231 |
||
6232 |
self executeCommand:stream contents. |
|
6233 |
! |
|
6234 |
||
6235 |
makeFileNameArgumentString |
|
6236 |
|stream| |
|
6237 |
||
15589 | 6238 |
stream := CharacterWriteStream new. |
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6239 |
self currentSelectedFiles do:[: file | |
8563 | 6240 |
stream nextPut:$". |
4414 | 6241 |
stream nextPutAll:file baseName. |
8563 | 6242 |
stream nextPutAll:'" '. |
6243 |
]. |
|
6244 |
^ stream contents. |
|
12493 | 6245 |
! |
6246 |
||
6247 |
removeFilesAndCVSContainers:files |
|
6248 |
|numFiles question aswer| |
|
6249 |
||
6250 |
(numFiles := files size) > 0 ifTrue:[ |
|
6251 |
numFiles > 1 ifTrue:[ |
|
6252 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:numFiles |
|
6253 |
] ifFalse:[ |
|
6254 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(files first baseName allBold) |
|
6255 |
]. |
|
6256 |
||
6257 |
aswer := Dialog |
|
6258 |
confirm:question withCRs |
|
6259 |
yesLabel:(resources string:'Remove') |
|
6260 |
noLabel:(resources string:'Cancel'). |
|
6261 |
||
6262 |
aswer ifTrue:[ |
|
6263 |
self withActivityIndicationDo:[ |
|
6264 |
self cvsRemoveAndRemoveFromCVS:files |
|
6265 |
] |
|
6266 |
] |
|
6267 |
] |
|
3892 | 6268 |
! ! |
6269 |
||
14126 | 6270 |
|
11139 | 6271 |
!AbstractFileBrowser methodsFor:'menu actions-scm-mercurial'! |
6272 |
||
6273 |
mercurialAdd |
|
6274 |
|executionBlock sel maxCmdSize| |
|
6275 |
||
6276 |
maxCmdSize := 512. |
|
6277 |
||
6278 |
sel := self currentSelectedObjects. |
|
6279 |
sel isEmptyOrNil ifTrue:[ |
|
6280 |
^ self |
|
6281 |
]. |
|
6282 |
||
6283 |
executionBlock := |
|
6284 |
[:stream | |
|
6285 |
|prevDir cmd| |
|
6286 |
||
6287 |
prevDir := nil. |
|
6288 |
sel do:[:fn | |
|
6289 |
|nameArg dir| |
|
6290 |
||
6291 |
nameArg := '"',fn baseName,'"'. |
|
6292 |
dir := fn directory. |
|
6293 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6294 |
"/ flush |
|
6295 |
cmd notNil ifTrue:[ |
|
6296 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6297 |
cmd := nil. |
|
6298 |
] |
|
6299 |
]. |
|
6300 |
cmd isNil ifTrue:[ |
|
6301 |
cmd := 'hg add'. |
|
6302 |
]. |
|
6303 |
cmd := cmd,' ',nameArg. |
|
6304 |
prevDir := dir. |
|
6305 |
]. |
|
6306 |
cmd notNil ifTrue:[ |
|
6307 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6308 |
cmd := nil. |
|
6309 |
]. |
|
6310 |
stream nextPutLine:'Commit to finish the transaction'. |
|
6311 |
]. |
|
6312 |
||
6313 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg add'. |
|
6314 |
||
6315 |
"Created: / 15-01-2012 / 15:55:47 / cg" |
|
6316 |
! |
|
6317 |
||
6318 |
mercurialCommit |
|
6319 |
|dir executionBlock| |
|
6320 |
||
6321 |
"/ dir := self currentDirectory. |
|
6322 |
dir := self directoryContentsBrowser directory. |
|
6323 |
executionBlock := |
|
6324 |
[:stream | |
|
6325 |
(self getExecutionBlockForCommand:'hg commit' |
|
6326 |
inDirectory:dir) value:stream. |
|
6327 |
stream nextPutLine:'Push to sync other repositories'. |
|
6169 | 6328 |
]. |
11139 | 6329 |
|
6330 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg commit'. |
|
6331 |
||
6332 |
"Created: / 15-01-2012 / 16:21:27 / cg" |
|
6333 |
! |
|
6334 |
||
11144 | 6335 |
mercurialInit |
6336 |
|dir executionBlock| |
|
6337 |
||
6338 |
dir := self directoryContentsBrowser directory. |
|
6339 |
||
6340 |
(Dialog confirm:(resources |
|
6341 |
string:'Initialize new Mercurial Repository in %1?' |
|
6342 |
with:dir baseName)) ifFalse:[^ self]. |
|
6343 |
||
6344 |
executionBlock := |
|
6345 |
[:stream | |
|
6346 |
(self getExecutionBlockForCommand:('hg init') |
|
6347 |
inDirectory:dir) value:stream. |
|
6348 |
]. |
|
6349 |
||
6350 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg init'. |
|
6351 |
||
6352 |
"Created: / 17-01-2012 / 15:58:46 / cg" |
|
6353 |
! |
|
6354 |
||
11139 | 6355 |
mercurialPush |
6356 |
|destination dir executionBlock| |
|
6357 |
||
6358 |
destination := Dialog request:'Mercurial Repository' |
|
6359 |
initialAnswer:(LastMercurialRepository ? MercurialSourceCodeManager repositoryName). |
|
6360 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
6361 |
||
6362 |
LastMercurialRepository := destination. |
|
6363 |
||
6364 |
dir := self directoryContentsBrowser directory. |
|
6365 |
executionBlock := |
|
6366 |
[:stream | |
|
6367 |
(self getExecutionBlockForCommand:('hg push "%1"' bindWith:destination) |
|
6368 |
inDirectory:dir) value:stream. |
|
6369 |
]. |
|
6370 |
||
6371 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg push'. |
|
6372 |
||
6373 |
"Created: / 15-01-2012 / 16:29:41 / cg" |
|
6374 |
! |
|
6375 |
||
6376 |
mercurialStatus |
|
6377 |
|executionBlock sel maxCmdSize| |
|
6378 |
||
6379 |
maxCmdSize := 512. |
|
6380 |
||
6381 |
sel := self currentSelectedObjects. |
|
6382 |
sel isEmptyOrNil ifTrue:[ |
|
6383 |
^ self |
|
6384 |
]. |
|
6385 |
||
6386 |
executionBlock := |
|
6387 |
[:stream | |
|
6388 |
|prevDir cmd| |
|
6389 |
||
6390 |
prevDir := nil. |
|
6391 |
sel do:[:fn | |
|
6392 |
|nameArg dir| |
|
6393 |
||
6394 |
nameArg := '"',fn baseName,'"'. |
|
6395 |
dir := fn directory. |
|
6396 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6397 |
"/ flush |
|
6398 |
cmd notNil ifTrue:[ |
|
6399 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6400 |
cmd := nil. |
|
6401 |
] |
|
6402 |
]. |
|
6403 |
cmd isNil ifTrue:[ |
|
6404 |
cmd := 'hg status'. |
|
6405 |
]. |
|
6406 |
cmd := cmd,' ',nameArg. |
|
6407 |
prevDir := dir. |
|
6408 |
]. |
|
6409 |
cmd notNil ifTrue:[ |
|
6410 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6411 |
cmd := nil. |
|
6412 |
]. |
|
6413 |
]. |
|
6414 |
||
6415 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg status'. |
|
6416 |
||
6417 |
"Created: / 15-01-2012 / 19:43:08 / cg" |
|
3892 | 6418 |
! ! |
6419 |
||
4849 | 6420 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
3892 | 6421 |
|
8510 | 6422 |
allFilesInSelectedDirectoriesForWhich:aBlock |
6423 |
|directories allFiles| |
|
6424 |
||
6425 |
directories := self currentSelectedDirectories. |
|
6426 |
directories isEmpty ifTrue:[^ self]. |
|
6427 |
||
6428 |
allFiles := OrderedCollection new. |
|
6429 |
directories do:[:dir| |
|
6430 |
[ |
|
6431 |
|fileNames| |
|
6432 |
||
6433 |
fileNames := dir directoryContents. |
|
6434 |
fileNames notNil ifTrue:[ |
|
6435 |
fileNames := fileNames |
|
6436 |
collect:[:fn | dir construct:fn] |
|
6437 |
thenSelect:[:fn | fn isDirectory not and:[aBlock value:fn]]. |
|
6438 |
allFiles addAll:fileNames. |
|
6439 |
] |
|
6440 |
] on:FileStream openErrorSignal do:[:ex| |
|
6441 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
|
6442 |
with:ex pathName |
|
6443 |
with:ex description). |
|
6444 |
ex proceedWith:nil. |
|
6445 |
]. |
|
6446 |
]. |
|
6447 |
||
6448 |
^ allFiles |
|
6449 |
! |
|
6450 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6451 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6452 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6453 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6454 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6455 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6456 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6457 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6458 |
"/ 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
|
6459 |
"/ 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
|
6460 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6461 |
conv := OrderedCollection new. |
4722 | 6462 |
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
|
6463 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6464 |
outSuffix = 'png' ifTrue:[ |
4722 | 6465 |
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
|
6466 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6467 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6468 |
outSuffix = 'gif' ifTrue:[ |
4722 | 6469 |
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
|
6470 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6471 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6472 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 6473 |
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
|
6474 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6475 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6476 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 6477 |
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
|
6478 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6479 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6480 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6481 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6482 |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6483 |
convertImageFrom:fileName to:outFile onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6484 |
|writer image outSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6485 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6486 |
outSuffix := outFile suffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6487 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6488 |
((writer := MIMETypes imageReaderForSuffix:outSuffix) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6489 |
and:[ (image := Image fromFile:fileName) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6490 |
and:[ writer canRepresent:image ]]) ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6491 |
"/ can do it with Smalltalk tools |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6492 |
writer save:image onFile:outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6493 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6494 |
"/ use external tools (pbm-package, if available) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6495 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6496 |
convertImageUsingExternalFileToolsFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6497 |
toSuffix:outSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6498 |
onError:exceptionBlock. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6499 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6500 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6501 |
"Created: / 20-05-2010 / 11:12:36 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6502 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6503 |
|
4367 | 6504 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6505 |
self convertImageToSuffix:'gif' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6506 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6507 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6508 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6509 |
self convertImageToSuffix:'jpg' |
4531 | 6510 |
! |
6511 |
||
6512 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6513 |
self convertImageToSuffix:'png' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6514 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6515 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6516 |
convertImageToSuffix:outSuffix |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6517 |
|outFile filesToConvert| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6518 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6519 |
self withActivityIndicationDo:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6520 |
filesToConvert := self currentSelectedObjects copy. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6521 |
filesToConvert do:[:fileName | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6522 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6523 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6524 |
fileName isDirectory ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6525 |
|skip| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6526 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6527 |
skip := false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6528 |
outFile := fileName withSuffix:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6529 |
outFile exists ifTrue:[ |
4722 | 6530 |
|answer| |
6531 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6532 |
answer := Dialog |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6533 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6534 |
default:false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6535 |
answer isNil ifTrue:[AbortSignal raise]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6536 |
answer ifFalse:[ skip := true ]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6537 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6538 |
skip ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6539 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6540 |
convertImageFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6541 |
to:outFile |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6542 |
onError:[:errMsg | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6543 |
filesToConvert size == 1 ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6544 |
Dialog warn:errMsg |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6545 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6546 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6547 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6548 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6549 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6550 |
]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6551 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6552 |
self updateAndSelect:nil. |
4367 | 6553 |
] |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6554 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6555 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6556 |
self notify:nil. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6557 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6558 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6559 |
"Modified: / 20-05-2010 / 11:15:35 / cg" |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6560 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6561 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6562 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6563 |
self convertImageToSuffix:'xpm' |
4367 | 6564 |
! |
6565 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6566 |
convertImageUsingExternalFileToolsFrom:fileName toSuffix:outSuffix onError:exceptionBlock |
13121 | 6567 |
|inFile outFile chainOfConversions conversionStream |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6568 |
eachConversionSuffixCommandPair eachConversionCommand eachConversionSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6569 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6570 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6571 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6572 |
chainOfConversions isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6573 |
self warn:('Don''t know how to convert from %1 to %2' bindWith:fileName suffix with:outSuffix). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6574 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6575 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6576 |
conversionStream := chainOfConversions readStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6577 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6578 |
inFile := fileName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6579 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6580 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6581 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6582 |
eachConversionCommand == #readToXPM ifTrue:[ |
13121 | 6583 |
|image tempStreamXPM| |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6584 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6585 |
image := Image fromFile:(inFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6586 |
image isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6587 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6588 |
^ false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6589 |
]. |
13121 | 6590 |
tempStreamXPM := FileStream newTemporaryWithSuffix:'xpm'. |
6591 |
XPMReader save:image onStream:tempStreamXPM. |
|
6592 |
tempStreamXPM close. |
|
6593 |
inFile := tempStreamXPM fileName. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6594 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6595 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6596 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6597 |
[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6598 |
|command errOutput errMsg| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6599 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6600 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6601 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6602 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6603 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6604 |
self notify:(resources string:'Converting: %1 to %2...' with:fileName baseName with:eachConversionSuffix). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6605 |
|
13121 | 6606 |
outFile := (FileStream newTemporaryWithSuffix:eachConversionSuffix) close pathName. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6607 |
command := eachConversionCommand |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6608 |
bindWith:(inFile pathName) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6609 |
with:(outFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6610 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6611 |
errOutput := String writeStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6612 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6613 |
(OperatingSystem executeCommand:command errorTo:errOutput) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6614 |
errMsg := resources |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6615 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6616 |
with:inFile baseName allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6617 |
with:eachConversionSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6618 |
with:eachConversionCommand allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6619 |
with:errOutput contents. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6620 |
exceptionBlock value:errMsg. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6621 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6622 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6623 |
outFile delete. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6624 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6625 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6626 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6627 |
inFile := outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6628 |
eachConversionSuffixCommandPair := conversionStream next |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6629 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6630 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6631 |
] ifCurtailed:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6632 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6633 |
outFile delete. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6634 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6635 |
^ true. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6636 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6637 |
"Created: / 20-05-2010 / 11:05:50 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6638 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6639 |
|
3892 | 6640 |
createProjectAndOpenProjectBrowser |
6641 |
|nm f s directory| |
|
6642 |
||
6643 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 6644 |
directory := self currentDirectory. |
3892 | 6645 |
nm := directory baseName. |
6646 |
f := (directory construct:nm) withSuffix:'prj'. |
|
6647 |
f exists ifTrue:[ |
|
4414 | 6648 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
6649 |
^ self. |
|
3892 | 6650 |
]. |
6651 |
s := f writeStream. |
|
6652 |
s nextPutAll:' |
|
6653 |
name ''' , nm , ''' |
|
6654 |
type #classLibrary |
|
6655 |
package #''private:' , nm , ''' |
|
6656 |
prerequisites nil |
|
6657 |
||
6658 |
classes #( ) |
|
6659 |
'. |
|
6660 |
s close. |
|
6661 |
ProjectBrowser openOnFile:f. |
|
6662 |
! |
|
6663 |
||
5880 | 6664 |
doExecuteCommand |
6665 |
"execute an OperatingSystem-command" |
|
6666 |
||
6667 |
| action fileName| |
|
6668 |
||
6669 |
fileName := self firstSelectedFile. |
|
6670 |
action := [:command | |
|
6671 |
self addToCommandHistory:command for:fileName. |
|
6672 |
self executeCommand:command. |
|
6673 |
]. |
|
6674 |
self askForCommandFor:fileName thenDo:action |
|
6675 |
! |
|
6676 |
||
6677 |
doExecuteScript |
|
16941 | 6678 |
"execute a Smalltalk script" |
5880 | 6679 |
|
6680 |
|textHolder dialog template dummyClass dummyInstance| |
|
6681 |
||
6682 |
template := |
|
6683 |
'"/ Smalltalk script: |
|
6684 |
||
16084 | 6685 |
"/ the following variables are accessible: |
5880 | 6686 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
6687 |
"/ selectedFiles (= ...) |
|
6688 |
"/ |
|
6689 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
6690 |
"/ |
|
6691 |
"/ Useful operations are: |
|
6692 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
6693 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
6694 |
"/ directory directory |
|
6695 |
"/ |
|
6696 |
"/ example: move all files which match a aarticular pattern to |
|
6697 |
"/ a separate directory: |
|
6698 |
"/ |
|
6699 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
6700 |
"/ |
|
6701 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
6702 |
"/ |
|
6703 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
6704 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
6705 |
"/ idx := eachBaseNameString indexOf:$_. |
|
6706 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
6707 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
6708 |
"/ newDir := directory construct:prefix. |
|
6709 |
"/ newDir exists ifFalse:[ |
|
6710 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
6711 |
"/ newDir makeDirectory. |
|
6712 |
"/ ]. |
|
6713 |
"/ ]. |
|
6714 |
"/ newDir exists ifTrue:[ |
|
6715 |
"/ oldFile := directory construct:eachBaseNameString. |
|
6716 |
"/ newFile := newDir construct:rest. |
|
6717 |
"/ oldFile moveTo:newFile |
|
6718 |
"/ ] |
|
6719 |
"/ ] |
|
6720 |
"/ ] |
|
6721 |
'. |
|
6722 |
||
6723 |
LastScriptBlockString isNil ifTrue:[ |
|
6724 |
LastScriptBlockString := template. |
|
6725 |
]. |
|
6726 |
||
6727 |
textHolder := ValueHolder new. |
|
6728 |
dialog := Dialog |
|
6729 |
forRequestText:(resources string:'Enter script') |
|
6730 |
editViewClass:CodeView |
|
6731 |
lines:25 |
|
6732 |
columns:70 |
|
6733 |
initialAnswer:LastScriptBlockString |
|
6734 |
model:textHolder. |
|
6735 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
6736 |
dialog open. |
|
6737 |
dialog accepted ifFalse:[^ self]. |
|
6738 |
||
6739 |
LastScriptBlockString := textHolder value. |
|
6740 |
||
6741 |
Class classConventionViolationConfirmationQuerySignal |
|
6742 |
answer:true |
|
6743 |
do:[ |
|
6744 |
dummyClass := Object class |
|
6745 |
name:#Dummy |
|
6746 |
inEnvironment:nil |
|
6747 |
subclassOf:Object |
|
6748 |
instanceVariableNames:'directory selectedFiles' |
|
6749 |
variable:false |
|
6750 |
words:true |
|
6751 |
pointers:true |
|
6752 |
classVariableNames:'' |
|
6753 |
poolDictionaries:'' |
|
6754 |
category:#dummyCategory |
|
6755 |
comment:nil |
|
6756 |
changed:true. |
|
6757 |
]. |
|
6758 |
||
6759 |
dummyInstance := dummyClass basicNew. |
|
6760 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
6761 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
6762 |
||
6763 |
Compiler |
|
6764 |
evaluate:textHolder value |
|
6765 |
in:nil |
|
6766 |
receiver:dummyInstance |
|
6767 |
notifying:nil |
|
6768 |
logged:false |
|
6769 |
ifFail:[] |
|
6770 |
compile:true. |
|
6771 |
||
6772 |
"/ fileName := self firstSelectedFile. |
|
6773 |
"/ action := [:command | |
|
6774 |
"/ self addToCommandHistory:command for:fileName. |
|
6775 |
"/ self executeCommand:command. |
|
6776 |
"/ ]. |
|
6777 |
"/ self askForCommandFor:fileName thenDo:action |
|
6778 |
! |
|
6779 |
||
4230 | 6780 |
doMake |
7938 | 6781 |
|dir cmd| |
4230 | 6782 |
|
13856 | 6783 |
cmd := self makeCommandHolder value. |
6784 |
||
6785 |
"Make" |
|
6786 |
cmd = 'make' ifTrue:[ |
|
6787 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6788 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6789 |
dir notNil ifTrue:[ |
|
6790 |
(dir construct:'bmake.bat') exists ifTrue:[ |
|
6791 |
cmd := 'bmake.bat'. |
|
6792 |
] |
|
7938 | 6793 |
] |
13856 | 6794 |
]. |
6795 |
self executeCommand:cmd. |
|
6796 |
^self. |
|
6797 |
]. |
|
6798 |
||
6799 |
"Apache ant" |
|
6800 |
cmd = 'ant' ifTrue:[ |
|
6801 |
self executeCommand:cmd. |
|
6802 |
^self. |
|
6803 |
]. |
|
6804 |
||
6805 |
"Add more here..." |
|
6806 |
||
6807 |
"Modified (comment): / 13-04-2012 / 17:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4230 | 6808 |
! |
6809 |
||
8256 | 6810 |
doOpenCBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6811 |
"the CBrowser is an eXept-internal C-language IDE tool. |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6812 |
(no longer of much interest, since we have VC and eclipse, but this was written |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6813 |
20 years ago ;-)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6814 |
|
8256 | 6815 |
|destDir| |
6816 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6817 |
(CBrowser isNil or:[ CBrowser::Browser isNil ]) ifTrue:[ |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6818 |
Smalltalk loadPackage:'exept:CC' |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6819 |
]. |
8256 | 6820 |
destDir := self currentDirectory. |
6821 |
CBrowser::Browser openIn:destDir pathName |
|
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6822 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6823 |
"Modified: / 04-10-2011 / 13:41:31 / cg" |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6824 |
"Modified (comment): / 27-07-2012 / 20:41:40 / cg" |
8256 | 6825 |
! |
6826 |
||
7829 | 6827 |
doOpenExplorer |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6828 |
self currentDirectory asFilename openExplorer |
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6829 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6830 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
7829 | 6831 |
! |
6832 |
||
12473 | 6833 |
doOpenFinder |
6834 |
self currentDirectory asFilename openFinder |
|
6835 |
||
6836 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
|
6837 |
! |
|
6838 |
||
12811 | 6839 |
doOpenMonticelloBrowser |
12874
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
6840 |
MCMczReader isNil ifTrue:[ Smalltalk loadPackage:'stx:goodies/monticello']. |
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
6841 |
|
12811 | 6842 |
self withWaitCursorDo:[ |
6843 |
self currentSelectedFiles do:[:fn | |
|
6844 |
|version snapshot| |
|
6845 |
||
6846 |
fn suffix asLowercase = 'mcz' ifTrue:[ |
|
6847 |
version := MCMczReader versionFromFile:fn. |
|
6848 |
snapshot := version snapshot. |
|
6849 |
(Tools::ChangeSetBrowser2 |
|
6850 |
on: snapshot asChangeSet |
|
6851 |
label: version info name) |
|
6852 |
beTwoColumn; |
|
6853 |
targetNamespace:nil; |
|
6854 |
targetPackage:nil; |
|
6855 |
open |
|
6856 |
] |
|
6857 |
] |
|
6858 |
] |
|
6859 |
! |
|
6860 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6861 |
doOpenSettings |
8168 | 6862 |
self openSettingsDialog |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6863 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6864 |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6865 |
doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6866 |
"open using win32-shell" |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6867 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6868 |
|fileName| |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6869 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6870 |
fileName := self firstSelectedFile. |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6871 |
fileName notNil ifTrue:[ |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6872 |
OperatingSystem |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6873 |
openApplicationForDocument:fileName pathName |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6874 |
operation:#open |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6875 |
] |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6876 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6877 |
"Modified: / 21-07-2012 / 12:26:10 / cg" |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6878 |
! |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6879 |
|
7104 | 6880 |
editMode:aSymbol |
6881 |
self |
|
6882 |
applicationNamed:#FileApplicationNoteBook |
|
6883 |
ifPresentDo:[:appl | |
|
6884 |
|subApp| |
|
6885 |
||
6886 |
subApp := appl selectedApplication. |
|
6887 |
subApp notNil ifTrue:[ |
|
6888 |
^ subApp perform:aSymbol |
|
6889 |
] |
|
6890 |
]. |
|
6891 |
||
6892 |
"Created: / 11-09-2006 / 12:42:08 / cg" |
|
6893 |
! |
|
6894 |
||
6895 |
editModeInsert |
|
6896 |
self editMode:#editModeInsert |
|
6897 |
||
6898 |
"Created: / 11-09-2006 / 12:40:36 / cg" |
|
6899 |
! |
|
6900 |
||
6901 |
editModeInsertAndSelect |
|
6902 |
self editMode:#editModeInsertAndSelect |
|
6903 |
||
6904 |
"Created: / 11-09-2006 / 12:40:45 / cg" |
|
6905 |
! |
|
6906 |
||
6907 |
editModeOverwrite |
|
6908 |
self editMode:#editModeOverwrite |
|
6909 |
||
6910 |
"Modified: / 11-09-2006 / 12:42:26 / cg" |
|
6911 |
! |
|
6912 |
||
15528 | 6913 |
fetchFileByURL |
6914 |
|url destinationFilename| |
|
6915 |
||
6916 |
url := Dialog request:'URL to Fetch:' initialAnswer:'http://host/path'. |
|
6917 |
url isEmptyOrNil ifTrue:[^ self]. |
|
6918 |
url := url asURL. |
|
6919 |
||
6920 |
destinationFilename := Dialog request:'Download As:' initialAnswer:(UnixFilename named:url path) baseName. |
|
6921 |
destinationFilename isEmptyOrNil ifTrue:[^ self]. |
|
6922 |
||
6923 |
destinationFilename := self currentDirectory asFilename / destinationFilename. |
|
6924 |
destinationFilename exists ifTrue:[ |
|
6925 |
|answer| |
|
6926 |
||
6927 |
answer := Dialog |
|
6928 |
confirm:(resources string:'Overwrite existing %1 ?' with:destinationFilename baseName allBold) |
|
6929 |
default:false. |
|
6930 |
answer ~~ true ifTrue:[^ self]. |
|
6931 |
]. |
|
6932 |
self withActivityIndicationDo:[ |
|
6933 |
self notify:(resources string:'Fetching %1' with:url). |
|
6934 |
HTTPInterface get:url destinationFile:destinationFilename. |
|
6935 |
self notify:nil. |
|
6936 |
] |
|
6937 |
||
6938 |
"Modified: / 20-05-2010 / 11:15:35 / cg" |
|
6939 |
! |
|
6940 |
||
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6941 |
fileContentsAsByteArray |
17769 | 6942 |
|file fileSize| |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6943 |
|
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6944 |
file := self firstSelectedFile. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6945 |
file isNil ifTrue:[^ self ]. |
17769 | 6946 |
|
6947 |
file := file asFilename. |
|
6948 |
||
6949 |
(fileSize := file fileSize) > (1024*1024) ifTrue:[ |
|
6950 |
fileSize > (128*1024*1024) ifTrue:[ |
|
11889 | 6951 |
Dialog warn:(resources string:'File is too big'). |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6952 |
^ self. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6953 |
]. |
17769 | 6954 |
(Dialog confirm:(resources |
6955 |
string:'File is big (%1) - proceed?' |
|
6956 |
with:(UnitConverter fileSizeStringFor:fileSize)) |
|
6957 |
) ifFalse:[^ self]. |
|
6958 |
]. |
|
6959 |
file binaryContentsOfEntireFile inspect |
|
6960 |
||
6961 |
"Modified: / 19-11-2017 / 14:58:43 / cg" |
|
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6962 |
! |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6963 |
|
3892 | 6964 |
fileFileIn |
6965 |
"fileIn the selected file(s)" |
|
6966 |
||
6967 |
self fileFileInLazy:false |
|
6968 |
! |
|
6969 |
||
7324 | 6970 |
fileFileIn:aFilename lazy:lazy |
6971 |
"fileIn a file" |
|
6972 |
||
6973 |
self withActivityIndicationDo:[ |
|
6974 |
self notify:('File in:', aFilename asFilename baseName). |
|
6975 |
self singleFileFileIn:aFilename lazy:lazy. |
|
6976 |
self notify:nil. |
|
6977 |
] |
|
6978 |
||
6979 |
"Created: / 20-09-2006 / 14:28:35 / cg" |
|
6980 |
! |
|
6981 |
||
3892 | 6982 |
fileFileInLazy |
6983 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
6984 |
||
6985 |
self fileFileInLazy:true |
|
6986 |
! |
|
6987 |
||
6988 |
fileFileInLazy:lazy |
|
6989 |
"fileIn the selected file(s)" |
|
6990 |
||
7324 | 6991 |
self currentSelectedFiles do:[:fileName | |
6992 |
self fileIn:fileName lazy:lazy |
|
6993 |
]. |
|
6994 |
||
6995 |
"Modified: / 20-09-2006 / 14:29:24 / cg" |
|
3892 | 6996 |
! |
6997 |
||
12497 | 6998 |
fileFileInPackage |
6999 |
"assuming the current directory is a package directory, load it" |
|
7000 |
||
7001 |
|packageDir dir path top packageID| |
|
7002 |
||
7003 |
"/ find a reasonable package-id (walk up until we find stx) |
|
7004 |
path := ''. |
|
7005 |
dir := packageDir := self currentDirectory. |
|
7006 |
||
7007 |
top := (Smalltalk projectDirectoryForPackage:'stx') asFilename. |
|
7008 |
[ (dir / 'stx') = top ] whileFalse:[ |
|
7009 |
path := dir baseName , '/' , path. |
|
7010 |
dir := dir directory. |
|
7011 |
dir isNil ifTrue:[ |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7012 |
Dialog warn:'Could not find a path from "stx" to the current directory.'. |
12497 | 7013 |
"/ should ask the user for a packageID and proceed... |
7014 |
^ self. |
|
7015 |
]. |
|
7016 |
]. |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7017 |
packageID := path copyButLast:1. |
12497 | 7018 |
Smalltalk loadPackage:packageID fromDirectory:packageDir asAutoloaded:true |
7019 |
! |
|
7020 |
||
3892 | 7021 |
fileFileInToNameSpace |
7022 |
"fileIn the selected file(s)<into a nameSpace" |
|
7023 |
||
7024 |
|ns listOfKnownNameSpaces| |
|
7025 |
||
7026 |
listOfKnownNameSpaces := Set new. |
|
7027 |
NameSpace |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
7028 |
allNameSpaces |
4414 | 7029 |
do:[:eachNameSpace | |
7030 |
listOfKnownNameSpaces add:eachNameSpace name |
|
7031 |
]. |
|
3892 | 7032 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
7033 |
||
7034 |
ns := Dialog |
|
4414 | 7035 |
request:'During fileIn, new classes are created in nameSpace:' |
7036 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
7037 |
list:listOfKnownNameSpaces. |
|
3892 | 7038 |
ns isEmptyOrNil ifTrue:[^ self]. |
7039 |
||
7040 |
LastEnforcedNameSpace := ns. |
|
7041 |
ns := NameSpace name:ns. |
|
7042 |
||
7043 |
Class nameSpaceQuerySignal |
|
4414 | 7044 |
answer:ns |
7045 |
do:[ |
|
7046 |
self fileFileInLazy:false |
|
7047 |
] |
|
3892 | 7048 |
! |
7049 |
||
7050 |
fileFindAllDuplicates |
|
7051 |
"scan directory and all subdirs for duplicate files" |
|
7052 |
||
7053 |
|fileNames dir infoDir filesBySize |
|
7054 |
result info dirPrefix myName stream textBox maxLength directories| |
|
7055 |
||
7056 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7057 |
self withActivityIndicationDo:[ |
4414 | 7058 |
result := Dictionary new. |
7059 |
myName := self class name asString. |
|
7060 |
directories := self currentSelectedDirectories. |
|
7061 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 7062 |
|
4414 | 7063 |
dir := directories first. |
3892 | 7064 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7065 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7066 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7067 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 7068 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
7069 |
with:ex pathName |
|
7070 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7071 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7072 |
]. |
4765 | 7073 |
fileNames := fileNames |
7074 |
collect:[:fn | dir construct:fn] |
|
7075 |
thenSelect:[:fn | fn isDirectory not]. |
|
3892 | 7076 |
|
7077 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 7078 |
infoDir := Dictionary new. |
7079 |
fileNames do:[:fn | |
|
7080 |
infoDir at:fn put:(fn fileSize) |
|
7081 |
]. |
|
7082 |
||
14497 | 7083 |
"/ for each, get the file's size. |
4414 | 7084 |
"/ in a first pass, look for files of the same size and |
7085 |
"/ compare them ... |
|
3892 | 7086 |
|
7087 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 7088 |
filesBySize := Dictionary new. |
7089 |
infoDir keysAndValuesDo:[:fn :sz | |
|
7090 |
|entry| |
|
7091 |
||
7092 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7093 |
entry add:fn. |
|
7094 |
]. |
|
7095 |
||
7096 |
"/ any of same size ? |
|
3892 | 7097 |
|
7098 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 7099 |
filesBySize do:[:entry | |
7100 |
|files| |
|
7101 |
||
7102 |
entry size > 1 ifTrue:[ |
|
7103 |
files := entry asArray. |
|
7104 |
1 to:files size-1 do:[:idx1 | |
|
7105 |
idx1+1 to:files size do:[:idx2 | |
|
7106 |
|fn1 fn2| |
|
7107 |
||
7108 |
fn1 := files at:idx1. |
|
7109 |
fn2 := files at:idx2. |
|
3892 | 7110 |
|
7111 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 7112 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
7113 |
"/ compare the files |
|
7114 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7115 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 7116 |
result at:fn1 put:fn2. |
7117 |
] |
|
7118 |
] |
|
7119 |
] |
|
7120 |
] |
|
7121 |
] |
|
7122 |
]. |
|
3892 | 7123 |
|
7124 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 7125 |
dirPrefix := dir pathName. |
7126 |
result := result associations. |
|
7127 |
result := result collect:[:assoc | |
|
7128 |
|f1 f2| |
|
7129 |
||
7130 |
f1 := assoc key name. |
|
7131 |
f2 := assoc value name. |
|
7132 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
7133 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
7134 |
]. |
|
7135 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
7136 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
7137 |
]. |
|
7138 |
f1 < f2 ifTrue:[ |
|
7139 |
f2 -> f1 |
|
7140 |
] ifFalse:[ |
|
7141 |
f1 -> f2 |
|
7142 |
] |
|
7143 |
]. |
|
7144 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
7145 |
||
7146 |
info := OrderedCollection new. |
|
7147 |
result do:[:assoc | |
|
7148 |
info add:(assoc key , ' same as ' , assoc value) |
|
7149 |
]. |
|
7150 |
info isEmpty ifTrue:[ |
|
11889 | 7151 |
Dialog information:(resources string:'No duplicate files found.'). |
5543 | 7152 |
^ self. |
4414 | 7153 |
]. |
3892 | 7154 |
]. |
7155 |
||
15589 | 7156 |
stream := CharacterWriteStream new. |
11688 | 7157 |
stream nextPutAllLines:info. |
5542 | 7158 |
|
3892 | 7159 |
textBox := TextBox new. |
7160 |
textBox initialText:(stream contents). |
|
5542 | 7161 |
stream close. |
11889 | 7162 |
textBox title:(resources string:'File duplicates in directory: %1' with:dir asString). |
3892 | 7163 |
textBox readOnly:true. |
7164 |
textBox noCancel. |
|
11889 | 7165 |
textBox label:(resources string:'Duplicates in %1' with:dir asString). |
3892 | 7166 |
maxLength := 10. |
7167 |
info do:[: el | |
|
4414 | 7168 |
maxLength := maxLength max:(el size). |
3892 | 7169 |
]. |
7170 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 7171 |
textBox maxExtent:Screen current extent. |
7172 |
textBox openModeless. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7173 |
|
11688 | 7174 |
"Modified: / 27-07-2012 / 09:29:00 / cg" |
3892 | 7175 |
! |
7176 |
||
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7177 |
fileFindDuplicateFile |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7178 |
"scan directory for duplicates of the selected files" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7179 |
|
10306 | 7180 |
|files filesBySize samePerFile stream textBox mustHaveMatches| |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7181 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7182 |
files := self currentSelectedFiles. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7183 |
files isEmpty ifTrue:[^ self]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7184 |
|
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7185 |
self withWaitCursorDo:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7186 |
filesBySize := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7187 |
files do:[:fn | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7188 |
|sz entry| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7189 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7190 |
sz := fn asFilename fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7191 |
(filesBySize at:sz ifAbsentPut:[Set new]) add:fn. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7192 |
]. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7193 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7194 |
samePerFile := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7195 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7196 |
self currentSelectedDirectories do:[:eachDir | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7197 |
eachDir recursiveDirectoryContentsAsFilenamesDo:[:eachFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7198 |
eachFile isDirectory ifFalse:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7199 |
|sz possibleMatches| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7200 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7201 |
sz := eachFile fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7202 |
possibleMatches := filesBySize at:sz ifAbsent:nil. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7203 |
possibleMatches notNil ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7204 |
possibleMatches do:[:eachFileWithSameSize | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7205 |
eachFileWithSameSize ~= eachFile ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7206 |
(eachFileWithSameSize sameContentsAs:eachFile) ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7207 |
(samePerFile at:eachFileWithSameSize ifAbsentPut:[Set new]) add:eachFile |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7208 |
] |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7209 |
] |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7210 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7211 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7212 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7213 |
] |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7214 |
]. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7215 |
]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7216 |
|
15589 | 7217 |
stream := CharacterWriteStream with:'Duplicates:'. |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7218 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7219 |
do:[:origFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7220 |
|sameFiles| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7221 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7222 |
sameFiles := samePerFile at:origFile. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7223 |
stream nextPutLine:origFile baseName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7224 |
(sameFiles asOrderedCollection collect:[:each | each baseName]) sort do:[:eachSameName | |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7225 |
stream nextPutAll:' '; nextPutLine:eachSameName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7226 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7227 |
]. |
10306 | 7228 |
stream nextPutLine:'Files without duplicates:'. |
7229 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7230 |
do:[:origFile | |
|
7231 |
|sameFiles| |
|
7232 |
||
7233 |
sameFiles := samePerFile at:origFile. |
|
7234 |
sameFiles isEmpty ifTrue:[ |
|
7235 |
stream nextPutLine:origFile baseName. |
|
7236 |
]. |
|
7237 |
]. |
|
7238 |
||
7239 |
mustHaveMatches := Dialog request:'Must have for duplicates matching ?:' initialAnswer:(LastMustMatchPattern ? '[a-z][a-z][a-z]_[0-9][0-9][0-9].*'). |
|
7240 |
mustHaveMatches notEmptyOrNil ifTrue:[ |
|
7241 |
LastMustMatchPattern := mustHaveMatches. |
|
7242 |
||
7243 |
stream nextPutLine:'Files without duplicates in xxx_nnn.jpg:'. |
|
7244 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7245 |
do:[:origFile | |
|
7246 |
|sameFiles| |
|
7247 |
||
7248 |
sameFiles := samePerFile at:origFile. |
|
7249 |
sameFiles notEmpty ifTrue:[ |
|
7250 |
(sameFiles contains:[:file | mustHaveMatches match:file baseName]) ifFalse:[ |
|
7251 |
stream nextPutLine:origFile baseName. |
|
7252 |
] |
|
7253 |
]. |
|
7254 |
]. |
|
7255 |
]. |
|
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7256 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7257 |
textBox := TextBox new. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7258 |
textBox initialText:(stream contents). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7259 |
textBox title:'Files with same contents'. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7260 |
textBox readOnly:true. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7261 |
textBox noCancel. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7262 |
textBox extent:(350@400). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7263 |
textBox maxExtent:Screen current extent. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7264 |
textBox openModeless. "/ showAtPointer. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7265 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7266 |
"Created: / 11-07-2011 / 12:39:44 / cg" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7267 |
! |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7268 |
|
3892 | 7269 |
fileFindDuplicates |
7270 |
"scan directory for duplicate files" |
|
7271 |
||
8510 | 7272 |
|infoDir filesBySize result info stream textBox maxLength directories allFiles titleStream size| |
7273 |
||
7274 |
directories := self currentSelectedDirectories. |
|
3892 | 7275 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7276 |
self withActivityIndicationDo:[ |
4355 | 7277 |
result := Dictionary new. |
7278 |
||
7279 |
directories := self currentSelectedDirectories. |
|
7280 |
directories isEmpty ifTrue:[^ self]. |
|
7281 |
||
8510 | 7282 |
allFiles := self allFilesInSelectedDirectoriesForWhich:[:f | true]. |
4355 | 7283 |
|
7284 |
infoDir := Dictionary new. |
|
7285 |
allFiles do:[:fn | |
|
7286 |
infoDir at:fn put:(fn info) |
|
7287 |
]. |
|
7288 |
||
14497 | 7289 |
"/ for each, get the file's size. |
4355 | 7290 |
"/ in a first pass, look for files of the same size and |
7291 |
"/ compare them ... |
|
7292 |
||
7293 |
filesBySize := Dictionary new. |
|
7294 |
infoDir keysAndValuesDo:[:fn :info | |
|
7295 |
|sz entry| |
|
7296 |
||
7297 |
sz := info size. |
|
7298 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7299 |
entry add:fn. |
|
7300 |
]. |
|
7301 |
||
7302 |
"/ any of same size ? |
|
7303 |
||
7304 |
filesBySize do:[:entry | |
|
7305 |
|files| |
|
7306 |
||
7307 |
entry size > 1 ifTrue:[ |
|
7308 |
files := entry asArray. |
|
7309 |
1 to:files size-1 do:[:idx1 | |
|
7310 |
idx1+1 to:files size do:[:idx2 | |
|
7311 |
|fn1 fn2| |
|
7312 |
||
7313 |
fn1 := files at:idx1. |
|
7314 |
fn2 := files at:idx2. |
|
7315 |
||
7316 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
7317 |
"/ compare the files |
|
7318 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7319 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4355 | 7320 |
result at:fn1 put:fn2. |
7321 |
] |
|
7322 |
] |
|
7323 |
] |
|
7324 |
] |
|
7325 |
] |
|
7326 |
]. |
|
7327 |
||
7328 |
result := result associations. |
|
7329 |
result := result collect:[:assoc | |
|
7330 |
|f1 f2| |
|
7331 |
||
7332 |
f1 := assoc key asString. |
|
7333 |
f2 := assoc value asString. |
|
7334 |
f1 < f2 ifTrue:[ |
|
7335 |
f2 -> f1 |
|
7336 |
] ifFalse:[ |
|
7337 |
f1 -> f2 |
|
7338 |
] |
|
7339 |
]. |
|
5789 | 7340 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
7341 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
4355 | 7342 |
|
7343 |
info := OrderedCollection new. |
|
7344 |
size := self getBestDirectory asString size. |
|
7345 |
result do:[:assoc | |
|
7346 |
|fn1 fn2| |
|
7347 |
||
7348 |
fn1 := assoc key. |
|
7349 |
fn2 := assoc value. |
|
7350 |
size > 1 ifTrue:[ |
|
7351 |
fn1 := ('..', (fn1 copyFrom:(size + 1))). |
|
7352 |
fn2 := ('..', (fn2 copyFrom:(size + 1))). |
|
7353 |
]. |
|
7354 |
(fn1 includes:Character space) ifTrue:[ |
|
7355 |
fn1 := '"' , fn1 , '"' |
|
7356 |
]. |
|
7357 |
(fn2 includes:Character space) ifTrue:[ |
|
7358 |
fn2 := '"' , fn2 , '"' |
|
7359 |
]. |
|
7360 |
info add:(fn1 , ' same as ' , fn2) |
|
7361 |
]. |
|
7362 |
info isEmpty ifTrue:[ |
|
5543 | 7363 |
Dialog information:'No duplicate files found.'. |
7364 |
^ self. |
|
4355 | 7365 |
]. |
3892 | 7366 |
]. |
15589 | 7367 |
stream := CharacterWriteStream new. |
11688 | 7368 |
stream nextPutAllLines:info. |
7369 |
||
15589 | 7370 |
titleStream := CharacterWriteStream with:'File duplicates in directory'. |
3892 | 7371 |
directories size == 1 ifTrue:[ |
12602 | 7372 |
titleStream nextPutAll:'y: '; nextPutAll: directories first asString. |
3892 | 7373 |
] ifFalse:[ |
4535 | 7374 |
titleStream nextPutLine:'ies: '. |
4355 | 7375 |
directories do:[:dir| |
7376 |
size > 1 ifTrue:[ |
|
7377 |
titleStream nextPutAll:'..'. |
|
4535 | 7378 |
titleStream nextPutLine:((dir asString) copyFrom:(size + 1)). |
4355 | 7379 |
] ifFalse:[ |
4535 | 7380 |
titleStream nextPutLine:(dir asString). |
4355 | 7381 |
]. |
7382 |
] |
|
3892 | 7383 |
]. |
5543 | 7384 |
|
3892 | 7385 |
textBox := TextBox new. |
7386 |
textBox initialText:(stream contents). |
|
7387 |
textBox title:(titleStream contents). |
|
7388 |
textBox readOnly:true. |
|
7389 |
textBox noCancel. |
|
14715 | 7390 |
stream := WriteStream on:''. |
7391 |
stream nextPutAll:'Duplicates in '. |
|
4170 | 7392 |
directories do:[ :aDirectory | |
4355 | 7393 |
stream nextPutAll:aDirectory baseName. |
7394 |
stream space. |
|
4050 | 7395 |
]. |
4170 | 7396 |
textBox label:stream contents. |
3892 | 7397 |
maxLength := 10. |
7398 |
info do:[: el | |
|
4355 | 7399 |
maxLength := maxLength max:(el size). |
3892 | 7400 |
]. |
5092 | 7401 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
7402 |
textBox maxExtent:Screen current extent. |
|
4355 | 7403 |
textBox openModeless. "/ showAtPointer. |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7404 |
|
11688 | 7405 |
"Modified: / 27-07-2012 / 09:29:14 / cg" |
3892 | 7406 |
! |
7407 |
||
7408 |
fileFindFile |
|
5961 | 7409 |
|filename| |
7410 |
||
7411 |
filename := self firstSelectedFileName. |
|
7412 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7413 |
filename := Filename homeDirectory. |
3892 | 7414 |
]. |
4101 | 7415 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 7416 |
! |
7417 |
||
8510 | 7418 |
fileFindSimilarImages |
7419 |
"scan directory for similar image files" |
|
7420 |
||
8512 | 7421 |
|result stream textBox directories imageFiles histogramsV histogramsH |
7422 |
similarV similarH similar alreadyPrinted| |
|
8510 | 7423 |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7424 |
self withWaitCursorDo:[ |
8510 | 7425 |
self withActivityIndicationDo:[ |
7426 |
result := Dictionary new. |
|
7427 |
||
7428 |
directories := self currentSelectedDirectories. |
|
7429 |
directories isEmpty ifTrue:[^ self]. |
|
7430 |
||
13714 | 7431 |
imageFiles := self allFilesInSelectedDirectoriesForWhich:[:f | f mimeTypeFromName isImageType]. |
8511 | 7432 |
"/ imageFiles := imageFiles select:[:f | f baseName startsWith:'foo']. |
7433 |
imageFiles sort:[:a :b | a pathName < b pathName]. |
|
7434 |
||
8510 | 7435 |
"/ for each, get the color histogram |
7436 |
histogramsV := Dictionary new. |
|
7437 |
histogramsH := Dictionary new. |
|
7438 |
imageFiles do:[:fn | |
|
7439 |
|hist image| |
|
7440 |
||
7441 |
image := Image fromFile:fn. |
|
7442 |
Transcript showCR:'generating histogram for ',fn baseName. |
|
7443 |
hist := ImageColorHistogram new forImage:image. |
|
7444 |
histogramsV at:fn put:(hist histogramVectorV). |
|
7445 |
histogramsH at:fn put:(hist histogramVectorH). |
|
7446 |
]. |
|
7447 |
||
7448 |
similarH := Dictionary new. |
|
7449 |
similarV := Dictionary new. |
|
7450 |
similar := Dictionary new. |
|
7451 |
||
8512 | 7452 |
(self firstSelectedFile notNil |
7453 |
ifTrue:[ Array with:self firstSelectedFile ] |
|
7454 |
ifFalse:[ imageFiles ]) |
|
7455 |
do:[:eachFile1 | |
|
8510 | 7456 |
|setOfSimilar distancesV distancesH| |
7457 |
||
7458 |
distancesV := OrderedCollection new. |
|
7459 |
distancesH := OrderedCollection new. |
|
7460 |
setOfSimilar := OrderedCollection new. |
|
7461 |
||
7462 |
imageFiles do:[:eachFile2 | |
|
7463 |
|v1 v2 dV dH| |
|
7464 |
||
7465 |
eachFile1 ~= eachFile2 ifTrue:[ |
|
7466 |
v1 := histogramsV at:eachFile1. |
|
7467 |
v2 := histogramsV at:eachFile2. |
|
7468 |
dV := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7469 |
distancesV add:(eachFile2 -> dV). |
|
7470 |
v1 := histogramsH at:eachFile1. |
|
7471 |
v2 := histogramsH at:eachFile2. |
|
7472 |
dH := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7473 |
distancesH add:(eachFile2 -> dH). |
|
7474 |
(dV < 10000 and:[dH < 10000]) ifTrue:[ |
|
8512 | 7475 |
setOfSimilar add:eachFile2->(dV + dH). |
8510 | 7476 |
]. |
7477 |
] |
|
7478 |
]. |
|
7479 |
distancesV sort:[:a1 :a2 | a1 value < a2 value]. |
|
7480 |
distancesH sort:[:a1 :a2 | a1 value < a2 value]. |
|
7481 |
similarV at:eachFile1 put:distancesV. |
|
7482 |
similarH at:eachFile1 put:distancesH. |
|
7483 |
setOfSimilar notEmpty ifTrue:[ similar at:eachFile1 put:setOfSimilar ]. |
|
7484 |
]. |
|
7485 |
||
7486 |
similar isEmpty ifTrue:[ |
|
7487 |
Dialog information:'No similarities found.'. |
|
7488 |
^ self. |
|
7489 |
]. |
|
7490 |
]. |
|
7491 |
||
15589 | 7492 |
stream := CharacterWriteStream new. |
8512 | 7493 |
alreadyPrinted := Set new. |
7494 |
||
7495 |
imageFiles do:[:eachFile | |
|
7496 |
|eachSet| |
|
7497 |
||
7498 |
(alreadyPrinted includes:eachFile) ifFalse:[ |
|
7499 |
eachSet := similar at:eachFile ifAbsent:nil. |
|
7500 |
eachSet notNil ifTrue:[ |
|
7501 |
stream nextPutLine:eachFile pathName. |
|
7502 |
eachSet do:[:info | |
|
7503 |
|fn2 dist| |
|
7504 |
||
7505 |
fn2 := info key. |
|
7506 |
dist := info value. |
|
7507 |
stream nextPutAll:' '. |
|
7508 |
stream nextPutAll:fn2 pathName. |
|
7509 |
stream nextPutLine:' (',dist printString,')'. |
|
7510 |
alreadyPrinted add:fn2. |
|
7511 |
]. |
|
7512 |
stream cr. |
|
7513 |
]. |
|
8510 | 7514 |
]. |
7515 |
]. |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7516 |
]. |
8510 | 7517 |
|
7518 |
textBox := TextBox new. |
|
7519 |
textBox initialText:(stream contents). |
|
7520 |
textBox title:'File similarities:'. |
|
7521 |
textBox readOnly:true. |
|
7522 |
textBox noCancel. |
|
7523 |
||
7524 |
textBox label:'File similarities'. |
|
7525 |
textBox extent:(400@((similar size max:40)* 10)). |
|
7526 |
textBox maxExtent:Screen current extent. |
|
7527 |
textBox openModeless. "/ showAtPointer. |
|
7528 |
||
7529 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
|
7530 |
! |
|
7531 |
||
4618 | 7532 |
fileHexDump |
17744 | 7533 |
|file item| |
4618 | 7534 |
|
7535 |
file := self firstSelectedFile. |
|
7536 |
file notNil ifTrue:[ |
|
7537 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 7538 |
self |
7539 |
applicationNamed:#FileApplicationNoteBook |
|
7540 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 7541 |
]. |
17744 | 7542 |
|
7543 |
"Modified (format): / 12-11-2017 / 11:19:56 / cg" |
|
4618 | 7544 |
! |
7545 |
||
7324 | 7546 |
fileIn:aFilename |
7547 |
"fileIn a file" |
|
7548 |
||
7549 |
self fileIn:aFilename lazy:false |
|
7550 |
||
7551 |
"Created: / 20-09-2006 / 14:30:06 / cg" |
|
7552 |
! |
|
7553 |
||
7554 |
fileIn:aFilename lazy:lazy |
|
7555 |
"fileIn a file" |
|
7556 |
||
7557 |
self withActivityIndicationDo:[ |
|
7558 |
self notify:('File in:', aFilename asFilename baseName). |
|
7559 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7560 |
self notify:nil. |
|
7561 |
] |
|
7562 |
||
7563 |
"Created: / 20-09-2006 / 14:29:21 / cg" |
|
7564 |
! |
|
7565 |
||
4930 | 7566 |
filterSelectedFiles:whichFilter |
7567 |
|selectedFiles numFiles msg filterBlock| |
|
7568 |
||
7560 | 7569 |
selectedFiles := self currentSelectedObjects. |
4930 | 7570 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
7571 |
||
7572 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
7573 |
numFiles > 1 ifTrue:[ |
|
7574 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
7575 |
]. |
|
7576 |
||
7577 |
(Dialog |
|
6352 | 7578 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 7579 |
initialAnswer:false |
7580 |
) ifFalse:[ |
|
7581 |
^ self |
|
7582 |
]. |
|
7583 |
||
7584 |
whichFilter == #rot13 ifTrue:[ |
|
7585 |
filterBlock := [:charIn | charIn rot13 ]. |
|
7586 |
]. |
|
7587 |
"/ add more here... |
|
7588 |
||
7589 |
filterBlock isNil ifTrue:[ |
|
7590 |
self information:'No such filter: ' , whichFilter. |
|
7591 |
^ self. |
|
7592 |
]. |
|
7593 |
||
7594 |
selectedFiles do:[:fileName | |
|
7595 |
|s| |
|
7596 |
||
7597 |
self notify:('Processing:', fileName baseName). |
|
7598 |
fileName isDirectory ifFalse:[ |
|
7599 |
[ |
|
7600 |
|inFile outFile in out| |
|
7601 |
||
7602 |
inFile := fileName asFilename. |
|
7603 |
outFile := (fileName pathName , '.filter') asFilename. |
|
7604 |
||
7605 |
[ |
|
7606 |
|charIn charOut| |
|
7607 |
||
7608 |
in := inFile readStream. |
|
7609 |
out := outFile writeStream. |
|
7610 |
[in atEnd] whileFalse:[ |
|
7611 |
charIn := in next. |
|
7612 |
charOut := filterBlock value:charIn. |
|
7613 |
out nextPut:charOut. |
|
7614 |
]. |
|
13683 | 7615 |
out close. out:= nil. |
4930 | 7616 |
outFile renameTo:inFile. |
7617 |
] ensure:[ |
|
7618 |
out notNil ifTrue:[ out close ]. |
|
7619 |
in notNil ifTrue:[ in close ]. |
|
7620 |
outFile delete. |
|
7621 |
] |
|
7622 |
] on:FileStream openErrorSignal do:[:ex| |
|
7623 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
7624 |
]. |
|
7625 |
] |
|
7626 |
]. |
|
6190 | 7627 |
self notify:nil. |
7560 | 7628 |
|
7629 |
"Modified: / 04-12-2006 / 13:14:48 / cg" |
|
4930 | 7630 |
! |
7631 |
||
9784 | 7632 |
forEachParsedXmlFileDo:aBlock |
7633 |
"parse all selected XML files, for each dom-tree, evaluate aBlock" |
|
7634 |
||
7635 |
self withActivityIndicationDo:[ |
|
7636 |
| selectedFiles xmlDocument | |
|
7637 |
||
7638 |
selectedFiles:= self currentSelectedFiles. |
|
7639 |
selectedFiles do:[:fileName | |
|
7640 |
XML::XMLSignal handle:[:ex | |
|
14551 | 7641 |
Dialog |
7642 |
information:('Error while reading XML:\ %1' bindWith:ex description) withCRs |
|
7643 |
title:'XML Error'. |
|
9784 | 7644 |
^ self. |
7645 |
] do:[ |
|
7646 |
|s d magic encoder document| |
|
7647 |
||
7648 |
s := fileName asFilename readStream. |
|
14012 | 7649 |
[ |
7650 |
s binary. |
|
7651 |
magic := (s next:2). |
|
7652 |
magic = #[254 255] ifTrue:[ |
|
7653 |
"/ UTF16BE |
|
7654 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16be. |
|
7655 |
] ifFalse:[ |
|
7656 |
magic = #[255 254] ifTrue:[ |
|
7657 |
"/ UTF16LE |
|
7658 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16le. |
|
7659 |
]. |
|
7660 |
]. |
|
7661 |
] ensure:[ |
|
7662 |
s close. |
|
7663 |
]. |
|
9784 | 7664 |
document notNil ifTrue:[ |
7665 |
xmlDocument := XML::XMLParser |
|
7666 |
processDocumentString:document |
|
7667 |
beforeScanDo:[:parse| parse validate:false]. |
|
7668 |
] ifFalse:[ |
|
7669 |
xmlDocument := XML::XMLParser |
|
7670 |
processDocumentInFilename:fileName |
|
7671 |
beforeScanDo:[:parse| parse validate:false]. |
|
7672 |
] |
|
7673 |
]. |
|
7674 |
aBlock value:xmlDocument. |
|
7675 |
]. |
|
7676 |
] |
|
7677 |
||
7678 |
"Created: / 17-02-2011 / 13:58:21 / cg" |
|
7679 |
! |
|
7680 |
||
8832 | 7681 |
forEachSelectedFileIgnoringDirectories:ignoreDirs do:aBlock |
7682 |
|numItems path files| |
|
7683 |
||
7684 |
files := self currentSelectedFiles. |
|
7685 |
||
7686 |
(numItems := files size) > 2 ifTrue:[ |
|
7687 |
(self |
|
7688 |
confirm:(resources string:'Open for each of the %1 items ?' |
|
7689 |
with:numItems)) ifFalse:[^ self]. |
|
7690 |
]. |
|
7691 |
||
7692 |
self withActivityIndicationDo:[ |
|
7693 |
files do:[:fileName | |
|
7694 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
7695 |
fileName isAbsolute ifTrue:[ |
|
17239 | 7696 |
path := fileName name. |
8832 | 7697 |
] ifFalse:[ |
7698 |
path := fileName pathName. |
|
7699 |
]. |
|
7700 |
aBlock value:path |
|
7701 |
] |
|
7702 |
]. |
|
7703 |
]. |
|
17239 | 7704 |
|
7705 |
"Modified: / 19-01-2017 / 16:57:03 / stefan" |
|
8832 | 7706 |
! |
7707 |
||
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7708 |
generateDetachedSignaturesForSelectedFiles |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7709 |
"generate detached signature (pkcs7) files from the contents of the selected files. |
16941 | 7710 |
For Smalltalk text files, better use #generateSignaturesForSelectedFiles." |
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7711 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7712 |
self withActivityIndicationDo:[ |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7713 |
self currentSelectedFiles do:[:fn | |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7714 |
|data hash signature signatureFile| |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7715 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7716 |
self notify:'Generating detached signature file for ', (fn baseName),'...'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7717 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7718 |
data := fn contentsAsString. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7719 |
hash := SHA1Stream hashValueOf:data. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7720 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7721 |
signature := Expecco::KeyFileGenerator new signExpeccoCode:hash. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7722 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7723 |
signatureFile := fn addSuffix:'sig'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7724 |
signatureFile contents:signature. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7725 |
]. |
13677 | 7726 |
self updateCurrentDirectoryWithReread. |
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7727 |
self notify:nil. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7728 |
] |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7729 |
! |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7730 |
|
15211 | 7731 |
generatePatchInstallerForSelectedFiles |
7732 |
"generate an expecco patch, which installs the selected file(s). |
|
7733 |
Opens a dialog asking for the target directory and if the patch should be signed" |
|
7734 |
||
7735 |
|dialog targetDirHolder targetDir |
|
7736 |
generateSignedPatchHolder patchFileNameHolder patchFileName| |
|
7737 |
||
7738 |
targetDirHolder := '.' asValue. |
|
7739 |
generateSignedPatchHolder := true asValue. |
|
7740 |
patchFileNameHolder := '/tmp/00nn_patchFile.st' asValue. |
|
7741 |
||
7742 |
dialog := Dialog new. |
|
7743 |
dialog label:(resources string:'Patch Installer for File(s)'). |
|
7744 |
dialog addTextLabel:'Patchfile Name' adjust:#left. |
|
7745 |
dialog addInputFieldOn:patchFileNameHolder tabable:true. |
|
7746 |
dialog addTextLabel:'Target directory (relative to executable''s directory at execution time)' adjust:#left. |
|
7747 |
dialog addInputFieldOn:targetDirHolder tabable:true. |
|
7748 |
dialog addCheckBox:'Generate Signed Patch' on:generateSignedPatchHolder. |
|
7749 |
dialog addAbortAndOkButtons. |
|
7750 |
dialog open. |
|
7751 |
||
7752 |
dialog accepted ifFalse:[^ self]. |
|
7753 |
||
7754 |
targetDir := targetDirHolder value asFilename. |
|
7755 |
patchFileName := patchFileNameHolder value asFilename. |
|
7756 |
||
7757 |
self withActivityIndicationDo:[ |
|
7758 |
|outStream zipArchive pkcs7SignedData signatureFilename| |
|
7759 |
||
7760 |
self notify:'Generating self extracting st script: ', patchFileName name, '...'. |
|
7761 |
outStream := patchFileName writeStream. |
|
7762 |
outStream nextPutAll:' |
|
7763 |
|patchStream zipArchive| |
|
7764 |
patchStream := Expecco::Browser::CurrentPatchStreamQuery query. |
|
7765 |
patchStream isNil ifTrue:[ self error:''sorry, this patch can only be installed in expecco 2.6.2 and newer (missing CurrentPatchStreamQuery)'']. |
|
7766 |
zipArchive := ZipArchive readingFrom:patchStream. |
|
7767 |
zipArchive members do:[:each | zipArchive extract:each fileName]. |
|
7768 |
patchStream setToEnd. "/ to force fileIn to finish |
|
7769 |
!! |
|
7770 |
||
7771 |
!! !! |
|
7772 |
||
7773 |
'. |
|
7774 |
zipArchive := ZipArchive writingTo:outStream. "/ newFileNamed:(patchFileName). |
|
7775 |
||
7776 |
self currentSelectedFiles do:[:fn | |
|
7777 |
|inStream signatureFilename| |
|
7778 |
||
7779 |
inStream := fn asFilename readStream. |
|
7780 |
zipArchive addFile: (targetDir construct:fn asFilename baseName) name fromStream:inStream. |
|
7781 |
inStream close. |
|
7782 |
]. |
|
7783 |
||
16975 | 7784 |
zipArchive close. |
15211 | 7785 |
|
7786 |
generateSignedPatchHolder value ifTrue:[ |
|
7787 |
self notify:'Generating signed file from: ', patchFileName name, '...'. |
|
7788 |
||
7789 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:patchFileName contentsOfEntireFile. |
|
7790 |
signatureFilename := patchFileName withSuffix:'expeccoPatch'. |
|
7791 |
signatureFilename contents:pkcs7SignedData. |
|
7792 |
]. |
|
7793 |
self notify:nil. |
|
7794 |
] |
|
7795 |
! |
|
13783 | 7796 |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7797 |
generateSignaturesForSelectedFiles |
13783 | 7798 |
"generate signed pkcs7 files from the contents of the selected files. |
7799 |
These can be delivered as expeccoPatch files" |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7800 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7801 |
self withActivityIndicationDo:[ |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7802 |
self currentSelectedFiles do:[:fn | |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7803 |
|pkcs7SignedData signatureFilename| |
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7804 |
|
8646 | 7805 |
self notify:'Generating signed file from: ', (fn baseName), '...'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7806 |
|
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7807 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:fn contentsOfEntireFile. |
12094 | 7808 |
signatureFilename := fn withSuffix:'expeccoPatch'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7809 |
signatureFilename contents:pkcs7SignedData. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7810 |
]. |
13677 | 7811 |
self updateCurrentDirectoryWithReread. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7812 |
self notify:nil. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7813 |
] |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7814 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7815 |
|
9784 | 7816 |
inspectXmlFile |
7817 |
"Show an XML file - either in an XMLInspector or fall back to |
|
7818 |
a plain inspector on the XML tree" |
|
7819 |
||
7820 |
self forEachParsedXmlFileDo:[:xmlDocument | |
|
7821 |
XML::XMLInspector notNil ifTrue:[ |
|
7822 |
XML::XMLInspector openOn:xmlDocument. |
|
7823 |
] ifFalse:[ |
|
7824 |
"fall back..." |
|
7825 |
xmlDocument inspect. |
|
7826 |
] |
|
7827 |
]. |
|
7828 |
||
7829 |
"Modified: / 17-02-2011 / 13:58:16 / cg" |
|
7830 |
! |
|
7831 |
||
3892 | 7832 |
installAllAsAutoloaded |
7833 |
"install all classes found here as autoloaded classes" |
|
7834 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7835 |
self installAllAsAutoloadedRecursive:false |
3892 | 7836 |
! |
7837 |
||
6521 | 7838 |
installAllAsAutoloadedRecursive |
7839 |
"install all classes found here and in subdirectories as autoloaded classes" |
|
7840 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7841 |
self installAllAsAutoloadedRecursive:true |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7842 |
! |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7843 |
|
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7844 |
installAllAsAutoloadedRecursive:aBoolean |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7845 |
"install all classes found here (and in subdirs if aBoolean is true) as autoloaded classes" |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7846 |
|
6521 | 7847 |
[ |
15507 | 7848 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
7849 |
|installAction| |
|
7850 |
||
7851 |
installAction := |
|
7852 |
[:fn | |
|
7853 |
(fn suffix = 'st') ifTrue:[ |
|
7854 |
self notify:('Install as autoloaded: ', fn baseName). |
|
7855 |
self installAsAutoloaded:fn. |
|
7856 |
] |
|
7857 |
]. |
|
7858 |
||
7859 |
self withActivityIndicationDo:[ |
|
7860 |
self currentSelectedDirectories do:[:dir| |
|
7861 |
aBoolean ifTrue:[ |
|
7862 |
dir recursiveDirectoryContentsAsFilenamesDo:installAction |
|
7863 |
] ifFalse:[ |
|
7864 |
dir directoryContentsAsFilenamesDo:installAction |
|
15152 | 7865 |
]. |
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7866 |
]. |
15507 | 7867 |
self notify:nil. |
7868 |
]. |
|
7869 |
] |
|
6521 | 7870 |
] fork. |
7871 |
! |
|
7872 |
||
3892 | 7873 |
installAsAutoloaded:aFilename |
7874 |
"install aFilename as autoloaded class" |
|
7875 |
||
13292 | 7876 |
Smalltalk installAutoloadedClassFromSourceFile:aFilename |
7877 |
||
7878 |
"Modified: / 01-08-2013 / 16:58:09 / cg" |
|
3892 | 7879 |
! |
7880 |
||
15211 | 7881 |
joinSelectedFiles |
7882 |
|selectedFiles numFiles msg outFileName outFile outStream| |
|
7883 |
||
7884 |
selectedFiles := self currentSelectedObjects. |
|
7885 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
7886 |
||
7887 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
7888 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
7889 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
|
7890 |
outFile := selectedFiles first directory construct:outFileName. |
|
7891 |
||
7892 |
outStream := outFile writeStream. |
|
7893 |
||
7894 |
selectedFiles do:[:fileName | |
|
7895 |
|inStream| |
|
7896 |
||
7897 |
self notify:('Adding:', fileName baseName). |
|
7898 |
inStream := fileName readStream. |
|
7899 |
inStream copyToEndInto:outStream. |
|
7900 |
inStream close. |
|
7901 |
]. |
|
7902 |
outStream close. |
|
7903 |
self notify:nil. |
|
7904 |
||
7905 |
"Modified: / 04-12-2006 / 13:15:10 / cg" |
|
7906 |
! |
|
4558 | 7907 |
|
6292 | 7908 |
loadImageThenDo:aBlock |
3892 | 7909 |
|img path files| |
7910 |
||
3982 | 7911 |
files := self currentSelectedFiles. |
3892 | 7912 |
files isEmpty ifTrue:[ ^ self]. |
7913 |
files do:[:fileName | |
|
4414 | 7914 |
path := fileName. |
7915 |
path isDirectory ifFalse:[ |
|
7916 |
img := Image fromFile:(path pathName). |
|
7917 |
img notNil ifTrue:[ |
|
6292 | 7918 |
aBlock value:img |
4414 | 7919 |
] ifFalse:[ |
15346 | 7920 |
Dialog warn:(resources string:'Unknown image format: "%1"' with:fileName asString) |
4414 | 7921 |
] |
7922 |
] |
|
3892 | 7923 |
]. |
7924 |
! |
|
7925 |
||
13089 | 7926 |
loadSignatureSupport |
7927 |
Expecco::KeyFileGenerator isNil ifTrue:[ |
|
14047 | 7928 |
Smalltalk loadPackage:'exept:expecco/license' |
13089 | 7929 |
]. |
7930 |
! |
|
7931 |
||
3892 | 7932 |
openASN1Browser |
7933 |
||
7934 |
self openTool:OSI::ASN1Browser |
|
7935 |
! |
|
7936 |
||
7937 |
openAppletViewer |
|
7938 |
|numItems files| |
|
7939 |
||
3982 | 7940 |
files := self currentSelectedFiles. |
3892 | 7941 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 7942 |
(self |
7943 |
confirm:(resources string:'open for each of the %1 items ?' |
|
7944 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 7945 |
]. |
7946 |
||
7947 |
Java startupJavaSystem. |
|
7948 |
"/ Java markAllClassesUninitialized. |
|
7949 |
"/ Java initAllStaticFields. |
|
7950 |
"/ Java initAllClasses. |
|
7951 |
||
7952 |
files do:[:fileName | |
|
4414 | 7953 |
|p path| |
7954 |
||
7955 |
path := fileName. |
|
7956 |
path isDirectory ifFalse:[ |
|
7957 |
p := Java |
|
7958 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
7959 |
argumentString:path pathName. |
|
7960 |
p resume. |
|
7961 |
] |
|
3892 | 7962 |
]. |
7963 |
! |
|
7964 |
||
7965 |
openCBrowser |
|
6031 | 7966 |
|dir files| |
5880 | 7967 |
|
7968 |
dir := self theSingleSelectedDirectoryOrNil. |
|
7969 |
dir isNil ifTrue:[ ^ self]. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7970 |
self withActivityIndicationDo:[ |
7560 | 7971 |
files := self currentSelectedObjects. |
6031 | 7972 |
files notEmptyOrNil ifTrue:[ |
7973 |
CBrowser::Browser openOn:files first. |
|
7974 |
] ifFalse:[ |
|
7975 |
CBrowser::Browser openIn:dir. |
|
7976 |
] |
|
3892 | 7977 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7978 |
|
7560 | 7979 |
"Modified: / 04-12-2006 / 13:15:19 / cg" |
3892 | 7980 |
! |
7981 |
||
4230 | 7982 |
openChangeSetBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7983 |
"open a changeSet browser on the selected file(s)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7984 |
|
4230 | 7985 |
self |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7986 |
openTool:(UserPreferences current changeSetBrowserClass) |
4230 | 7987 |
with:#openOnFile: |
7988 |
ignoreDirectories:true |
|
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7989 |
|
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7990 |
"Modified (comment): / 27-07-2012 / 20:42:55 / cg" |
4230 | 7991 |
! |
7992 |
||
3892 | 7993 |
openChangesBrowser |
7994 |
"open a change browser on the selected file(s)" |
|
7995 |
||
7996 |
self openTool:(UserPreferences current changesBrowserClass) |
|
7997 |
! |
|
7998 |
||
7999 |
openDiffView |
|
15215 | 8000 |
"open a diff-view on the two selected files" |
8001 |
||
8002 |
|name1 name2 files title |
|
8003 |
defaultName defaultDir| |
|
6460 | 8004 |
|
8005 |
files := self currentSelectedObjects. |
|
3892 | 8006 |
files isEmpty ifTrue:[ |
6460 | 8007 |
Dialog warn:(resources string:'You have to select a file first'). |
4414 | 8008 |
^ self. |
3892 | 8009 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8010 |
|
3892 | 8011 |
(files size == 2) ifTrue:[ |
4414 | 8012 |
name1 := files last. |
8013 |
name2 := files first. |
|
3892 | 8014 |
] ifFalse:[ |
4414 | 8015 |
LastFileDiffFile notNil ifTrue:[ |
11052 | 8016 |
LastFileDiffFile exists ifTrue:[ |
8017 |
name1 := LastFileDiffFile. |
|
8018 |
]. |
|
8019 |
"/ | directory | |
|
8020 |
"/ directory := self currentDirectory. |
|
8021 |
"/ directory notNil ifTrue:[ |
|
8022 |
"/ lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
8023 |
"/ (lastFile exists and:[lastFile isReadable]) ifTrue:[ |
|
8024 |
"/ name1 := lastFile. |
|
8025 |
"/ ] |
|
8026 |
"/ ] |
|
4414 | 8027 |
]. |
8028 |
name2 := files first. |
|
6460 | 8029 |
title := resources string:'Show differences between "%1" and:' with:name2 baseName. |
4414 | 8030 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
11052 | 8031 |
defaultDir := name1 notNil ifTrue:[name1 directory] ifFalse:[self currentDirectory]. |
4414 | 8032 |
name1 := DialogBox |
8033 |
requestFileName:title |
|
8034 |
default:defaultName |
|
6460 | 8035 |
ok:(resources string:'OK') |
8036 |
abort:(resources string:'Compare against File List') |
|
4414 | 8037 |
pattern:'*' |
11052 | 8038 |
fromDirectory:defaultDir. |
3892 | 8039 |
]. |
15215 | 8040 |
self openDiffViewOn:name1 and:name2 |
8041 |
||
8042 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
|
8043 |
! |
|
8044 |
||
8045 |
openDiffViewOn:fileArg1 and:fileArg2 |
|
8046 |
"open a diff-view on two files" |
|
8047 |
||
17769 | 8048 |
|file1 file2 file1Size file2Size text1 text2 d err nm l1 sameContents msg| |
15215 | 8049 |
|
8050 |
file1 := fileArg1. |
|
8051 |
file2 := fileArg2. |
|
3892 | 8052 |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8053 |
self withWaitCursorDo:[ |
15215 | 8054 |
(file1 isNil or:[file1 asString isEmpty]) ifTrue:[ |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8055 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
14126 | 8056 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l string]]. |
15215 | 8057 |
file1 := nil. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8058 |
l1 := 'browser contents' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8059 |
] ifFalse:[ |
15215 | 8060 |
file1 := file1 asFilename. |
8061 |
LastFileDiffFile := file1. |
|
8062 |
file1 isReadable ifFalse:[ |
|
8063 |
nm := file1. |
|
8064 |
file1 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8065 |
err := '"%1" does not exist.'. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8066 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8067 |
err := '"%1" is not readable.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8068 |
]. |
4414 | 8069 |
]. |
15215 | 8070 |
l1 := file1 pathName |
4414 | 8071 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8072 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8073 |
err isNil ifTrue:[ |
15215 | 8074 |
file2 isReadable ifFalse:[ |
8075 |
nm := file2. |
|
8076 |
file2 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8077 |
err := '"%1" does not exist.'. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8078 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8079 |
err := '"%1" is not readable.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8080 |
]. |
4414 | 8081 |
]. |
8082 |
]. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8083 |
err notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8084 |
Dialog warn:(resources string:err with:nm pathName allBold). |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8085 |
^ self |
6176 | 8086 |
]. |
8087 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8088 |
self withActivityIndicationDo:[ |
17769 | 8089 |
file1Size := file1 isNil ifTrue:[0] ifFalse:[file1 fileSize]. |
8090 |
file2Size := file2 isNil ifTrue:[0] ifFalse:[file2 fileSize]. |
|
8091 |
||
8092 |
((file1Size > (1024*1024*32)) or:[ file2Size > (1024*1024*32) ]) ifTrue:[ |
|
8093 |
file1Size = file2Size ifTrue:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8094 |
ProgressIndicator |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8095 |
displayBusyIndicator:'Comparing...' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8096 |
at:(Screen default center) |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8097 |
during:[ |
15215 | 8098 |
sameContents := (file1 sameContentsAs:file2). |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8099 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8100 |
sameContents ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8101 |
self information:'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8102 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8103 |
self information:'Different contents (File(s) too big for more details).' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8104 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8105 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8106 |
self information:'Different size (File(s) too big for more details).' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8107 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8108 |
^ self. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8109 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8110 |
|
15215 | 8111 |
file1 notNil ifTrue:[ |
8112 |
file1 isDirectory ifTrue:[ |
|
8113 |
text1 := file1 directoryContents asString. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8114 |
] ifFalse:[ |
15215 | 8115 |
text1 := file1 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8116 |
] |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8117 |
]. |
15215 | 8118 |
file2 isDirectory ifTrue:[ |
8119 |
text2 := file2 directoryContents asString. |
|
6460 | 8120 |
] ifFalse:[ |
15215 | 8121 |
text2 := file2 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8122 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8123 |
text1 = text2 ifTrue:[ |
15215 | 8124 |
(file1 isDirectory or:[file2 isDirectory]) ifTrue:[ |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8125 |
msg := 'Same filename lists.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8126 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8127 |
msg := 'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8128 |
]. |
16911 | 8129 |
self information:msg |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8130 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8131 |
d := DiffTextView |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8132 |
openOn:text1 label:l1 |
15215 | 8133 |
and:text2 label:file2 pathName. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8134 |
d topView label:(resources string:'File Differences'). |
6460 | 8135 |
] |
4414 | 8136 |
] |
3892 | 8137 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8138 |
|
17769 | 8139 |
"Modified: / 19-11-2017 / 15:00:47 / cg" |
3892 | 8140 |
! |
8141 |
||
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8142 |
openDirectoryDiffView |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8143 |
"open a directory diff-view" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8144 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8145 |
|name1 name2 files| |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8146 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8147 |
files := self currentSelectedObjects. |
11108 | 8148 |
files notEmpty ifTrue:[ |
8149 |
name1 := files first asFilename. |
|
8150 |
name1 asFilename isDirectory ifFalse:[ |
|
8151 |
name1 := name1 directory |
|
8152 |
]. |
|
8153 |
]. |
|
8154 |
||
8155 |
(files size == 2) ifTrue:[ |
|
8156 |
name2 := files second. |
|
8157 |
] ifFalse:[ |
|
8158 |
(files size ~= 1) ifTrue:[ |
|
8159 |
Dialog warn:(resources string:'Please select one or two directories.'). |
|
8160 |
^ self. |
|
8161 |
]. |
|
8162 |
name2 := Dialog |
|
8163 |
requestDirectoryName:(resources |
|
8164 |
string:'Recursive compare "%1" with folder:' |
|
8165 |
with:name1 asFilename baseName) |
|
8166 |
default:(LastFileDiffDirectory ? self currentDirectory). |
|
8167 |
name2 isEmptyOrNil ifTrue:[^ self]. |
|
8168 |
LastFileDiffDirectory := name2. |
|
8169 |
]. |
|
8170 |
name2 := name2 asFilename. |
|
8171 |
||
8172 |
name2 asFilename isDirectory ifFalse:[ |
|
8173 |
name2 := name2 directory |
|
8174 |
]. |
|
8175 |
||
8176 |
self |
|
8177 |
applicationNamed:#FileApplicationNoteBook |
|
8178 |
ifPresentDo:[:appl | ^ appl openCompareDirectory:name1 with:name2]. |
|
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8179 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8180 |
"Created: / 20-05-2010 / 15:01:17 / cg" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8181 |
! |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8182 |
|
3892 | 8183 |
openEditor |
8184 |
self openTool:EditTextView |
|
8185 |
! |
|
8186 |
||
4957 | 8187 |
openGV |
8188 |
self openOSCommandWithFiles:'gv' |
|
8189 |
! |
|
8190 |
||
3892 | 8191 |
openHTMLReader |
8192 |
||
8193 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
8194 |
! |
|
8195 |
||
8196 |
openImageEditor |
|
6292 | 8197 |
[ |
8198 |
self loadImageThenDo:[:img | img edit] |
|
8199 |
] fork |
|
3892 | 8200 |
! |
8201 |
||
8202 |
openImageInspector |
|
6292 | 8203 |
[ |
8204 |
self loadImageThenDo:[:img | img inspect] |
|
8205 |
] fork |
|
3892 | 8206 |
! |
8207 |
||
8208 |
openImagePreview |
|
5778 | 8209 |
[ |
8210 |
self |
|
6292 | 8211 |
loadImageThenDo: |
5778 | 8212 |
[:img | |
8213 |
|i top viewer| |
|
8214 |
||
8215 |
top := StandardSystemView new. |
|
8216 |
||
8217 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8218 |
i := img. |
|
8219 |
top extent:200@200. |
|
8220 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
8221 |
top openAndWait. |
|
8222 |
||
8223 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
8224 |
i := i magnifiedPreservingRatioTo:200@200. |
|
8225 |
]. |
|
8226 |
viewer image:i. |
|
8227 |
]. |
|
3892 | 8228 |
] fork |
8229 |
! |
|
8230 |
||
8231 |
openMP3Player |
|
8232 |
|file| |
|
8233 |
||
3982 | 8234 |
file := self currentSelectedFiles. |
3892 | 8235 |
(file isEmpty) ifTrue:[ |
4414 | 8236 |
^ self. |
3892 | 8237 |
]. |
8238 |
file := file first. |
|
8239 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
8240 |
! |
|
8241 |
||
4957 | 8242 |
openOSCommandWithFiles:command |
8243 |
|files fileNames| |
|
8244 |
||
8245 |
files := self currentSelectedFiles. |
|
8246 |
(files isEmpty) ifTrue:[ |
|
8247 |
^ self. |
|
8248 |
]. |
|
8249 |
||
8250 |
fileNames := files collect:[:each | |
|
8251 |
'"' , each asFilename pathName , '"' |
|
8252 |
]. |
|
8253 |
||
8254 |
[ |
|
8255 |
OperatingSystem |
|
4959 | 8256 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
8257 |
inDirectory:(files first asFilename directory). |
|
4957 | 8258 |
] fork |
8259 |
! |
|
8260 |
||
4820 | 8261 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8262 |
|files fileNames cmd arg| |
4820 | 8263 |
|
8264 |
files := self currentSelectedFiles. |
|
8265 |
(files isEmpty) ifTrue:[ |
|
8266 |
^ self. |
|
8267 |
]. |
|
12972 | 8268 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'. |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8269 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8270 |
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
|
8271 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8272 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8273 |
|
4820 | 8274 |
fileNames := |
8275 |
files |
|
8276 |
collect: |
|
8277 |
[:each | |
|
8278 |
'"' , each asFilename pathName , '"' |
|
8279 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8280 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8281 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8282 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8283 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8284 |
]. |
4820 | 8285 |
|
4950 | 8286 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8287 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 8288 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8289 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8290 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 8291 |
! |
8292 |
||
4958 | 8293 |
openRP |
8294 |
self openOSCommandWithFiles:'realplay' |
|
8295 |
! |
|
8296 |
||
8426 | 8297 |
openResourceFileEditor |
8298 |
||
8299 |
self |
|
8300 |
openTool: Tools::InternationalLanguageTranslationEditor |
|
8301 |
with: #openOnFile: |
|
8302 |
! |
|
8303 |
||
3892 | 8304 |
openSlideShow |
5880 | 8305 |
|dir| |
8306 |
||
8307 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8308 |
dir isNil ifTrue:[^ self]. |
|
8309 |
||
3892 | 8310 |
CodingExamples_GUI::SlideShow openIn:dir. |
8311 |
! |
|
8312 |
||
8313 |
openSnapshotImageBrowser |
|
4491 | 8314 |
"Sorry, for now, only the old browser can handle snapShotImages." |
8315 |
||
3892 | 8316 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
8317 |
! |
|
8318 |
||
8319 |
openTerminal |
|
5880 | 8320 |
|dir| |
8321 |
||
8322 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 8323 |
|
5300 | 8324 |
TerminalApplication notNil ifTrue:[ |
8325 |
TerminalApplication openIn:dir |
|
8326 |
] ifFalse:[ |
|
8327 |
VT100TerminalView openShellIn:dir. |
|
8328 |
]. |
|
3892 | 8329 |
! |
8330 |
||
8331 |
openTool:aToolClass |
|
8332 |
"open a tool on the selected file(s)" |
|
8333 |
||
8334 |
^ self openTool:aToolClass ignoreDirectories:true |
|
8335 |
! |
|
8336 |
||
8337 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
8338 |
"open a tool on the selected file(s)" |
|
8339 |
||
8340 |
^ self |
|
4414 | 8341 |
openTool:aToolClass |
8342 |
with:#openOn: |
|
8343 |
ignoreDirectories:ignoreDirs |
|
3892 | 8344 |
! |
8345 |
||
8426 | 8346 |
openTool:aToolClass with:aSelector |
8347 |
"open a tool on the selected file(s)" |
|
8348 |
||
8349 |
^ self openTool:aToolClass with:aSelector ignoreDirectories:true |
|
8350 |
! |
|
8351 |
||
3892 | 8352 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
8353 |
"open a tool on the selected file(s)" |
|
8354 |
||
8832 | 8355 |
|tool| |
3892 | 8356 |
|
8357 |
aToolClass isNil ifTrue:[ |
|
4414 | 8358 |
Dialog warn:'Sorry, that tool seems to be not available'. |
8359 |
^ nil. |
|
3892 | 8360 |
]. |
8832 | 8361 |
self forEachSelectedFileIgnoringDirectories:ignoreDirs do:[:path | |
8362 |
tool := aToolClass perform:aSelector with:path. |
|
3892 | 8363 |
]. |
8364 |
^ tool |
|
8832 | 8365 |
! |
8366 |
||
8367 |
openWebBrowser |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8368 |
self |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8369 |
forEachSelectedFileIgnoringDirectories:true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8370 |
do:[:path | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8371 |
Error |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8372 |
handle:[:ex | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8373 |
Dialog warn:'Shell execution failed: ',ex description |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8374 |
] do:[ |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8375 |
OperatingSystem openApplicationForDocument:path operation:#open. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8376 |
^ self. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8377 |
] |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8378 |
]. |
3892 | 8379 |
! |
8380 |
||
6022 | 8381 |
openWorkspace |
8382 |
self |
|
8383 |
openTool:WorkspaceApplication |
|
8384 |
with:#openOnFile: |
|
8385 |
ignoreDirectories:true |
|
8386 |
! |
|
8387 |
||
4950 | 8388 |
openXV |
4957 | 8389 |
self openOSCommandWithFiles:'xv' |
4950 | 8390 |
! |
8391 |
||
3892 | 8392 |
openZipTool |
5880 | 8393 |
|zipTool| |
3892 | 8394 |
|
8395 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 8396 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 8397 |
]. |
8398 |
! |
|
8399 |
||
8400 |
readAbbrevFile |
|
8401 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
8402 |
||
5880 | 8403 |
|directories| |
3892 | 8404 |
|
3982 | 8405 |
directories := self currentSelectedDirectories. |
3892 | 8406 |
directories isEmpty ifTrue:[^ self]. |
8407 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8408 |
self withActivityIndicationDo:[ |
5880 | 8409 |
directories do:[:eachDir | |
8410 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
8411 |
] |
|
5828 | 8412 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8413 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8414 |
"Modified: / 25-07-2006 / 09:07:43 / cg" |
3892 | 8415 |
! |
8416 |
||
6460 | 8417 |
readAndShowResources |
8418 |
self withActivityIndicationDo:[ |
|
8419 |
| selectedFiles| |
|
8420 |
||
8421 |
selectedFiles:= self currentSelectedFiles. |
|
8422 |
selectedFiles do:[:fileName | |
|
8423 |
resources := ResourcePack fromFile:fileName. |
|
8424 |
resources inspect. |
|
8425 |
]. |
|
8426 |
] |
|
8427 |
! |
|
8428 |
||
3892 | 8429 |
singleFileFileIn:fileName lazy:lazy |
8430 |
"fileIn the selected file(s)" |
|
8431 |
||
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8432 |
|aStream wasLazy notifyString dontAskSignals lang| |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8433 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8434 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8435 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8436 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8437 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8438 |
[ |
4345 | 8439 |
(ObjectFileLoader notNil |
5491 | 8440 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 8441 |
AbortOperationRequest catch:[ |
8442 |
|p| |
|
8443 |
||
8444 |
"/ |
|
8445 |
"/ look if already loaded ... then unload first |
|
8446 |
"/ |
|
8447 |
p := fileName pathName. |
|
8448 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
8449 |
(Dialog confirm:(resources |
|
8450 |
string:'%1 is already loaded; load anyway ?' |
|
8451 |
with:p)) ifFalse:[ |
|
8452 |
^ self |
|
8453 |
]. |
|
8454 |
notifyString := 'unloading old ' , p , ' ...'. |
|
8455 |
Transcript showCR:notifyString. |
|
4523 | 8456 |
self notify:notifyString. |
4345 | 8457 |
ObjectFileLoader unloadObjectFile:p. |
8458 |
]. |
|
8459 |
||
8460 |
notifyString := 'loading ' , p , ' ...'. |
|
8461 |
Transcript showCR:notifyString. |
|
4523 | 8462 |
self notify:notifyString. |
12426 | 8463 |
(ObjectFileLoader loadObjectFile:p) isNil ifTrue:[ |
8464 |
notifyString := 'Error: could not load ' , p. |
|
8465 |
Transcript showCR:notifyString. |
|
8466 |
self notify:notifyString. |
|
8467 |
] ifFalse:[ |
|
8468 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
8469 |
]. |
|
4345 | 8470 |
] |
8471 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
8472 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
8473 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
8474 |
aStream := fileName readStreamOrNil. |
4345 | 8475 |
aStream notNil ifTrue:[ |
8476 |
aStream fileInBinary. |
|
8477 |
] |
|
8478 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8479 |
((fileName hasSuffix:'class') or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 8480 |
"/ loading a java class file |
8481 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 8482 |
JavaClassReader loadFile:fileName |
4345 | 8483 |
] |
8484 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
8485 |
"/ loading a sif (smalltalk interchange format) file |
|
8486 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
8487 |
SmalltalkInterchangeFileManager newForFileIn |
|
8488 |
fileName: fileName pathName; |
|
8489 |
fileIn. |
|
8490 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
|
8491 |
Parcel isNil ifTrue:[ |
|
8492 |
Dialog warn:'Parcel support not loaded.' |
|
8493 |
] ifFalse:[ |
|
8494 |
Parcel loadParcelFrom: fileName pathName |
|
8495 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8496 |
] ifFalse:[ (fileName hasSuffix:'jar') ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8497 |
JavaVM isNil ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8498 |
Dialog warn: (resources string: 'Java support is not loaded.'). |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8499 |
^ self. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8500 |
] ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8501 |
JavaVM booted ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8502 |
(Dialog confirm: (resources string: 'Java is not initialized. Initialize now?')) ifFalse:[ ^ self. ]. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8503 |
JavaVM boot. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8504 |
]. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8505 |
JavaVM loadClassesIn: fileName. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8506 |
] |
4345 | 8507 |
] ifFalse:[ |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8508 |
"/ ask programming languages... |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8509 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
14360 | 8510 |
(lang isNil and:[(fileName hasSuffix:'js')]) ifTrue:[ |
14362 | 8511 |
Smalltalk loadPackage:'stx:libjavascript'. |
14360 | 8512 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
8513 |
]. |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8514 |
(lang notNil and:[lang ~= SmalltalkLanguage]) ifTrue:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8515 |
lang fileIn:fileName. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8516 |
] ifFalse:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8517 |
"/ loading a regular (chunk) or xml source file |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8518 |
Error handle:[:ex | |
15675 | 8519 |
self errorNotify:'Error during file in: ', ex description. |
15981 | 8520 |
ex resume. |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8521 |
] do:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8522 |
aStream := fileName readStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8523 |
[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8524 |
Class withoutUpdatingChangesDo:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8525 |
wasLazy := Compiler compileLazy:lazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8526 |
Smalltalk fileInStream:aStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8527 |
]. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8528 |
Class addInfoRecord:('fileIn ' , fileName asString) |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8529 |
] ensure:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8530 |
Compiler compileLazy:wasLazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8531 |
aStream close |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8532 |
] |
4345 | 8533 |
] |
8534 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8535 |
]]]] |
4345 | 8536 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8537 |
] on:Error, HaltInterrupt, Class packageRedefinitionNotification do:[:ex| |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
8538 |
|sig msg label labels values action proceedValue isRedef redefKind| |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8539 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8540 |
isRedef := false. |
12684 | 8541 |
sig := ex creator. |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8542 |
(dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8543 |
action := #continue |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8544 |
] ifFalse:[ |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8545 |
(sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8546 |
ex reject |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8547 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8548 |
sig == Class methodRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8549 |
msg := 'trying to overwrite method:\\ ' , ex oldMethod whoString , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8550 |
, ex oldPackage , ''' with method from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8551 |
label := 'Method redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8552 |
redefKind := 'method'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8553 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8554 |
] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8555 |
msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8556 |
, ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8557 |
label := 'Class redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8558 |
redefKind := 'class'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8559 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8560 |
] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender| |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8561 |
label := msg := 'Breakpoint/Halt in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8562 |
sender := ex suspendedContext. |
17024 | 8563 |
msg := msg , ('\\in %1 » %2' bindWith:(sender receiver class name) with:(sender sender selector)) |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8564 |
] ifFalse:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8565 |
label := 'Error in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8566 |
msg := 'error in fileIn: %1' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8567 |
]]]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8568 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8569 |
msg := msg bindWith:ex description. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8570 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8571 |
labels := #('Cancel' 'Skip' 'Debug' 'Compare Sources'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8572 |
values := #(abort skip debug compareSources). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8573 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8574 |
isRedef ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8575 |
msg := msg, ('%<cr>%<cr>Continue will install the change and assign the %1 to the new package. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8576 |
Keep Package will install the change, but keep the %1 in the old package.' bindWith:redefKind). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8577 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8578 |
labels := labels , #('Keep Package' ). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8579 |
values := values , #(keep). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8580 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8581 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8582 |
labels := labels , #( 'Continue' 'ContinueForAll'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8583 |
values := values , #( continue continueForAll). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8584 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8585 |
AbortAllOperationWantedQuery query ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8586 |
labels := #('Cancel All') , labels. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8587 |
values := #(cancelAll) , values. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8588 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8589 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8590 |
action := Dialog |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8591 |
choose:(msg withCRs) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8592 |
label:label |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8593 |
image:(WarningBox iconBitmap) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8594 |
labels:labels |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8595 |
values:values |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8596 |
default:#continue |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8597 |
onCancel:#abort. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8598 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8599 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8600 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8601 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8602 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8603 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8604 |
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
|
8605 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8606 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8607 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8608 |
(action == #compareSources) ifTrue:[ |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8609 |
DiffCodeView |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8610 |
openOn:(ex oldMethod source) label:'Old Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8611 |
and:(ex newMethod source) label:'New Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8612 |
title:ex description. |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8613 |
ex resignalAs:ex |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8614 |
]. |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
8615 |
(action == #continue or:[action == #keep]) ifTrue:[ |
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
8616 |
ex proceedWith:action "(isRedef ifTrue:[#keep] ifFalse:[#continue])". |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8617 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8618 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8619 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8620 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8621 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8622 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8623 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8624 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8625 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8626 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8627 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8628 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8629 |
action == #debug ifTrue:[ |
7330
fe62e489caae
When opening a debugger, make sure that the topmost context is returnable
Stefan Vogel <sv@exept.de>
parents:
7324
diff
changeset
|
8630 |
Debugger enter:ex returnableSuspendedContext |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8631 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8632 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8633 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8634 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8635 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8636 |
] |
7040 | 8637 |
|
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8638 |
"Modified: / 22-11-2011 / 13:52:17 / cg" |
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8639 |
"Modified: / 19-02-2014 / 12:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4531 | 8640 |
! |
8641 |
||
4558 | 8642 |
splitFile:infile intoPiecesOfSize:kiloBytes |
8643 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
8644 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
8645 |
||
8646 |
bufferSize := 32*1024. |
|
8647 |
||
8648 |
inStream := infile readStream. |
|
8649 |
||
8650 |
bytesPerSplit := kiloBytes * 1024. |
|
8651 |
||
8652 |
remaining := infile fileSize. |
|
8653 |
splitIndex := 1. |
|
8654 |
[remaining > 0] whileTrue:[ |
|
8655 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8656 |
outStream := outFile asFilename writeStream. |
|
8657 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
8658 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
8659 |
buffer := ByteArray new:bufferSize. |
|
8660 |
n := inStream |
|
8661 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
8662 |
into:buffer |
|
8663 |
startingAt:1. |
|
8664 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
8665 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
8666 |
remaining := remaining - n. |
|
8667 |
]. |
|
8668 |
outStream close. |
|
8669 |
splitIndex := splitIndex + 1. |
|
8670 |
]. |
|
8671 |
inStream close. |
|
8672 |
! |
|
8673 |
||
15906 | 8674 |
splitFile:infile intoPiecesWithNumberOfLines:numberOfLines |
8675 |
|splitIndex line |
|
8676 |
inStream outFile outStream remainingLinesInThisOutfile| |
|
8677 |
||
8678 |
inStream := infile readStream. |
|
8679 |
||
8680 |
splitIndex := 1. |
|
8681 |
[inStream atEnd] whileFalse:[ |
|
8682 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8683 |
outStream := outFile asFilename writeStream. |
|
8684 |
remainingLinesInThisOutfile := numberOfLines. |
|
8685 |
[(remainingLinesInThisOutfile > 0) and:[inStream atEnd not]] whileTrue:[ |
|
8686 |
line := inStream nextLine. |
|
15910 | 8687 |
outStream nextPutLine:line. |
15906 | 8688 |
remainingLinesInThisOutfile := remainingLinesInThisOutfile - 1. |
8689 |
]. |
|
8690 |
outStream close. |
|
8691 |
splitIndex := splitIndex + 1. |
|
8692 |
]. |
|
8693 |
inStream close. |
|
8694 |
! |
|
8695 |
||
4558 | 8696 |
splitSelectedFiles |
6264 | 8697 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 8698 |
|
12871 | 8699 |
selectedFiles := self currentSelectedFiles. |
4558 | 8700 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
8701 |
||
6265 | 8702 |
msg := (numFiles > 1) |
8703 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
8704 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 8705 |
|
6352 | 8706 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 8707 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
8708 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 8709 |
kiloBytes isNil ifTrue:[^ self]. |
8710 |
||
8711 |
selectedFiles do:[:fileName | |
|
8712 |
self notify:('Splitting:', fileName baseName). |
|
8713 |
fileName isDirectory ifFalse:[ |
|
8714 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
|
8715 |
] |
|
8716 |
]. |
|
6190 | 8717 |
self notify:nil. |
6265 | 8718 |
|
7560 | 8719 |
"Modified: / 04-12-2006 / 13:15:26 / cg" |
4558 | 8720 |
! |
8721 |
||
15906 | 8722 |
splitSelectedFilesByLines |
8723 |
|selectedFiles numFiles msg numLinesString numLines| |
|
8724 |
||
8725 |
selectedFiles := self currentSelectedFiles. |
|
8726 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
8727 |
||
8728 |
msg := (numFiles > 1) |
|
8729 |
ifTrue:'Split each of the %1 files into pieces with number of lines:' |
|
8730 |
ifFalse:'Split %2 into pieces with number of lines:'. |
|
8731 |
||
8732 |
numLinesString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
8733 |
numLinesString isEmptyOrNil ifTrue:[^ self]. |
|
8734 |
||
8735 |
numLines := Integer readFrom:numLinesString onError:nil. |
|
8736 |
numLines isNil ifTrue:[^ self]. |
|
8737 |
||
8738 |
selectedFiles do:[:fileName | |
|
8739 |
self notify:('Splitting:', fileName baseName). |
|
8740 |
fileName isDirectory ifFalse:[ |
|
8741 |
self splitFile:fileName intoPiecesWithNumberOfLines:numLines |
|
8742 |
] |
|
8743 |
]. |
|
8744 |
self notify:nil. |
|
8745 |
! |
|
8746 |
||
15211 | 8747 |
truncateSelectedFilesToZeroSize |
8748 |
|selectedFiles numFiles msg| |
|
8749 |
||
8750 |
selectedFiles := self currentSelectedObjects. |
|
8751 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
8752 |
||
8753 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
|
8754 |
numFiles > 1 ifTrue:[ |
|
8755 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
|
8756 |
]. |
|
8757 |
||
8758 |
(Dialog |
|
8759 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
|
8760 |
initialAnswer:false |
|
8761 |
) ifFalse:[ |
|
8762 |
^ self |
|
8763 |
]. |
|
8764 |
||
8765 |
selectedFiles do:[:fileName | |
|
8766 |
|s| |
|
8767 |
||
8768 |
self notify:('Truncating:', fileName baseName). |
|
8769 |
fileName isDirectory ifFalse:[ |
|
8770 |
[ |
|
8771 |
s := fileName writeStream. |
|
8772 |
s close. |
|
8773 |
] on:FileStream openErrorSignal do:[:ex| |
|
8774 |
self warn:('Cannot truncate "%1".' bindWith:fileName baseName allBold). |
|
8775 |
]. |
|
8776 |
] |
|
8777 |
]. |
|
8778 |
self notify:nil. |
|
8779 |
||
8780 |
"Modified: / 04-12-2006 / 13:15:28 / cg" |
|
8781 |
! ! |
|
3892 | 8782 |
|
4849 | 8783 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 8784 |
|
8785 |
anySTFilesPresent |
|
8786 |
^ self anyFilesPresentWithSuffix:'st' |
|
8787 |
! |
|
8788 |
||
8789 |
canCreateNewProject |
|
8790 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
12811 | 8791 |
^ self currentSelectedFiles contains:[:fileName| |
8792 |
| suffix| |
|
8793 |
suffix := fileName suffix asLowercase. |
|
8794 |
(suffix = 'prj' or:[suffix = 'st']) |
|
8795 |
] |
|
3892 | 8796 |
! |
8797 |
||
8798 |
canDoTerminal |
|
8799 |
||
8800 |
^ OperatingSystem isUNIXlike |
|
8801 |
or:[OperatingSystem isMSWINDOWSlike] |
|
8802 |
! |
|
8803 |
||
8804 |
canDoTerminalAndSystemIsDOS |
|
8805 |
||
8806 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
8807 |
! |
|
8808 |
||
8809 |
canDoTerminalAndSystemIsUnix |
|
8810 |
||
8811 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
8812 |
! |
|
8813 |
||
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8814 |
canGenerateSignatureFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8815 |
"we need the both the KeyFileGenerator (for the secret expecco key) and the KeyFile" |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8816 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8817 |
Expecco::KeyFileGenerator isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8818 |
Expecco::KeyFile isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8819 |
|
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8820 |
^ self currentSelectedFiles notEmptyOrNil |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8821 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8822 |
|
12811 | 8823 |
canOpenMonticelloBrowser |
8824 |
^ self currentSelectedFiles |
|
8825 |
contains:[:fileName| |
|
8826 |
fileName suffix asLowercase = 'mcz' |
|
8827 |
] |
|
8828 |
! |
|
8829 |
||
3892 | 8830 |
canReadAbbrevFile |
8831 |
||
5960 | 8832 |
|currentDirectory| |
3892 | 8833 |
|
8834 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 8835 |
currentDirectory := self currentDirectory. |
8836 |
^ currentDirectory notNil |
|
8837 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 8838 |
! |
8839 |
||
8840 |
canRemoveFromSourcePath |
|
8841 |
||
8842 |
^ false |
|
8843 |
! |
|
8844 |
||
13089 | 8845 |
cannotGenerateSignatureFiles |
8846 |
^ self canGenerateSignatureFiles not |
|
8847 |
! |
|
8848 |
||
3892 | 8849 |
hasASN1 |
8850 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 8851 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 8852 |
|
8853 |
! |
|
8854 |
||
8855 |
hasASN1AndSelection |
|
8856 |
^ [ self hasSelection value |
|
17416 | 8857 |
and:[self currentSelectedFiles notEmptyOrNil |
4414 | 8858 |
and:[OSI::ASN1Parser notNil |
8859 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
17416 | 8860 |
|
8861 |
"Modified: / 17-02-2017 / 08:25:09 / cg" |
|
3892 | 8862 |
! |
8863 |
||
8864 |
hasCBrowser |
|
8865 |
^ [ CBrowser::Browser notNil ] |
|
8866 |
! |
|
8867 |
||
8868 |
hasJava |
|
8869 |
||
14298 | 8870 |
^ [ JavaVM notNil |
8871 |
and:[JavaClassReader notNil |
|
8872 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 8873 |
! |
8874 |
||
8875 |
hasJavaAndSelection |
|
8876 |
||
12871 | 8877 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 8878 |
and:[JavaClassReader notNil |
8879 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 8880 |
! |
8881 |
||
8882 |
hasMP3Player |
|
8883 |
||
8884 |
^ [ MP3PlayerApplication notNil |
|
4414 | 8885 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 8886 |
! |
8887 |
||
8888 |
hasMP3PlayerAndSelection |
|
8889 |
||
12871 | 8890 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 8891 |
and:[ self hasMP3Player value]] |
3892 | 8892 |
! |
8893 |
||
8426 | 8894 |
hasResourceFileSelected |
12871 | 8895 |
^ (self currentSelectedFiles) |
8896 |
contains:[:fn | |
|
12811 | 8897 |
fn suffix asLowercase = 'rs' |
8898 |
]. |
|
8426 | 8899 |
! |
8900 |
||
3892 | 8901 |
hasSlideShow |
8902 |
||
8903 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
8904 |
! |
|
8905 |
||
8906 |
hasSnapshotSelection |
|
8907 |
||
8908 |
^ [ |
|
4414 | 8909 |
| files | |
8426 | 8910 |
|
4414 | 8911 |
files := self currentSelectedFiles. |
8912 |
((files size == 1) |
|
8913 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 8914 |
] |
8915 |
! |
|
8916 |
||
7869 | 8917 |
hasXml |
9206 | 8918 |
^ [ XML::XMLParser notNil ] |
7869 | 8919 |
! |
8920 |
||
8921 |
hasXmlFileSelected |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
8922 |
"/ cg - no longer use this to enable XML-inspector (always enabled). |
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
8923 |
"/ then handle the error when it ever fails during xml-parsing. |
7869 | 8924 |
|
8426 | 8925 |
^ [ |
8926 |
|sel fileName| |
|
7869 | 8927 |
|
8928 |
sel := self currentSelectedFiles. |
|
8929 |
sel size == 1 ifTrue:[ |
|
8930 |
fileName := sel first. |
|
8931 |
fileName notNil ifTrue:[ |
|
15936 | 8932 |
#('xml' 'xsd' 'vdx') includes:fileName suffix asLowercase |
7869 | 8933 |
] ifFalse:[ |
8934 |
false |
|
8935 |
] |
|
8936 |
] ifFalse:[ |
|
8937 |
false |
|
8938 |
] |
|
8939 |
] |
|
8940 |
! |
|
8941 |
||
3892 | 8942 |
hasZipFileSelected |
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8943 |
|sel fileName suff| |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8944 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8945 |
sel := self currentSelectedFiles. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8946 |
sel size == 1 ifFalse:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8947 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8948 |
fileName := sel first. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8949 |
fileName isNil ifTrue:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8950 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8951 |
suff := fileName suffix asLowercase. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8952 |
(suff = 'zip' or:[suff = 'jar']) ifTrue:[^ true]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8953 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8954 |
^ fileName mimeTypeOfContents = 'application/x-zip-compressed' |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8955 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8956 |
"Modified: / 14-02-2011 / 17:17:03 / cg" |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8957 |
! |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8958 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8959 |
hasZipFileSelectedHolder |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8960 |
^ [ self hasZipFileSelected ] |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8961 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8962 |
"Created: / 14-02-2011 / 17:16:08 / cg" |
3892 | 8963 |
! |
8964 |
||
8965 |
javaSupportLoaded |
|
8966 |
||
8967 |
^ false |
|
8968 |
! ! |
|
8969 |
||
14126 | 8970 |
|
8971 |
||
3906 | 8972 |
!AbstractFileBrowser methodsFor:'presentation'! |
8973 |
||
8974 |
getModeString:modeBits |
|
8975 |
"convert file-mode bits into a more user-friendly string. |
|
8976 |
This is wrong here - should be moved into OperatingSystem." |
|
8977 |
||
8978 |
^ self getModeString:modeBits |
|
4414 | 8979 |
with:#( 'owner:' $r $w $x |
8980 |
' group:' $r $w $x |
|
8981 |
' others:' $r $w $x ) |
|
3906 | 8982 |
! |
8983 |
||
8984 |
getModeString:modeBits with:texts |
|
8985 |
"convert file-mode bits into a more user-friendly string. |
|
8986 |
This is wrong here - should be moved into OperatingSystem." |
|
8987 |
||
8988 |
|bits modeString| |
|
8989 |
||
8990 |
bits := modeBits bitAnd:8r777. |
|
8991 |
modeString := ''. |
|
8992 |
||
8993 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
8994 |
with: texts do:[:bitMask :access | |
|
4414 | 8995 |
|ch| |
8996 |
||
8997 |
bitMask isNil ifTrue:[ |
|
8998 |
modeString := modeString , access |
|
8999 |
] ifFalse:[ |
|
9000 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
9001 |
ch := $- |
|
9002 |
] ifFalse:[ |
|
9003 |
ch := access |
|
9004 |
]. |
|
9005 |
modeString := modeString copyWith:ch |
|
9006 |
] |
|
3906 | 9007 |
]. |
9008 |
^ modeString |
|
9009 |
! ! |
|
9010 |
||
5880 | 9011 |
!AbstractFileBrowser methodsFor:'private'! |
9012 |
||
9013 |
theSingleSelectedDirectoryOrHomeDir |
|
9014 |
|dir| |
|
9015 |
||
5888 | 9016 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 9017 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
9018 |
^ dir. |
|
9019 |
! |
|
9020 |
||
9021 |
theSingleSelectedDirectoryOrNil |
|
9022 |
|dirs| |
|
9023 |
||
9024 |
dirs := self currentSelectedDirectories. |
|
9025 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
9026 |
^ dirs anElement. |
|
14577 | 9027 |
! |
9028 |
||
9029 |
theSingleSelectedFileOrNil |
|
9030 |
|dirs| |
|
9031 |
||
9032 |
dirs := self currentSelectedFiles. |
|
9033 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
9034 |
^ dirs anElement. |
|
5880 | 9035 |
! ! |
9036 |
||
3892 | 9037 |
!AbstractFileBrowser methodsFor:'queries'! |
9038 |
||
8256 | 9039 |
cBrowserLoaded |
9040 |
^ CBrowser::Browser notNil |
|
9041 |
! |
|
9042 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9043 |
cBrowserMenuItemVisible |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9044 |
^ self cBrowserLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9045 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9046 |
"Created: / 04-10-2011 / 13:40:38 / cg" |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9047 |
! |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9048 |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9049 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9050 |
"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
|
9051 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9052 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9053 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9054 |
|
3906 | 9055 |
getFileInfoStringForFirstSelectedFile:longInfo |
9056 |
"get stat info on selected file - return a string which can be |
|
9057 |
shown in a box" |
|
9058 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9059 |
|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
|
9060 |
sizeString fileSize tAccess tModification buffer| |
3906 | 9061 |
|
7560 | 9062 |
selFiles := self currentSelectedObjects. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9063 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 9064 |
filename := selFiles first. |
9065 |
||
8364 | 9066 |
info := filename linkInfo. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9067 |
info isNil ifTrue:[ |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9068 |
^ 'Cannot get fileInfo'. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9069 |
^ nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9070 |
]. |
8364 | 9071 |
|
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
9072 |
buffer := Text writeStream. |
4765 | 9073 |
|
9074 |
buffer |
|
9075 |
nextPutAll:'filename: '; |
|
9076 |
nextPutLine:filename asString. |
|
9077 |
||
8364 | 9078 |
OperatingSystem isMSDOSlike ifTrue: [ |
9079 |
(info alternativeName notNil |
|
9080 |
and:[ info alternativeName ~= info fullName ]) ifTrue:[ |
|
9081 |
buffer nextPutAll:'shortname: '. |
|
9082 |
buffer nextPutLine:info alternativeName. |
|
9083 |
] |
|
9084 |
]. |
|
9085 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9086 |
buffer nextPutAll:'type: '. |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9087 |
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
|
9088 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9089 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9090 |
]. |
4765 | 9091 |
buffer |
9092 |
nextPutAll:'symbolic link to: '; |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
9093 |
nextPutLine:(info path ? '???'). |
3906 | 9094 |
] 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
|
9095 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9096 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9097 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9098 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9099 |
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
|
9100 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9101 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9102 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9103 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9104 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9105 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9106 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9107 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9108 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9109 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9110 |
fileSize > 1024 ifTrue:[ |
8172 | 9111 |
sizeString := sizeString,' (',(UnitConverter fileSizeStringFor:fileSize),')'. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9112 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9113 |
]. |
4765 | 9114 |
buffer nextPutLine:sizeString. |
3906 | 9115 |
|
9116 |
modeBits := info mode. |
|
9117 |
modeString := self getModeString:modeBits. |
|
4765 | 9118 |
|
9119 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 9120 |
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
|
9121 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 9122 |
]. |
4765 | 9123 |
buffer |
9124 |
cr; |
|
9125 |
nextPutAll:'owner: '; |
|
9126 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
9127 |
||
3906 | 9128 |
longInfo ifTrue:[ |
4765 | 9129 |
buffer |
9130 |
nextPutAll:'group: '; |
|
9131 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
9132 |
||
9133 |
tAccess := info accessTime. |
|
9134 |
buffer |
|
9135 |
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
|
9136 |
nextPutAll:tAccess asDate printString; |
4765 | 9137 |
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
|
9138 |
nextPutLine:tAccess asTime printString. |
4765 | 9139 |
|
9140 |
tModification := info modificationTime. |
|
9141 |
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
|
9142 |
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
|
9143 |
nextPutAll:tModification asDate printString; |
4765 | 9144 |
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
|
9145 |
nextPutLine:tModification asTime printString. |
3906 | 9146 |
]. |
4765 | 9147 |
^ buffer contents |
7560 | 9148 |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
9149 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
3906 | 9150 |
! |
9151 |
||
8510 | 9152 |
hasImageColorHistogram |
9153 |
^ ImageColorHistogram notNil |
|
9154 |
! |
|
9155 |
||
17686 | 9156 |
hasImageHistogram |
9157 |
^ ImageAlgorithms notNil |
|
9158 |
||
9159 |
"Created: / 10-09-2017 / 16:50:34 / cg" |
|
9160 |
! |
|
9161 |
||
10258 | 9162 |
hasSubversionSupport |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
9163 |
^ ConfigurableFeatures includesFeature: #SubversionSupport |
10258 | 9164 |
|
9165 |
"Created: / 24-06-2010 / 19:59:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10678
3a574f143d8f
changed: #hasSubversionSupport
Claus Gittinger <cg@exept.de>
parents:
10669
diff
changeset
|
9166 |
"Modified: / 07-09-2011 / 10:41:19 / cg" |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
9167 |
"Modified: / 19-01-2012 / 10:43:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10258 | 9168 |
! |
9169 |
||
3892 | 9170 |
initialCommandFor:fileName into:aBox |
9171 |
"set a useful initial command for execute box." |
|
9172 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
9173 |
self class initialCommandFor:fileName in:Filename currentDirectory intoBox:aBox |
3892 | 9174 |
! |
9175 |
||
9176 |
isAbstractFileBrowser |
|
9177 |
||
9178 |
^ true |
|
9179 |
! |
|
9180 |
||
9181 |
systemIsDOS |
|
9182 |
||
9183 |
^ OperatingSystem isMSDOSlike |
|
9184 |
! |
|
9185 |
||
12473 | 9186 |
systemIsOSX |
9187 |
||
9188 |
^ OperatingSystem isOSXlike |
|
9189 |
! |
|
9190 |
||
3892 | 9191 |
systemIsUnix |
9192 |
^ OperatingSystem isUNIXlike |
|
14980 | 9193 |
! |
9194 |
||
9195 |
systemSupportsVolumes |
|
9196 |
||
9197 |
^ OperatingSystem supportsVolumes |
|
3892 | 9198 |
! ! |
9199 |
||
9200 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
9201 |
||
9202 |
allItemsOfCurrentDirectory |
|
5009 | 9203 |
self |
4774 | 9204 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 9205 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
9206 |
||
9207 |
^ nil |
|
3892 | 9208 |
! |
9209 |
||
9210 |
anyFilesPresentWithSuffix:suffix |
|
6725 | 9211 |
self currentSelectedDirectories do:[:dir| |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9212 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
9213 |
(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
|
9214 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 9215 |
]. |
9216 |
^ false. |
|
9217 |
! |
|
9218 |
||
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9219 |
commonPrefixOfSelectedFiles |
4773 | 9220 |
|selFiles stringCol firstPre| |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9221 |
|
7560 | 9222 |
selFiles := self currentSelectedObjects. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9223 |
selFiles isEmpty ifTrue:[^ nil]. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9224 |
|
4772 | 9225 |
stringCol := selFiles collect:[:file | file asString]. |
4773 | 9226 |
firstPre := stringCol at:1. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9227 |
stringCol from:2 do:[:el| |
4773 | 9228 |
firstPre := firstPre commonPrefixWith:el. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9229 |
]. |
4773 | 9230 |
^ firstPre asFilename |
7560 | 9231 |
|
9232 |
"Modified: / 04-12-2006 / 13:14:25 / cg" |
|
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9233 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9234 |
|
12481 | 9235 |
compressTabsOnSave |
9236 |
"if true, compress leading spaces (multiples of 8) with a tab character |
|
9237 |
when saving. |
|
9238 |
Default is true" |
|
9239 |
||
9240 |
^ true |
|
9241 |
! |
|
9242 |
||
3892 | 9243 |
currentFilesAreInSameDirectory |
9244 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9245 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 9246 |
! |
9247 |
||
9248 |
currentFilesHasDirectories |
|
9249 |
||
6725 | 9250 |
^ self currentSelectedDirectories notEmpty. |
3892 | 9251 |
! |
9252 |
||
3982 | 9253 |
directoriesForFiles:aFileCol |
11743 | 9254 |
^ aFileCol collect:[:file| self getDirWithoutFileName:file] as:Set. |
3982 | 9255 |
! |
9256 |
||
3892 | 9257 |
fileListIsEmpty |
5009 | 9258 |
self |
9259 |
applicationNamed:#DirectoryContentsBrowser |
|
9260 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
9261 |
||
9262 |
^ nil. |
|
3892 | 9263 |
! |
9264 |
||
9265 |
fileListIsNotEmpty |
|
9266 |
||
9267 |
^ self fileListIsEmpty not. |
|
9268 |
! |
|
9269 |
||
9270 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 9271 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 9272 |
|
9273 |
| file1 file2 | |
|
9274 |
||
6284 | 9275 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 9276 |
file1 := aFilename1 asFilename. |
9277 |
file2 := aFilename2 asFilename. |
|
6284 | 9278 |
|
3892 | 9279 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 9280 |
|
3892 | 9281 |
((file1 isDirectory) |
9282 |
and:[(file2 isDirectory) |
|
9283 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 9284 |
^ file1 baseName = file2 baseName |
3892 | 9285 |
]. |
3982 | 9286 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 9287 |
! |
9288 |
||
9289 |
getAllFilesAsStringCollection |
|
5009 | 9290 |
self |
9291 |
applicationNamed:#DirectoryContentsBrowser |
|
9292 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
9293 |
||
9294 |
^ nil |
|
3892 | 9295 |
! |
9296 |
||
9297 |
getBestDirectory |
|
9298 |
||
9299 |
|selFiles stringCol firstPre| |
|
9300 |
||
6725 | 9301 |
selFiles := self currentSelectedDirectories. |
3892 | 9302 |
selFiles isEmpty ifTrue:[^ nil]. |
9303 |
selFiles size == 1 ifTrue:[^ selFiles first]. |
|
4486 | 9304 |
stringCol := (selFiles collect:[:file| file asString]) asOrderedCollection. |
3892 | 9305 |
firstPre := stringCol at:1. |
9306 |
stringCol from:2 do:[:el| |
|
4414 | 9307 |
firstPre := firstPre commonPrefixWith:el. |
3892 | 9308 |
]. |
9309 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
4414 | 9310 |
firstPre removeLast. |
3892 | 9311 |
]. |
9312 |
^ firstPre asFilename |
|
9313 |
! |
|
9314 |
||
9315 |
getDirWithoutFileName:aFileName |
|
9316 |
||
9317 |
| dir | |
|
9318 |
aFileName isNil ifTrue:[ |
|
4414 | 9319 |
^ aFileName. |
3892 | 9320 |
]. |
9321 |
dir := aFileName asFilename. |
|
9322 |
dir isDirectory ifFalse:[ |
|
4414 | 9323 |
dir := dir directory. |
3892 | 9324 |
]. |
9325 |
^ dir. |
|
9326 |
! |
|
9327 |
||
9328 |
getInfoItem |
|
9329 |
"get filename of a description-file (.dir.info, README etc.); |
|
16778 | 9330 |
This file is automatically shown when a directory is entered. |
3892 | 9331 |
You can add more names below if you like." |
9332 |
||
5880 | 9333 |
|dir| |
9334 |
||
9335 |
dir := self theSingleSelectedDirectoryOrNil. |
|
9336 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 9337 |
|
16778 | 9338 |
#( |
3892 | 9339 |
'.dir.info' |
9340 |
'README' |
|
9341 |
'ReadMe' |
|
9342 |
'Readme' |
|
9343 |
'readme' |
|
9344 |
'read.me' |
|
9345 |
'Read.me' |
|
9346 |
'READ.ME' |
|
9347 |
'README.TXT' |
|
15915 | 9348 |
'README.txt' |
3892 | 9349 |
'readme.txt' |
9350 |
'Readme.txt' |
|
9351 |
'Info.txt' |
|
9352 |
'info.txt' |
|
9353 |
'INFO.TXT' |
|
15915 | 9354 |
'INFO.txt' |
16778 | 9355 |
) do:[:f | |
5883 | 9356 |
|n| |
4414 | 9357 |
|
5880 | 9358 |
n := dir construct:f. |
4414 | 9359 |
(n isReadable and:[n isDirectory not]) ifTrue:[ |
9360 |
^ DirectoryContentsBrowser itemClass fileName:n |
|
9361 |
] |
|
3892 | 9362 |
]. |
9363 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9364 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9365 |
|
12497 | 9366 |
hasPackageDirectorySelected |
9367 |
|dir| |
|
9368 |
||
9369 |
dir := self currentDirectory. |
|
9370 |
^ dir notNil |
|
9371 |
and:[ dir exists |
|
9372 |
and:[ (dir / 'abbrev.stc') exists ]] |
|
9373 |
! |
|
9374 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9375 |
parentDirectoriesOfCurrentFiles |
11743 | 9376 |
^ self currentSelectedObjects |
9377 |
collect:[:file | file directory] as:Set |
|
7560 | 9378 |
|
9379 |
"Modified: / 04-12-2006 / 13:15:21 / cg" |
|
6521 | 9380 |
! |
9381 |
||
9382 |
recursiveAnyFilesPresentWithSuffix:suffix |
|
6652 | 9383 |
^ true. "/ the code below is too slow for a menu enabling operation |
9384 |
||
9385 |
"/ |directories| |
|
9386 |
"/ |
|
9387 |
"/ directories := self currentDirectories value. |
|
9388 |
"/ directories do:[:dir| |
|
9389 |
"/ [ |
|
9390 |
"/ dir recursiveDirectoryContentsDo:[:f | |
|
9391 |
"/ (f asFilename suffix = suffix) ifTrue:[ ^ true] |
|
9392 |
"/ ] |
|
9393 |
"/ ] on:FileStream openErrorSignal do:[:ex|]. |
|
9394 |
"/ ]. |
|
9395 |
"/ ^ false. |
|
6586 | 9396 |
! |
9397 |
||
9398 |
recursiveAnySTFilesPresent |
|
9399 |
^ self recursiveAnyFilesPresentWithSuffix:'st' |
|
3982 | 9400 |
! ! |
9401 |
||
9402 |
!AbstractFileBrowser methodsFor:'selection'! |
|
9403 |
||
9404 |
currentSelectedDirectories |
|
6725 | 9405 |
^ self currentDirectoriesValue. |
3982 | 9406 |
! |
9407 |
||
9408 |
currentSelectedFiles |
|
12824 | 9409 |
^ self currentSelectedObjects reject:[:file | file isDirectory]. |
7560 | 9410 |
|
9411 |
"Modified: / 04-12-2006 / 13:14:39 / cg" |
|
3982 | 9412 |
! |
9413 |
||
6460 | 9414 |
currentSelectedObjects |
9415 |
^ self currentFileNameHolder value |
|
9416 |
! |
|
9417 |
||
3982 | 9418 |
firstSelectedFile |
7560 | 9419 |
^ self currentSelectedObjects |
12102 | 9420 |
detect:[:file | (file ? '') asFilename isDirectory not] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9421 |
ifNone:[]. |
7560 | 9422 |
|
9423 |
"Modified: / 04-12-2006 / 13:14:50 / cg" |
|
4414 | 9424 |
! |
9425 |
||
9490 | 9426 |
hasOnlyDirectoriesSelected |
9427 |
^ self currentSelectedObjects conform:[:file | file isDirectory]. |
|
9428 |
||
9429 |
"Created: / 20-05-2010 / 10:45:03 / cg" |
|
9430 |
! |
|
9431 |
||
4414 | 9432 |
hasOnlyFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9433 |
|
7560 | 9434 |
^ self currentSelectedObjects conform:[:file | file isDirectory not]. |
9435 |
||
9436 |
"Modified: / 04-12-2006 / 13:15:01 / cg" |
|
4414 | 9437 |
! |
9438 |
||
9490 | 9439 |
hasTwoDirectoriesSelected |
9440 |
||
9441 |
^ self currentSelectedObjects size == 2 |
|
9442 |
and:[self hasOnlyDirectoriesSelected] |
|
9443 |
||
9444 |
"Created: / 20-05-2010 / 10:45:18 / cg" |
|
9445 |
! |
|
9446 |
||
4414 | 9447 |
hasTwoFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9448 |
|
7560 | 9449 |
^ self currentSelectedObjects size == 2 |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9450 |
and:[self hasOnlyFilesSelected] |
7560 | 9451 |
|
9452 |
"Modified: / 04-12-2006 / 13:15:04 / cg" |
|
14577 | 9453 |
! |
9454 |
||
9455 |
selectNextFile |
|
9456 |
self |
|
9457 |
applicationNamed:#DirectoryContentsBrowser |
|
9458 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectNextFile ]]. |
|
9459 |
! |
|
9460 |
||
9461 |
selectPreviousFile |
|
9462 |
self |
|
9463 |
applicationNamed:#DirectoryContentsBrowser |
|
9464 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectPreviousFile ]]. |
|
3892 | 9465 |
! ! |
9466 |
||
3964 | 9467 |
!AbstractFileBrowser methodsFor:'sorting'! |
9468 |
||
3989 | 9469 |
currentSortOrder |
17790 | 9470 |
^ self |
9471 |
aspectFor:#currentSortOrder |
|
9472 |
ifAbsent:[ |
|
9473 |
(Dictionary new |
|
9474 |
at:#column put:nil; |
|
9475 |
at:#reverse put:false; |
|
9476 |
at:#sortCaseless put:false; |
|
9477 |
yourself |
|
9478 |
) asValue |
|
9479 |
]. |
|
9480 |
||
9481 |
"Modified: / 25-11-2017 / 17:43:00 / cg" |
|
3989 | 9482 |
! |
9483 |
||
9484 |
sortBlockHolder |
|
9485 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 9486 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9487 |
selector:#fileName |
|
9488 |
sortCaseless:self sortCaseless value |
|
9489 |
sortReverse:false) asValue. |
|
3989 | 9490 |
]. |
9491 |
! |
|
9492 |
||
9493 |
sortBlockProperty |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9494 |
|v| |
4027 | 9495 |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9496 |
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
|
9497 |
v addDependent:self. |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9498 |
^ v. |
3989 | 9499 |
! |
9500 |
||
9501 |
sortCaseless |
|
4201 | 9502 |
" aspect for sort caseless " |
3989 | 9503 |
|
13000 | 9504 |
^ self |
9505 |
aspectFor:#sortCaseless |
|
9506 |
ifAbsent:[ (Filename isCaseSensitive not) asValue ] |
|
3989 | 9507 |
! |
9508 |
||
4074 | 9509 |
sortDirectoriesBeforeFiles |
9510 |
||
4201 | 9511 |
" aspect for sort directories always before files" |
4074 | 9512 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
9513 |
! |
|
9514 |
||
3989 | 9515 |
sortFileListsBy:instanceName |
9516 |
||
9517 |
self sortFileListsBy:instanceName withReverse:true |
|
9518 |
! |
|
9519 |
||
9520 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
9521 |
| aSymbol sortCaselessLocal currentSortOrder sorter isReverse| |
3964 | 9522 |
|
9523 |
aSymbol := instanceName asSymbol. |
|
4027 | 9524 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 9525 |
sortCaselessLocal := self sortCaseless value. |
4027 | 9526 |
currentSortOrder := self currentSortOrder value. |
17790 | 9527 |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9528 |
currentSortOrder isEmptyOrNil ifTrue:[ |
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9529 |
self currentSortOrder value:(currentSortOrder := Dictionary new). |
4343 | 9530 |
currentSortOrder at:#column put:aSymbol. |
9531 |
currentSortOrder at:#reverse put:false. |
|
9532 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 9533 |
] ifFalse:[ |
4343 | 9534 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
9535 |
"/ sort caseless changed |
|
9536 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
9537 |
] ifFalse:[ |
|
9538 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
9539 |
"/ same column like before - change sort order ifReverse is true |
|
9540 |
aBoolean ifTrue:[ |
|
9541 |
isReverse := currentSortOrder at:#reverse. |
|
9542 |
currentSortOrder at:#reverse put:(isReverse not). |
|
9543 |
]. |
|
9544 |
] ifFalse:[ |
|
9545 |
"/ another column - remark column |
|
9546 |
currentSortOrder at:#column put:aSymbol. |
|
9547 |
] |
|
9548 |
] |
|
3964 | 9549 |
]. |
4027 | 9550 |
self currentSortOrder changed. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9551 |
|
5383 | 9552 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9553 |
selector:instanceName |
|
9554 |
sortCaseless:sortCaselessLocal |
|
9555 |
sortReverse:(currentSortOrder at:#reverse). |
|
9556 |
self sortBlockHolder value:sorter. |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9557 |
|
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9558 |
"Modified: / 18-09-2007 / 09:42:47 / cg" |
17790 | 9559 |
"Modified (format): / 25-11-2017 / 17:43:31 / cg" |
3964 | 9560 |
! ! |
9561 |
||
3892 | 9562 |
!AbstractFileBrowser methodsFor:'startup & release'! |
9563 |
||
16720 | 9564 |
initializeAspects |
9565 |
aspects := IdentityDictionary new. |
|
9566 |
aspects at:#applications put:(IdentityDictionary new). |
|
9567 |
! |
|
9568 |
||
3892 | 9569 |
makeDependent |
4074 | 9570 |
self filterModel addDependent:self. |
4004 | 9571 |
self currentFileNameHolder addDependent:self. |
4074 | 9572 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 9573 |
self sortCaseless addDependent:self. |
4011 | 9574 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
9575 |
self rootHolder addDependent:self. |
3892 | 9576 |
! |
9577 |
||
9578 |
masterApplication:anApplication |
|
9579 |
||
9580 |
masterApplication isNil ifTrue:[ |
|
4414 | 9581 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
9582 |
aspects := anApplication aspects |
|
9583 |
] ifFalse:[ |
|
9584 |
aspects isNil ifTrue:[ |
|
16721 | 9585 |
self initializeAspects. |
4414 | 9586 |
] |
9587 |
]. |
|
9588 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9589 |
"/ self makeDependent. |
3892 | 9590 |
]. |
3952 | 9591 |
^ super masterApplication:anApplication. |
3892 | 9592 |
! |
9593 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9594 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9595 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9596 |
super postBuildWith:aBuilder. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9597 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9598 |
|
3892 | 9599 |
postOpenWith:aBuilder |
9600 |
||
9601 |
super postOpenWith:aBuilder. |
|
14655 | 9602 |
"/ now done for all windowGroups by the group itself |
9603 |
"/ self windowGroup showWaitCursorWhenBusyForMillis:100. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9604 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9605 |
"Modified: / 25-07-2006 / 09:12:45 / cg" |
3892 | 9606 |
! ! |
9607 |
||
9608 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
9609 |
||
9610 |
files |
|
9611 |
"return the value of the instance variable 'files' (automatically generated)" |
|
9612 |
||
9613 |
^ files |
|
9614 |
! |
|
9615 |
||
9616 |
files:something |
|
9617 |
"set the value of the instance variable 'files' (automatically generated)" |
|
9618 |
||
9619 |
files := something. |
|
9620 |
! |
|
9621 |
||
9622 |
method |
|
9623 |
"return the value of the instance variable 'method' (automatically generated)" |
|
9624 |
||
9625 |
^ method |
|
9626 |
! |
|
9627 |
||
9628 |
method:something |
|
9629 |
"set the value of the instance variable 'method' (automatically generated)" |
|
9630 |
||
9631 |
method := something. |
|
9632 |
! ! |
|
9633 |
||
9634 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
9635 |
||
9636 |
locked |
|
9637 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
9638 |
||
9639 |
locked isNil ifTrue:[ |
|
4414 | 9640 |
locked := false. |
3892 | 9641 |
]. |
9642 |
^ locked |
|
9643 |
! ! |
|
9644 |
||
9645 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
9646 |
||
9647 |
doIfUnLocked:aBlock |
|
9648 |
||
9649 |
self locked ifFalse:[ |
|
4414 | 9650 |
aBlock value. |
3892 | 9651 |
]. |
9652 |
! |
|
9653 |
||
9654 |
doLocked:aBlock |
|
9655 |
||
9656 |
locked := true. |
|
4004 | 9657 |
aBlock ensure:[ |
4414 | 9658 |
locked := false. |
4004 | 9659 |
] |
3892 | 9660 |
! ! |
9661 |
||
3952 | 9662 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
9663 |
||
6369 | 9664 |
defaultHistorySize |
9665 |
^ 50 |
|
3892 | 9666 |
! ! |
9667 |
||
6371 | 9668 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 9669 |
|
9670 |
new |
|
6371 | 9671 |
^ (super new) initializeHistory. |
6369 | 9672 |
! ! |
9673 |
||
9674 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
9675 |
||
9676 |
historySize |
|
9677 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
9678 |
^ historySize |
|
9679 |
! |
|
9680 |
||
9681 |
historySize:aNumber |
|
9682 |
historySize := aNumber |
|
4032 | 9683 |
! ! |
9684 |
||
3892 | 9685 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
9686 |
||
3952 | 9687 |
addToHistory:aPath |
15803 | 9688 |
| item pathToAdd sep| |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9689 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9690 |
pathToAdd := aPath. |
15803 | 9691 |
(pathToAdd endsWith:(sep := Filename separator)) ifTrue:[ |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9692 |
pathToAdd asFilename isRootDirectory ifFalse:[ |
15803 | 9693 |
pathToAdd := pathToAdd copyButLast:(sep asString size). |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9694 |
] |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9695 |
]. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9696 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9697 |
item := self getItemFor:pathToAdd. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9698 |
self backForwardListAdd:pathToAdd. |
3952 | 9699 |
item isNil ifTrue:[ |
4347 | 9700 |
" not already in history" |
6369 | 9701 |
self size >= self historySize ifTrue:[ |
4347 | 9702 |
self removeLast. |
9703 |
]. |
|
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9704 |
item := DirectoryHistoryItem path:pathToAdd. |
3952 | 9705 |
] ifFalse:[ |
4347 | 9706 |
"already been there before; move the entry to |
9707 |
the beginning, so it will fall out later." |
|
9708 |
self remove:item. |
|
10381
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9709 |
]. |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9710 |
self addFirst:item |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9711 |
|
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9712 |
"Modified: / 24-07-2011 / 07:12:54 / cg" |
3952 | 9713 |
! |
9714 |
||
4347 | 9715 |
backForwardListAdd:aPath |
9716 |
|pathIndex| |
|
9717 |
||
9718 |
pathIndex := backForwardList indexOf:aPath. |
|
9719 |
pathIndex == 0 ifTrue:[ |
|
9720 |
" a new path comes in remove forward paths " |
|
9721 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
9722 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
9723 |
]. |
|
9724 |
] ifFalse:[ |
|
9725 |
backForwardList remove:aPath. |
|
9726 |
pathIndex <= backForwardIndex ifTrue:[ |
|
9727 |
backForwardIndex := backForwardIndex - 1. |
|
9728 |
] |
|
4022 | 9729 |
]. |
4347 | 9730 |
backForwardList add:aPath afterIndex:backForwardIndex. |
9731 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 9732 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 9733 |
backForwardList removeFirst. |
9734 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 9735 |
]. |
4347 | 9736 |
! |
9737 |
||
9738 |
goBackward |
|
4288 | 9739 |
"return the first path of the backward list; |
9740 |
remove it from the back list and add it ti the forward list." |
|
4022 | 9741 |
|
4347 | 9742 |
|retPath| |
9743 |
||
9744 |
self canBackward ifTrue:[ |
|
9745 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
9746 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 9747 |
]. |
4022 | 9748 |
^ retPath. |
9749 |
! |
|
9750 |
||
9751 |
goForward |
|
4288 | 9752 |
"return the first path of the forward list; |
9753 |
remove it from the list." |
|
4022 | 9754 |
|
4347 | 9755 |
|retPath| |
9756 |
||
9757 |
self canForward ifTrue:[ |
|
9758 |
retPath := backForwardList at:backForwardIndex + 1. |
|
9759 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 9760 |
]. |
4022 | 9761 |
^ retPath. |
9762 |
! |
|
9763 |
||
9764 |
resetForwardBackward |
|
9765 |
||
4347 | 9766 |
self initialize |
4022 | 9767 |
! |
9768 |
||
9769 |
setPosition:aPosition for:aPath |
|
9770 |
||
9771 |
self do:[:item| |
|
4414 | 9772 |
item path = aPath ifTrue:[ |
9773 |
item position:aPosition. |
|
9774 |
] |
|
4022 | 9775 |
]. |
3892 | 9776 |
! ! |
9777 |
||
4870 | 9778 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 9779 |
|
6371 | 9780 |
initializeHistory |
4032 | 9781 |
|
4347 | 9782 |
backForwardList := OrderedCollection new. |
9783 |
self reverseDo:[:el| |
|
9784 |
backForwardList add:el path. |
|
9785 |
]. |
|
9786 |
backForwardIndex := backForwardList size. |
|
4032 | 9787 |
! ! |
9788 |
||
3892 | 9789 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
9790 |
||
4288 | 9791 |
canBackward |
4347 | 9792 |
|
9793 |
^ backForwardIndex > 1 |
|
4288 | 9794 |
! |
9795 |
||
3892 | 9796 |
canForward |
4347 | 9797 |
|
9798 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
9799 |
! |
|
9800 |
||
9801 |
getBackCollection |
|
9802 |
||
9803 |
| backCol | |
|
9804 |
||
9805 |
backCol := OrderedCollection new. |
|
9806 |
self canBackward ifTrue:[ |
|
9807 |
| tmpCol | |
|
9808 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
9809 |
tmpCol reverseDo:[ :el| |
|
9810 |
backCol add:el. |
|
9811 |
] |
|
9812 |
]. |
|
9813 |
^ backCol |
|
3952 | 9814 |
! |
9815 |
||
9816 |
getForwardCollection |
|
9817 |
||
4347 | 9818 |
| forwCol | |
9819 |
||
9820 |
forwCol := OrderedCollection new. |
|
9821 |
self canForward ifTrue:[ |
|
9822 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
9823 |
]. |
|
9824 |
^ forwCol |
|
3952 | 9825 |
! |
9826 |
||
9827 |
getItemFor:aPath |
|
6627 | 9828 |
^ self detect:[:item| item path = aPath] ifNone:nil. |
9829 |
"/ self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
9830 |
"/ ^ nil. |
|
3952 | 9831 |
! |
9832 |
||
9833 |
getPositionFor:aPath |
|
9834 |
||
9835 |
|item| |
|
9836 |
||
9837 |
item := self getItemFor:aPath. |
|
9838 |
||
9839 |
item notNil ifTrue:[ |
|
4414 | 9840 |
^ item position. |
3952 | 9841 |
]. |
9842 |
^ nil |
|
9843 |
! |
|
9844 |
||
9845 |
includesPath:aPath |
|
6627 | 9846 |
^ self contains:[:item | item path = aPath]. |
9847 |
||
9848 |
"/ self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
9849 |
"/ ^ false. |
|
4347 | 9850 |
! |
9851 |
||
9852 |
nextBackwardItem |
|
9853 |
"return the first path of the backward list" |
|
9854 |
||
9855 |
|retPath| |
|
9856 |
||
9857 |
self canBackward ifTrue:[ |
|
9858 |
retPath := backForwardList at:backForwardIndex. |
|
9859 |
]. |
|
9860 |
^ retPath. |
|
9861 |
! |
|
9862 |
||
9863 |
nextForwardItem |
|
9864 |
"return the first path of the forward list" |
|
9865 |
||
9866 |
|retPath| |
|
9867 |
||
9868 |
self canForward ifTrue:[ |
|
9869 |
retPath := backForwardList at:backForwardIndex + 1. |
|
9870 |
]. |
|
9871 |
^ retPath. |
|
3952 | 9872 |
! ! |
9873 |
||
9874 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
9875 |
||
9876 |
path:aPath |
|
9877 |
||
9878 |
^ self new path:aPath |
|
9879 |
! ! |
|
9880 |
||
9881 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
9882 |
||
6433 | 9883 |
asFilename |
9884 |
^ path asFilename |
|
9885 |
! |
|
9886 |
||
3952 | 9887 |
path |
9888 |
"return the value of the instance variable 'path' (automatically generated)" |
|
9889 |
||
9890 |
^ path |
|
9891 |
! |
|
9892 |
||
9893 |
path:something |
|
9894 |
"set the value of the instance variable 'path' (automatically generated)" |
|
9895 |
||
9896 |
path := something. |
|
9897 |
! |
|
9898 |
||
9899 |
position |
|
9900 |
"return the value of the instance variable 'position' (automatically generated)" |
|
9901 |
||
9902 |
^ position |
|
9903 |
! |
|
9904 |
||
9905 |
position:something |
|
9906 |
"set the value of the instance variable 'position' (automatically generated)" |
|
9907 |
||
9908 |
position := something. |
|
9909 |
! |
|
9910 |
||
9911 |
printString |
|
9912 |
||
9913 |
^ self path asString |
|
3892 | 9914 |
! ! |
9915 |
||
9916 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
9917 |
||
9918 |
withValue:aValue isHolder:aBoolean |
|
9919 |
||
9920 |
| instance | |
|
9921 |
||
9922 |
instance := self basicNew. |
|
9923 |
instance value:aValue. |
|
9924 |
instance isHolder:aBoolean. |
|
9925 |
^ instance |
|
9926 |
! ! |
|
9927 |
||
9928 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
9929 |
||
9930 |
isHolder |
|
9931 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
9932 |
||
9933 |
^ isHolder |
|
9934 |
! |
|
9935 |
||
9936 |
isHolder:something |
|
9937 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
|
9938 |
||
9939 |
isHolder := something. |
|
9940 |
! |
|
9941 |
||
9942 |
value |
|
9943 |
"return the value of the instance variable 'value' (automatically generated)" |
|
9944 |
||
9945 |
^ value |
|
9946 |
! |
|
9947 |
||
9948 |
value:something |
|
9949 |
"set the value of the instance variable 'value' (automatically generated)" |
|
9950 |
||
9951 |
value := something. |
|
9952 |
! ! |
|
9953 |
||
9954 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
9955 |
||
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9956 |
version |
15803 | 9957 |
^ '$Header$' |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9958 |
! |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9959 |
|
8832 | 9960 |
version_CVS |
15803 | 9961 |
^ '$Header$' |
3892 | 9962 |
! ! |
12094 | 9963 |