author | Claus Gittinger <cg@exept.de> |
Wed, 01 May 2019 11:44:53 +0200 | |
changeset 18746 | a12a52c66c53 |
parent 18734 | ffbafcfcccf1 |
child 18747 | 138797ada819 |
permissions | -rw-r--r-- |
18666 | 1 |
"{ Encoding: utf8 }" |
2 |
||
5140 | 3 |
" |
4 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
15211 | 14 |
"{ Package: 'stx:libtool' }" |
15 |
||
16 |
"{ NameSpace: Smalltalk }" |
|
17 |
||
18 |
ApplicationModel subclass:#AbstractFileBrowser |
|
19 |
instanceVariableNames:'aspects' |
|
16720 | 20 |
classVariableNames:'CommandHistory CommandHistorySize DefaultCommandPerSuffix |
21 |
DefaultFilters DirectoryBookmarks LastEnforcedNameSpace |
|
22 |
LastFileDiffDirectory LastFileDiffFile LastFileSelection |
|
23 |
LastMercurialRepository LastMoveDestination LastMustMatchPattern |
|
18609 | 24 |
LastScriptBlockString MaxFileSizeShownWithoutAsking RootHolder |
25 |
RuntimeAspects VisitedDirectories' |
|
15211 | 26 |
poolDictionaries:'' |
27 |
category:'Interface-Tools-File' |
|
28 |
! |
|
3892 | 29 |
|
30 |
AbstractFileBrowser class instanceVariableNames:'DisabledCursorImage EnabledCursorImage' |
|
31 |
||
32 |
" |
|
33 |
The following class instance variables are inherited by this class: |
|
34 |
||
14126 | 35 |
ApplicationModel - ClassResources |
36 |
Model - |
|
37 |
Object - |
|
3892 | 38 |
" |
39 |
! |
|
40 |
||
41 |
Object subclass:#Clipboard |
|
14126 | 42 |
instanceVariableNames:'method files' |
43 |
classVariableNames:'' |
|
44 |
poolDictionaries:'' |
|
45 |
privateIn:AbstractFileBrowser |
|
3892 | 46 |
! |
47 |
||
48 |
Object subclass:#CodeExecutionLock |
|
14126 | 49 |
instanceVariableNames:'locked' |
50 |
classVariableNames:'' |
|
51 |
poolDictionaries:'' |
|
52 |
privateIn:AbstractFileBrowser |
|
3892 | 53 |
! |
54 |
||
4366 | 55 |
List subclass:#DirectoryHistory |
14126 | 56 |
instanceVariableNames:'forwardList backList lastWasForwardPath lastBackPath lastAddPath |
57 |
backForwardList backForwardIndex historySize' |
|
58 |
classVariableNames:'HistorySize' |
|
59 |
poolDictionaries:'' |
|
60 |
privateIn:AbstractFileBrowser |
|
3952 | 61 |
! |
62 |
||
63 |
Object subclass:#DirectoryHistoryItem |
|
14126 | 64 |
instanceVariableNames:'path position' |
65 |
classVariableNames:'' |
|
66 |
poolDictionaries:'' |
|
67 |
privateIn:AbstractFileBrowser::DirectoryHistory |
|
3892 | 68 |
! |
69 |
||
70 |
Object subclass:#SaveAspectItem |
|
14126 | 71 |
instanceVariableNames:'value isHolder' |
72 |
classVariableNames:'' |
|
73 |
poolDictionaries:'' |
|
74 |
privateIn:AbstractFileBrowser |
|
3892 | 75 |
! |
76 |
||
5140 | 77 |
!AbstractFileBrowser class methodsFor:'documentation'! |
78 |
||
79 |
copyright |
|
80 |
" |
|
81 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
82 |
All Rights Reserved |
|
83 |
||
84 |
This software is furnished under a license and may be used |
|
85 |
only in accordance with the terms of that license and with the |
|
86 |
inclusion of the above copyright notice. This software may not |
|
87 |
be provided or otherwise made available to, or used by, any |
|
88 |
other person. No title to or ownership of the software is |
|
89 |
hereby transferred. |
|
90 |
" |
|
5967 | 91 |
! |
92 |
||
93 |
documentation |
|
94 |
" |
|
95 |
[Author:] |
|
96 |
Christian Penk |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
97 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
98 |
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
|
99 |
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
|
100 |
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
|
101 |
and as a container is almost incomprehensable... |
17768 | 102 |
|
103 |
[class variables:] |
|
104 |
CommandHistory |
|
105 |
CommandHistorySize |
|
106 |
DefaultCommandPerSuffix |
|
107 |
DefaultFilters |
|
108 |
DirectoryBookmarks |
|
109 |
LastEnforcedNameSpace |
|
110 |
LastFileDiffDirectory |
|
111 |
LastFileDiffFile |
|
112 |
LastFileSelection |
|
113 |
LastMercurialRepository |
|
114 |
LastMoveDestination |
|
115 |
LastMustMatchPattern |
|
116 |
LastScriptBlockString |
|
117 |
RootHolder |
|
118 |
RuntimeAspects |
|
119 |
VisitedDirectories |
|
120 |
MaxFileSizeShownWithoutAsking ..... for big files, I will ask if only the first part is |
|
121 |
to be shown. This number (if non-nil) suppresses this |
|
122 |
question for files smaller. |
|
123 |
The initial default is 1Mb (1024*1024) |
|
5967 | 124 |
" |
5140 | 125 |
! ! |
3892 | 126 |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
127 |
!AbstractFileBrowser class methodsFor:'accessing'! |
3952 | 128 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
129 |
currentSelection |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
130 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
131 |
LastFileSelection isNil ifTrue:[ |
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 |
]. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
134 |
^ LastFileSelection |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
135 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
136 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
137 |
currentSelection:aFilenameCol |
6589 | 138 |
aFilenameCol notEmptyOrNil ifTrue:[ |
12102 | 139 |
LastFileSelection := aFilenameCol collect:[:file | (file ? '') asFilename] |
6589 | 140 |
] |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
141 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
142 |
|
3952 | 143 |
directoryHistory |
144 |
||
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
145 |
VisitedDirectories isNil ifTrue:[ |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
146 |
VisitedDirectories := self directoryHistoryClass new. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
147 |
"/ VisitedDirectories inspect. |
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 |
^ VisitedDirectories |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
150 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
151 |
"Modified: / 21-11-2012 / 08:45:49 / cg" |
3952 | 152 |
! |
153 |
||
17768 | 154 |
maxFileSizeShownWithoutAsking |
155 |
"the max. filesize which is loaded without asking if only the first |
|
156 |
part should be shown" |
|
157 |
||
158 |
^ MaxFileSizeShownWithoutAsking ? (1024*1024) |
|
159 |
||
160 |
"Created: / 19-11-2017 / 14:48:19 / cg" |
|
161 |
! |
|
162 |
||
163 |
maxFileSizeShownWithoutAsking:anIntegerOrNilForDefault |
|
164 |
"the max. filesize which is loaded without asking if only the first |
|
17769 | 165 |
part should be shown. |
166 |
Nil resets to the default (currently 1Mb)" |
|
17768 | 167 |
|
168 |
MaxFileSizeShownWithoutAsking := anIntegerOrNilForDefault |
|
169 |
||
17769 | 170 |
" |
171 |
self maxFileSizeShownWithoutAsking:nil |
|
172 |
" |
|
173 |
||
17768 | 174 |
"Created: / 19-11-2017 / 14:48:45 / cg" |
175 |
! |
|
176 |
||
3952 | 177 |
resetClassVars |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
178 |
VisitedDirectories := nil. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
179 |
LastFileSelection := nil. |
5936 | 180 |
|
181 |
" |
|
182 |
AbstractFileBrowser resetClassVars |
|
183 |
" |
|
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
184 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
185 |
"Modified: / 21-11-2012 / 08:45:53 / cg" |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
186 |
! |
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 |
^ RootHolder |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
191 |
! |
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 |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
194 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
195 |
RootHolder := aRoot |
3952 | 196 |
! ! |
197 |
||
4915 | 198 |
!AbstractFileBrowser class methodsFor:'accessing-bookmarks'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
199 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
200 |
addBookmark:aDirectoryPath |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
201 |
"add aDirectoryPath to the list of our known bookmarks. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
202 |
Do not add duplicates." |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
203 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
204 |
|bookmarks| |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
205 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
206 |
bookmarks := self directoryBookmarks. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
207 |
(bookmarks includes:aDirectoryPath) ifFalse:[ |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
208 |
bookmarks add:aDirectoryPath asFilename. |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
209 |
]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
210 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
211 |
|
8013 | 212 |
bookmarksFrom:aFileNameOrString |
12390 | 213 |
|bookmarks s fileName line| |
8013 | 214 |
|
215 |
fileName := aFileNameOrString asFilename. |
|
216 |
[ |
|
217 |
s := fileName readStream. |
|
218 |
] on:OpenError do:[:ex| |
|
219 |
^ nil. |
|
220 |
]. |
|
221 |
||
222 |
bookmarks := OrderedCollection new. |
|
223 |
[s atEnd] whileFalse:[ |
|
12390 | 224 |
line := s nextLine. |
225 |
(line startsWith:';') ifFalse:[ |
|
226 |
bookmarks add:(Base64Coder decode:line) asString. |
|
227 |
] |
|
8013 | 228 |
]. |
229 |
s close. |
|
230 |
||
231 |
^ bookmarks |
|
232 |
! |
|
233 |
||
4679 | 234 |
defaultBookMarksFileDirectory |
12390 | 235 |
"the directory, where the default bookmarks are stored (as defaultBookMarksFilename)" |
236 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
237 |
^ Filename homeDirectory |
4679 | 238 |
! |
239 |
||
240 |
defaultBookMarksFilename |
|
12390 | 241 |
"the filename, in which the default bookmarks are stored (in defaultBookMarksDirectory)" |
242 |
||
4679 | 243 |
^ '.fileBrowserBookmarks' |
244 |
! |
|
245 |
||
246 |
directoryBookmarks |
|
247 |
DirectoryBookmarks isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
248 |
self loadBookmarksFrom:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename). |
4679 | 249 |
|
250 |
DirectoryBookmarks isEmptyOrNil ifTrue:[ |
|
17979 | 251 |
DirectoryBookmarks := |
252 |
OrderedCollection |
|
253 |
with:(Filename homeDirectory asAbsoluteFilename) |
|
254 |
with:(Filename currentDirectory asAbsoluteFilename). |
|
4679 | 255 |
] |
256 |
]. |
|
257 |
^ DirectoryBookmarks |
|
258 |
||
259 |
" |
|
5438
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
260 |
DirectoryBookmarks := nil. |
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
261 |
self directoryBookmarks. |
4679 | 262 |
" |
263 |
! |
|
264 |
||
8013 | 265 |
directoryBookmarks: collectionOfFilenames |
266 |
||
267 |
DirectoryBookmarks := collectionOfFilenames. |
|
268 |
self saveBookmarksInDefaultBookmarksFile. |
|
269 |
! |
|
270 |
||
271 |
editBookmarksWithDefault: aFilenameOrNil |
|
272 |
| oldBookmarks newBookmarks | |
|
273 |
||
274 |
oldBookmarks := self directoryBookmarks copy. |
|
275 |
newBookmarks := BookmarksEditDialog openWith: oldBookmarks defaultBookmark: aFilenameOrNil. |
|
276 |
newBookmarks isNil ifTrue:[^ self]. |
|
277 |
self directoryBookmarks: newBookmarks. |
|
9681
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
278 |
|
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
279 |
"Modified: / 13-01-2011 / 12:52:28 / cg" |
8013 | 280 |
! |
281 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
282 |
hasBookmarks |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
283 |
^ self directoryBookmarks notEmptyOrNil |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
284 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
285 |
|
4679 | 286 |
loadBookmarksFrom:aFileNameOrString |
8013 | 287 |
|bookmarks| |
288 |
||
289 |
bookmarks := self bookmarksFrom: aFileNameOrString. |
|
290 |
bookmarks isNil ifTrue:[^ self]. |
|
4679 | 291 |
|
292 |
DirectoryBookmarks := OrderedCollection new. |
|
293 |
bookmarks do:[:eachPath | |
|
294 |
self addBookmark:eachPath asFilename |
|
295 |
]. |
|
296 |
! |
|
297 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
298 |
removeBookmark:aDirectoryPath |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
299 |
|bookmarks| |
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 := self directoryBookmarks. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
302 |
bookmarks isEmptyOrNil ifTrue:[ ^ self]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
303 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
304 |
bookmarks remove:aDirectoryPath ifAbsent:[]. |
4679 | 305 |
! |
306 |
||
307 |
saveBookmarks |
|
308 |
|fn| |
|
309 |
||
310 |
fn := Dialog |
|
18746 | 311 |
requestFileNameForSave:(self resourceString:'Save Bookmarks') |
4679 | 312 |
default:(self defaultBookMarksFilename) |
313 |
fromDirectory:(self defaultBookMarksFileDirectory). |
|
314 |
fn isEmptyOrNil ifTrue:[^ self]. |
|
315 |
||
316 |
self saveBookmarksIn:fn |
|
9607 | 317 |
|
318 |
"Modified: / 27-10-2010 / 11:27:09 / cg" |
|
18746 | 319 |
"Modified: / 01-05-2019 / 11:14:19 / Claus Gittinger" |
4679 | 320 |
! |
321 |
||
8013 | 322 |
saveBookmarks: bookmarks in:aFileNameOrString |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
323 |
"save the bokmarks in aFileNameOrString. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
324 |
Use Base64 coding" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
325 |
|
13683 | 326 |
|bookmarkStream fileName coder| |
4679 | 327 |
|
328 |
fileName := aFileNameOrString asFilename. |
|
329 |
fileName exists ifTrue:[ |
|
13683 | 330 |
fileName renameTo:(fileName addSuffix:'sav'). |
4679 | 331 |
]. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
332 |
bookmarkStream := fileName writeStream. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
333 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
334 |
"save each bookmark in one line" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
335 |
coder := (Base64Coder on:bookmarkStream) lineLimit:nil. |
4679 | 336 |
bookmarks do:[:eachPath | |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
337 |
eachPath asFilename pathName acceptVisitor:coder. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
338 |
coder flush. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
339 |
bookmarkStream cr. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
340 |
]. |
12391 | 341 |
bookmarkStream syncData; close. |
5960 | 342 |
! |
343 |
||
8013 | 344 |
saveBookmarksIn:aFileNameOrString |
345 |
"save the bokmarks in aFileNameOrString. |
|
346 |
Use Base64 coding" |
|
347 |
||
348 |
| bookmarks | |
|
349 |
||
350 |
bookmarks := self directoryBookmarks. |
|
351 |
self saveBookmarks: bookmarks in:aFileNameOrString |
|
352 |
! |
|
353 |
||
5960 | 354 |
saveBookmarksInDefaultBookmarksFile |
355 |
self saveBookmarksIn:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename) |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
356 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
357 |
|
4915 | 358 |
!AbstractFileBrowser class methodsFor:'accessing-classes'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
359 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
360 |
directoryHistoryClass |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
361 |
^ DirectoryHistory |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
362 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
363 |
"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
|
364 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
365 |
|
3892 | 366 |
!AbstractFileBrowser class methodsFor:'defaults'! |
367 |
||
368 |
commandHistory |
|
369 |
||
370 |
CommandHistory isNil ifTrue:[ |
|
4414 | 371 |
CommandHistory := OrderedCollection new. |
3892 | 372 |
]. |
373 |
^ CommandHistory |
|
374 |
! |
|
375 |
||
376 |
commandHistorySize |
|
4190 | 377 |
"max no of entries in the HistoryList " |
6369 | 378 |
|
3892 | 379 |
CommandHistorySize isNil ifTrue:[ |
6369 | 380 |
CommandHistorySize := 150 |
3892 | 381 |
]. |
382 |
^ CommandHistorySize |
|
383 |
! |
|
384 |
||
385 |
defaultFilterList |
|
386 |
||
387 |
DefaultFilters isNil ifTrue:[ |
|
4414 | 388 |
DefaultFilters := #( '*' |
389 |
'*.st' |
|
390 |
'*.[h,c]*' |
|
12760 | 391 |
'*.txt; *.htm*' |
392 |
'*.gif; *.xpm; *.jpg; *.png' |
|
393 |
'~*o; ~*.obj; ~*.dll;' |
|
4414 | 394 |
) |
3892 | 395 |
]. |
396 |
^ DefaultFilters. |
|
12760 | 397 |
|
398 |
" |
|
399 |
DefaultFilters := nil |
|
400 |
" |
|
3892 | 401 |
! |
402 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
403 |
initialCommandFor:fileName in:aDirectory intoBox:aBox |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
404 |
"set a useful initial command in an execute box." |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
405 |
|
4523 | 406 |
|mime cmd select path suffix baseName pathName| |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
407 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
408 |
path := aDirectory filenameFor:fileName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
409 |
baseName := path baseName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
410 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
411 |
|
16160 | 412 |
cmd := UserPreferences current defaultFileOpenCommandFor:suffix. |
413 |
cmd notNil ifTrue:[ |
|
414 |
aBox initialText:(cmd bindWith:fileName pathName). |
|
415 |
^ self |
|
416 |
]. |
|
417 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
418 |
mime := MIMETypes mimeTypeForSuffix:suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
419 |
"/ mime notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
420 |
"/ cmd := self initialCommandForMIME:mime file:path |
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 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
423 |
"/ 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
|
424 |
"/ XXX or from resources. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
425 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
426 |
(path type == #regular) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
427 |
path isExecutableProgram ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
428 |
aBox initialText:(path pathName , ' <arguments>'). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
429 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
430 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
431 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
432 |
select := true. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
433 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
434 |
"some heuristics - my personal preferences ... |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
435 |
(actually this should come from a configfile)" |
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 |
(baseName endsWith:'akefile') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
438 |
aBox initialText:'make target' selectFrom:6 to:11. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
439 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
440 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
441 |
|
18264 | 442 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:mime. |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
443 |
cmd notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
444 |
select := false |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
445 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
446 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
447 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
448 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
449 |
(suffix = 'C') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
450 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
451 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
452 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
453 |
suffix := suffix asLowercase. |
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 = 'taz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
456 |
aBox initialText:'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
457 |
select := false. |
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 = 'tar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
460 |
cmd := 'tar tvf %1'. |
18578 | 461 |
select := 'tar tvf' size |
4496
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 = 'zoo') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
464 |
cmd := 'zoo -list %1'. |
18578 | 465 |
select := 'zoo -list' size |
4496
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 = 'zip') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
468 |
cmd := 'unzip -l %1'. |
18578 | 469 |
select := 'unzip -l' size |
4496
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 = 'jar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
472 |
cmd := 'unzip -l %1'. |
18578 | 473 |
select := 'unzip -l' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
474 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
475 |
(suffix = 'z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
476 |
(baseName asLowercase endsWith:'tar.z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
477 |
cmd := 'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
478 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
479 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
480 |
cmd := 'uncompress %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
481 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
482 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
483 |
(suffix = 'gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
484 |
(baseName asLowercase endsWith:'tar.gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
485 |
cmd := ('gunzip < %1 | tar tvf -' ). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
486 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
487 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
488 |
cmd := 'gunzip %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 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
491 |
(suffix = 'html') ifTrue:[ |
18578 | 492 |
"/ cmd := 'netscape %1' |
493 |
cmd := 'firefox %1'. |
|
494 |
select := 'firefox' size |
|
4496
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 = 'htm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
497 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
498 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
499 |
(suffix = 'uue') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
500 |
cmd := 'uudecode %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
501 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
502 |
(suffix = 'c') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
503 |
cmd := 'cc -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
504 |
select := 5. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
505 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
506 |
(suffix = 'cc') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
507 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
508 |
select := 6. |
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 = 'xbm') ifTrue:[ |
18578 | 511 |
cmd := 'bitmap %1'. |
512 |
select := 'bitmap' size |
|
4496
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 |
(suffix = 'ps') ifTrue:[ |
18578 | 515 |
cmd := 'ghostview %1'. |
516 |
select := 'ghostview' size |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
517 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
518 |
((suffix = '1') or:[suffix = 'man']) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
519 |
cmd := 'nroff -man %1'. |
18578 | 520 |
select := 'nroff -man' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
521 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
522 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
523 |
]. |
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 isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
526 |
DefaultCommandPerSuffix isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
527 |
cmd := '<cmd>' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
528 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
529 |
cmd := DefaultCommandPerSuffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
530 |
at:suffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
531 |
ifAbsent:'<cmd>'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
532 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
533 |
cmd := cmd , ' %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
534 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
535 |
|
4523 | 536 |
pathName := path pathName. |
537 |
OperatingSystem isUNIXlike ifTrue:[ |
|
538 |
pathName includesSeparator ifTrue:[ |
|
539 |
pathName := '"' , pathName , '"' |
|
540 |
] |
|
541 |
]. |
|
542 |
||
543 |
cmd := cmd bindWith:pathName. |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
544 |
select == false ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
545 |
aBox initialText:cmd |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
546 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
547 |
select class == Interval ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
548 |
aBox initialText:cmd selectFrom:select start to:select stop |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
549 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
550 |
select isInteger ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
551 |
select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
552 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
553 |
aBox initialText:cmd selectFrom:1 to:select |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
554 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
555 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
556 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
557 |
|
18264 | 558 |
"Modified: / 24-09-1997 / 16:34:52 / stefan" |
559 |
"Modified: / 09-04-1998 / 17:15:57 / cg" |
|
560 |
"Modified: / 09-07-2018 / 11:16:30 / Stefan Vogel" |
|
18578 | 561 |
"Modified: / 05-02-2019 / 10:23:20 / Claus Gittinger" |
3892 | 562 |
! |
563 |
||
5941 | 564 |
listOfRuntimeValuesToRemember |
565 |
" list of all aspects that will be remembered after closing a FileBrowserV2" |
|
566 |
||
567 |
^ #( |
|
568 |
"/ #filterModel |
|
569 |
#enableFileHistory |
|
570 |
#fileHistory |
|
571 |
#currentSortOrder |
|
572 |
#sortBlockProperty |
|
573 |
) |
|
3892 | 574 |
! |
575 |
||
576 |
resetAspects |
|
577 |
||
578 |
RuntimeAspects := nil. |
|
579 |
||
5941 | 580 |
" |
581 |
self resetAspects |
|
582 |
" |
|
3892 | 583 |
! |
584 |
||
585 |
runtimeAspects |
|
586 |
||
587 |
RuntimeAspects isNil ifTrue:[ |
|
4414 | 588 |
RuntimeAspects := Dictionary new. |
3892 | 589 |
]. |
590 |
^ RuntimeAspects |
|
591 |
! |
|
592 |
||
4201 | 593 |
userPreferencesAspectList |
594 |
" list of all aspects that will be saved with save settings |
|
595 |
that aspects will be image consistent if the settings are saved in Launcher |
|
11501 | 596 |
don't forget to add a access methods in UserPreferences if you add a aspect here |
4201 | 597 |
" |
598 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
599 |
^ Dictionary |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
600 |
withKeysAndValues:#( |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
601 |
viewDirsInContentsBrowser true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
602 |
showDirectoryTree true |
11501 | 603 |
showHiddenFiles true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
604 |
viewDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
605 |
viewDetails true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
606 |
viewDirectoryDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
607 |
viewFilesInDirectoryTree false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
608 |
viewGroup false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
609 |
viewOwner false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
610 |
viewPermissions false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
611 |
viewPreview false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
612 |
viewSize true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
613 |
viewSizeInKiloBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
614 |
viewSizeInBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
615 |
viewTime true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
616 |
viewType false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
617 |
openMultipleApplicationsForType false |
7788 | 618 |
filenameEntryFieldVisibleHolder true |
619 |
toolBarVisibleHolder true |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
620 |
sortDirectoriesBeforeFiles true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
621 |
openAlwaysInTextEditor false |
15111 | 622 |
alwaysUseSmalltalkTools true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
623 |
sortCaseless false |
13011 | 624 |
"/ 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
|
625 |
showDirectoriesOnTop false |
4201 | 626 |
) |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
627 |
|
11501 | 628 |
"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
|
629 |
"Modified: / 12-08-2014 / 13:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3892 | 630 |
! ! |
631 |
||
17202 | 632 |
!AbstractFileBrowser class methodsFor:'drag & drop'! |
633 |
||
634 |
doStartDrag:aDropSource in:aView |
|
635 |
"set the cursors before starting the drag & drop operation" |
|
636 |
||
637 |
|hdl| |
|
638 |
||
639 |
hdl := DragAndDropManager new. |
|
640 |
||
641 |
hdl disabledCursor:self disabledCursorIcon. |
|
642 |
hdl enabledCursor:self enabledCursorIcon. |
|
643 |
hdl alienCursor:nil. |
|
644 |
||
645 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft. |
|
646 |
||
647 |
"Modified: / 23-07-2007 / 23:00:38 / cg" |
|
648 |
! ! |
|
649 |
||
5398 | 650 |
!AbstractFileBrowser class methodsFor:'help specs'! |
651 |
||
17889 | 652 |
basicHelpSpec |
6099 | 653 |
<resource: #help> |
654 |
||
17889 | 655 |
^ super helpSpec addPairsFrom:#( |
6099 | 656 |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
657 |
#lockFileEncoding |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
658 |
'Do not guess the encoding from the file''s contents.' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
659 |
|
6100 | 660 |
#closeTabButton |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
661 |
'Close this tab' |
6100 | 662 |
|
6099 | 663 |
#addTerminal |
17182 | 664 |
'Add a shell terminal page' |
6099 | 665 |
|
666 |
#make |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
667 |
'Call the make command' |
6099 | 668 |
|
669 |
#searchFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
670 |
'Search a file' |
6099 | 671 |
|
672 |
#directoryUp |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
673 |
'Directory up' |
6099 | 674 |
|
675 |
#directoryBack |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
676 |
'Directory back' |
6099 | 677 |
|
678 |
#directoryForward |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
679 |
'Directory forward' |
6099 | 680 |
|
681 |
#directoryHistory |
|
682 |
'Directory' |
|
683 |
||
684 |
#copyFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
685 |
'Copy the selected file(s)' |
6099 | 686 |
|
687 |
#cutFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
688 |
'Cut the selected file(s)' |
6099 | 689 |
|
690 |
#editFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
691 |
'Edit the selected file' |
6099 | 692 |
|
693 |
#fileHome |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
694 |
'Goto home directory' |
6099 | 695 |
|
8093 | 696 |
#fileDesktop |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
697 |
'Goto desktop directory' |
8093 | 698 |
|
6099 | 699 |
#fileGotoDefault |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
700 |
'Goto default directory (ST/X start directory)' |
6099 | 701 |
|
6454 | 702 |
#fileGotoSmalltalkDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
703 |
'Goto Smalltalk directory (ST/X application)' |
6454 | 704 |
|
6456 | 705 |
#fileGotoDefaultDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
706 |
'Goto current directory' |
6456 | 707 |
|
6099 | 708 |
#pasteFile |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
709 |
'Paste file(s)' |
6099 | 710 |
|
711 |
#deleteFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
712 |
'Delete the selected file(s)' |
6099 | 713 |
|
714 |
#fileIn |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
715 |
'File in' |
6099 | 716 |
|
717 |
#fileHistory |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
718 |
'File history' |
6099 | 719 |
|
720 |
#fileGotoBookmark |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
721 |
'Goto bookmarked directory' |
6099 | 722 |
|
723 |
#hideToolBar |
|
13910 | 724 |
'Hide the toolbar (show again via "View"-menu)' |
6099 | 725 |
|
726 |
#hideFilenameEntryField |
|
13910 | 727 |
'Hide filename & filter fields (show again via "View"-menu)' |
728 |
||
729 |
#hideBookmarks |
|
730 |
'Hide the bookmarks (show again via "View"-menu)' |
|
6099 | 731 |
|
732 |
#openChangeBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
733 |
'Open a Changebrowser on file' |
6099 | 734 |
|
735 |
#showFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
736 |
'Show file details' |
6099 | 737 |
|
738 |
#hideFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
739 |
'Hide file details' |
6099 | 740 |
|
741 |
#toggleDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
742 |
'Show/hide file details' |
6099 | 743 |
|
744 |
#viewDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
745 |
'Show/hide file details' |
6099 | 746 |
|
747 |
#selectDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
748 |
'Select file details to be shown' |
6099 | 749 |
|
8088 | 750 |
#showDifferences |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
751 |
'Show differences between file and editor versions' |
8088 | 752 |
|
753 |
#toggleHexDisplay |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
754 |
'Toggle between hexadecimal and textual representation' |
8088 | 755 |
|
756 |
#findInBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
757 |
'Navigate the browser''s file list to the edited file' |
8088 | 758 |
|
759 |
#saveFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
760 |
'Save the editor''s contents into the file' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
761 |
|
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
762 |
#saveFileAs |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
763 |
'Save the editor''s contents into another file' |
8088 | 764 |
|
765 |
#reloadFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
766 |
'Reload from the file' |
8088 | 767 |
|
768 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
769 |
'Send to the printer' |
8088 | 770 |
|
6099 | 771 |
). |
772 |
||
8261 | 773 |
" |
17889 | 774 |
self helpSpec |
8261 | 775 |
" |
776 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
777 |
"Modified: / 06-10-2011 / 14:55:27 / cg" |
8261 | 778 |
! |
779 |
||
17889 | 780 |
helpSpec |
8261 | 781 |
<resource: #programHelp> |
782 |
||
783 |
|spec hist resources| |
|
784 |
||
17889 | 785 |
spec := self basicHelpSpec. |
8261 | 786 |
|
787 |
"/ add help items for the history |
|
6099 | 788 |
hist := self directoryHistory. |
789 |
hist notNil ifTrue:[ |
|
790 |
resources := self classResources. |
|
791 |
hist canForward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
792 |
spec at:#directoryForward put:[ resources string:'Forward to: %1' with:hist nextForwardItem ]. |
6099 | 793 |
]. |
794 |
hist canBackward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
795 |
spec at:#directoryBack put:[ resources string:'Back to: %1' with:hist nextBackwardItem ]. |
6099 | 796 |
]. |
797 |
]. |
|
798 |
^ spec. |
|
799 |
||
800 |
" |
|
17889 | 801 |
self helpSpec |
6099 | 802 |
" |
803 |
||
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
804 |
"Modified: / 03-11-2007 / 12:05:01 / cg" |
5398 | 805 |
! ! |
806 |
||
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
807 |
!AbstractFileBrowser class methodsFor:'image specs'! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
808 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
809 |
clearHistoryIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
810 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
811 |
|
17413 | 812 |
^ ToolbarIconLibrary deleteIcon |
813 |
"/ ^ Icon deleteIcon |
|
814 |
||
815 |
"Modified: / 15-02-2017 / 19:45:24 / cg" |
|
8994
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 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
818 |
copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
819 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
820 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
821 |
^ ToolbarIconLibrary copyIcon |
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 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
824 |
cutIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
825 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
826 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
827 |
^ ToolbarIconLibrary cut20x20Icon2 "cut28x28Icon" |
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 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
830 |
deleteIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
831 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
832 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
833 |
^ ToolbarIconLibrary erase20x20Icon "/ delete28x28Icon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
834 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
835 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
836 |
directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
837 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
838 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
839 |
^ ToolbarIconLibrary directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
840 |
! |
3892 | 841 |
|
15211 | 842 |
disabledCursorIcon |
843 |
"This resource specification was automatically generated |
|
844 |
by the ImageEditor of ST/X." |
|
845 |
||
846 |
"Do not manually edit this!! If it is corrupted, |
|
847 |
the ImageEditor may not be able to read the specification." |
|
848 |
||
849 |
" |
|
17202 | 850 |
self disabledCursorIcon inspect |
851 |
ImageEditor openOnClass:self andSelector:#disabledCursorIcon |
|
15211 | 852 |
Icon flushCachedIcons |
853 |
" |
|
854 |
||
855 |
<resource: #image> |
|
856 |
||
857 |
^Icon |
|
858 |
constantNamed:#'AbstractFileBrowser class disabledCursorIcon' |
|
859 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
860 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@XF@@@H@P@@DOB@@BLLP@AA@"@@RHD @H1AD@BRHI@@$QBP@IBH$@BPQI@@"BLP@D QH@ADBB@@H0Q@@AC |
|
861 |
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:' |
|
862 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@_>@@@O?0@@G?>@@C<O0@A?@>@@_8G @O?A<@C38O@@<_C0@OC8<@C0_O@@>C?0@G _8@A<C>@@O0_@@A? |
|
863 |
? @@O?0@@A?8@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
864 |
! |
|
6337 | 865 |
|
15211 | 866 |
enabledCursorIcon |
867 |
"This resource specification was automatically generated |
|
868 |
by the ImageEditor of ST/X." |
|
869 |
||
870 |
"Do not manually edit this!! If it is corrupted, |
|
871 |
the ImageEditor may not be able to read the specification." |
|
872 |
||
873 |
" |
|
17202 | 874 |
self enabledCursorIcon inspect |
875 |
ImageEditor openOnClass:self andSelector:#enabledCursorIcon |
|
15211 | 876 |
Icon flushCachedIcons |
877 |
" |
|
878 |
||
879 |
<resource: #image> |
|
880 |
||
881 |
^Icon |
|
882 |
constantNamed:#'AbstractFileBrowser class enabledCursorIcon' |
|
883 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
884 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@@@@@?0_0@@@@@@C?A?@@@@@@@@AP@@@@T@@@@E@@@@A |
|
885 |
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:' |
|
886 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@?8?0@O>O<@C?#?@@@G@@@@A0@@@@\@@@@G@@@@A |
|
887 |
0@@@@\@@@@G@@@@A0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
888 |
! |
|
6337 | 889 |
|
3892 | 890 |
fileInIcon |
891 |
<resource: #programImage> |
|
892 |
||
6116 | 893 |
^ ToolbarIconLibrary fileInIcon |
3892 | 894 |
! |
895 |
||
6079 | 896 |
historyBackIcon |
897 |
<resource: #programImage> |
|
898 |
||
899 |
^ ToolbarIconLibrary historyBackIcon |
|
900 |
! |
|
901 |
||
902 |
historyForwardIcon |
|
903 |
<resource: #programImage> |
|
904 |
||
905 |
^ ToolbarIconLibrary historyForwardIcon |
|
906 |
! |
|
907 |
||
3892 | 908 |
homeIcon |
909 |
<resource: #programImage> |
|
910 |
||
6079 | 911 |
^ ToolbarIconLibrary homeIcon |
3892 | 912 |
! |
913 |
||
6074 | 914 |
homeIcon2 |
6079 | 915 |
<resource: #programImage> |
916 |
||
917 |
^ ToolbarIconLibrary homeIcon2 |
|
6074 | 918 |
! |
919 |
||
920 |
htmlReloadIcon |
|
921 |
<resource: #programImage> |
|
922 |
||
923 |
^ ToolbarIconLibrary reload22x22Icon |
|
924 |
! |
|
925 |
||
15211 | 926 |
leftDownIcon |
927 |
<resource: #image> |
|
928 |
"This resource specification was automatically generated |
|
929 |
by the ImageEditor of ST/X." |
|
930 |
"Do not manually edit this!! If it is corrupted, |
|
931 |
the ImageEditor may not be able to read the specification." |
|
932 |
" |
|
933 |
self leftDownIcon inspect |
|
934 |
ImageEditor openOnClass:self andSelector:#leftDownIcon" |
|
935 |
||
936 |
^ Icon constantNamed:#'AbstractFileBrowser class leftDownIcon' |
|
937 |
ifAbsentPut:[ |
|
938 |
(Depth2Image new) |
|
939 |
width:28; |
|
940 |
height:28; |
|
941 |
photometric:(#palette); |
|
942 |
bitsPerSample:(#( 2 )); |
|
943 |
samplesPerPixel:(1); |
|
944 |
bits:(ByteArray |
|
945 |
fromPackedString:' |
|
946 |
UUUUUUUUUUUPAUUUUUUUP@UUUUUUUPB!!UUUUUU@B*AUUUUU@B*(UUUUUPB** UUUUPB***AUUUTB***(EUUUB****%UUUR*****UUUUU@*%UUUUUUPJ)UUUU |
|
947 |
UUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*$@@@@AUPJ*****)UTB******UU@******%UPJ*****)UTAUUUU |
|
948 |
UUUU@@@@@@@AUUUUUUUUUP@a'); |
|
949 |
colorMapFromArray:#[ 255 255 255 0 0 0 40 40 100 255 0 0 ]; |
|
950 |
mask:((ImageMask new) |
|
951 |
width:28; |
|
952 |
height:28; |
|
953 |
bits:(ByteArray |
|
954 |
fromPackedString:' |
|
955 |
@@@@@@@@@@@@ @@@@\@@@@O @@@G<@@@C? @@A?<@@@?? @@_?<@@G?? @@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C??? @???8@O? |
|
956 |
?>@C??? @???8@O??>@@@@@@@@@@@@@a'); |
|
957 |
yourself); |
|
958 |
yourself |
|
959 |
] |
|
960 |
! |
|
961 |
||
962 |
menuHistoryList9x20Icon |
|
963 |
<resource: #image> |
|
964 |
"This resource specification was automatically generated |
|
965 |
by the ImageEditor of ST/X." |
|
966 |
"Do not manually edit this!! If it is corrupted, |
|
967 |
the ImageEditor may not be able to read the specification." |
|
968 |
" |
|
969 |
self menuHistoryList9x20Icon inspect |
|
970 |
ImageEditor openOnClass:self andSelector:#menuHistoryList9x20Icon |
|
971 |
Icon flushCachedIcons" |
|
972 |
||
973 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryList9x20Icon' |
|
974 |
ifAbsentPut:[ |
|
975 |
(Depth1Image new) |
|
976 |
width:9; |
|
977 |
height:20; |
|
978 |
photometric:(#palette); |
|
979 |
bitsPerSample:(#( 1 )); |
|
980 |
samplesPerPixel:(1); |
|
981 |
bits:(ByteArray |
|
982 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
983 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
984 |
mask:((ImageMask new) |
|
985 |
width:9; |
|
986 |
height:20; |
|
987 |
bits:(ByteArray |
|
988 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
989 |
yourself); |
|
990 |
yourself |
|
991 |
] |
|
992 |
! |
|
993 |
||
994 |
menuHistoryListIcon |
|
995 |
<resource: #image> |
|
996 |
"This resource specification was automatically generated |
|
997 |
by the ImageEditor of ST/X." |
|
998 |
"Do not manually edit this!! If it is corrupted, |
|
999 |
the ImageEditor may not be able to read the specification." |
|
1000 |
" |
|
1001 |
self menuHistoryListIcon inspect |
|
1002 |
ImageEditor openOnClass:self andSelector:#menuHistoryListIcon" |
|
1003 |
||
1004 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryListIcon' |
|
1005 |
ifAbsentPut:[ |
|
1006 |
(Depth1Image new) |
|
1007 |
width:12; |
|
1008 |
height:12; |
|
1009 |
photometric:(#palette); |
|
1010 |
bitsPerSample:(#( 1 )); |
|
1011 |
samplesPerPixel:(1); |
|
1012 |
bits:(ByteArray fromPackedString:'??S?<O?0??C?<O?0??/?=_?0??C?<O?0'); |
|
1013 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
1014 |
mask:((ImageMask new) |
|
1015 |
width:12; |
|
1016 |
height:12; |
|
1017 |
bits:(ByteArray fromPackedString:'@@@O@@<@C0A?8C?@G8@O@@X@@@A?8@@@'); |
|
1018 |
yourself); |
|
1019 |
yourself |
|
1020 |
] |
|
1021 |
! |
|
3892 | 1022 |
|
6087 | 1023 |
newDirectoryIcon |
6074 | 1024 |
<resource: #programImage> |
1025 |
||
6087 | 1026 |
^ ToolbarIconLibrary newDirectoryIcon |
3923 | 1027 |
! |
1028 |
||
6091 | 1029 |
removeTabIcon |
1030 |
<resource: #programImage> |
|
1031 |
||
1032 |
^ ToolbarIconLibrary removeTabIcon |
|
1033 |
! |
|
1034 |
||
3892 | 1035 |
vt100Terminal |
1036 |
<resource: #programImage> |
|
1037 |
||
1038 |
^ ToolbarIconLibrary shell20x20Icon |
|
1039 |
! ! |
|
1040 |
||
5528 | 1041 |
!AbstractFileBrowser class methodsFor:'interface specs'! |
1042 |
||
15211 | 1043 |
encodingDialogSpec |
1044 |
"This resource specification was automatically generated |
|
1045 |
by the UIPainter of ST/X." |
|
1046 |
||
1047 |
"Do not manually edit this!! If it is corrupted, |
|
1048 |
the UIPainter may not be able to read the specification." |
|
1049 |
||
1050 |
" |
|
1051 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#encodingDialogSpec |
|
1052 |
AbstractFileBrowser new openInterface:#encodingDialogSpec |
|
1053 |
" |
|
1054 |
||
1055 |
<resource: #canvas> |
|
1056 |
||
1057 |
^ |
|
1058 |
#(FullSpec |
|
1059 |
name: encodingDialogSpec |
|
1060 |
window: |
|
1061 |
(WindowSpec |
|
1062 |
label: 'File Encoding' |
|
1063 |
name: 'File Encoding' |
|
1064 |
min: (Point 10 10) |
|
1065 |
bounds: (Rectangle 0 0 379 590) |
|
1066 |
) |
|
1067 |
component: |
|
1068 |
(SpecCollection |
|
1069 |
collection: ( |
|
1070 |
(LabelSpec |
|
1071 |
label: 'Select the External (File-) Encoding:' |
|
1072 |
name: 'Label1' |
|
1073 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1074 |
translateLabel: true |
|
1075 |
adjust: left |
|
1076 |
) |
|
1077 |
(DataSetSpec |
|
1078 |
name: 'Table1' |
|
1079 |
layout: (LayoutFrame 0 0 30 0 0 1 -60 1) |
|
1080 |
model: selectedEncoding |
|
1081 |
hasHorizontalScrollBar: true |
|
1082 |
hasVerticalScrollBar: true |
|
1083 |
dataList: encodingList |
|
1084 |
has3Dseparators: true |
|
1085 |
columns: |
|
1086 |
(Array |
|
1087 |
||
1088 |
(DataSetColumnSpec |
|
1089 |
label: 'Encoding' |
|
1090 |
labelButtonType: Button |
|
1091 |
height: heightOfFirstRow |
|
1092 |
model: at: |
|
1093 |
canSelect: false |
|
1094 |
isResizeable: false |
|
1095 |
showRowSeparator: false |
|
1096 |
showColSeparator: false |
|
1097 |
) |
|
1098 |
(DataSetColumnSpec |
|
1099 |
label: 'Description' |
|
1100 |
labelButtonType: Button |
|
1101 |
height: heightOfFirstRow |
|
1102 |
model: at: |
|
1103 |
canSelect: false |
|
1104 |
isResizeable: false |
|
1105 |
showRowSeparator: false |
|
1106 |
showColSeparator: false |
|
1107 |
) |
|
1108 |
) |
|
1109 |
doubleClickChannel: accept |
|
1110 |
) |
|
1111 |
(CheckBoxSpec |
|
1112 |
label: 'Lock Encoding' |
|
1113 |
name: 'LockEncodingCheckBox' |
|
1114 |
layout: (LayoutFrame 3 0 -60 1 217 0 -30 1) |
|
1115 |
activeHelpKey: lockFileEncoding |
|
1116 |
model: lockFileEncoding |
|
1117 |
translateLabel: true |
|
1118 |
) |
|
1119 |
(HorizontalPanelViewSpec |
|
1120 |
name: 'ButtonPanel' |
|
1121 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1122 |
horizontalLayout: fitSpace |
|
1123 |
verticalLayout: center |
|
1124 |
horizontalSpace: 3 |
|
1125 |
verticalSpace: 3 |
|
1126 |
reverseOrderIfOKAtLeft: true |
|
1127 |
component: |
|
1128 |
(SpecCollection |
|
1129 |
collection: ( |
|
1130 |
(ActionButtonSpec |
|
1131 |
label: 'Cancel' |
|
1132 |
name: 'Button2' |
|
1133 |
translateLabel: true |
|
1134 |
model: cancel |
|
1135 |
extent: (Point 183 22) |
|
1136 |
) |
|
1137 |
(ActionButtonSpec |
|
1138 |
label: 'OK' |
|
1139 |
name: 'Button1' |
|
1140 |
translateLabel: true |
|
1141 |
model: accept |
|
1142 |
isDefault: true |
|
1143 |
extent: (Point 184 22) |
|
1144 |
) |
|
1145 |
) |
|
1146 |
||
1147 |
) |
|
1148 |
) |
|
1149 |
) |
|
1150 |
||
1151 |
) |
|
1152 |
) |
|
1153 |
! |
|
1154 |
||
1155 |
lineEndConventionDialogSpec |
|
1156 |
"This resource specification was automatically generated |
|
1157 |
by the UIPainter of ST/X." |
|
1158 |
||
1159 |
"Do not manually edit this!! If it is corrupted, |
|
1160 |
the UIPainter may not be able to read the specification." |
|
1161 |
||
1162 |
" |
|
1163 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#lineEndConventionDialogSpec |
|
1164 |
AbstractFileBrowser new openInterface:#lineEndConventionDialogSpec |
|
1165 |
" |
|
1166 |
||
1167 |
<resource: #canvas> |
|
1168 |
||
1169 |
^ |
|
15212 | 1170 |
#(FullSpec |
1171 |
name: lineEndConventionDialogSpec |
|
1172 |
window: |
|
1173 |
(WindowSpec |
|
1174 |
label: 'Line-End Convention' |
|
1175 |
name: 'Line-End Convention' |
|
1176 |
min: (Point 10 10) |
|
1177 |
bounds: (Rectangle 0 0 379 239) |
|
1178 |
) |
|
1179 |
component: |
|
1180 |
(SpecCollection |
|
1181 |
collection: ( |
|
1182 |
(LabelSpec |
|
1183 |
label: 'Select the Line-End Convention (used when saving files):' |
|
1184 |
name: 'Label1' |
|
1185 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1186 |
translateLabel: true |
|
1187 |
adjust: left |
|
1188 |
) |
|
1189 |
(VerticalPanelViewSpec |
|
1190 |
name: 'VerticalPanel1' |
|
1191 |
layout: (LayoutFrame 20 0 40 0 0 1 -30 1) |
|
1192 |
horizontalLayout: fit |
|
1193 |
verticalLayout: topSpace |
|
1194 |
horizontalSpace: 3 |
|
1195 |
verticalSpace: 3 |
|
1196 |
component: |
|
1197 |
(SpecCollection |
|
1198 |
collection: ( |
|
1199 |
(RadioButtonSpec |
|
1200 |
label: 'NL (Unix)' |
|
1201 |
name: 'RadioButton1' |
|
1202 |
translateLabel: true |
|
1203 |
model: lineEndConvention |
|
1204 |
isTriggerOnDown: true |
|
1205 |
select: nl |
|
1206 |
extent: (Point 359 22) |
|
1207 |
) |
|
1208 |
(RadioButtonSpec |
|
1209 |
label: 'CR-NL (MSDOS)' |
|
1210 |
name: 'RadioButton4' |
|
1211 |
translateLabel: true |
|
1212 |
model: lineEndConvention |
|
1213 |
isTriggerOnDown: true |
|
1214 |
select: crlf |
|
1215 |
extent: (Point 359 22) |
|
1216 |
) |
|
1217 |
(RadioButtonSpec |
|
1218 |
label: 'CR (VMS and pre OSX mac)' |
|
1219 |
name: 'RadioButton5' |
|
1220 |
translateLabel: true |
|
1221 |
model: lineEndConvention |
|
1222 |
isTriggerOnDown: true |
|
1223 |
select: cr |
|
1224 |
extent: (Point 359 22) |
|
15211 | 1225 |
) |
15212 | 1226 |
(RadioButtonSpec |
1227 |
label: 'ETX (some modem protocols and mainframe files)' |
|
1228 |
name: 'RadioButton6' |
|
1229 |
translateLabel: true |
|
1230 |
model: lineEndConvention |
|
1231 |
isTriggerOnDown: true |
|
1232 |
select: etx |
|
1233 |
extent: (Point 359 22) |
|
1234 |
) |
|
1235 |
(RadioButtonSpec |
|
1236 |
label: 'EOT (some modem protocols and mainframe files)' |
|
1237 |
name: 'RadioButton7' |
|
1238 |
translateLabel: true |
|
1239 |
model: lineEndConvention |
|
1240 |
isTriggerOnDown: true |
|
1241 |
select: eot |
|
1242 |
extent: (Point 359 22) |
|
15211 | 1243 |
) |
15212 | 1244 |
) |
1245 |
||
1246 |
) |
|
15211 | 1247 |
) |
15212 | 1248 |
(HorizontalPanelViewSpec |
1249 |
name: 'ButtonPanel' |
|
1250 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1251 |
horizontalLayout: fitSpace |
|
1252 |
verticalLayout: center |
|
1253 |
horizontalSpace: 3 |
|
1254 |
verticalSpace: 3 |
|
1255 |
reverseOrderIfOKAtLeft: true |
|
1256 |
component: |
|
1257 |
(SpecCollection |
|
1258 |
collection: ( |
|
1259 |
(ActionButtonSpec |
|
1260 |
label: 'Cancel' |
|
1261 |
name: 'Button2' |
|
1262 |
translateLabel: true |
|
1263 |
model: cancel |
|
1264 |
extent: (Point 185 22) |
|
1265 |
) |
|
1266 |
(ActionButtonSpec |
|
1267 |
label: 'OK' |
|
1268 |
name: 'Button1' |
|
1269 |
translateLabel: true |
|
1270 |
model: accept |
|
1271 |
isDefault: true |
|
1272 |
extent: (Point 185 22) |
|
1273 |
) |
|
1274 |
) |
|
1275 |
||
1276 |
) |
|
1277 |
) |
|
1278 |
) |
|
1279 |
||
1280 |
) |
|
1281 |
) |
|
15211 | 1282 |
! |
1283 |
||
1284 |
tabStopConversionDialogSpec |
|
1285 |
"This resource specification was automatically generated |
|
1286 |
by the UIPainter of ST/X." |
|
1287 |
||
1288 |
"Do not manually edit this!! If it is corrupted, |
|
1289 |
the UIPainter may not be able to read the specification." |
|
1290 |
||
1291 |
" |
|
1292 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#tabStopConversionDialogSpec |
|
1293 |
AbstractFileBrowser new openInterface:#tabStopConversionDialogSpec |
|
1294 |
" |
|
1295 |
||
1296 |
<resource: #canvas> |
|
1297 |
||
1298 |
^ |
|
1299 |
#(FullSpec |
|
1300 |
name: 'tabStopConversionDialogSpec' |
|
1301 |
window: |
|
1302 |
(WindowSpec |
|
1303 |
label: 'Tab-Stop Conversion' |
|
1304 |
name: 'Tab-Stop Conversion' |
|
1305 |
min: (Point 10 10) |
|
1306 |
bounds: (Rectangle 0 0 379 239) |
|
1307 |
) |
|
1308 |
component: |
|
1309 |
(SpecCollection |
|
1310 |
collection: ( |
|
1311 |
(LabelSpec |
|
1312 |
label: 'Select the Tab-Stop Conversion (used when saving files):' |
|
1313 |
name: 'Label1' |
|
1314 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1315 |
translateLabel: true |
|
1316 |
adjust: left |
|
1317 |
) |
|
1318 |
(VerticalPanelViewSpec |
|
1319 |
name: 'VerticalPanel1' |
|
1320 |
layout: (LayoutFrame 0 0 30 0 0 1 -30 1) |
|
1321 |
horizontalLayout: center |
|
1322 |
verticalLayout: center |
|
1323 |
horizontalSpace: 3 |
|
1324 |
verticalSpace: 3 |
|
1325 |
component: |
|
1326 |
(SpecCollection |
|
1327 |
collection: ( |
|
1328 |
(RadioButtonSpec |
|
1329 |
label: '4' |
|
1330 |
name: 'RadioButton1' |
|
1331 |
translateLabel: true |
|
1332 |
model: tabStops |
|
1333 |
isTriggerOnDown: true |
|
1334 |
select: 4 |
|
1335 |
extent: (Point 136 22) |
|
1336 |
) |
|
1337 |
(RadioButtonSpec |
|
1338 |
label: '8' |
|
1339 |
name: 'RadioButton4' |
|
1340 |
translateLabel: true |
|
1341 |
model: tabStops |
|
1342 |
isTriggerOnDown: true |
|
1343 |
select: 8 |
|
1344 |
extent: (Point 136 22) |
|
1345 |
) |
|
1346 |
) |
|
1347 |
||
1348 |
) |
|
1349 |
) |
|
1350 |
(HorizontalPanelViewSpec |
|
1351 |
name: 'ButtonPanel' |
|
1352 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1353 |
horizontalLayout: fitSpace |
|
1354 |
verticalLayout: center |
|
1355 |
horizontalSpace: 3 |
|
1356 |
verticalSpace: 3 |
|
1357 |
reverseOrderIfOKAtLeft: true |
|
1358 |
component: |
|
1359 |
(SpecCollection |
|
1360 |
collection: ( |
|
1361 |
(ActionButtonSpec |
|
1362 |
label: 'Cancel' |
|
1363 |
name: 'Button2' |
|
1364 |
translateLabel: true |
|
1365 |
model: cancel |
|
1366 |
extent: (Point 185 22) |
|
1367 |
) |
|
1368 |
(ActionButtonSpec |
|
1369 |
label: 'OK' |
|
1370 |
name: 'Button1' |
|
1371 |
translateLabel: true |
|
1372 |
model: accept |
|
1373 |
isDefault: true |
|
1374 |
extent: (Point 185 22) |
|
1375 |
) |
|
1376 |
) |
|
1377 |
||
1378 |
) |
|
1379 |
) |
|
1380 |
) |
|
1381 |
||
1382 |
) |
|
1383 |
) |
|
1384 |
||
1385 |
"Modified: / 28-02-2012 / 11:12:38 / cg" |
|
1386 |
! ! |
|
5528 | 1387 |
|
3892 | 1388 |
!AbstractFileBrowser class methodsFor:'menu specs'! |
1389 |
||
15211 | 1390 |
baseBookmarksMenuSpec |
1391 |
"This resource specification was automatically generated |
|
1392 |
by the MenuEditor of ST/X." |
|
1393 |
||
1394 |
"Do not manually edit this!! If it is corrupted, |
|
1395 |
the MenuEditor may not be able to read the specification." |
|
1396 |
||
1397 |
" |
|
1398 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec |
|
1399 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec)) startUp |
|
1400 |
" |
|
1401 |
||
1402 |
<resource: #menu> |
|
1403 |
||
1404 |
^ |
|
1405 |
#(Menu |
|
1406 |
( |
|
1407 |
(MenuItem |
|
1408 |
enabled: currentFilesHasDirectories |
|
1409 |
label: 'Add Bookmark' |
|
1410 |
itemValue: addBookmark |
|
1411 |
translateLabel: true |
|
1412 |
) |
|
1413 |
(MenuItem |
|
1414 |
enabled: hasBookmarksToRemove |
|
1415 |
label: 'Remove Bookmark' |
|
1416 |
itemValue: removeBookmark |
|
1417 |
translateLabel: true |
|
1418 |
) |
|
1419 |
(MenuItem |
|
1420 |
label: 'Save Bookmarks In...' |
|
1421 |
itemValue: saveBookmarks |
|
1422 |
translateLabel: true |
|
1423 |
) |
|
1424 |
) |
|
1425 |
nil |
|
1426 |
nil |
|
1427 |
) |
|
1428 |
! |
|
1429 |
||
1430 |
baseBookmarksMenuSpec2 |
|
1431 |
"This resource specification was automatically generated |
|
1432 |
by the MenuEditor of ST/X." |
|
1433 |
||
1434 |
"Do not manually edit this!! If it is corrupted, |
|
1435 |
the MenuEditor may not be able to read the specification." |
|
1436 |
||
1437 |
" |
|
1438 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec2 |
|
1439 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec2)) startUp |
|
1440 |
" |
|
1441 |
||
1442 |
<resource: #menu> |
|
1443 |
||
1444 |
^ |
|
1445 |
#(Menu |
|
1446 |
( |
|
1447 |
(MenuItem |
|
1448 |
label: 'Edit Bookmarks' |
|
1449 |
itemValue: editBookmarks |
|
1450 |
translateLabel: true |
|
1451 |
) |
|
1452 |
(MenuItem |
|
1453 |
label: '-' |
|
1454 |
) |
|
1455 |
(MenuItem |
|
1456 |
enabled: currentFilesHasDirectories |
|
1457 |
label: 'Add Bookmark' |
|
1458 |
itemValue: addBookmark |
|
1459 |
translateLabel: true |
|
1460 |
) |
|
1461 |
) |
|
1462 |
nil |
|
1463 |
nil |
|
1464 |
) |
|
1465 |
! |
|
1466 |
||
1467 |
browserMenu |
|
1468 |
"This resource specification was automatically generated |
|
1469 |
by the MenuEditor of ST/X." |
|
1470 |
||
1471 |
"Do not manually edit this!! If it is corrupted, |
|
1472 |
the MenuEditor may not be able to read the specification." |
|
1473 |
||
1474 |
||
1475 |
" |
|
1476 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#browserMenu |
|
1477 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser browserMenu)) startUp |
|
1478 |
" |
|
1479 |
||
1480 |
<resource: #menu> |
|
1481 |
||
1482 |
^ |
|
1483 |
#(Menu |
|
1484 |
( |
|
1485 |
(MenuItem |
|
1486 |
label: 'Spawn Filebrowser' |
|
1487 |
itemValue: doSpawn |
|
1488 |
translateLabel: true |
|
1489 |
shortcutKey: Ctrln |
|
1490 |
) |
|
1491 |
(MenuItem |
|
1492 |
label: 'Windows Explorer' |
|
1493 |
itemValue: doOpenExplorer |
|
1494 |
translateLabel: true |
|
17946 | 1495 |
isVisible: systemIsDOS |
15211 | 1496 |
) |
1497 |
(MenuItem |
|
1498 |
label: 'Open Finder' |
|
1499 |
itemValue: doOpenFinder |
|
1500 |
translateLabel: true |
|
1501 |
isVisible: systemIsOSX |
|
1502 |
) |
|
1503 |
(MenuItem |
|
1504 |
label: 'C Browser' |
|
1505 |
itemValue: doOpenCBrowser |
|
1506 |
translateLabel: true |
|
1507 |
isVisible: cBrowserMenuItemVisible |
|
1508 |
) |
|
1509 |
(MenuItem |
|
18432 | 1510 |
label: 'STXGDB Debugger' |
1511 |
itemValue: doOpenGDBApplication |
|
1512 |
translateLabel: true |
|
1513 |
isVisible: stxgdbMenuItemVisible |
|
1514 |
) |
|
1515 |
(MenuItem |
|
15211 | 1516 |
label: '-' |
1517 |
) |
|
1518 |
(MenuItem |
|
1519 |
label: 'Add Text Editor Page' |
|
1520 |
itemValue: newTextEditor |
|
1521 |
translateLabel: true |
|
1522 |
shortcutKey: Ctrlt |
|
1523 |
) |
|
1524 |
(MenuItem |
|
1525 |
label: 'Add Shell Terminal Page' |
|
1526 |
itemValue: doAddTerminal |
|
1527 |
translateLabel: true |
|
1528 |
) |
|
1529 |
(MenuItem |
|
1530 |
label: 'Add Archiver Page' |
|
1531 |
itemValue: doAddArchiver |
|
1532 |
translateLabel: true |
|
1533 |
) |
|
1534 |
(MenuItem |
|
1535 |
label: 'Add Search Page' |
|
1536 |
itemValue: doOpenSearchFile |
|
1537 |
translateLabel: true |
|
1538 |
) |
|
1539 |
(MenuItem |
|
1540 |
label: '-' |
|
1541 |
isVisible: false |
|
1542 |
) |
|
1543 |
(MenuItem |
|
1544 |
label: 'Settings...' |
|
1545 |
itemValue: doOpenSettings |
|
1546 |
translateLabel: true |
|
1547 |
isVisible: false |
|
1548 |
) |
|
1549 |
(MenuItem |
|
1550 |
label: 'Encoding...' |
|
1551 |
itemValue: fileEncodingDialog |
|
1552 |
translateLabel: true |
|
1553 |
isVisible: false |
|
1554 |
) |
|
1555 |
(MenuItem |
|
1556 |
label: 'Line End Convention...' |
|
1557 |
itemValue: lineEndConventionDialog |
|
1558 |
translateLabel: true |
|
1559 |
isVisible: false |
|
1560 |
) |
|
1561 |
(MenuItem |
|
1562 |
label: 'Tab Stop Conversion...' |
|
1563 |
itemValue: tabStopConversionDialog |
|
1564 |
translateLabel: true |
|
1565 |
isVisible: false |
|
1566 |
) |
|
1567 |
(MenuItem |
|
1568 |
label: '-' |
|
1569 |
) |
|
1570 |
(MenuItem |
|
1571 |
label: 'Exit' |
|
1572 |
itemValue: closeRequest |
|
1573 |
translateLabel: true |
|
1574 |
) |
|
1575 |
) |
|
1576 |
nil |
|
1577 |
nil |
|
1578 |
) |
|
1579 |
||
17724 | 1580 |
"Modified: / 29-10-2017 / 11:13:49 / cg" |
18432 | 1581 |
"Modified: / 26-09-2018 / 12:07:26 / Claus Gittinger" |
15211 | 1582 |
! |
1583 |
||
1584 |
directoryMenu |
|
1585 |
"This resource specification was automatically generated |
|
1586 |
by the MenuEditor of ST/X." |
|
1587 |
||
1588 |
"Do not manually edit this!! If it is corrupted, |
|
1589 |
the MenuEditor may not be able to read the specification." |
|
1590 |
||
1591 |
||
1592 |
" |
|
1593 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#directoryMenu |
|
1594 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser directoryMenu)) startUp |
|
1595 |
" |
|
1596 |
||
1597 |
<resource: #menu> |
|
1598 |
||
1599 |
^ |
|
1600 |
#(Menu |
|
1601 |
( |
|
1602 |
(MenuItem |
|
1603 |
label: 'Bookmarks' |
|
1604 |
submenuChannel: bookmarksMenu |
|
1605 |
) |
|
1606 |
(MenuItem |
|
1607 |
label: 'Visited Directories' |
|
1608 |
submenuChannel: visitedDirectoriesMenu |
|
1609 |
) |
|
1610 |
(MenuItem |
|
1611 |
label: '-' |
|
1612 |
) |
|
1613 |
(MenuItem |
|
1614 |
label: 'Up' |
|
1615 |
itemValue: doGoDirectoryUp |
|
1616 |
) |
|
1617 |
(MenuItem |
|
1618 |
activeHelpKey: directoryBack |
|
1619 |
enabled: enableBack |
|
1620 |
label: 'Back' |
|
1621 |
itemValue: doBack |
|
1622 |
) |
|
1623 |
(MenuItem |
|
1624 |
activeHelpKey: directoryBack |
|
1625 |
enabled: enableForward |
|
1626 |
label: 'Forward' |
|
1627 |
itemValue: doForward |
|
1628 |
) |
|
1629 |
(MenuItem |
|
1630 |
label: '-' |
|
1631 |
) |
|
1632 |
(MenuItem |
|
1633 |
enabled: enableHome |
|
1634 |
label: 'Home Directory' |
|
1635 |
itemValue: doGotoHomeDirectory |
|
1636 |
) |
|
1637 |
(MenuItem |
|
1638 |
enabled: enableGotoDesktopDirectory |
|
1639 |
label: 'Desktop' |
|
1640 |
itemValue: doGotoDesktopDirectory |
|
1641 |
) |
|
1642 |
(MenuItem |
|
18511 | 1643 |
enabled: enableGotoDocumentsDirectory |
1644 |
label: 'Documents' |
|
1645 |
itemValue: doGotoDocumentsDirectory |
|
1646 |
) |
|
1647 |
(MenuItem |
|
18352 | 1648 |
enabled: enableGotoDownloadsDirectory |
1649 |
label: 'Downloads' |
|
1650 |
itemValue: doGotoDownloadsDirectory |
|
1651 |
) |
|
1652 |
(MenuItem |
|
15211 | 1653 |
enabled: enableGotoDefaultDirectory |
1654 |
label: 'Default (Current) Directory' |
|
1655 |
itemValue: doGotoDefaultDirectory |
|
1656 |
) |
|
1657 |
(MenuItem |
|
1658 |
enabled: enableGotoSmalltalkDirectory |
|
1659 |
label: 'Smalltalk (Application) Directory' |
|
1660 |
itemValue: doGotoSmalltalkDirectory |
|
1661 |
) |
|
1662 |
(MenuItem |
|
17187 | 1663 |
enabled: enableGotoSmalltalkWorkspaceDirectory |
1664 |
label: 'Smalltalk Workspace Directory' |
|
1665 |
itemValue: doGotoSmalltalkWorkspaceDirectory |
|
1666 |
) |
|
1667 |
(MenuItem |
|
15211 | 1668 |
enabled: enableGotoTempDirectory |
1669 |
label: 'Smalltalk Temp Directory' |
|
1670 |
itemValue: doGotoTempDirectory |
|
1671 |
) |
|
1672 |
(MenuItem |
|
1673 |
label: '-' |
|
17582 | 1674 |
isVisible: false |
15211 | 1675 |
) |
1676 |
(MenuItem |
|
1677 |
enabled: enableMakeCurrentDirectory |
|
1678 |
label: 'Make this the Default (Current) Directory' |
|
1679 |
itemValue: doMakeCurrentDirectory |
|
17582 | 1680 |
isVisible: false |
15211 | 1681 |
) |
1682 |
) |
|
1683 |
nil |
|
1684 |
nil |
|
1685 |
) |
|
17582 | 1686 |
|
1687 |
"Modified: / 17-07-2017 / 10:08:31 / cg" |
|
15211 | 1688 |
! |
1689 |
||
1690 |
editMenu |
|
1691 |
"This resource specification was automatically generated |
|
1692 |
by the MenuEditor of ST/X." |
|
1693 |
||
1694 |
"Do not manually edit this!! If it is corrupted, |
|
1695 |
the MenuEditor may not be able to read the specification." |
|
1696 |
||
1697 |
" |
|
1698 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#editMenu |
|
1699 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser editMenu)) startUp |
|
1700 |
" |
|
1701 |
||
1702 |
<resource: #menu> |
|
1703 |
||
1704 |
^ |
|
1705 |
#(Menu |
|
1706 |
( |
|
1707 |
(MenuItem |
|
1708 |
enabled: hasFileSelection |
|
1709 |
label: 'Copy Selected Filenames to Clipboard' |
|
1710 |
itemValue: copySelectedFilenames |
|
1711 |
translateLabel: true |
|
1712 |
) |
|
1713 |
(MenuItem |
|
1714 |
enabled: fileListIsNotEmpty |
|
1715 |
label: 'Copy all Filenames to Clipboard' |
|
1716 |
itemValue: copyFileList |
|
1717 |
translateLabel: true |
|
1718 |
) |
|
1719 |
) |
|
1720 |
nil |
|
1721 |
nil |
|
1722 |
) |
|
1723 |
! |
|
1724 |
||
1725 |
emptyMenuSpec |
|
1726 |
"This resource specification was automatically generated |
|
1727 |
by the MenuEditor of ST/X." |
|
1728 |
||
1729 |
"Do not manually edit this!! If it is corrupted, |
|
1730 |
the MenuEditor may not be able to read the specification." |
|
1731 |
||
1732 |
" |
|
1733 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#emptyMenuSpec |
|
1734 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser emptyMenuSpec)) startUp |
|
1735 |
" |
|
1736 |
||
1737 |
<resource: #menu> |
|
1738 |
||
1739 |
^ |
|
1740 |
#(#Menu |
|
1741 |
#( |
|
1742 |
) |
|
1743 |
nil |
|
1744 |
nil |
|
1745 |
) |
|
1746 |
! |
|
1747 |
||
1748 |
extraMenu |
|
1749 |
"This resource specification was automatically generated |
|
1750 |
by the MenuEditor of ST/X." |
|
1751 |
||
1752 |
"Do not manually edit this!! If it is corrupted, |
|
1753 |
the MenuEditor may not be able to read the specification." |
|
1754 |
||
1755 |
||
1756 |
" |
|
1757 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#extraMenu |
|
1758 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser extraMenu)) startUp |
|
1759 |
" |
|
1760 |
||
1761 |
<resource: #menu> |
|
1762 |
||
1763 |
^ |
|
1764 |
#(Menu |
|
1765 |
( |
|
1766 |
(MenuItem |
|
1767 |
label: 'Encoding...' |
|
1768 |
itemValue: fileEncodingDialog |
|
1769 |
translateLabel: true |
|
1770 |
) |
|
1771 |
(MenuItem |
|
1772 |
label: 'Line End Convention...' |
|
1773 |
itemValue: lineEndConventionDialog |
|
1774 |
translateLabel: true |
|
1775 |
) |
|
1776 |
(MenuItem |
|
1777 |
label: 'Tab Stop Conversion...' |
|
1778 |
itemValue: tabStopConversionDialog |
|
1779 |
translateLabel: true |
|
1780 |
) |
|
1781 |
(MenuItem |
|
1782 |
label: '-' |
|
1783 |
) |
|
1784 |
(MenuItem |
|
1785 |
label: 'Settings...' |
|
1786 |
itemValue: doOpenSettings |
|
1787 |
translateLabel: true |
|
1788 |
labelImage: (ResourceRetriever ToolbarIconLibrary settings16x16Icon 'Settings...') |
|
1789 |
) |
|
1790 |
) |
|
1791 |
nil |
|
1792 |
nil |
|
1793 |
) |
|
1794 |
! |
|
1795 |
||
1796 |
fileMenu |
|
1797 |
"This resource specification was automatically generated |
|
1798 |
by the MenuEditor of ST/X." |
|
1799 |
||
1800 |
"Do not manually edit this!! If it is corrupted, |
|
1801 |
the MenuEditor may not be able to read the specification." |
|
1802 |
||
1803 |
||
1804 |
" |
|
1805 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileMenu |
|
1806 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileMenu)) startUp |
|
1807 |
" |
|
1808 |
||
1809 |
<resource: #menu> |
|
1810 |
||
1811 |
^ |
|
1812 |
#(Menu |
|
1813 |
( |
|
1814 |
(MenuItem |
|
1815 |
enabled: enableFileHistory |
|
1816 |
label: 'File History' |
|
1817 |
submenuChannel: menuFileHistory |
|
1818 |
) |
|
1819 |
(MenuItem |
|
1820 |
label: '-' |
|
1821 |
) |
|
1822 |
(MenuItem |
|
1823 |
label: 'Open' |
|
1824 |
itemValue: doShowFileContents |
|
1825 |
) |
|
1826 |
(MenuItem |
|
1827 |
label: '-' |
|
1828 |
) |
|
1829 |
(MenuItem |
|
1830 |
enabled: hasFileSelection |
|
1831 |
label: 'FileIn' |
|
1832 |
itemValue: fileFileIn |
|
1833 |
) |
|
1834 |
(MenuItem |
|
1835 |
enabled: hasFileSelection |
|
1836 |
label: 'FileIn to Namespace...' |
|
1837 |
itemValue: fileFileInToNameSpace |
|
1838 |
) |
|
1839 |
(MenuItem |
|
1840 |
enabled: hasPackageDirectorySelected |
|
1841 |
label: 'Load Package from Here' |
|
1842 |
itemValue: fileFileInPackage |
|
1843 |
) |
|
1844 |
(MenuItem |
|
1845 |
label: '-' |
|
1846 |
) |
|
1847 |
(MenuItem |
|
1848 |
label: 'New' |
|
1849 |
submenuChannel: newMenu |
|
1850 |
keepLinkedMenu: true |
|
1851 |
) |
|
1852 |
(MenuItem |
|
1853 |
label: '-' |
|
1854 |
) |
|
1855 |
(MenuItem |
|
1856 |
enabled: hasSelection |
|
1857 |
label: 'Cut' |
|
1858 |
itemValue: cutFiles |
|
1859 |
) |
|
1860 |
(MenuItem |
|
1861 |
enabled: hasSelection |
|
1862 |
label: 'Copy' |
|
1863 |
itemValue: copyFiles |
|
1864 |
) |
|
1865 |
(MenuItem |
|
1866 |
enabled: canPaste |
|
1867 |
label: 'Paste' |
|
1868 |
itemValue: pasteFiles |
|
1869 |
) |
|
1870 |
(MenuItem |
|
1871 |
enabled: hasSelection |
|
1872 |
label: 'Delete' |
|
1873 |
itemValue: deleteFiles |
|
1874 |
) |
|
1875 |
(MenuItem |
|
1876 |
enabled: hasSelection |
|
1877 |
label: 'Erase' |
|
1878 |
itemValue: eraseFiles |
|
1879 |
) |
|
1880 |
(MenuItem |
|
1881 |
label: '-' |
|
1882 |
) |
|
1883 |
(MenuItem |
|
1884 |
enabled: hasSelection |
|
1885 |
label: 'Rename...' |
|
1886 |
itemValue: renameSelection |
|
1887 |
shortcutKey: Rename |
|
1888 |
) |
|
1889 |
(MenuItem |
|
1890 |
enabled: hasSelection |
|
1891 |
label: 'Move To...' |
|
1892 |
itemValue: moveSelectionTo |
|
1893 |
) |
|
1894 |
(MenuItem |
|
1895 |
enabled: hasSelection |
|
1896 |
label: 'Copy To...' |
|
1897 |
itemValue: copySelectionTo |
|
1898 |
) |
|
1899 |
(MenuItem |
|
1900 |
enabled: hasSelection |
|
1901 |
label: 'Properties...' |
|
1902 |
itemValue: doShowProperties |
|
1903 |
) |
|
1904 |
(MenuItem |
|
1905 |
label: '-' |
|
1906 |
isVisible: javaSupportLoaded |
|
1907 |
) |
|
1908 |
(MenuItem |
|
1909 |
enabled: canAddToClassPath |
|
1910 |
label: 'Add to Java Class Path' |
|
1911 |
isVisible: javaSupportLoaded |
|
1912 |
) |
|
1913 |
(MenuItem |
|
1914 |
enabled: canRemoveFromClassPath |
|
1915 |
label: 'Remove from Java Class Path' |
|
1916 |
isVisible: javaSupportLoaded |
|
1917 |
) |
|
1918 |
(MenuItem |
|
1919 |
enabled: canAddToSourcePath |
|
1920 |
label: 'Add to Java Source Path' |
|
1921 |
isVisible: javaSupportLoaded |
|
1922 |
) |
|
1923 |
(MenuItem |
|
1924 |
enabled: canRemoveFromSourcePath |
|
1925 |
label: 'Remove from Java Source Path' |
|
1926 |
isVisible: javaSupportLoaded |
|
1927 |
) |
|
1928 |
) |
|
1929 |
nil |
|
1930 |
nil |
|
1931 |
) |
|
1932 |
! |
|
1933 |
||
1934 |
fileOpMenu |
|
1935 |
"This resource specification was automatically generated |
|
1936 |
by the MenuEditor of ST/X." |
|
1937 |
||
1938 |
"Do not manually edit this!! If it is corrupted, |
|
1939 |
the MenuEditor may not be able to read the specification." |
|
1940 |
||
1941 |
||
1942 |
" |
|
1943 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileOpMenu |
|
1944 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileOpMenu)) startUp |
|
1945 |
" |
|
1946 |
||
1947 |
<resource: #menu> |
|
1948 |
||
1949 |
^ |
|
1950 |
#(Menu |
|
1951 |
( |
|
1952 |
(MenuItem |
|
1953 |
enabled: hasFileSelection |
|
15906 | 1954 |
label: 'Split (by size)...' |
15211 | 1955 |
itemValue: splitSelectedFiles |
1956 |
) |
|
1957 |
(MenuItem |
|
1958 |
enabled: hasFileSelection |
|
15906 | 1959 |
label: 'Split (by #lines)...' |
1960 |
itemValue: splitSelectedFilesByLines |
|
1961 |
) |
|
1962 |
(MenuItem |
|
1963 |
enabled: hasFileSelection |
|
15211 | 1964 |
label: 'Join...' |
1965 |
itemValue: joinSelectedFiles |
|
1966 |
) |
|
1967 |
(MenuItem |
|
1968 |
enabled: hasFileSelection |
|
1969 |
label: 'Copy Corrupted File To...' |
|
1970 |
itemValue: copySelectionToRepairingCorruptedFiles |
|
1971 |
) |
|
1972 |
(MenuItem |
|
15569 | 1973 |
label: 'Copy Corrupted File From -> To...' |
1974 |
itemValue: copyFromToRepairingCorruptedFiles |
|
1975 |
) |
|
1976 |
(MenuItem |
|
15211 | 1977 |
label: '-' |
1978 |
) |
|
1979 |
(MenuItem |
|
1980 |
enabled: hasFileSelection |
|
1981 |
label: 'Rot13...' |
|
1982 |
itemValue: filterSelectedFiles: |
|
1983 |
argument: rot13 |
|
1984 |
) |
|
1985 |
(MenuItem |
|
1986 |
label: '-' |
|
1987 |
) |
|
1988 |
(MenuItem |
|
1989 |
enabled: hasFileSelection |
|
1990 |
label: 'Truncate...' |
|
1991 |
itemValue: truncateSelectedFilesToZeroSize |
|
1992 |
) |
|
1993 |
(MenuItem |
|
1994 |
label: '-' |
|
1995 |
) |
|
1996 |
(MenuItem |
|
1997 |
label: 'Load Signature Support Package' |
|
1998 |
itemValue: loadSignatureSupport |
|
1999 |
isVisible: cannotGenerateSignatureFiles |
|
2000 |
) |
|
2001 |
(MenuItem |
|
2002 |
enabled: canGenerateSignatureFiles |
|
2003 |
label: 'Generate Signed Files' |
|
2004 |
itemValue: generateSignaturesForSelectedFiles |
|
2005 |
) |
|
2006 |
(MenuItem |
|
2007 |
enabled: canGenerateSignatureFiles |
|
2008 |
label: 'Generate Detached Signature Files (use for dll)' |
|
2009 |
itemValue: generateDetachedSignaturesForSelectedFiles |
|
2010 |
) |
|
2011 |
(MenuItem |
|
2012 |
enabled: canGenerateSignatureFiles |
|
2013 |
label: 'Generate Patch Installer for File(s)' |
|
2014 |
itemValue: generatePatchInstallerForSelectedFiles |
|
2015 |
) |
|
2016 |
(MenuItem |
|
2017 |
label: '-' |
|
2018 |
) |
|
2019 |
(MenuItem |
|
2020 |
enabled: hasFileSelection |
|
2021 |
label: 'File Differences' |
|
2022 |
itemValue: openDiffView |
|
2023 |
isVisible: hasTwoFilesSelectedHolder |
|
2024 |
) |
|
2025 |
(MenuItem |
|
2026 |
enabled: hasFileSelection |
|
2027 |
label: 'File Differences...' |
|
2028 |
itemValue: openDiffView |
|
2029 |
isVisible: hasNotTwoFilesSelectedHolder |
|
2030 |
) |
|
2031 |
(MenuItem |
|
2032 |
enabled: hasSelection |
|
2033 |
label: 'Directory Differences' |
|
2034 |
itemValue: openDirectoryDiffView |
|
2035 |
isVisible: hasTwoDirectoriesSelectedHolder |
|
2036 |
) |
|
2037 |
(MenuItem |
|
2038 |
enabled: hasSelection |
|
2039 |
label: 'Directory Differences...' |
|
2040 |
itemValue: openDirectoryDiffView |
|
2041 |
isVisible: hasNotTwoDirectoriesSelectedHolder |
|
2042 |
) |
|
17831 | 2043 |
(MenuItem |
2044 |
label: '-' |
|
2045 |
) |
|
2046 |
(MenuItem |
|
2047 |
label: 'Remove .bak and .sav Files...' |
|
2048 |
itemValue: removeBakAndSavFiles |
|
2049 |
) |
|
15211 | 2050 |
) |
2051 |
nil |
|
2052 |
nil |
|
2053 |
) |
|
2054 |
! |
|
2055 |
||
2056 |
newMenu |
|
2057 |
"This resource specification was automatically generated |
|
2058 |
by the MenuEditor of ST/X." |
|
2059 |
||
2060 |
"Do not manually edit this!! If it is corrupted, |
|
2061 |
the MenuEditor may not be able to read the specification." |
|
2062 |
||
2063 |
" |
|
2064 |
MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#newMenu |
|
2065 |
(Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser newMenu)) startUp |
|
2066 |
" |
|
2067 |
||
2068 |
<resource: #menu> |
|
2069 |
||
2070 |
^ |
|
2071 |
#(#Menu |
|
2072 |
#( |
|
2073 |
#(#MenuItem |
|
2074 |
#label: 'Directory...' |
|
2075 |
#translateLabel: true |
|
2076 |
#value: #newDirectory |
|
2077 |
) |
|
2078 |
#(#MenuItem |
|
2079 |
#label: 'File...' |
|
2080 |
#translateLabel: true |
|
2081 |
#value: #newFile |
|
2082 |
) |
|
2083 |
#(#MenuItem |
|
2084 |
#label: 'Hard Link...' |
|
2085 |
#translateLabel: true |
|
2086 |
#value: #newHardLink |
|
2087 |
) |
|
2088 |
#(#MenuItem |
|
2089 |
#label: 'Symbolic Link...' |
|
2090 |
#translateLabel: true |
|
2091 |
#value: #newSoftLink |
|
2092 |
) |
|
2093 |
) |
|
2094 |
nil |
|
2095 |
nil |
|
2096 |
) |
|
2097 |
! |
|
2098 |
||
2099 |
scmMenuSlice |
|
2100 |
"This resource specification was automatically generated |
|
2101 |
by the MenuEditor of ST/X." |
|
2102 |
||
2103 |
"Do not manually edit this!! If it is corrupted, |
|
2104 |
the MenuEditor may not be able to read the specification." |
|
2105 |
||
2106 |
||
2107 |
" |
|
2108 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#scmMenuSlice |
|
2109 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser scmMenuSlice)) startUp |
|
2110 |
" |
|
2111 |
||
2112 |
<resource: #menu> |
|
2113 |
||
2114 |
^ |
|
2115 |
#(Menu |
|
2116 |
( |
|
2117 |
(MenuItem |
|
2118 |
label: 'CVS' |
|
2119 |
isVisible: cvsMenusAreShown |
|
2120 |
submenuChannel: cvsMenu |
|
2121 |
) |
|
2122 |
(MenuItem |
|
2123 |
label: 'SVN' |
|
2124 |
isVisible: svnMenusAreShown |
|
2125 |
submenuChannel: svnMenu |
|
2126 |
) |
|
2127 |
(MenuItem |
|
2128 |
label: 'Mercurial' |
|
2129 |
isVisible: mercurialMenusAreShown |
|
2130 |
submenuChannel: mercurialMenu |
|
2131 |
) |
|
2132 |
(MenuItem |
|
2133 |
label: 'HG' |
|
2134 |
isVisible: hgMenusAreShown |
|
2135 |
submenuChannel: hgMenu |
|
2136 |
) |
|
2137 |
(MenuItem |
|
2138 |
label: 'Perforce' |
|
2139 |
isVisible: perforceMenusAreShown |
|
2140 |
submenuChannel: perforceMenu |
|
2141 |
) |
|
2142 |
) |
|
2143 |
nil |
|
2144 |
nil |
|
2145 |
) |
|
2146 |
! |
|
2147 |
||
2148 |
showMenuSpec |
|
2149 |
"This resource specification was automatically generated |
|
2150 |
by the MenuEditor of ST/X." |
|
2151 |
||
2152 |
"Do not manually edit this!! If it is corrupted, |
|
2153 |
the MenuEditor may not be able to read the specification." |
|
2154 |
||
2155 |
" |
|
2156 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpec |
|
2157 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpec)) startUp |
|
2158 |
" |
|
2159 |
||
2160 |
<resource: #menu> |
|
2161 |
||
2162 |
^ |
|
2163 |
#(Menu |
|
2164 |
( |
|
2165 |
(MenuItem |
|
2166 |
label: 'Hidden Files' |
|
2167 |
translateLabel: true |
|
2168 |
hideMenuOnActivated: false |
|
2169 |
indication: showHiddenFiles |
|
2170 |
) |
|
2171 |
(MenuItem |
|
2172 |
label: '-' |
|
2173 |
) |
|
2174 |
(MenuItem |
|
2175 |
label: 'Directory Tree' |
|
2176 |
translateLabel: true |
|
2177 |
hideMenuOnActivated: false |
|
2178 |
indication: showDirectoryTree |
|
2179 |
) |
|
2180 |
(MenuItem |
|
2181 |
label: 'Regular Files in TreeView (Left)' |
|
2182 |
translateLabel: true |
|
2183 |
hideMenuOnActivated: false |
|
2184 |
indication: viewFilesInDirectoryTree |
|
2185 |
) |
|
2186 |
(MenuItem |
|
2187 |
label: 'Directories in ContentsView (Right)' |
|
2188 |
translateLabel: true |
|
2189 |
hideMenuOnActivated: false |
|
2190 |
indication: viewDirsInContentsBrowser |
|
2191 |
) |
|
2192 |
(MenuItem |
|
2193 |
enabled: enableViewNoteBookApplication |
|
2194 |
label: 'File Applications' |
|
2195 |
translateLabel: true |
|
2196 |
hideMenuOnActivated: false |
|
2197 |
indication: viewNoteBookApplicationHolder |
|
2198 |
) |
|
2199 |
(MenuItem |
|
2200 |
label: '-' |
|
2201 |
) |
|
2202 |
(MenuItem |
|
2203 |
label: 'DiskUsage' |
|
2204 |
translateLabel: true |
|
2205 |
hideMenuOnActivated: false |
|
2206 |
indication: showDiskUsageHolder |
|
2207 |
) |
|
2208 |
) |
|
2209 |
nil |
|
2210 |
nil |
|
2211 |
) |
|
2212 |
! |
|
2213 |
||
2214 |
showMenuSpecForDialog |
|
2215 |
"This resource specification was automatically generated |
|
2216 |
by the MenuEditor of ST/X." |
|
2217 |
||
2218 |
"Do not manually edit this!! If it is corrupted, |
|
2219 |
the MenuEditor may not be able to read the specification." |
|
2220 |
||
2221 |
" |
|
2222 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpecForDialog |
|
2223 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpecForDialog)) startUp |
|
2224 |
" |
|
2225 |
||
2226 |
<resource: #menu> |
|
2227 |
||
2228 |
^ |
|
2229 |
#(Menu |
|
2230 |
( |
|
2231 |
(MenuItem |
|
2232 |
label: 'Hidden Files' |
|
2233 |
translateLabel: true |
|
2234 |
hideMenuOnActivated: false |
|
2235 |
indication: showHiddenFiles |
|
2236 |
) |
|
2237 |
) |
|
2238 |
nil |
|
2239 |
nil |
|
2240 |
) |
|
2241 |
! |
|
2242 |
||
2243 |
sortMenu |
|
2244 |
"This resource specification was automatically generated |
|
2245 |
by the MenuEditor of ST/X." |
|
2246 |
||
2247 |
"Do not manually edit this!! If it is corrupted, |
|
2248 |
the MenuEditor may not be able to read the specification." |
|
2249 |
||
2250 |
" |
|
2251 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#sortMenu |
|
2252 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser sortMenu)) startUp |
|
2253 |
" |
|
2254 |
||
2255 |
<resource: #menu> |
|
2256 |
||
2257 |
^ |
|
2258 |
#(#Menu |
|
2259 |
#( |
|
2260 |
#(#MenuItem |
|
2261 |
#label: 'By Filename' |
|
2262 |
#translateLabel: true |
|
2263 |
#hideMenuOnActivated: false |
|
2264 |
#choice: #sortBlockProperty |
|
2265 |
#choiceValue: #baseName |
|
2266 |
) |
|
2267 |
#(#MenuItem |
|
2268 |
#label: 'By Extension' |
|
2269 |
#translateLabel: true |
|
2270 |
#hideMenuOnActivated: false |
|
2271 |
#choice: #sortBlockProperty |
|
2272 |
#choiceValue: #suffix |
|
2273 |
) |
|
2274 |
#(#MenuItem |
|
2275 |
#label: 'By Permissions' |
|
2276 |
#translateLabel: true |
|
2277 |
#hideMenuOnActivated: false |
|
2278 |
#choice: #sortBlockProperty |
|
2279 |
#choiceValue: #permissions |
|
2280 |
) |
|
2281 |
#(#MenuItem |
|
2282 |
#label: 'By Owner' |
|
2283 |
#translateLabel: true |
|
2284 |
#isVisible: #viewOwner |
|
2285 |
#hideMenuOnActivated: false |
|
2286 |
#choice: #sortBlockProperty |
|
2287 |
#choiceValue: #owner |
|
2288 |
) |
|
2289 |
#(#MenuItem |
|
2290 |
#label: 'By Group' |
|
2291 |
#translateLabel: true |
|
2292 |
#isVisible: #viewOwner |
|
2293 |
#hideMenuOnActivated: false |
|
2294 |
#choice: #sortBlockProperty |
|
2295 |
#choiceValue: #group |
|
2296 |
) |
|
2297 |
#(#MenuItem |
|
2298 |
#label: 'By Size' |
|
2299 |
#translateLabel: true |
|
2300 |
#hideMenuOnActivated: false |
|
2301 |
#choice: #sortBlockProperty |
|
2302 |
#choiceValue: #fileSize |
|
2303 |
) |
|
2304 |
#(#MenuItem |
|
2305 |
#label: 'By Date && Time' |
|
2306 |
#translateLabel: true |
|
2307 |
#hideMenuOnActivated: false |
|
2308 |
#choice: #sortBlockProperty |
|
2309 |
#choiceValue: #modificationTime |
|
2310 |
) |
|
2311 |
#(#MenuItem |
|
2312 |
#label: '-' |
|
2313 |
) |
|
2314 |
#(#MenuItem |
|
2315 |
#label: 'Ignore Case in Sort' |
|
2316 |
#translateLabel: true |
|
2317 |
#hideMenuOnActivated: false |
|
2318 |
#indication: #sortCaseless |
|
2319 |
) |
|
2320 |
#(#MenuItem |
|
2321 |
#label: 'Directories before Files' |
|
2322 |
#translateLabel: true |
|
2323 |
#hideMenuOnActivated: false |
|
2324 |
#indication: #sortDirectoriesBeforeFiles |
|
2325 |
) |
|
2326 |
) |
|
2327 |
nil |
|
2328 |
nil |
|
2329 |
) |
|
2330 |
! |
|
2331 |
||
2332 |
toolsMenuSpec |
|
2333 |
"This resource specification was automatically generated |
|
2334 |
by the MenuEditor of ST/X." |
|
2335 |
||
2336 |
"Do not manually edit this!! If it is corrupted, |
|
2337 |
the MenuEditor may not be able to read the specification." |
|
2338 |
||
2339 |
||
2340 |
" |
|
2341 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec |
|
2342 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp |
|
2343 |
" |
|
2344 |
||
2345 |
<resource: #menu> |
|
2346 |
||
2347 |
^ |
|
2348 |
#(Menu |
|
2349 |
( |
|
2350 |
(MenuItem |
|
2351 |
label: 'Open (Win32-Shell)' |
|
2352 |
itemValue: doOpenWithShellCommand |
|
2353 |
isVisible: systemIsDOS |
|
2354 |
) |
|
2355 |
(MenuItem |
|
18013 | 2356 |
label: 'Open (OSX-Application)' |
2357 |
itemValue: doOpenWithShellCommand |
|
2358 |
isVisible: systemIsOSX |
|
2359 |
) |
|
2360 |
(MenuItem |
|
15211 | 2361 |
label: 'Execute UNIX Command...' |
2362 |
itemValue: doExecuteCommand |
|
2363 |
isVisible: systemIsUnix |
|
2364 |
) |
|
2365 |
(MenuItem |
|
2366 |
label: 'Execute DOS Command...' |
|
2367 |
itemValue: doExecuteCommand |
|
2368 |
isVisible: systemIsDOS |
|
2369 |
) |
|
2370 |
(MenuItem |
|
2371 |
label: 'Execute Script...' |
|
2372 |
itemValue: doExecuteScript |
|
2373 |
) |
|
2374 |
(MenuItem |
|
2375 |
enabled: canDoTerminal |
|
2376 |
label: 'Shell Terminal' |
|
2377 |
itemValue: openTerminal |
|
2378 |
isVisible: canDoTerminalAndSystemIsUnix |
|
2379 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'Shell Terminal') |
|
2380 |
) |
|
2381 |
(MenuItem |
|
2382 |
enabled: canDoTerminal |
|
2383 |
label: 'DOS Terminal' |
|
2384 |
itemValue: openTerminal |
|
2385 |
isVisible: canDoTerminalAndSystemIsDOS |
|
2386 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'DOS Terminal') |
|
2387 |
) |
|
2388 |
(MenuItem |
|
2389 |
label: '-' |
|
2390 |
) |
|
2391 |
(MenuItem |
|
2392 |
enabled: hasFileSelection |
|
2393 |
label: 'Changes Browser' |
|
2394 |
itemValue: openChangesBrowser |
|
2395 |
) |
|
2396 |
(MenuItem |
|
2397 |
enabled: hasFileSelection |
|
2398 |
label: 'ChangeSet Browser' |
|
2399 |
itemValue: openChangeSetBrowser |
|
2400 |
isVisible: changeSetBrowserItemVisible |
|
2401 |
) |
|
2402 |
(MenuItem |
|
2403 |
enabled: hasFileSelection |
|
2404 |
label: 'Workspace' |
|
2405 |
itemValue: openWorkspace |
|
2406 |
) |
|
2407 |
(MenuItem |
|
2408 |
label: '-' |
|
2409 |
) |
|
2410 |
(MenuItem |
|
2411 |
enabled: canReadAbbrevFile |
|
2412 |
label: 'Install Autoloaded' |
|
2413 |
itemValue: readAbbrevFile |
|
2414 |
) |
|
2415 |
(MenuItem |
|
2416 |
enabled: anySTFilesPresent |
|
2417 |
label: 'Install all ST-Files as Autoloaded' |
|
2418 |
itemValue: installAllAsAutoloaded |
|
2419 |
) |
|
2420 |
(MenuItem |
|
2421 |
enabled: recursiveAnySTFilesPresent |
|
2422 |
label: 'Recursive Install all ST-Files as Autoloaded' |
|
2423 |
itemValue: installAllAsAutoloadedRecursive |
|
2424 |
) |
|
2425 |
(MenuItem |
|
2426 |
label: '-' |
|
2427 |
) |
|
2428 |
(MenuItem |
|
2429 |
enabled: hasJava |
|
2430 |
label: 'Add Directory to Java Source Path (stx:libjava)' |
|
2431 |
itemValue: addDirToJavaSourcePath |
|
2432 |
) |
|
2433 |
(MenuItem |
|
2434 |
enabled: hasJava |
|
2435 |
label: 'Add Selected Files to Java Source Path (stx:libjava)' |
|
2436 |
itemValue: fileAddToJavaSourcePath |
|
2437 |
) |
|
2438 |
(MenuItem |
|
2439 |
label: '-' |
|
2440 |
) |
|
2441 |
(MenuItem |
|
2442 |
label: 'File Operations' |
|
2443 |
submenuChannel: fileOpMenu |
|
2444 |
) |
|
2445 |
(MenuItem |
|
2446 |
label: 'File Utilities' |
|
2447 |
submenu: |
|
2448 |
(Menu |
|
2449 |
( |
|
2450 |
(MenuItem |
|
2451 |
enabled: hasFileSelection |
|
2452 |
label: 'Editor' |
|
2453 |
itemValue: openEditor |
|
2454 |
) |
|
2455 |
(MenuItem |
|
2456 |
enabled: hasFileSelection |
|
2457 |
label: 'HTML Reader' |
|
2458 |
itemValue: openHTMLReader |
|
2459 |
) |
|
2460 |
(MenuItem |
|
2461 |
enabled: hasFileSelection |
|
2462 |
label: 'Web Browser' |
|
2463 |
itemValue: openWebBrowser |
|
2464 |
) |
|
2465 |
(MenuItem |
|
2466 |
label: 'XML Inspector' |
|
2467 |
itemValue: inspectXmlFile |
|
2468 |
isVisible: hasXml |
|
2469 |
showBusyCursorWhilePerforming: true |
|
2470 |
) |
|
2471 |
(MenuItem |
|
2472 |
enabled: hasFileSelection |
|
2473 |
label: 'Acroread (PDF Viewer)' |
|
2474 |
itemValue: openPDFViewer |
|
2475 |
) |
|
2476 |
(MenuItem |
|
2477 |
enabled: hasASN1AndSelection |
|
2478 |
label: 'ASN1 Browser' |
|
2479 |
itemValue: openASN1Browser |
|
2480 |
isVisible: hasASN1 |
|
2481 |
) |
|
2482 |
(MenuItem |
|
2483 |
enabled: hasCBrowser |
|
2484 |
label: 'C Browser' |
|
2485 |
itemValue: openCBrowser |
|
2486 |
isVisible: hasCBrowser |
|
2487 |
) |
|
2488 |
(MenuItem |
|
2489 |
enabled: canOpenMonticelloBrowser |
|
2490 |
label: 'Monticello Browser' |
|
2491 |
itemValue: doOpenMonticelloBrowser |
|
2492 |
) |
|
2493 |
(MenuItem |
|
2494 |
enabled: hasJavaAndSelection |
|
2495 |
label: 'Applet Viewer' |
|
2496 |
itemValue: openAppletViewer |
|
2497 |
isVisible: hasJava |
|
2498 |
) |
|
2499 |
(MenuItem |
|
2500 |
enabled: hasMP3PlayerAndSelection |
|
2501 |
label: 'MP3 Player' |
|
2502 |
itemValue: openMP3Player |
|
2503 |
isVisible: hasMP3Player |
|
2504 |
) |
|
2505 |
(MenuItem |
|
2506 |
enabled: hasFileSelection |
|
2507 |
label: 'xv (Image Viewer)' |
|
2508 |
itemValue: openXV |
|
2509 |
isVisible: systemIsUnix |
|
2510 |
) |
|
2511 |
(MenuItem |
|
2512 |
enabled: currentFilesAreInSameDirectory |
|
2513 |
label: 'Slide Show' |
|
2514 |
itemValue: openSlideShow |
|
2515 |
isVisible: hasSlideShow |
|
2516 |
) |
|
2517 |
(MenuItem |
|
2518 |
enabled: hasFileSelection |
|
2519 |
label: 'gv (Postscript Viewer)' |
|
2520 |
itemValue: openGV |
|
2521 |
isVisible: systemIsUnix |
|
2522 |
) |
|
2523 |
(MenuItem |
|
2524 |
enabled: hasMP3PlayerAndSelection |
|
2525 |
label: 'MP3 Player' |
|
2526 |
itemValue: openMP3Player |
|
2527 |
isVisible: hasMP3Player |
|
2528 |
) |
|
2529 |
(MenuItem |
|
2530 |
enabled: hasFileSelection |
|
2531 |
label: 'Realplay (avi viewer)' |
|
2532 |
itemValue: openRP |
|
2533 |
isVisible: systemIsUnix |
|
2534 |
) |
|
2535 |
(MenuItem |
|
2536 |
label: '-' |
|
2537 |
) |
|
2538 |
(MenuItem |
|
2539 |
label: 'Smalltalk' |
|
2540 |
submenu: |
|
2541 |
(Menu |
|
2542 |
( |
|
2543 |
(MenuItem |
|
2544 |
enabled: hasSnapshotSelection |
|
2545 |
label: 'Snapshot Image Browser' |
|
2546 |
itemValue: openSnapshotImageBrowser |
|
2547 |
) |
|
2548 |
(MenuItem |
|
2549 |
enabled: canCreateNewProject |
|
2550 |
label: 'Create Smalltalk Project' |
|
2551 |
itemValue: createProjectAndOpenProjectBrowser |
|
2552 |
) |
|
2553 |
(MenuItem |
|
2554 |
label: '-' |
|
2555 |
) |
|
2556 |
(MenuItem |
|
2557 |
enabled: hasResourceFileSelected |
|
2558 |
label: 'Show Contents of Resourcefile' |
|
2559 |
itemValue: readAndShowResources |
|
2560 |
) |
|
2561 |
(MenuItem |
|
2562 |
enabled: hasResourceFileSelected |
|
2563 |
label: 'Resource File Editor' |
|
2564 |
itemValue: openResourceFileEditor |
|
2565 |
showBusyCursorWhilePerforming: true |
|
2566 |
) |
|
2567 |
(MenuItem |
|
2568 |
label: '-' |
|
2569 |
) |
|
2570 |
(MenuItem |
|
2571 |
enabled: hasFileSelection |
|
2572 |
label: 'Contents as ByteArray' |
|
2573 |
itemValue: fileContentsAsByteArray |
|
2574 |
) |
|
18426 | 2575 |
(MenuItem |
2576 |
label: '-' |
|
2577 |
) |
|
2578 |
(MenuItem |
|
2579 |
enabled: hasFileSelection |
|
2580 |
label: 'Changes from GNU Smalltalk Source' |
|
2581 |
itemValue: changeSetFromGSTSource |
|
2582 |
) |
|
15211 | 2583 |
) |
2584 |
nil |
|
2585 |
nil |
|
2586 |
) |
|
2587 |
) |
|
2588 |
(MenuItem |
|
2589 |
label: 'Image' |
|
2590 |
submenu: |
|
2591 |
(Menu |
|
2592 |
( |
|
2593 |
(MenuItem |
|
2594 |
enabled: hasFileSelection |
|
2595 |
label: 'Image Editor' |
|
2596 |
itemValue: openImageEditor |
|
2597 |
) |
|
2598 |
(MenuItem |
|
2599 |
enabled: hasFileSelection |
|
2600 |
label: 'Image Preview' |
|
2601 |
itemValue: openImagePreview |
|
2602 |
) |
|
2603 |
(MenuItem |
|
2604 |
enabled: hasFileSelection |
|
2605 |
label: 'Image Inspector' |
|
2606 |
itemValue: openImageInspector |
|
2607 |
) |
|
2608 |
(MenuItem |
|
2609 |
label: '-' |
|
2610 |
) |
|
2611 |
(MenuItem |
|
2612 |
enabled: hasFileSelection |
|
2613 |
label: 'Convert to GIF' |
|
2614 |
itemValue: convertImageToGIF |
|
2615 |
) |
|
2616 |
(MenuItem |
|
2617 |
enabled: hasFileSelection |
|
2618 |
label: 'Convert to PNG' |
|
2619 |
itemValue: convertImageToPNG |
|
2620 |
) |
|
2621 |
(MenuItem |
|
2622 |
enabled: hasFileSelection |
|
2623 |
label: 'Convert to XPM' |
|
2624 |
itemValue: convertImageToXPM |
|
2625 |
) |
|
2626 |
(MenuItem |
|
2627 |
enabled: hasFileSelection |
|
2628 |
label: 'Convert to JPG' |
|
2629 |
itemValue: convertImageToJPG |
|
2630 |
) |
|
2631 |
) |
|
2632 |
nil |
|
2633 |
nil |
|
2634 |
) |
|
2635 |
) |
|
2636 |
(MenuItem |
|
15528 | 2637 |
label: 'Web' |
2638 |
submenu: |
|
2639 |
(Menu |
|
2640 |
( |
|
2641 |
(MenuItem |
|
2642 |
label: 'Fetch File by URL...' |
|
2643 |
itemValue: fetchFileByURL |
|
2644 |
) |
|
2645 |
) |
|
2646 |
nil |
|
2647 |
nil |
|
2648 |
) |
|
2649 |
) |
|
2650 |
(MenuItem |
|
15211 | 2651 |
enabled: hasZipFileSelectedHolder |
2652 |
label: 'ZipFile Tool' |
|
2653 |
itemValue: openZipTool |
|
2654 |
) |
|
2655 |
(MenuItem |
|
2656 |
enabled: hasFileSelection |
|
2657 |
label: 'Hex Dump' |
|
2658 |
itemValue: fileHexDump |
|
2659 |
) |
|
2660 |
) |
|
2661 |
nil |
|
2662 |
nil |
|
2663 |
) |
|
2664 |
) |
|
2665 |
(MenuItem |
|
2666 |
label: 'Find' |
|
2667 |
submenu: |
|
2668 |
(Menu |
|
2669 |
( |
|
2670 |
(MenuItem |
|
2671 |
label: 'File...' |
|
2672 |
itemValue: fileFindFile |
|
2673 |
) |
|
2674 |
(MenuItem |
|
2675 |
enabled: hasFileSelection |
|
2676 |
label: 'Same Contents as Selected...' |
|
2677 |
itemValue: fileFindDuplicateFile |
|
2678 |
) |
|
2679 |
(MenuItem |
|
2680 |
label: 'Duplicate Files' |
|
2681 |
itemValue: fileFindDuplicates |
|
2682 |
) |
|
2683 |
(MenuItem |
|
2684 |
enabled: hasSelection |
|
2685 |
label: 'All Duplicate Files (Recursive)' |
|
2686 |
itemValue: fileFindAllDuplicates |
|
2687 |
) |
|
2688 |
(MenuItem |
|
17686 | 2689 |
label: 'Similar Image Files (by Colors)' |
15211 | 2690 |
itemValue: fileFindSimilarImages |
2691 |
isVisible: hasImageColorHistogram |
|
2692 |
) |
|
17686 | 2693 |
(MenuItem |
2694 |
label: 'Similar Image Files (by Form)' |
|
2695 |
itemValue: fileFindSimilarImagesByForm |
|
2696 |
isVisible: hasImageHistogram |
|
2697 |
) |
|
15211 | 2698 |
) |
2699 |
nil |
|
2700 |
nil |
|
2701 |
) |
|
2702 |
) |
|
2703 |
) |
|
2704 |
nil |
|
2705 |
nil |
|
2706 |
) |
|
2707 |
! |
|
2708 |
||
2709 |
viewDetailsMenuSpec |
|
2710 |
"This resource specification was automatically generated |
|
2711 |
by the MenuEditor of ST/X." |
|
2712 |
||
2713 |
"Do not manually edit this!! If it is corrupted, |
|
2714 |
the MenuEditor may not be able to read the specification." |
|
2715 |
||
2716 |
" |
|
2717 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#viewDetailsMenuSpec |
|
2718 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser viewDetailsMenuSpec)) startUp |
|
2719 |
" |
|
2720 |
||
2721 |
<resource: #menu> |
|
2722 |
||
2723 |
^ |
|
2724 |
#(#Menu |
|
2725 |
#( |
|
2726 |
#(#MenuItem |
|
2727 |
#label: '-' |
|
2728 |
) |
|
2729 |
#(#MenuItem |
|
2730 |
#label: 'Hidden Files' |
|
2731 |
#translateLabel: true |
|
2732 |
#indication: #showHiddenFiles |
|
2733 |
) |
|
2734 |
) |
|
2735 |
nil |
|
2736 |
nil |
|
2737 |
) |
|
2738 |
! ! |
|
3892 | 2739 |
|
11144 | 2740 |
!AbstractFileBrowser class methodsFor:'menu specs-scm'! |
2741 |
||
15211 | 2742 |
cvsMenu |
2743 |
"This resource specification was automatically generated |
|
2744 |
by the MenuEditor of ST/X." |
|
2745 |
||
2746 |
"Do not manually edit this!! If it is corrupted, |
|
2747 |
the MenuEditor may not be able to read the specification." |
|
2748 |
||
2749 |
||
2750 |
" |
|
2751 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#cvsMenu |
|
2752 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser cvsMenu)) startUp |
|
2753 |
" |
|
2754 |
||
2755 |
<resource: #menu> |
|
2756 |
||
2757 |
^ |
|
2758 |
#(Menu |
|
2759 |
( |
|
2760 |
(MenuItem |
|
2761 |
label: 'Commit (CVS)...' |
|
2762 |
itemValue: cvsCommit |
|
2763 |
translateLabel: true |
|
2764 |
) |
|
2765 |
(MenuItem |
|
2766 |
enabled: canCvsAddAndCommit |
|
2767 |
label: 'Add && Commit...' |
|
2768 |
itemValue: cvsAddAndCommit |
|
2769 |
translateLabel: true |
|
2770 |
) |
|
2771 |
(MenuItem |
|
2772 |
enabled: canCvsAddAndCommit |
|
2773 |
label: 'Add as Binary && Commit...' |
|
2774 |
itemValue: cvsAddBinaryAndCommit |
|
2775 |
translateLabel: true |
|
2776 |
) |
|
2777 |
(MenuItem |
|
2778 |
label: 'Commit Folder (CVS)...' |
|
2779 |
itemValue: cvsCommitFolder |
|
2780 |
translateLabel: true |
|
2781 |
) |
|
2782 |
(MenuItem |
|
2783 |
label: '-' |
|
2784 |
) |
|
2785 |
(MenuItem |
|
2786 |
enabled: hasSelection |
|
2787 |
label: 'Update selected Files/Directories' |
|
2788 |
itemValue: cvsUpdateSelection |
|
2789 |
translateLabel: true |
|
2790 |
) |
|
2791 |
(MenuItem |
|
2792 |
label: 'Update Directory Local' |
|
2793 |
itemValue: cvsUpdateAll |
|
2794 |
translateLabel: true |
|
2795 |
) |
|
2796 |
(MenuItem |
|
2797 |
label: 'Update Directory Recursive' |
|
2798 |
itemValue: cvsUpdateAllRecursive |
|
2799 |
translateLabel: true |
|
2800 |
) |
|
2801 |
(MenuItem |
|
2802 |
label: '-' |
|
2803 |
) |
|
2804 |
(MenuItem |
|
2805 |
enabled: hasSelection |
|
2806 |
label: 'Tag...' |
|
2807 |
itemValue: cvsTagSelection |
|
2808 |
translateLabel: true |
|
2809 |
) |
|
2810 |
(MenuItem |
|
2811 |
enabled: hasSelection |
|
2812 |
label: 'Revision Log' |
|
2813 |
itemValue: cvsRevisionLog |
|
2814 |
translateLabel: true |
|
2815 |
) |
|
2816 |
(MenuItem |
|
2817 |
enabled: hasSelection |
|
2818 |
label: 'Compare with newest in Repository' |
|
2819 |
itemValue: cvsCompareWithNewest |
|
2820 |
translateLabel: true |
|
2821 |
) |
|
2822 |
(MenuItem |
|
2823 |
label: '-' |
|
2824 |
) |
|
2825 |
(MenuItem |
|
2826 |
enabled: canRemoveCVSContainer |
|
2827 |
label: 'Remove File && CVS Container...' |
|
2828 |
itemValue: cvsRemoveFileAndCVSContainer |
|
2829 |
translateLabel: true |
|
2830 |
) |
|
2831 |
) |
|
2832 |
nil |
|
2833 |
nil |
|
2834 |
) |
|
2835 |
! |
|
2836 |
||
2837 |
mercurialMenu |
|
2838 |
"This resource specification was automatically generated |
|
2839 |
by the MenuEditor of ST/X." |
|
2840 |
||
2841 |
"Do not manually edit this!! If it is corrupted, |
|
2842 |
the MenuEditor may not be able to read the specification." |
|
2843 |
||
2844 |
||
2845 |
" |
|
2846 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#mercurialMenu |
|
2847 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser mercurialMenu)) startUp |
|
2848 |
" |
|
2849 |
||
2850 |
<resource: #menu> |
|
2851 |
||
2852 |
^ |
|
2853 |
#(Menu |
|
2854 |
( |
|
2855 |
(MenuItem |
|
2856 |
label: 'Add' |
|
2857 |
itemValue: mercurialAdd |
|
2858 |
translateLabel: true |
|
2859 |
) |
|
2860 |
(MenuItem |
|
2861 |
label: 'Commit Changes' |
|
2862 |
itemValue: mercurialCommit |
|
2863 |
translateLabel: true |
|
2864 |
) |
|
2865 |
(MenuItem |
|
2866 |
label: 'Push...' |
|
2867 |
itemValue: mercurialPush |
|
2868 |
translateLabel: true |
|
2869 |
) |
|
2870 |
(MenuItem |
|
2871 |
label: 'Status' |
|
2872 |
itemValue: mercurialStatus |
|
2873 |
translateLabel: true |
|
2874 |
) |
|
2875 |
(MenuItem |
|
2876 |
label: '-' |
|
2877 |
) |
|
2878 |
(MenuItem |
|
2879 |
label: 'Init' |
|
2880 |
itemValue: mercurialInit |
|
2881 |
translateLabel: true |
|
2882 |
) |
|
2883 |
) |
|
2884 |
nil |
|
2885 |
nil |
|
2886 |
) |
|
2887 |
||
2888 |
"Modified: / 17-01-2012 / 15:57:40 / cg" |
|
2889 |
! |
|
2890 |
||
2891 |
perforceMenu |
|
2892 |
"This resource specification was automatically generated |
|
2893 |
by the MenuEditor of ST/X." |
|
2894 |
||
2895 |
"Do not manually edit this!! If it is corrupted, |
|
2896 |
the MenuEditor may not be able to read the specification." |
|
2897 |
||
2898 |
||
2899 |
" |
|
2900 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#perforceMenu |
|
2901 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser perforceMenu)) startUp |
|
2902 |
" |
|
2903 |
||
2904 |
<resource: #menu> |
|
2905 |
||
2906 |
^ |
|
2907 |
#(Menu |
|
2908 |
( |
|
2909 |
(MenuItem |
|
2910 |
label: 'Commit' |
|
2911 |
itemValue: perforceCommit |
|
2912 |
translateLabel: true |
|
2913 |
) |
|
2914 |
) |
|
2915 |
nil |
|
2916 |
nil |
|
2917 |
) |
|
2918 |
||
2919 |
"Created: / 15-01-2012 / 13:12:30 / cg" |
|
2920 |
! ! |
|
11144 | 2921 |
|
3892 | 2922 |
!AbstractFileBrowser class methodsFor:'misc'! |
2923 |
||
2924 |
newLock |
|
2925 |
^ CodeExecutionLock new |
|
2926 |
! ! |
|
2927 |
||
17288 | 2928 |
!AbstractFileBrowser class methodsFor:'queries'! |
2929 |
||
2930 |
isAbstract |
|
2931 |
^ self == AbstractFileBrowser |
|
2932 |
! ! |
|
2933 |
||
17868 | 2934 |
!AbstractFileBrowser class methodsFor:'queries-file'! |
2935 |
||
2936 |
getBestDirectoryFrom:directories |
|
2937 |
"from a set of directories, return the common parent directory" |
|
2938 |
||
2939 |
|stringCol firstPre| |
|
2940 |
||
2941 |
directories isEmpty ifTrue:[^ nil]. |
|
2942 |
directories size == 1 ifTrue:[^ directories first]. |
|
2943 |
stringCol := (directories collect:[:file| file asString]) asOrderedCollection. |
|
2944 |
firstPre := stringCol at:1. |
|
2945 |
stringCol from:2 do:[:el| |
|
2946 |
firstPre := firstPre commonPrefixWith:el. |
|
2947 |
]. |
|
2948 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
2949 |
firstPre removeLast. |
|
2950 |
]. |
|
2951 |
^ firstPre asFilename |
|
2952 |
! ! |
|
2953 |
||
17746 | 2954 |
!AbstractFileBrowser class methodsFor:'utilities - dump'! |
4610 | 2955 |
|
18666 | 2956 |
contentsOfBytesAsDump:dataOrFileStream base:numberBase numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
17744 | 2957 |
"utility helper: generate a hexDump with addresses; |
2958 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
2959 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
2960 |
to support display of alien encoded binary data." |
|
2961 |
||
18666 | 2962 |
|dataSize lines nHexLines replacementForUnprintable colsPerByte characterDecoder| |
17744 | 2963 |
|
2964 |
(characterEncodingSymbol isNil or:[characterEncodingSymbol == #'iso8859-1']) ifFalse:[ |
|
2965 |
characterDecoder := CharacterEncoder encoderToEncodeFrom:characterEncodingSymbol into:#unicode. |
|
2966 |
]. |
|
17252 | 2967 |
|
2968 |
"/ used to be: |
|
2969 |
"/ replacementForUnprintable := $. |
|
2970 |
replacementForUnprintable := Character value:16rB7. "/ a centered dot. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2971 |
|
17744 | 2972 |
"/ cols needed per byte in the hex dump |
2973 |
colsPerByte := ((255 printStringRadix:numberBase) size). |
|
2974 |
||
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2975 |
"generate a virtual collection which evaluates and returns lines on-demand" |
18666 | 2976 |
dataSize := dataOrFileStream isStream |
2977 |
ifTrue:[ dataOrFileStream fileSize ] |
|
2978 |
ifFalse:[ dataOrFileStream size ]. |
|
2979 |
nHexLines := (dataSize + 15) // 16. |
|
11281
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 := VirtualArray new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2982 |
lines setSize:nHexLines + (nHexLines // 16). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2983 |
lines |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2984 |
generator:[:lineNr | |
17744 | 2985 |
|blockNr lineNrInBlock startOffset lineStream asciiLineStream byte line |
2986 |
decodedChar charPrinted| |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2987 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2988 |
blockNr := (lineNr - 1) // 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2989 |
lineNrInBlock := (lineNr - 1) \\ 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2990 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2991 |
lineNrInBlock == 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2992 |
line := '' |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2993 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2994 |
startOffset := ((blockNr * 16) + lineNrInBlock) * 16. |
17744 | 2995 |
|
2996 |
"/ 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
|
2997 |
lineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2998 |
asciiLineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2999 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3000 |
lineStream nextPutAll:((startOffset+virtualStart) hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3001 |
lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3002 |
1 to:16 do:[:i | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3003 |
i ~~ 1 ifTrue:[ lineStream space ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3004 |
|
18666 | 3005 |
(startOffset + i) > dataSize ifTrue:[ |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3006 |
asciiLineStream nextPut:(Character space). |
17744 | 3007 |
lineStream spaces:colsPerByte. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3008 |
] ifFalse:[ |
18666 | 3009 |
dataOrFileStream isStream ifTrue:[ |
3010 |
dataOrFileStream position:(startOffset + i - 1). |
|
3011 |
byte := dataOrFileStream nextByte. |
|
3012 |
] ifFalse:[ |
|
3013 |
byte := dataOrFileStream at:startOffset + i. |
|
3014 |
]. |
|
17746 | 3015 |
lineStream nextPutAll:(byte printStringRadix:numberBase size:colsPerByte fill:$0). |
17744 | 3016 |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3017 |
|
17744 | 3018 |
decodedChar := byte. |
3019 |
characterDecoder notNil ifTrue:[ |
|
3020 |
decodedChar := characterDecoder encode:byte. |
|
3021 |
]. |
|
3022 |
||
3023 |
charPrinted := replacementForUnprintable. |
|
3024 |
decodedChar notNil ifTrue:[ |
|
3025 |
((decodedChar between:32 and:127) or:[(decodedChar between:(128+32) and:(128+127))]) ifTrue:[ |
|
3026 |
charPrinted := Character value:decodedChar. |
|
16188 | 3027 |
] ifFalse:[ |
17744 | 3028 |
(decodedChar between:0 and:31) ifTrue:[ |
3029 |
"/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400 |
|
3030 |
"/ are perfect here, but usually not available in the font |
|
3031 |
"/ and we have currently no way of knowing if they are... |
|
3032 |
"/ (could let the font draw into a bitmap and check if there is something...) |
|
18666 | 3033 |
"/ For now, write a dot.· |
17744 | 3034 |
"/ charPrinted := (Character value:(byte + 16r2400)) |
3035 |
]. |
|
16188 | 3036 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3037 |
]. |
17744 | 3038 |
asciiLineStream nextPut:charPrinted. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3039 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3040 |
]. |
17744 | 3041 |
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
|
3042 |
, asciiLineStream contents. |
11262 | 3043 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3044 |
line |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3045 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3046 |
^ lines. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3047 |
|
17744 | 3048 |
"Created: / 12-11-2017 / 11:24:29 / cg" |
17750 | 3049 |
"Modified: / 12-11-2017 / 14:17:59 / cg" |
18666 | 3050 |
"Modified: / 12-03-2019 / 16:16:53 / Claus Gittinger" |
3051 |
! |
|
3052 |
||
3053 |
contentsOfBytesAsHexDump:dataOrFileStream numberOfAddressDigits:addrDigits addressStart:virtualStart |
|
17744 | 3054 |
"utility helper: generate a hexDump with addresses; the character columns at the right show |
3055 |
the iso8859-1 characters" |
|
17753 | 3056 |
|
3057 |
^ self |
|
18666 | 3058 |
contentsOfBytesAsDump:dataOrFileStream base:16 |
17744 | 3059 |
numberOfAddressDigits:addrDigits |
3060 |
addressStart:virtualStart |
|
17753 | 3061 |
characterEncoding:#'iso8859-1' |
11262 | 3062 |
|
3063 |
"Created: / 13-02-2012 / 15:01:46 / cg" |
|
17744 | 3064 |
"Modified: / 12-11-2017 / 12:07:12 / cg" |
17753 | 3065 |
"Modified: / 14-11-2017 / 17:48:19 / mawalch" |
18666 | 3066 |
"Modified (format): / 12-03-2019 / 16:38:26 / Claus Gittinger" |
3067 |
! |
|
3068 |
||
3069 |
contentsOfBytesAsHexDump:dataOrFileStream numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
|
17744 | 3070 |
"utility helper: generate a hexDump with addresses; |
3071 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
3072 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
3073 |
to support display of alien encoded binary data." |
|
3074 |
||
3075 |
^ self |
|
18666 | 3076 |
contentsOfBytesAsDump:dataOrFileStream base:16 |
17744 | 3077 |
numberOfAddressDigits:addrDigits |
3078 |
addressStart:virtualStart |
|
3079 |
characterEncoding:characterEncodingSymbol |
|
3080 |
||
3081 |
"Created: / 12-11-2017 / 11:21:44 / cg" |
|
18666 | 3082 |
"Modified (format): / 12-03-2019 / 16:38:31 / Claus Gittinger" |
17744 | 3083 |
! |
3084 |
||
3085 |
contentsOfFileAsDump:f base:numberBase withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3086 |
"opens the file, get its contents and generates a dump for it" |
|
3087 |
||
4610 | 3088 |
|resources fileName stream data offs |
17768 | 3089 |
addrDigits lines answer sizeLimit showLastPart setNewLimit thisFileSizeString| |
4610 | 3090 |
|
3091 |
resources := self classResources. |
|
3092 |
||
3093 |
fileName := f baseName. |
|
3094 |
f isDirectory ifTrue:[ |
|
18609 | 3095 |
Dialog warn:(resources string:'"%1" is a directory.' with:fileName). |
4610 | 3096 |
^ nil |
3097 |
]. |
|
3098 |
f exists ifFalse:[ |
|
18609 | 3099 |
Dialog warn:(resources string:'oops, "%1" is gone or unreadable.' with:fileName). |
4610 | 3100 |
^ nil |
3101 |
]. |
|
3102 |
f isReadable ifFalse:[ |
|
18609 | 3103 |
Dialog warn:(resources string:'"%1" is unreadable.' with:fileName). |
4610 | 3104 |
^ nil |
3105 |
]. |
|
17768 | 3106 |
f fileSize > (self maxFileSizeShownWithoutAsking) ifTrue:[ |
8472 | 3107 |
limitOrNil notNil ifTrue:[ |
3108 |
sizeLimit := limitOrNil. |
|
3109 |
showLastPart := showLastPartOrNil |
|
3110 |
] ifFalse:[ |
|
17768 | 3111 |
setNewLimit := false. |
3112 |
thisFileSizeString := (UnitConverter fileSizeStringFor:f fileSize). |
|
3113 |
||
3114 |
Dialog |
|
3115 |
withOptoutOption:[ setNewLimit := true ] |
|
3116 |
labelled:(resources string:'No longer ask for files smaller than %1' with:thisFileSizeString) |
|
3117 |
do:[ |
|
3118 |
answer := Dialog |
|
3119 |
confirmWithCancel:(resources |
|
3120 |
stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' |
|
3121 |
with:(fileName contractTo:40) allBold |
|
3122 |
with:thisFileSizeString) |
|
3123 |
labels:#('Cancel' 'Show All' 'Show First Part' ). |
|
3124 |
]. |
|
8472 | 3125 |
answer isNil ifTrue:[^ nil]. |
3126 |
answer ifTrue:[ |
|
17769 | 3127 |
sizeLimit := (4 * 1024 * 1024) "max:self maxFileSizeShownWithoutAsking". |
17768 | 3128 |
] ifFalse:[ |
3129 |
setNewLimit ifTrue:[ |
|
3130 |
self maxFileSizeShownWithoutAsking:(self maxFileSizeShownWithoutAsking max:f fileSize). |
|
3131 |
]. |
|
3132 |
]. |
|
8436 | 3133 |
]. |
4610 | 3134 |
]. |
3135 |
||
18666 | 3136 |
[ |
3137 |
stream := f readStream binary. |
|
3138 |
sizeLimit notNil ifTrue:[ |
|
3139 |
showLastPart == true ifTrue:[ |
|
3140 |
stream position:(f fileSize - sizeLimit). |
|
3141 |
]. |
|
3142 |
data := stream nextBytes:sizeLimit. |
|
3143 |
] ifFalse:[ |
|
3144 |
f fileSize > (1024*1024) ifTrue:[ |
|
3145 |
data := stream |
|
3146 |
] ifFalse:[ |
|
3147 |
data := stream contents. |
|
3148 |
]. |
|
3149 |
]. |
|
3150 |
] ensure:[ |
|
3151 |
(stream notNil and:[stream ~~ data]) ifTrue:[ |
|
3152 |
stream close. |
|
3153 |
]. |
|
3154 |
]. |
|
3155 |
||
4610 | 3156 |
offs := 0. |
3157 |
lines := StringCollection new. |
|
3158 |
||
3159 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
3160 |
||
11262 | 3161 |
^ self |
17744 | 3162 |
contentsOfBytesAsDump:data base:numberBase |
11262 | 3163 |
numberOfAddressDigits:addrDigits |
3164 |
addressStart:0 |
|
17744 | 3165 |
characterEncoding:characterEncoding |
3166 |
||
3167 |
"Created: / 12-11-2017 / 12:08:10 / cg" |
|
17769 | 3168 |
"Modified: / 19-11-2017 / 15:01:34 / cg" |
18666 | 3169 |
"Modified: / 12-03-2019 / 16:18:46 / Claus Gittinger" |
17744 | 3170 |
! |
3171 |
||
3172 |
contentsOfFileAsHexDump:f |
|
3173 |
"opens the file, get its contents and generates a dump for it" |
|
3174 |
||
3175 |
^ self |
|
3176 |
contentsOfFileAsHexDump:f |
|
3177 |
withLimit:nil |
|
3178 |
lastPart:nil |
|
3179 |
characterEncoding:#'iso8859-1' |
|
3180 |
||
3181 |
"Modified (comment): / 12-11-2017 / 12:09:30 / cg" |
|
3182 |
! |
|
3183 |
||
3184 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil |
|
3185 |
"opens the file, get its contents and generates a dump for it" |
|
3186 |
||
3187 |
^ self |
|
3188 |
contentsOfFileAsHexDump:f |
|
3189 |
withLimit:limitOrNil |
|
3190 |
lastPart:showLastPartOrNil |
|
3191 |
characterEncoding:#'iso-8859-1' |
|
3192 |
||
3193 |
"Modified (comment): / 12-11-2017 / 12:09:34 / cg" |
|
3194 |
! |
|
3195 |
||
3196 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3197 |
"opens the file, get its contents and generates a dump for it" |
|
3198 |
||
3199 |
^ self |
|
3200 |
contentsOfFileAsDump:f base:16 |
|
3201 |
withLimit:limitOrNil |
|
3202 |
lastPart:showLastPartOrNil |
|
3203 |
characterEncoding:characterEncoding |
|
3204 |
||
3205 |
"Created: / 12-11-2017 / 12:02:05 / cg" |
|
4610 | 3206 |
! ! |
3207 |
||
17868 | 3208 |
!AbstractFileBrowser class methodsFor:'utilities - files'! |
3209 |
||
3210 |
allFilesInDirectories:directories forWhich:aBlock |
|
3211 |
|allFiles| |
|
3212 |
||
3213 |
directories isEmpty ifTrue:[^ #()]. |
|
3214 |
||
3215 |
allFiles := OrderedCollection new. |
|
3216 |
directories do:[:dir| |
|
3217 |
[ |
|
3218 |
|fileNames| |
|
3219 |
||
3220 |
fileNames := dir directoryContents. |
|
3221 |
fileNames notNil ifTrue:[ |
|
3222 |
fileNames := fileNames |
|
3223 |
collect:[:fn | dir construct:fn] |
|
3224 |
thenSelect:[:fn | fn isDirectory not and:[aBlock value:fn]]. |
|
3225 |
allFiles addAll:fileNames. |
|
3226 |
] |
|
3227 |
] on:FileStream openErrorSignal do:[:ex| |
|
3228 |
self warn:(self classResources stringWithCRs:'Cannot access: %1\(%2)' |
|
3229 |
with:ex pathName |
|
3230 |
with:ex description). |
|
3231 |
ex proceedWith:nil. |
|
3232 |
]. |
|
3233 |
]. |
|
3234 |
||
3235 |
^ allFiles |
|
3236 |
! |
|
3237 |
||
3238 |
fileFindDuplicatesIn:directories |
|
3239 |
"scan directories for duplicate files. |
|
17871 | 3240 |
return a dictionary mapping duplicate files to their original; |
3241 |
the oldest file found will be the value (original), the younger files (copies) will be the keys. |
|
17868 | 3242 |
Files without duplicate(s) will not have an entry in the dictionary." |
3243 |
||
3244 |
|infoDir filesBySize anySameSized |
|
3245 |
result allFiles| |
|
3246 |
||
3247 |
directories isEmpty ifTrue:[^ #()]. |
|
3248 |
||
3249 |
allFiles := self allFilesInDirectories:directories forWhich:[:f | true]. |
|
3250 |
allFiles isEmpty ifTrue:[^ #()]. |
|
3251 |
||
3252 |
"/ for each, get the file's info (size, modificationTime etc.). |
|
3253 |
infoDir := Dictionary new. |
|
3254 |
allFiles do:[:fn | |
|
3255 |
infoDir at:fn put:(fn info) |
|
3256 |
]. |
|
3257 |
||
3258 |
"/ in a first pass, collect groups by the same size |
|
3259 |
"/ remember those fileSizes for which multiple files exist |
|
3260 |
filesBySize := Dictionary new. |
|
3261 |
anySameSized := false. |
|
3262 |
infoDir keysAndValuesDo:[:fn :info | |
|
3263 |
|sz entry| |
|
3264 |
||
3265 |
sz := info fileSize. |
|
3266 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
3267 |
entry add:fn. |
|
3268 |
entry size > 1 ifTrue:[ anySameSized := true ]. |
|
3269 |
]. |
|
3270 |
||
3271 |
"/ any of same size ? |
|
3272 |
anySameSized ifFalse:[^ #() ]. |
|
3273 |
||
3274 |
result := Dictionary new. |
|
3275 |
||
3276 |
"/ now walk over the same-sized files and compare the contents. |
|
3277 |
filesBySize do:[:entry | |
|
3278 |
|files| |
|
3279 |
||
3280 |
entry size > 1 ifTrue:[ |
|
3281 |
files := entry asArray. |
|
3282 |
files |
|
3283 |
sort:[:a :b | |
|
3284 |
|tA tB| |
|
3285 |
tA := (infoDir at:a) modificationTime. |
|
3286 |
tB := (infoDir at:b) modificationTime. |
|
3287 |
tA < tB |
|
3288 |
]. |
|
3289 |
||
3290 |
1 to:files size-1 do:[:idx1 | |
|
3291 |
|fn1| |
|
3292 |
||
3293 |
fn1 := files at:idx1. |
|
3294 |
idx1+1 to:files size do:[:idx2 | |
|
3295 |
|fn2| |
|
3296 |
||
3297 |
fn2 := files at:idx2. |
|
3298 |
||
3299 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
3300 |
"/ compare the files |
|
3301 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3302 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
|
17871 | 3303 |
result at:fn2 put:fn1. |
17868 | 3304 |
] |
3305 |
] |
|
3306 |
] |
|
3307 |
] |
|
3308 |
] |
|
3309 |
]. |
|
3310 |
||
17869 | 3311 |
result := result associations copy. |
3312 |
"/ result := result collect:[:assoc | |
|
3313 |
"/ |f1 f2| |
|
3314 |
"/ |
|
3315 |
"/ f1 := assoc key asString. |
|
3316 |
"/ f2 := assoc value asString. |
|
3317 |
"/ f1 < f2 ifTrue:[ |
|
3318 |
"/ f2 -> f1 |
|
3319 |
"/ ] ifFalse:[ |
|
3320 |
"/ f1 -> f2 |
|
3321 |
"/ ] |
|
3322 |
"/ ]. |
|
17868 | 3323 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
3324 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
17869 | 3325 |
result sort:[:f1 :f2 | f1 key < f2 key]. |
17868 | 3326 |
^ result |
3327 |
! ! |
|
3328 |
||
3892 | 3329 |
!AbstractFileBrowser methodsFor:'actions'! |
3330 |
||
3331 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 3332 |
"setup and launch a querybox to ask for a unix command. |
3892 | 3333 |
Then evaluate aBlock passing the command-string as argument." |
3334 |
||
16160 | 3335 |
|box osName commandString alwaysOpenLikeThisHolder openCmd suffix| |
3892 | 3336 |
|
3337 |
osName := OperatingSystem platformName. |
|
3338 |
||
3339 |
box := FilenameEnterBox |
|
4414 | 3340 |
title:(resources string:'Execute %1 command:' with:osName) |
3341 |
okText:(resources string:'Execute') |
|
4523 | 3342 |
action:[:cmd | commandString := cmd]. |
3892 | 3343 |
|
3344 |
fileName notNil ifTrue:[ |
|
4414 | 3345 |
self initialCommandFor:fileName into:box. |
3892 | 3346 |
]. |
16160 | 3347 |
alwaysOpenLikeThisHolder := false asValue. |
3348 |
box verticalPanel add:((CheckBox label:'Always use this command for this file type') model:alwaysOpenLikeThisHolder). |
|
3892 | 3349 |
box directory:(self getDirWithoutFileName:fileName). |
16160 | 3350 |
box open. |
3351 |
||
3352 |
"/ box destroy. |
|
3353 |
alwaysOpenLikeThisHolder value ifTrue:[ |
|
3354 |
openCmd := commandString upTo:$". |
|
3355 |
suffix := fileName suffix. |
|
16306 | 3356 |
UserPreferences current |
3357 |
defaultFileOpenCommandFor:suffix put:(openCmd,' "%1"'); |
|
3358 |
beModified. |
|
3359 |
self breakPoint:#cg. |
|
16160 | 3360 |
]. |
3361 |
||
4523 | 3362 |
commandString notNil ifTrue:[ |
3363 |
aBlock value:commandString |
|
3364 |
]. |
|
3365 |
||
3892 | 3366 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
3367 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
3368 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
3369 |
! |
|
3370 |
||
3371 |
changeFileBrowserTitleTo:aString |
|
4774 | 3372 |
self |
3373 |
applicationNamed:#FileBrowserV2 |
|
5009 | 3374 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 3375 |
! |
3376 |
||
3377 |
copyFileList |
|
4774 | 3378 |
"copy the fileList to the clipBoard" |
3379 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3380 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3381 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3382 |
fileList := self |
4774 | 3383 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3384 |
ifPresentDo:[:app | app browserFileList]. |
3385 |
||
3386 |
fileList notNil ifTrue:[ |
|
3387 |
self copyFileListToClipBoard:fileList. |
|
3388 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3389 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3390 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3391 |
copyFileListToClipBoard:fileList |
4774 | 3392 |
"copy the itemList to the clipBoard" |
3393 |
||
3394 |
|stream| |
|
3395 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3396 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 3397 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3398 |
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
|
3399 |
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
|
3400 |
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
|
3401 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3402 |
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
|
3403 |
(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
|
3404 |
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
|
3405 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3406 |
]. |
3892 | 3407 |
]. |
6034 | 3408 |
self window setClipboardText:stream contents. |
3892 | 3409 |
! |
3410 |
||
3411 |
copySelectedFilenames |
|
4774 | 3412 |
"copy the selected fileNames to the clipBoard" |
3413 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3414 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3415 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3416 |
fileList := self |
4774 | 3417 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3418 |
ifPresentDo:[:appl | appl selectedFileNames]. |
3419 |
fileList notNil ifTrue:[ |
|
3420 |
self copyFileListToClipBoard:fileList. |
|
3421 |
]. |
|
3892 | 3422 |
! |
3423 |
||
10923 | 3424 |
doAddArchiver |
3425 |
|files| |
|
3426 |
||
3427 |
files := self currentSelectedFiles. |
|
3428 |
files size == 1 ifFalse:[ |
|
17818 | 3429 |
Dialog information:(resources string:'Select exactly one archive.'). |
10923 | 3430 |
^ self |
3431 |
]. |
|
3432 |
||
3433 |
self |
|
3434 |
applicationNamed:#FileApplicationNoteBook |
|
3435 |
ifPresentDo:[:appl | appl doAddArchiverOn:files first]. |
|
3436 |
||
3437 |
"Created: / 29-11-2011 / 19:01:31 / cg" |
|
17818 | 3438 |
"Modified: / 29-11-2017 / 12:25:47 / cg" |
10923 | 3439 |
! |
3440 |
||
3892 | 3441 |
doAddTerminal |
5960 | 3442 |
|dir| |
3443 |
||
3444 |
dir := self currentDirectory. |
|
3445 |
dir isNil ifTrue:[ |
|
4414 | 3446 |
dir := Filename homeDirectory |
3892 | 3447 |
]. |
4774 | 3448 |
|
5009 | 3449 |
self |
3450 |
applicationNamed:#FileApplicationNoteBook |
|
3451 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
18734 | 3452 |
|
3453 |
"Modified (format): / 10-04-2019 / 05:53:35 / Claus Gittinger" |
|
3892 | 3454 |
! |
3455 |
||
3456 |
doOpenSearchFile |
|
5961 | 3457 |
|item file| |
3458 |
||
3459 |
file := self firstSelectedFileName. |
|
3460 |
file isNil ifTrue:[ |
|
3461 |
file := Filename homeDirectory asAbsoluteFilename. |
|
3462 |
]. |
|
3463 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 3464 |
self openSearchFileOn:item. |
3465 |
! |
|
3466 |
||
3467 |
doShowFileContents |
|
5009 | 3468 |
self |
3469 |
applicationNamed:#DirectoryContentsBrowser |
|
3470 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
3471 |
||
3472 |
^ nil |
|
3892 | 3473 |
! |
3474 |
||
3475 |
doShowProperties |
|
3476 |
"show long stat (file)-info" |
|
3477 |
||
3478 |
self fileGetInfo:true |
|
3479 |
! |
|
3480 |
||
14577 | 3481 |
enterAction |
3482 |
self |
|
3483 |
applicationNamed:#DirectoryContentsBrowser |
|
3484 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl enterAction ]]. |
|
3485 |
! |
|
3486 |
||
5528 | 3487 |
fileEncodingDialog |
14497 | 3488 |
"open a dialog to allow change of the file's character encoding. |
5528 | 3489 |
Files are converted to internal encoding when read, and converted back |
3490 |
to this encoding when saved. |
|
3491 |
Notice: currently, not too many encodings are supported by the system." |
|
3492 |
||
3493 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
3494 |
||
3495 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
3496 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
3497 |
||
3498 |
bindings := IdentityDictionary new. |
|
3499 |
bindings at:#encodingList put:encodingDescr. |
|
3500 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 3501 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
3502 |
||
5528 | 3503 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
3504 |
ifTrue:[ |
|
3505 |
idx := (bindings at:#selectedEncoding) value. |
|
3506 |
selectedEncoding := encodings at:idx. |
|
3507 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 3508 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 3509 |
]. |
5737 | 3510 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 3511 |
]. |
3512 |
||
3513 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
3514 |
! |
|
3515 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3516 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3517 |
"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
|
3518 |
|
5959 | 3519 |
|currentFileNameHolder currentSel| |
3520 |
||
3521 |
currentFileNameHolder := self currentFileNameHolder. |
|
3522 |
||
3523 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3524 |
(currentSel includes:aFilename) ifFalse:[ |
9677 | 3525 |
self withWaitCursorDo:[ |
3526 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
|
3527 |
] |
|
3528 |
]. |
|
3529 |
||
3530 |
"Modified: / 29-12-2010 / 11:04:29 / cg" |
|
3892 | 3531 |
! |
3532 |
||
11053 | 3533 |
lineEndConventionDialog |
3534 |
"open a dialog to allow change of the line end conventions |
|
3535 |
(when writing files)" |
|
3536 |
||
3537 |
|bindings| |
|
3538 |
||
3539 |
bindings := IdentityDictionary new. |
|
3540 |
bindings at:#lineEndConvention put:(self lineEndConvention asValue). |
|
3541 |
||
3542 |
(self openDialogInterface:#lineEndConventionDialogSpec withBindings:bindings) |
|
3543 |
ifTrue:[ |
|
15208 | 3544 |
self lineEndConventionHolder value:(bindings at:#lineEndConvention) value asSymbol |
11053 | 3545 |
]. |
3546 |
||
3547 |
"Created: / 06-01-2012 / 15:34:51 / cg" |
|
3548 |
! |
|
3549 |
||
4392 | 3550 |
newTextEditor |
5009 | 3551 |
self |
3552 |
applicationNamed:#FileApplicationNoteBook |
|
15936 | 3553 |
ifPresentDo:[:appl | |
3554 |
|editor files item| |
|
3555 |
||
3556 |
editor := appl newTextEditor. |
|
3557 |
(files := self currentSelectedFiles) size == 1 ifTrue:[ |
|
3558 |
item := DirectoryContentsBrowser itemClass fileName:files first. |
|
3559 |
editor item:item. |
|
3560 |
]. |
|
3561 |
^ editor |
|
3562 |
]. |
|
5009 | 3563 |
|
3564 |
^ nil. |
|
3565 |
! |
|
3566 |
||
3567 |
openApplByFileItem:anItem |
|
8490 | 3568 |
"/ q: is the following always wanted ? |
9267 | 3569 |
self window sensor shiftDown ifFalse:[ |
17715 | 3570 |
((anItem mimeType startsWith:'application/x-expecco-') |
3571 |
and:[(Smalltalk at:#ExpeccoStartup) notNil]) ifTrue:[ |
|
3572 |
(Smalltalk at:#ExpeccoStartup) main:{anItem fileName asString}. |
|
3573 |
^ self. |
|
3574 |
]. |
|
3575 |
||
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3576 |
"/ cg: no - batch and shell scripts are to be |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3577 |
"/ anItem fileName isExecutableProgram ifTrue:[ |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3578 |
"/ self executeCommand:anItem fileName pathName. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3579 |
"/ ^ self. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3580 |
"/ ]. |
9267 | 3581 |
|
8490 | 3582 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
3583 |
"/ Error handle:[:ex | |
|
3584 |
"/ ] do:[ |
|
3585 |
"/ OperatingSystem |
|
3586 |
"/ shellExecute:nil |
|
3587 |
"/ lpOperation:'open' |
|
3588 |
"/ lpFile:(anItem fileName pathName) |
|
3589 |
"/ lpParameters:nil |
|
3590 |
"/ lpDirectory:(self directory pathName) |
|
3591 |
"/ nShowCmd:#SW_SHOWNORMAL. |
|
3592 |
"/ ^ self. |
|
3593 |
"/ ] |
|
3594 |
"/ ] |
|
9267 | 3595 |
]. |
5306 | 3596 |
^ self |
5009 | 3597 |
applicationNamed:#FileApplicationNoteBook |
5306 | 3598 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3599 |
|
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3600 |
"Modified: / 06-09-2011 / 11:11:15 / cg" |
17715 | 3601 |
"Modified: / 18-10-2017 / 10:15:15 / stefan" |
3892 | 3602 |
! |
3603 |
||
4392 | 3604 |
openApplForFile:aFilename |
5306 | 3605 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 3606 |
! |
3607 |
||
3892 | 3608 |
openCommandResultApplication |
3609 |
||
5009 | 3610 |
self |
3611 |
applicationNamed:#FileApplicationNoteBook |
|
3612 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
3613 |
||
3614 |
^ nil |
|
3892 | 3615 |
! |
3616 |
||
5010 | 3617 |
openNewTextEditorOn:anItem |
5009 | 3618 |
self |
3619 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3620 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 3621 |
|
3622 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3623 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3624 |
|
5010 | 3625 |
openSearchFileOn:anItem |
5009 | 3626 |
self |
3627 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3628 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 3629 |
|
3630 |
^ nil. |
|
3892 | 3631 |
! |
3632 |
||
5162 | 3633 |
openTextEditorForFile:aFilename |
3634 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
3635 |
! |
|
3636 |
||
5010 | 3637 |
openTextEditorOn:anItem |
5009 | 3638 |
self |
3639 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3640 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 3641 |
|
3642 |
^ nil. |
|
3892 | 3643 |
! |
3644 |
||
5010 | 3645 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 3646 |
self |
3647 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3648 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 3649 |
|
3650 |
^ nil. |
|
4618 | 3651 |
! |
3652 |
||
5959 | 3653 |
setCurrentFileName:aFilename |
3654 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
3655 |
! |
|
3656 |
||
3657 |
setCurrentFileNames:aCollectionOfFilenames |
|
3658 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
3659 |
! |
|
3660 |
||
11053 | 3661 |
tabStopConversionDialog |
3662 |
"open a dialog to allow change of the tab stop conversion (when reading/writing files)" |
|
3663 |
||
3664 |
|bindings| |
|
3665 |
||
3666 |
bindings := IdentityDictionary new. |
|
3667 |
bindings at:#tabStops put:(self inputTabColumnConversion asValue). |
|
3668 |
||
3669 |
(self openDialogInterface:#tabStopConversionDialogSpec withBindings:bindings) |
|
3670 |
ifTrue:[ |
|
3671 |
self inputTabColumnConversionHolder value:(bindings at:#tabStops) value |
|
3672 |
]. |
|
3673 |
||
3674 |
"Created: / 06-01-2012 / 15:36:06 / cg" |
|
3675 |
! |
|
3676 |
||
3892 | 3677 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3678 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3679 |
aColOfFiles notNil ifTrue:[ |
5959 | 3680 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3681 |
]. |
3892 | 3682 |
! |
3683 |
||
3684 |
updateCurrentDirectory |
|
5739 | 3685 |
self updateCurrentDirectory:false |
3686 |
! |
|
3687 |
||
3688 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3689 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3690 |
|
5009 | 3691 |
self |
3692 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 3693 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 3694 |
self |
3695 |
applicationNamed:#DirectoryTreeBrowser |
|
3696 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 3697 |
! |
3698 |
||
5739 | 3699 |
updateCurrentDirectoryWithReread |
3700 |
self updateCurrentDirectory:true |
|
3701 |
! |
|
3702 |
||
4345 | 3703 |
withActivityIndicationDo:aBlock |
3704 |
||
3705 |
self activityVisibilityChannel value:true. |
|
3706 |
[ |
|
9361 | 3707 |
self withWaitCursorDo:[ |
3708 |
aBlock value. |
|
3709 |
] |
|
4345 | 3710 |
] ensure:[ |
3711 |
self activityVisibilityChannel value:false. |
|
3712 |
] |
|
3892 | 3713 |
! ! |
3714 |
||
3715 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
3716 |
||
3717 |
addBookmark |
|
3718 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
6725 | 3719 |
self addBookmarks:(self currentSelectedDirectories). |
5960 | 3720 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 3721 |
! |
3722 |
||
3723 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3724 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3725 |
self class addBookmark:path |
3892 | 3726 |
]. |
3727 |
! |
|
3728 |
||
8013 | 3729 |
editBookmarks |
17849 | 3730 |
self class editBookmarksWithDefault: self currentSelectedDirectories firstOrNil. |
3731 |
||
3732 |
"Modified: / 13-12-2017 / 23:24:39 / stefan" |
|
8013 | 3733 |
! |
3734 |
||
3892 | 3735 |
hasBookmarks |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3736 |
^ self class hasBookmarks |
3892 | 3737 |
! |
3738 |
||
3739 |
hasBookmarksToRemove |
|
3740 |
|bookmarks directories| |
|
3741 |
||
3982 | 3742 |
directories := self currentSelectedDirectories. |
3892 | 3743 |
bookmarks := self class directoryBookmarks. |
17416 | 3744 |
^ (bookmarks notEmptyOrNil and:[directories notEmpty]) |
3745 |
||
3746 |
"Modified: / 17-02-2017 / 08:25:22 / cg" |
|
3892 | 3747 |
! |
3748 |
||
3749 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3750 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3751 |
self class removeBookmark:dir |
3892 | 3752 |
]. |
4679 | 3753 |
! |
3754 |
||
3755 |
saveBookmarks |
|
3756 |
self class saveBookmarks |
|
3892 | 3757 |
! ! |
3758 |
||
3759 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
3760 |
||
3761 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 3762 |
|cmd suffix cmdHist historySize| |
3892 | 3763 |
|
3764 |
cmdHist := self class commandHistory. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
3765 |
(aCommandString notEmptyOrNil) ifTrue:[ |
4414 | 3766 |
cmdHist notNil ifTrue:[ |
3767 |
cmdHist addFirst:aCommandString. |
|
6369 | 3768 |
historySize := self class commandHistorySize. |
3769 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 3770 |
cmdHist removeLast |
3771 |
] |
|
3772 |
]. |
|
3773 |
aFilename notNil ifTrue:[ |
|
3774 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
3775 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
3776 |
DefaultCommandPerSuffix := Dictionary new. |
|
3777 |
]. |
|
3778 |
suffix := aFilename asFilename suffix. |
|
3779 |
suffix notNil ifTrue:[ |
|
3780 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
3781 |
] |
|
3782 |
] |
|
3892 | 3783 |
] |
3784 |
! |
|
3785 |
||
3786 |
doBack |
|
6286 | 3787 |
"go backward in the history" |
3892 | 3788 |
|
4022 | 3789 |
| fileName| |
3790 |
||
6369 | 3791 |
fileName := self directoryHistory goBackward. |
3892 | 3792 |
fileName notNil ifTrue:[ |
4347 | 3793 |
self gotoFile:(fileName asFilename). |
3892 | 3794 |
] |
3795 |
! |
|
3796 |
||
3797 |
doForward |
|
6286 | 3798 |
"go forward in the history" |
3892 | 3799 |
|
3964 | 3800 |
| fileName| |
3801 |
||
6369 | 3802 |
fileName := self directoryHistory goForward. |
3892 | 3803 |
fileName notNil ifTrue:[ |
4414 | 3804 |
self gotoFile:(fileName asFilename). |
4022 | 3805 |
] ifFalse:[ |
4414 | 3806 |
self enableForward value:false. |
4022 | 3807 |
|
3808 |
]. |
|
3892 | 3809 |
! ! |
3810 |
||
3811 |
!AbstractFileBrowser methodsFor:'applications'! |
|
3812 |
||
5009 | 3813 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
3814 |
|appl| |
|
3815 |
||
3816 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
3817 |
appl notNil ifTrue:[ |
|
3818 |
^ aBlock value:appl |
|
3819 |
]. |
|
3820 |
^ nil. |
|
3821 |
! |
|
3822 |
||
4004 | 3823 |
directoryContentsBrowser |
3824 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 3825 |
! ! |
3826 |
||
3827 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
3828 |
||
3829 |
applications |
|
3830 |
^ aspects at:#applications |
|
3831 |
! |
|
3832 |
||
3833 |
backgroundProcesses |
|
3834 |
||
3835 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
3836 |
! |
|
3837 |
||
4230 | 3838 |
canMake |
15259 | 3839 |
^ self aspectFor:#canMake ifAbsent:[ ValueHolder with:false ]. |
4230 | 3840 |
! |
3841 |
||
18246 | 3842 |
canOpenChangeBrowser |
3843 |
^ self aspectFor:#canOpenChangeBrowser ifAbsent:[ false asValue ]. |
|
3844 |
||
3845 |
"Created: / 30-06-2018 / 18:29:53 / Claus Gittinger" |
|
3846 |
! |
|
3847 |
||
3892 | 3848 |
currentDirectories |
6725 | 3849 |
" returns a holder on a Collection of all currently selected directories |
3850 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3892 | 3851 |
" |
3852 |
||
3853 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
3854 |
! |
|
3855 |
||
6725 | 3856 |
currentDirectoriesValue |
3857 |
" returns a Collection of all currently selected directories |
|
3858 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3859 |
" |
|
3860 |
||
3861 |
^ self currentDirectories value |
|
3862 |
! |
|
3863 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3864 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3865 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3866 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3867 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3868 |
|
6725 | 3869 |
directories := self currentSelectedDirectories. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3870 |
(directories size ~= 1) ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3871 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3872 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3873 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3874 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3875 |
|
13856 | 3876 |
currentDirectoryDisplayed |
3877 |
"Return a directory as Filename that is currently displayed in the browser" |
|
3878 |
||
3879 |
^self subclassResponsibility |
|
3880 |
||
3881 |
"Created: / 14-01-2013 / 11:57:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3882 |
! |
|
3883 |
||
3892 | 3884 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3885 |
"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
|
3886 |
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
|
3887 |
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
|
3888 |
|
6589 | 3889 |
^ self aspectFor:#currentFileNameHolder |
3890 |
ifAbsent:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3891 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3892 |
|
4692 | 3893 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3894 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3895 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3896 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3897 |
currentSel asValue |
6589 | 3898 |
] |
3899 |
notPresentDo:[:holder| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3900 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3901 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3902 |
newFilenames := Set new. |
6589 | 3903 |
filenames do:[:eachFilename| |
3904 |
|existingFilename| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3905 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3906 |
existingFilename notNil ifTrue:[ |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3907 |
[existingFilename isRootDirectory or:[existingFilename exists]] whileFalse:[ |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3908 |
existingFilename := existingFilename directory. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3909 |
]. |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3910 |
existingFilename exists ifTrue:[ |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3911 |
newFilenames add:existingFilename. |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3912 |
]. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3913 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3914 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3915 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3916 |
] |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3917 |
|
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3918 |
"Modified: / 27-11-2010 / 15:42:45 / cg" |
3892 | 3919 |
! |
3920 |
||
5528 | 3921 |
defaultFileEncoding |
3922 |
^ #'iso8859-1' "/ #'utf-8' |
|
3923 |
! |
|
3924 |
||
3892 | 3925 |
enableDirectoryUp |
3926 |
||
15259 | 3927 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[ValueHolder with:false] |
3892 | 3928 |
! |
3929 |
||
6456 | 3930 |
enableGotoDefaultDirectory |
15259 | 3931 |
^ self aspectFor:#enableGotoDefaultDirectory ifAbsent:[ ValueHolder with:true ]. |
4593 | 3932 |
! |
3933 |
||
8168 | 3934 |
enableGotoDesktop |
14308 | 3935 |
"/ backward compatibility |
3936 |
^ self enableGotoDesktopDirectory. |
|
8168 | 3937 |
! |
3938 |
||
9572 | 3939 |
enableGotoDesktopDirectory |
15259 | 3940 |
^ self aspectFor:#enableGotoDesktopDirectory ifAbsent:[ ValueHolder with:true ]. |
9572 | 3941 |
|
3942 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3943 |
! |
|
3944 |
||
18511 | 3945 |
enableGotoDocumentsDirectory |
3946 |
^ self aspectFor:#enableGotoDocumentsDirectory ifAbsent:[ ValueHolder with:true ]. |
|
3947 |
||
3948 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3949 |
! |
|
3950 |
||
18352 | 3951 |
enableGotoDownloadsDirectory |
3952 |
^ self aspectFor:#enableGotoDownloadsDirectory ifAbsent:[ ValueHolder with:true ]. |
|
3953 |
||
3954 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3955 |
! |
|
3956 |
||
6434 | 3957 |
enableGotoSmalltalkDirectory |
6456 | 3958 |
^ self aspectFor:#enableGotoSmalltalkDirectory ifAbsent:[ true asValue ]. |
6434 | 3959 |
! |
3960 |
||
17187 | 3961 |
enableGotoSmalltalkWorkspaceDirectory |
3962 |
^ self aspectFor:#enableGotoSmalltalkWorkspaceDirectory ifAbsent:[ true asValue ]. |
|
3963 |
! |
|
3964 |
||
9677 | 3965 |
enableGotoTempDirectory |
3966 |
^ self aspectFor:#enableGotoTempDirectory ifAbsent:[ true asValue ]. |
|
3967 |
||
3968 |
"Created: / 29-12-2010 / 11:01:17 / cg" |
|
3969 |
! |
|
3970 |
||
3892 | 3971 |
enableHome |
3972 |
||
3973 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
3974 |
! |
|
3975 |
||
9596 | 3976 |
enableMakeCurrentDirectory |
3977 |
^ self aspectFor:#enableMakeCurrentDirectory ifAbsent:[ true asValue ]. |
|
3978 |
||
3979 |
"Created: / 26-10-2010 / 17:17:58 / cg" |
|
3980 |
! |
|
3981 |
||
3892 | 3982 |
enableViewNoteBookApplication |
3983 |
||
3984 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
3985 |
! |
|
3986 |
||
5528 | 3987 |
fileEncoding |
3988 |
^ self fileEncodingHolder value |
|
3989 |
! |
|
3990 |
||
3991 |
fileEncoding:newEncoding |
|
5533 | 3992 |
self fileEncodingHolder value:newEncoding. |
3993 |
||
3994 |
self |
|
3995 |
applicationNamed:#FileApplicationNoteBook |
|
3996 |
ifPresentDo:[:nb | |
|
3997 |
|appl| |
|
3998 |
||
3999 |
appl := nb selectedApplication. |
|
5535 | 4000 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 4001 |
appl fileEncoding:newEncoding |
4002 |
] |
|
4003 |
]. |
|
5528 | 4004 |
! |
4005 |
||
5737 | 4006 |
fileEncodingHolder |
4007 |
^ self |
|
4008 |
aspectFor:#fileEncodingHolder |
|
4009 |
ifAbsent:[ |
|
4010 |
self |
|
4011 |
applicationNamed:#FileApplicationNoteBook |
|
4012 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
4013 |
] |
|
4014 |
! |
|
4015 |
||
17485 | 4016 |
fileEntryFieldHolder |
4017 |
^ self subclassResponsibility. |
|
4018 |
||
4019 |
"Created: / 31-03-2017 / 11:36:49 / stefan" |
|
4020 |
! |
|
4021 |
||
5961 | 4022 |
firstSelectedFileName |
4023 |
|files| |
|
4024 |
||
7560 | 4025 |
files := self currentSelectedObjects. |
5961 | 4026 |
files notEmpty ifTrue:[ |
4027 |
^ files first |
|
4028 |
]. |
|
4029 |
^ nil |
|
7560 | 4030 |
|
4031 |
"Modified: / 04-12-2006 / 13:14:53 / cg" |
|
5961 | 4032 |
! |
4033 |
||
6456 | 4034 |
gotoDefaultDirectoryIsVisible |
9596 | 4035 |
^ true. |
4036 |
"/ ^ (Filename defaultDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
4037 |
||
4038 |
"Modified: / 26-10-2010 / 17:23:51 / cg" |
|
6456 | 4039 |
! |
4040 |
||
9572 | 4041 |
gotoDesktopDirectoryIsVisible |
4042 |
Filename desktopDirectory = Filename homeDirectory ifTrue:[^ false]. |
|
4043 |
||
4044 |
^ (Filename desktopDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
4045 |
||
4046 |
"Created: / 01-10-2010 / 16:26:27 / cg" |
|
4047 |
! |
|
4048 |
||
4618 | 4049 |
hasFileSelection |
4050 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
4051 |
! |
|
4052 |
||
9490 | 4053 |
hasNotTwoDirectoriesSelectedHolder |
4054 |
^ self |
|
4055 |
aspectFor:#hasNotTwoDirectoriesSelectedHolder |
|
4056 |
ifAbsent:[ |
|
4057 |
BlockValue |
|
4058 |
with:[:m | self hasTwoDirectoriesSelected not] |
|
4059 |
argument:self currentFileNameHolder |
|
4060 |
]. |
|
4061 |
||
4062 |
"Created: / 20-05-2010 / 10:45:50 / cg" |
|
4063 |
! |
|
4064 |
||
5830 | 4065 |
hasNotTwoFilesSelectedHolder |
9490 | 4066 |
^ self |
4067 |
aspectFor:#hasNotTwoFilesSelectedHolder |
|
5830 | 4068 |
ifAbsent:[ |
4069 |
BlockValue |
|
4070 |
with:[:m | self hasTwoFilesSelected not] |
|
4071 |
argument:self currentFileNameHolder |
|
4072 |
]. |
|
9490 | 4073 |
|
4074 |
"Modified: / 20-05-2010 / 10:46:01 / cg" |
|
5830 | 4075 |
! |
4076 |
||
3892 | 4077 |
hasSelection |
17923 | 4078 |
"aspect holding true, if a file is selected" |
3892 | 4079 |
|
4080 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
4081 |
! |
|
4082 |
||
9490 | 4083 |
hasTwoDirectoriesSelectedHolder |
4084 |
^ self |
|
4085 |
aspectFor:#hasTwoDirectoriesSelectedHolder |
|
4086 |
ifAbsent:[ |
|
4087 |
BlockValue |
|
4088 |
with:[:m | self hasTwoDirectoriesSelected] |
|
4089 |
argument:self currentFileNameHolder |
|
4090 |
]. |
|
4091 |
||
4092 |
"Created: / 20-05-2010 / 10:45:41 / cg" |
|
4093 |
! |
|
4094 |
||
4414 | 4095 |
hasTwoFilesSelectedHolder |
9490 | 4096 |
^ self |
4097 |
aspectFor:#hasTwoFilesSelectedHolder |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4098 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4099 |
BlockValue |
5830 | 4100 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4101 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4102 |
]. |
9490 | 4103 |
|
4104 |
"Modified: / 20-05-2010 / 10:46:08 / cg" |
|
4414 | 4105 |
! |
4106 |
||
11053 | 4107 |
inputTabColumnConversion |
4108 |
^ self inputTabColumnConversionHolder value |
|
4109 |
||
4110 |
"Created: / 06-01-2012 / 15:25:56 / cg" |
|
4111 |
! |
|
4112 |
||
4113 |
inputTabColumnConversionHolder |
|
4114 |
^ self |
|
4115 |
aspectFor:#inputTabColumnConversionHolder |
|
4116 |
ifAbsent:[ |
|
4117 |
self |
|
4118 |
applicationNamed:#FileApplicationNoteBook |
|
4119 |
ifPresentDo:[:appl | appl inputTabColumnConversionHolder]. |
|
4120 |
] |
|
4121 |
||
4122 |
"Created: / 06-01-2012 / 15:26:16 / cg" |
|
4123 |
! |
|
4124 |
||
4125 |
lineEndConvention |
|
15208 | 4126 |
^ self lineEndConventionHolder value asSymbol |
11053 | 4127 |
|
4128 |
"Created: / 06-01-2012 / 13:05:14 / cg" |
|
4129 |
! |
|
4130 |
||
11591 | 4131 |
lineEndConvention: aSymbol |
18525 | 4132 |
self lineEndConventionHolder value:(aSymbol ifNotNil:[aSymbol asSymbol]) |
11591 | 4133 |
|
4134 |
"Created: / 11-07-2012 / 19:51:58 / cg" |
|
18525 | 4135 |
"Modified: / 13-11-2018 / 11:13:41 / Stefan Vogel" |
11591 | 4136 |
! |
4137 |
||
11053 | 4138 |
lineEndConventionHolder |
4139 |
^ self |
|
4140 |
aspectFor:#lineEndConventionHolder |
|
4141 |
ifAbsent:[ |
|
4142 |
self |
|
4143 |
applicationNamed:#FileApplicationNoteBook |
|
4144 |
ifPresentDo:[:appl | appl lineEndConventionHolder]. |
|
4145 |
] |
|
4146 |
||
4147 |
"Created: / 06-01-2012 / 13:02:51 / cg" |
|
4148 |
! |
|
4149 |
||
5737 | 4150 |
lockFileEncoding:aBoolean |
4151 |
self lockFileEncodingHolder value:aBoolean. |
|
4152 |
||
4153 |
self |
|
4154 |
applicationNamed:#FileApplicationNoteBook |
|
4155 |
ifPresentDo:[:nb | |
|
4156 |
|appl| |
|
4157 |
||
4158 |
appl := nb selectedApplication. |
|
4159 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
4160 |
appl lockFileEncoding:aBoolean |
|
4161 |
] |
|
4162 |
]. |
|
4163 |
! |
|
4164 |
||
4165 |
lockFileEncodingHolder |
|
4166 |
^ self |
|
4167 |
aspectFor:#lockFileEncodingHolder |
|
4168 |
ifAbsent:[ |
|
4169 |
self |
|
4170 |
applicationNamed:#FileApplicationNoteBook |
|
4171 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
4172 |
] |
|
4173 |
! |
|
4174 |
||
13856 | 4175 |
makeCommandHolder |
4176 |
^ self aspectFor:#makeCommandHolder ifAbsent:[ nil asValue ]. |
|
4177 |
||
4178 |
"Created: / 13-04-2012 / 17:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4179 |
! |
|
4180 |
||
4523 | 4181 |
notify:aString |
11108 | 4182 |
"aString is shown in the lower pane" |
4183 |
||
4523 | 4184 |
self notifyChannel value:aString |
11108 | 4185 |
|
4186 |
"Modified (comment): / 11-01-2012 / 21:46:55 / cg" |
|
4523 | 4187 |
! |
4188 |
||
3892 | 4189 |
notifyChannel |
4190 |
||
4191 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 4192 |
! |
4193 |
||
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4194 |
progressPercentageHolder |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4195 |
^ self aspectFor:#progressPercentageHolder ifAbsent:[ nil asValue ]. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4196 |
|
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4197 |
"Created: / 11-10-2010 / 12:54:46 / cg" |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4198 |
! |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4199 |
|
4071 | 4200 |
rootHolder |
4201 |
"holder, which keeps the rootHolder of the treeView |
|
4202 |
" |
|
4203 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4204 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4205 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4206 |
]. |
8192
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4207 |
! |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4208 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4209 |
rootHolder:aHolder |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4210 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4211 |
self aspectFor:#rootHolder put:aHolder |
3892 | 4212 |
! ! |
4213 |
||
4214 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
4215 |
||
4216 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 4217 |
"returns the model for an aspect; these are stored in a common dictionary" |
4218 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4219 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 4220 |
! |
4221 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4222 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 4223 |
"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
|
4224 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4225 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4226 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4227 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4228 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4229 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4230 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4231 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4232 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4233 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4234 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4235 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4236 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4237 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4238 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4239 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4240 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4241 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4242 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4243 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4244 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4245 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4246 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4247 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4248 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4249 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4250 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4251 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4252 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4253 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4254 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4255 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4256 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4257 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4258 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4259 |
aspectFor:something put:aValueHolder |
6284 | 4260 |
"stores the model for an aspect; these are stored in a common dictionary" |
4261 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4262 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4263 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4264 |
|
3892 | 4265 |
aspects |
6284 | 4266 |
"returns the common aspect dictionary" |
4267 |
||
3892 | 4268 |
^ aspects |
4269 |
! |
|
4270 |
||
4271 |
runtimeAspectValueFor:something |
|
4272 |
"returns the default aspect item from the class variable RuntimeAspects |
|
4273 |
" |
|
4274 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
4275 |
! |
|
4276 |
||
4201 | 4277 |
saveAspectValues |
16306 | 4278 |
|prefs saveAspects aspectValue| |
4279 |
||
4280 |
prefs := UserPreferences current. |
|
4281 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4282 |
saveAspects := self class userPreferencesAspectList keys. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4283 |
saveAspects do:[ :aspectKey | |
4201 | 4284 |
aspectValue := (self perform:aspectKey) value. |
16306 | 4285 |
prefs |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4286 |
at: ('fileBrowser_',aspectKey asString) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4287 |
put: aspectValue. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4288 |
]. |
16306 | 4289 |
prefs beModified. |
4290 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4291 |
"Modified: / 04-09-2006 / 10:02:41 / cg" |
4201 | 4292 |
! |
4293 |
||
3892 | 4294 |
saveRuntimeAspectValues |
4295 |
|savedAspects dictionary value isHolder aspect| |
|
4296 |
||
5941 | 4297 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 4298 |
dictionary := Dictionary new. |
5941 | 4299 |
savedAspects do:[:aspectKey | |
4414 | 4300 |
aspect := self perform:aspectKey. |
4301 |
isHolder := aspect isValueModel. |
|
5941 | 4302 |
isHolder ifTrue:[ |
4303 |
value := aspect value |
|
4304 |
] ifFalse:[ |
|
4305 |
value := aspect |
|
4306 |
]. |
|
4307 |
dictionary at:aspectKey |
|
4308 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
4309 |
]. |
|
4310 |
RuntimeAspects := dictionary. |
|
3892 | 4311 |
! |
4312 |
||
4201 | 4313 |
userPreferencesAspectValueFor:something |
4314 |
"returns the default aspect from the Userpreferences |
|
3892 | 4315 |
" |
4201 | 4316 |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4317 |
(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
|
4318 |
^ UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4319 |
at:('fileBrowser_',something) asSymbol |
9579
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4320 |
ifAbsent:nil "(self class userPreferencesAspectList at:something)". |
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4321 |
|
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4322 |
"Modified: / 14-10-2010 / 19:16:38 / cg" |
3892 | 4323 |
! ! |
4324 |
||
4011 | 4325 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
4326 |
||
9015 | 4327 |
filter:aString |
4328 |
self filterModel value:aString |
|
4329 |
! |
|
4330 |
||
4018 | 4331 |
filterBackgroundColor |
4332 |
||
4333 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
4334 |
! |
|
4335 |
||
4011 | 4336 |
filterBlockHolder |
4337 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4338 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 4339 |
! |
4340 |
||
4341 |
filterListModel |
|
4342 |
||
4343 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
4344 |
! |
|
4345 |
||
4346 |
filterModel |
|
5941 | 4347 |
|m| |
4348 |
||
4349 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
4350 |
^ m |
|
4011 | 4351 |
! |
4352 |
||
8185
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4353 |
filterModel:aHolder |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4354 |
self aspectFor:#filterModel put:aHolder. |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4355 |
! |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4356 |
|
4018 | 4357 |
filterValueBox |
4358 |
||
4359 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
4360 |
! |
|
4361 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4362 |
makeFilterBlock |
14497 | 4363 |
"return a two-arg filterblock on the file's path- and base-name. This block should return true for files |
9102 | 4364 |
to be shown" |
4365 |
||
17481 | 4366 |
| filterString filterStrings filters notFilters showHidden filterBlock caseSensitive| |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4367 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4368 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4369 |
filterString = '' ifTrue:[filterString := '*']. |
17481 | 4370 |
caseSensitive := "ignoreCaseInPattern ?" Filename isCaseSensitive. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4371 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4372 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
12760 | 4373 |
filterStrings := filterStrings |
4374 |
select:[:eachFilter | eachFilter withoutSeparators notEmpty]. |
|
4375 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4376 |
filters := filterStrings |
12760 | 4377 |
reject:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
4378 |
thenCollect: |
|
4379 |
[:eachPattern | |
|
4380 |
|pattern| |
|
4381 |
||
4382 |
pattern := eachPattern withoutSeparators. |
|
15597 | 4383 |
pattern includesMatchCharacters ifFalse:[ |
4384 |
"JV@2012-03-05: Add implict star at the beginning and at the end of pattern, |
|
4385 |
that's how most of the other applications behave - do what most users expect" |
|
17772 | 4386 |
"/ pattern first == $* ifFalse:[pattern := '*' , pattern]. |
4387 |
"/ pattern last == $* ifFalse:[pattern := pattern , '*']. |
|
4388 |
[:name :baseName | baseName asLowercase includesString:pattern caseSensitive:caseSensitive] |
|
4389 |
] ifTrue:[ |
|
4390 |
pattern = '*' ifTrue:[ |
|
4391 |
[:name :baseName | true]. |
|
4392 |
] ifFalse:[ |
|
4393 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
|
4394 |
]. |
|
15597 | 4395 |
]. |
12760 | 4396 |
]. |
4397 |
||
4398 |
notFilters := filterStrings |
|
4399 |
select:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
|
4400 |
thenCollect: |
|
4401 |
[:eachPattern | |
|
9296 | 4402 |
|pattern| |
4403 |
||
4404 |
pattern := eachPattern withoutSeparators. |
|
12760 | 4405 |
pattern := (pattern copyFrom:2) withoutSeparators. |
17481 | 4406 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
9296 | 4407 |
]. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4408 |
|
12760 | 4409 |
|
4410 |
(filters size == 1 and:[notFilters isEmpty]) ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4411 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4412 |
] ifFalse:[ |
12760 | 4413 |
filters isEmpty ifTrue:[ |
4414 |
filterBlock := [:name :baseName | |
|
4415 |
(notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not |
|
4416 |
]. |
|
4417 |
] ifFalse:[ |
|
4418 |
notFilters isEmpty ifTrue:[ |
|
4419 |
filterBlock := [:name :baseName | |
|
4420 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4421 |
]. |
|
4422 |
] ifFalse:[ |
|
4423 |
filterBlock := [:name :baseName | |
|
4424 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4425 |
and:[ (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not ] |
|
4426 |
]. |
|
4427 |
] |
|
4428 |
] |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4429 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4430 |
|
4011 | 4431 |
showHidden := self showHiddenFiles value. |
4432 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4433 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4434 |
]. |
9296 | 4435 |
^ [:name :baseName | |
4436 |
name isHidden not and:[filterBlock value:name value:baseName]]. |
|
13856 | 4437 |
|
4438 |
"Modified: / 05-02-2012 / 01:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17481 | 4439 |
"Modified: / 27-03-2017 / 12:52:08 / stefan" |
17772 | 4440 |
"Modified: / 20-11-2017 / 22:02:04 / cg" |
4018 | 4441 |
! |
4442 |
||
4443 |
shownFiles |
|
4444 |
||
4445 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 4446 |
! ! |
4447 |
||
14126 | 4448 |
|
3892 | 4449 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
4450 |
||
4451 |
dirHistory |
|
6369 | 4452 |
"obsolete" |
4453 |
^ self directoryHistory |
|
4454 |
! |
|
4455 |
||
4456 |
directoryHistory |
|
3952 | 4457 |
^ self class directoryHistory |
3892 | 4458 |
! |
4459 |
||
4460 |
enableBack |
|
4461 |
||
15259 | 4462 |
^ self aspectFor:#enableBack ifAbsent:[ValueHolder with:false] |
3892 | 4463 |
! |
4464 |
||
4465 |
enableFileHistory |
|
4466 |
||
15259 | 4467 |
^ self aspectFor:#enableFileHistory ifAbsent:[ValueHolder with:false] |
3892 | 4468 |
! |
4469 |
||
4470 |
enableForward |
|
4471 |
||
15259 | 4472 |
^ self aspectFor:#enableForward ifAbsent:[ValueHolder with:false] |
3892 | 4473 |
! |
4474 |
||
4475 |
fileHistory |
|
9820
07b7d7929e3e
variable renamed in: #fileHistory
Stefan Vogel <sv@exept.de>
parents:
9793
diff
changeset
|
4476 |
^ self aspectFor:#fileHistory ifAbsent:[OrderedSet new] |
3892 | 4477 |
! ! |
4478 |
||
4479 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
4480 |
||
4345 | 4481 |
activityVisibilityChannel |
6284 | 4482 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 4483 |
|
15259 | 4484 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ ValueHolder with:false ]. |
4345 | 4485 |
! |
4486 |
||
15111 | 4487 |
alwaysUseSmalltalkTools |
4488 |
" aspect to prevent os tools to be opened on double click" |
|
4489 |
||
15259 | 4490 |
^ self aspectFor:#alwaysUseSmalltalkTools ifAbsent:[ ValueHolder with:true ]. |
15111 | 4491 |
! |
4492 |
||
6602 | 4493 |
changeSetBrowserItemVisible |
4494 |
^ Screen current ctrlDown. |
|
4495 |
! |
|
4496 |
||
11135 | 4497 |
cvsMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4498 |
^ ConfigurableFeatures includesFeature: #CVSSupportEnabled |
11135 | 4499 |
|
4500 |
"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
|
4501 |
"Modified: / 19-01-2012 / 10:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4502 |
! |
4503 |
||
13856 | 4504 |
hgMenusAreShown |
4505 |
^ (ConfigurableFeatures includesFeature: #HGSupportEnabled) |
|
4506 |
||
4507 |
"Created: / 14-01-2013 / 11:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4508 |
! |
|
4509 |
||
11135 | 4510 |
mercurialMenusAreShown |
11147 | 4511 |
^ ConfigurableFeatures hasMercurialSupportEnabled |
11135 | 4512 |
|
4513 |
"Created: / 15-01-2012 / 13:00:00 / cg" |
|
4514 |
! |
|
4515 |
||
4110 | 4516 |
openAlwaysInTextEditor |
18274 | 4517 |
"aspect for open every file in TextEditor don't use e.g. HtmlEditor for *.html'" |
4110 | 4518 |
|
15111 | 4519 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
18274 | 4520 |
|
4521 |
"Modified (comment): / 19-07-2018 / 15:28:00 / Stefan Vogel" |
|
4110 | 4522 |
! |
4523 |
||
3892 | 4524 |
openMultipleApplicationsForType |
4525 |
||
4201 | 4526 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
4527 |
open TextEditor " |
|
4528 |
||
3892 | 4529 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
4530 |
! |
|
4531 |
||
11137 | 4532 |
perforceMenusAreShown |
11996
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4533 |
^ (ConfigurableFeatures includesFeature: #PerforceSupportEnabled) |
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4534 |
and:[ ConfigurableFeatures hasPerforceSupportEnabled ] |
11137 | 4535 |
|
4536 |
"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
|
4537 |
"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
|
4538 |
"Modified: / 02-11-2012 / 11:19:59 / cg" |
11137 | 4539 |
! |
4540 |
||
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
|
4541 |
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
|
4542 |
|
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
|
4543 |
^ 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
|
4544 |
|
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
|
4545 |
"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
|
4546 |
! |
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
|
4547 |
|
4201 | 4548 |
showDirectoryTree |
4549 |
||
4550 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 4551 |
! |
4552 |
||
4554 | 4553 |
showDiskUsageHolder |
4554 |
|holder| |
|
4555 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
4556 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 4557 |
holder addDependent:self. |
4554 | 4558 |
^ holder |
4559 |
! |
|
4560 |
||
3892 | 4561 |
showHiddenFiles |
4562 |
||
9582 | 4563 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
4564 |
||
4565 |
"Modified: / 15-10-2010 / 10:28:17 / cg" |
|
3892 | 4566 |
! |
4567 |
||
9108 | 4568 |
showHiddenFiles:aHolder |
4569 |
self aspectFor:#showHiddenFiles put:aHolder. |
|
4570 |
! |
|
4571 |
||
4572 |
shownFiles:aHolder |
|
4573 |
self aspectFor:#shownFiles put:aHolder. |
|
4574 |
! |
|
4575 |
||
11135 | 4576 |
svnMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4577 |
^ ConfigurableFeatures includesFeature: #SubversionSupportEnabled |
11135 | 4578 |
|
4579 |
"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
|
4580 |
"Modified: / 19-01-2012 / 10:43:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4581 |
! |
4582 |
||
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4583 |
tagsBrowserVisibleHolder |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4584 |
masterApplication notNil ifTrue:[ |
11162
faf8af233ac0
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
11156
diff
changeset
|
4585 |
^ masterApplication perform:#tagsBrowserVisibleHolder ifNotUnderstood:false |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4586 |
]. |
10762
311190be6490
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
10757
diff
changeset
|
4587 |
^ self aspectFor:#tagsBrowserVisibleHolder ifAbsent:[ FileApplicationNoteBook::TextEditor defaultTagsBrowserVisible asValue ]. |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4588 |
|
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4589 |
"Created: / 27-06-2011 / 16:02:59 / cg" |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4590 |
! |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4591 |
|
10757
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4592 |
useCodeView2InTools |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4593 |
^ self aspectFor:#useCodeView2InTools ifAbsent:[ UserPreferences current useCodeView2InTools asValue ]. |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4594 |
|
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4595 |
"Created: / 06-10-2011 / 11:45:58 / cg" |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4596 |
! |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4597 |
|
4648 | 4598 |
userContextAvailable |
4599 |
||
4600 |
" aspect for show group and user columns in contents view |
|
4601 |
windows provides no user context" |
|
4602 |
||
4603 |
^ OperatingSystem isMSWINDOWSlike not |
|
4604 |
! |
|
4605 |
||
3892 | 4606 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4607 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4608 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4609 |
^ self directoryContentsBrowser viewDescription |
3892 | 4610 |
! |
4611 |
||
4612 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4613 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 4614 |
" |
3892 | 4615 |
|
6121 | 4616 |
|directoryContentsBrowser| |
4617 |
||
4618 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
4619 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
4620 |
^ directoryContentsBrowser viewDetails |
|
3892 | 4621 |
! |
4622 |
||
4623 |
viewDirectoryDescription |
|
4624 |
||
4201 | 4625 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
4626 |
on change directory " |
|
4627 |
||
3892 | 4628 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
4629 |
! |
|
4630 |
||
4201 | 4631 |
viewDirsInContentsBrowser |
4632 |
||
4633 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
9319
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4634 |
|
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4635 |
" |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4636 |
UserPreferences current viewDirsInContentsBrowser |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4637 |
" |
4201 | 4638 |
! |
4639 |
||
5870 | 4640 |
viewFilesInContentsBrowser |
4641 |
||
4642 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
4643 |
! |
|
4644 |
||
3892 | 4645 |
viewFilesInDirectoryTree |
4646 |
||
4201 | 4647 |
" aspect for view files in tree view (not only directories) " |
4648 |
||
3892 | 4649 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
4650 |
! |
|
4651 |
||
4652 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4653 |
" aspect for show group information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4654 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4655 |
^ self directoryContentsBrowser viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4656 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4657 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4658 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4659 |
" aspect for show file-type icon in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4660 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4661 |
^ self directoryContentsBrowser viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4662 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4663 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4664 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4665 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4666 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4667 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 4668 |
! |
4669 |
||
4670 |
viewNoteBookApplicationHolder |
|
4671 |
||
4672 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
4673 |
! |
|
4674 |
||
4675 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4676 |
" aspect for show owner information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4677 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4678 |
^ self directoryContentsBrowser viewOwner |
3892 | 4679 |
! |
4680 |
||
4681 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4682 |
" aspect for show permission information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4683 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4684 |
^ self directoryContentsBrowser viewPermissions |
3892 | 4685 |
! |
4686 |
||
4687 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4688 |
" aspect for show image previev in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4689 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4690 |
^ self directoryContentsBrowser viewPreview |
3892 | 4691 |
! |
4692 |
||
4693 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4694 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4695 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4696 |
^ self directoryContentsBrowser viewSize |
3892 | 4697 |
! |
4698 |
||
4974 | 4699 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4700 |
" aspect for show size-in-bytes information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4701 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4702 |
^ self directoryContentsBrowser viewSizeInBytes |
4974 | 4703 |
! |
4704 |
||
5312 | 4705 |
viewSizeInKiloBytes |
4706 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
4707 |
||
4708 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
4709 |
! |
|
4710 |
||
3892 | 4711 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4712 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4713 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4714 |
^ self directoryContentsBrowser viewTime |
3892 | 4715 |
! |
4716 |
||
4717 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4718 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4719 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4720 |
^ self directoryContentsBrowser viewType |
3892 | 4721 |
! ! |
4722 |
||
4723 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
4724 |
||
4725 |
executeCommand:cmd |
|
4726 |
||
4727 |
self executeCommand:cmd inDirectory:nil |
|
4728 |
! |
|
4729 |
||
5880 | 4730 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 4731 |
| nameString executionBlock| |
4732 |
||
5880 | 4733 |
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
|
4734 |
nameString := 'Execute: ', cmd. |
3892 | 4735 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4736 |
! |
|
4737 |
||
4738 |
getExecutionBlockForCommand:cmd |
|
4739 |
||
4740 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
4741 |
! |
|
4742 |
||
5880 | 4743 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
4744 |
| dir| |
|
4745 |
||
4746 |
dir := directoryOrNil. |
|
4747 |
directoryOrNil isNil ifTrue:[ |
|
4748 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6671 | 4749 |
dir isNil ifTrue:[ |
12493 | 4750 |
Dialog warn:(resources string:'Please select a single directory.'). |
16732 | 4751 |
AbortOperationRequest raise. |
6671 | 4752 |
^ nil |
4753 |
]. |
|
3892 | 4754 |
]. |
4523 | 4755 |
|
4756 |
^ [:stream| |
|
4757 |
stream notNil ifTrue:[ |
|
4414 | 4758 |
OperatingSystem |
4759 |
executeCommand:cmd |
|
4760 |
inputFrom:nil |
|
4761 |
outputTo:stream |
|
4762 |
errorTo:stream |
|
4763 |
inDirectory:dir |
|
16732 | 4764 |
lineWise:true |
16825 | 4765 |
showWindow:false |
4414 | 4766 |
onError:[:status| false]. |
4767 |
] |
|
4523 | 4768 |
]. |
3892 | 4769 |
! |
4770 |
||
4771 |
killAllRunningBackgroundProcesses |
|
4772 |
||
4773 |
self backgroundProcesses do:[ : process | |
|
4523 | 4774 |
self notify:'kill ', process name. |
4414 | 4775 |
process terminate. |
3892 | 4776 |
]. |
4777 |
! |
|
4778 |
||
4779 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
4780 |
| stream process appl nameString| |
|
4781 |
||
4782 |
appl := self openCommandResultApplication. |
|
4783 |
stream := appl resultStream. |
|
4784 |
nameString := aString ? 'Execution Result'. |
|
4785 |
appl changeTabTo:nameString. |
|
4523 | 4786 |
|
16102 | 4787 |
process := |
4788 |
[ |
|
4789 |
[aBlock value:stream] |
|
4790 |
ensure:[ |
|
4791 |
self backgroundProcesses remove:process ifAbsent:[]. |
|
4792 |
appl process value:nil. |
|
4793 |
||
4794 |
"/ close automatically, if there was no output. |
|
4571 | 4795 |
"/ appl resultStream contents isEmpty ifTrue:[ |
4796 |
"/ appl doClose. |
|
4797 |
"/ ] |
|
16102 | 4798 |
stream nextPutLine:'Done.'. |
4799 |
self enqueueMessage:#updateCurrentDirectory. |
|
4800 |
] |
|
4801 |
] newProcess. |
|
3892 | 4802 |
process priority:(Processor userBackgroundPriority). |
4803 |
process name:nameString. |
|
4804 |
self backgroundProcesses add:process. |
|
4805 |
appl process value:process. |
|
4806 |
process resume. |
|
4807 |
! ! |
|
4808 |
||
4809 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
4810 |
||
4915 | 4811 |
currentFileNameHolderChanged |
4812 |
"/ self currentFileNameHolderChangedForCommon |
|
4813 |
! |
|
4814 |
||
4577 | 4815 |
currentFileNameHolderChangedForCommon |
18389 | 4816 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty dir| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4817 |
|
7560 | 4818 |
selection := self currentSelectedObjects. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4819 |
self class currentSelection:selection. |
4734 | 4820 |
|
13521 | 4821 |
selectionNotEmpty := selection notEmptyOrNil. |
5476 | 4822 |
self hasSelection value:selectionNotEmpty. |
4823 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
18246 | 4824 |
self canOpenChangeBrowser value:(selectionNotEmpty). |
4734 | 4825 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4826 |
newDirectories := self directoriesForFiles:selection. |
6725 | 4827 |
oldDirectories := self currentSelectedDirectories. |
4011 | 4828 |
oldDirectories ~= newDirectories ifTrue:[ |
4347 | 4829 |
self currentDirectories value:newDirectories. |
4830 |
size := newDirectories size. |
|
4774 | 4831 |
rootInTreeView := self |
4832 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 4833 |
ifPresentDo:[:appl | appl rootHolder]. |
4834 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
4835 |
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
|
4836 |
|
4347 | 4837 |
newDirectories notEmpty ifTrue:[ |
6369 | 4838 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 4839 |
]. |
18389 | 4840 |
(dir := Filename homeDirectory) notNil ifTrue:[ |
4841 |
self enableHome value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4842 |
]. |
|
14308 | 4843 |
"/ self enableGotoDesktop value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
18389 | 4844 |
(dir := Filename defaultDirectory) notNil ifTrue:[ |
4845 |
self enableGotoDefaultDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4846 |
]. |
|
4847 |
(dir := self smalltalkDirectory) notNil ifTrue:[ |
|
4848 |
self enableGotoSmalltalkDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4849 |
]. |
|
4850 |
(dir := Filename desktopDirectory) notNil ifTrue:[ |
|
4851 |
self enableGotoDesktopDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4852 |
]. |
|
4853 |
(dir := Filename downloadsDirectory) notNil ifTrue:[ |
|
4854 |
self enableGotoDownloadsDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4855 |
]. |
|
18511 | 4856 |
(dir := Filename documentsDirectory) notNil ifTrue:[ |
4857 |
self enableGotoDocumentsDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4858 |
]. |
|
18389 | 4859 |
(dir := self tempDirectory) notNil ifTrue:[ |
4860 |
self enableGotoTempDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4861 |
]. |
|
4011 | 4862 |
]. |
9599
6ffff091db22
changed: #currentFileNameHolderChangedForCommon
Claus Gittinger <cg@exept.de>
parents:
9596
diff
changeset
|
4863 |
self enableGotoDefaultDirectory value:(self currentDirectory isNil or:[self currentDirectory pathName ~= OperatingSystem getCurrentDirectory]). |
9596 | 4864 |
self enableMakeCurrentDirectory value:(newDirectories size == 1 |
4865 |
and:[ newDirectories first asFilename pathName ~= OperatingSystem getCurrentDirectory ]). |
|
4022 | 4866 |
self enableForward value:self canForward. |
4734 | 4867 |
self enableBack value:self canBackward. |
6095 | 4868 |
|
13856 | 4869 |
self updateCanMake. |
7560 | 4870 |
|
9677 | 4871 |
"Modified: / 29-12-2010 / 11:01:52 / cg" |
13856 | 4872 |
"Modified: / 17-12-2013 / 08:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18389 | 4873 |
"Modified: / 17-09-2018 / 16:25:36 / Claus Gittinger" |
4011 | 4874 |
! |
4875 |
||
4876 |
filterModelChanged |
|
4877 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4878 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 4879 |
! |
4880 |
||
3892 | 4881 |
update:something with:aParameter from:changedObject |
4882 |
||
4883 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
4884 |
and the things that have to be done if it runs standalone " |
|
4885 |
||
4886 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 4887 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4888 |
^ self |
3892 | 4889 |
]. |
3989 | 4890 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4891 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4892 |
^ self |
3989 | 4893 |
]. |
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4894 |
changedObject == self sortBlockProperty ifTrue:[ |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4895 |
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
|
4896 |
^ self |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4897 |
]. |
4011 | 4898 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4899 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4900 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4901 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4902 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4903 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4904 |
^ self |
4004 | 4905 |
]. |
4781 | 4906 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 4907 |
self notify:nil. |
4781 | 4908 |
^ self |
4909 |
]. |
|
3989 | 4910 |
|
3892 | 4911 |
super update:something with:aParameter from:changedObject |
5543 | 4912 |
! |
4913 |
||
6095 | 4914 |
updateCanMake |
4915 |
|dir can| |
|
4916 |
||
4917 |
can := false. |
|
4918 |
dir := self currentDirectory. |
|
4919 |
dir notNil ifTrue:[ |
|
13856 | 4920 |
"/ Check for make |
6095 | 4921 |
can := (dir asFilename construct:'Makefile') exists. |
13856 | 4922 |
can ifFalse:[ |
4923 |
can := (dir asFilename construct:'makefile') exists. |
|
4924 |
]. |
|
6095 | 4925 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
4926 |
can ifFalse:[ |
|
13856 | 4927 |
can := (self currentDirectory asFilename construct:'bc.mak') exists. |
6095 | 4928 |
] |
4929 |
]. |
|
13856 | 4930 |
can ifTrue:[ |
4931 |
self makeCommandHolder value: 'make'. |
|
4932 |
self canMake value: true. |
|
4933 |
^ self |
|
4934 |
]. |
|
4935 |
||
4936 |
"/Check for Apache ant |
|
4937 |
(OperatingSystem canExecuteCommand: 'ant') ifTrue:[ |
|
4938 |
can := (dir asFilename construct:'build.xml') exists. |
|
4939 |
can ifTrue:[ |
|
4940 |
self makeCommandHolder value: 'ant'. |
|
4941 |
self canMake value: true. |
|
4942 |
^ self |
|
4943 |
]. |
|
4944 |
]. |
|
4945 |
||
4946 |
"/Add more here... |
|
4947 |
||
6095 | 4948 |
]. |
4949 |
self canMake value:can. |
|
13856 | 4950 |
|
4951 |
"Modified: / 17-12-2013 / 08:13:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6095 | 4952 |
! |
4953 |
||
5543 | 4954 |
updateListAfterDelete:colOfFiles |
17871 | 4955 |
self updateCurrentDirectoryWithReread |
3892 | 4956 |
! ! |
4957 |
||
4958 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
4959 |
||
4960 |
canPaste |
|
4961 |
||
15259 | 4962 |
^ self aspectFor:#canPaste ifAbsent:[ ValueHolder with:false ]. |
3892 | 4963 |
! |
4964 |
||
4965 |
clipboard |
|
4966 |
||
4967 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
4968 |
! |
|
4969 |
||
4970 |
copyFilesToClipBoard:colOfFiles |
|
4971 |
self putInClipBoard:colOfFiles as:#copy. |
|
4972 |
! |
|
4973 |
||
4974 |
cutFilesToClipBoard:colOfFiles |
|
4975 |
"defete current selected files/directories |
|
4976 |
" |
|
4977 |
self putInClipBoard:colOfFiles as:#cut. |
|
4978 |
! |
|
4979 |
||
4980 |
emptyClipBoard |
|
4981 |
||
4982 |
self clipboard files:nil. |
|
4983 |
self canPaste value:false. |
|
4984 |
! |
|
4985 |
||
4986 |
putInClipBoard:colOfFiles as:aSymbol |
|
4987 |
| stream clp| |
|
4988 |
||
4989 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
4990 |
clp := self clipboard. |
|
4991 |
clp files:nil. |
|
4992 |
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
|
4993 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
4994 |
stream := String writeStream. |
3892 | 4995 |
stream nextPutAll:aSymbol asString. |
4996 |
stream nextPutAll:' <'. |
|
4997 |
stream nextPutAll:colOfFiles first asString. |
|
4998 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 4999 |
stream nextPutAll:' ...'. |
3892 | 5000 |
]. |
5001 |
stream nextPutAll:'> to clipboard'. |
|
5002 |
||
4523 | 5003 |
self notify:stream contents. |
3892 | 5004 |
clp files:colOfFiles. |
5005 |
self canPaste value:true. |
|
5006 |
! ! |
|
5007 |
||
5008 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
5009 |
||
5010 |
canDropFiles:dropedObjects for:filename |
|
6284 | 5011 |
|filenameDirString filenameDir| |
3892 | 5012 |
|
5013 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 5014 |
|
3892 | 5015 |
filenameDir := self getDirWithoutFileName:filename. |
7491 | 5016 |
filenameDir isNil ifTrue:[^ false ]. |
13232 | 5017 |
filenameDir isWritableDirectory ifFalse:[^ false]. |
6284 | 5018 |
|
3892 | 5019 |
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
|
5020 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
5021 |
dropedObjects do:[:aDropObject | |
6284 | 5022 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
5023 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
5024 |
"/ |
|
5025 |
"/ dropFileName := aDropObject theObject. |
|
5026 |
"/ dropFileNameString := dropFileName asString. |
|
5027 |
"/ dropFileName isDirectory ifTrue:[ |
|
5028 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
5029 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
5030 |
"/ ^ false |
|
5031 |
"/ ] |
|
5032 |
"/ ] ifFalse:[ |
|
5033 |
"/ physicalPathName := dropFileName physicalPathName. |
|
5034 |
"/ (filenameDirString = dropFileName directory asString |
|
5035 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
5036 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
5037 |
"/ self notify:'Cannot drop a file into same directory'. |
|
5038 |
"/ ^ false |
|
5039 |
"/ ] |
|
5040 |
"/ ] |
|
5041 |
]. |
|
5042 |
self notify:nil. |
|
5043 |
^ true |
|
5044 |
! |
|
5045 |
||
5046 |
canDropObject:aDropObject into:aDirectory |
|
5047 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
5048 |
||
5049 |
dropFileName := aDropObject theObject. |
|
5050 |
dropFileNameString := dropFileName asString. |
|
5051 |
dropFileName isDirectory ifTrue:[ |
|
5052 |
filenameDirString := aDirectory asString. |
|
5053 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
5054 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
5055 |
^ false |
|
4414 | 5056 |
] |
6284 | 5057 |
] ifFalse:[ |
5058 |
physicalPathName := dropFileName physicalPathName. |
|
5059 |
(aDirectory = dropFileName directory |
|
5060 |
or:[ aDropObject isFileInArchive not |
|
5061 |
and:[physicalPathName notNil |
|
5062 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
5063 |
self notify:'Cannot drop a file into same directory'. |
|
5064 |
^ false |
|
5065 |
] |
|
5066 |
]. |
|
5067 |
^ true. |
|
3892 | 5068 |
! |
5069 |
||
7406 | 5070 |
canDropObjects:aCollectionOfDropObjects in:aWidget |
17865 | 5071 |
^ aCollectionOfDropObjects contains:#isFileObject |
7406 | 5072 |
|
5073 |
"Created: / 13-10-2006 / 15:52:49 / cg" |
|
5074 |
! |
|
5075 |
||
17202 | 5076 |
doStartDrag:arg1 in:arg2 |
5077 |
^ self class doStartDrag:arg1 in:arg2 |
|
6479 | 5078 |
! |
5079 |
||
7408 | 5080 |
dropObjects:aCollectionOfDropObjects in:aWidget at:position |
7990 | 5081 |
|fileEntryFieldHolder destDir dropObject fn d| |
5082 |
||
5083 |
fileEntryFieldHolder := self masterApplication notNil |
|
5084 |
ifTrue:[ self masterApplication fileEntryFieldHolder ] |
|
5085 |
ifFalse:[ self fileEntryFieldHolder ]. |
|
5086 |
||
5087 |
aWidget model == fileEntryFieldHolder ifTrue:[ |
|
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5088 |
dropObject := aCollectionOfDropObjects first. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5089 |
dropObject isFileObject ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5090 |
fn := dropObject theObject asFilename. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5091 |
dropObject isDirectory ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5092 |
d := fn. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5093 |
] ifFalse:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5094 |
d := fn directory. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5095 |
]. |
7990 | 5096 |
fileEntryFieldHolder value:d pathName. |
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5097 |
]. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5098 |
^ self. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5099 |
]. |
6479 | 5100 |
|
5101 |
destDir := self currentDirectory. |
|
5102 |
destDir isNil ifTrue:[^ self]. |
|
5103 |
||
8601 | 5104 |
self withWaitCursorDo:[ |
5105 |
aCollectionOfDropObjects do:[:dropObject | |
|
5106 |
|fn| |
|
5107 |
||
5108 |
dropObject isFileObject ifTrue:[ |
|
5109 |
fn := dropObject theObject asFilename. |
|
5110 |
dropObject isDirectory ifTrue:[ |
|
8808
cb6476c0cd3a
oops - drop of directories was broken
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
5111 |
fn recursiveCopyTo:destDir |
8601 | 5112 |
] ifFalse:[ |
8950
48c69259d82d
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
8887
diff
changeset
|
5113 |
fn copyTo:(destDir / fn baseName ) |
8601 | 5114 |
] |
6479 | 5115 |
] |
8601 | 5116 |
]. |
5117 |
]. |
|
9268
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5118 |
self directoryContentsBrowser notNil ifTrue:[ |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5119 |
self directoryContentsBrowser |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5120 |
directoryContentsChangeFlag:true; |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5121 |
wakeUp |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5122 |
]. |
7408 | 5123 |
|
5124 |
"Created: / 13-10-2006 / 18:26:41 / cg" |
|
3892 | 5125 |
! ! |
5126 |
||
5127 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
5128 |
||
5129 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 5130 |
"copy to" |
5131 |
||
7635 | 5132 |
^ self copyFile:aSourceFile to:aDestFile repairCorruptedFiles:false |
5133 |
||
5134 |
"Modified: / 07-02-2007 / 18:46:44 / cg" |
|
5135 |
! |
|
5136 |
||
5137 |
copyFile:aSourceFile to:aDestFile repairCorruptedFiles:repairCorruptedFiles |
|
5138 |
"copy to" |
|
5139 |
||
5140 |
|copyOperation msg| |
|
5141 |
||
5142 |
repairCorruptedFiles ifTrue:[ |
|
5143 |
copyOperation := FileOperation copyCorruptedFile:aSourceFile to:aDestFile |
|
5144 |
] ifFalse:[ |
|
5145 |
copyOperation := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
|
5146 |
]. |
|
5147 |
copyOperation result ifTrue:[ |
|
6190 | 5148 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 5149 |
] ifFalse:[ |
7635 | 5150 |
msg := copyOperation errorString. |
6190 | 5151 |
]. |
5152 |
self notify:msg. |
|
7635 | 5153 |
^ copyOperation result |
5154 |
||
5155 |
"Created: / 07-02-2007 / 18:46:34 / cg" |
|
3892 | 5156 |
! |
5157 |
||
5158 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
6374 | 5159 |
|copy result| |
3892 | 5160 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5161 |
self withActivityIndicationDo:[ |
5961 | 5162 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
6374 | 5163 |
copy result ifTrue:[ |
5164 |
result := Dictionary withKeys:(copy collectionOfCopiedFiles) andValues:(copy collectionOfNewFiles). |
|
5165 |
] ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5166 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5167 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5168 |
self updateCurrentDirectory. |
3892 | 5169 |
]. |
6374 | 5170 |
^ result |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5171 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5172 |
"Modified: / 25-07-2006 / 09:07:04 / cg" |
3892 | 5173 |
! |
5174 |
||
15569 | 5175 |
copyFromToRepairingCorruptedFiles |
5176 |
"ask for source and destination and copy the entered file. |
|
5177 |
Especially useful for raw devices to copy corrupted disks/files |
|
5178 |
" |
|
5179 |
||
5180 |
|source destination| |
|
5181 |
||
5182 |
source := Dialog |
|
5183 |
requestDirectoryName:(resources string:'Copy from:') |
|
5184 |
default:(LastMoveDestination ? self currentDirectory) |
|
5185 |
ok:(resources string:'Continue') |
|
5186 |
abort:nil. |
|
5187 |
||
5188 |
source isEmptyOrNil ifTrue:[^ self]. |
|
5189 |
source := source asFilename. |
|
5190 |
||
5191 |
destination := Dialog |
|
5192 |
requestDirectoryName:(resources string:'Copy "%1" to:' with:source) |
|
5193 |
default:(LastMoveDestination ? self currentDirectory) |
|
5194 |
ok:(resources string:'Copy') |
|
5195 |
abort:nil. |
|
5196 |
||
5197 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
5198 |
destination := destination asFilename. |
|
5199 |
||
5200 |
self copyFile:source to:destination repairCorruptedFiles:true. |
|
5201 |
! |
|
5202 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5203 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
12850 | 5204 |
|size msg answer file| |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5205 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5206 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5207 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5208 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5209 |
"/ 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
|
5210 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5211 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5212 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5213 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5214 |
"/ 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
|
5215 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5216 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5217 |
"/ 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
|
5218 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5219 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5220 |
"/ 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
|
5221 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5222 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5223 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5224 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5225 |
stringWithCRs:'Copy or move\\%1:\ %2\to:\ %3 ?' |
17762 | 5226 |
with:(resources string: |
5227 |
(file type == #regular |
|
5228 |
ifTrue:'file' |
|
5229 |
ifFalse:[ |
|
5230 |
file isDirectory |
|
5231 |
ifTrue:'directory' |
|
5232 |
ifFalse:'object'])) |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5233 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5234 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5235 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5236 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5237 |
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
|
5238 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5239 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 5240 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5241 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5242 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5243 |
request:msg |
8127 | 5244 |
label:(resources string:'Copy or Move') |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
5245 |
image:(WarningBox iconBitmap) |
8127 | 5246 |
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
|
5247 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5248 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5249 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5250 |
^ answer. |
17762 | 5251 |
|
5252 |
"Modified: / 17-11-2017 / 13:16:42 / cg" |
|
3892 | 5253 |
! |
5254 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5255 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 5256 |
"copy or move aColOfSourceFiles to aDirectory. |
5257 |
Asks the used if a move or a copy is wanted. |
|
5258 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
5259 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5260 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5261 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5262 |
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
|
5263 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5264 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5265 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5266 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5267 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5268 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5269 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5270 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5271 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5272 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5273 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5274 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 5275 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5276 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5277 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5278 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5279 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5280 |
|
4745 | 5281 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5282 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5283 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5284 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5285 |
^ true. |
3892 | 5286 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5287 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5288 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5289 |
^ true. |
3892 | 5290 |
]. |
4745 | 5291 |
^ false. |
3892 | 5292 |
! |
5293 |
||
6107 | 5294 |
copySelectionTo |
5295 |
"copy the selected file(s) to another directory" |
|
5296 |
||
13704 | 5297 |
self copySelectionToRepairingCorruptedFiles:false. |
5298 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5299 |
|
5300 |
"Modified: / 07-02-2007 / 18:42:48 / cg" |
|
5301 |
! |
|
5302 |
||
5303 |
copySelectionToRepairingCorruptedFiles |
|
5304 |
"copy the selected file(s) to another directory" |
|
5305 |
||
13704 | 5306 |
self copySelectionToRepairingCorruptedFiles:true. |
5307 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5308 |
|
5309 |
"Created: / 07-02-2007 / 18:42:59 / cg" |
|
5310 |
! |
|
5311 |
||
5312 |
copySelectionToRepairingCorruptedFiles:repairingCorruptedFiles |
|
5313 |
"copy the selected file(s) to another directory" |
|
5314 |
||
6299 | 5315 |
|selectedFiles msg destination directory| |
5316 |
||
7560 | 5317 |
selectedFiles := self currentSelectedObjects copy. |
6299 | 5318 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
5319 |
||
5320 |
msg := (selectedFiles size > 1) |
|
14588 | 5321 |
ifTrue:[ 'Copy Selected Items to Directory:' ] |
5322 |
ifFalse:[ 'Copy "%1" to Directory:' ]. |
|
6299 | 5323 |
|
5324 |
destination := Dialog |
|
14588 | 5325 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first baseName) |
7635 | 5326 |
default:(LastMoveDestination ? self currentDirectory) |
5327 |
ok:(resources string:'Copy') |
|
5328 |
abort:nil. |
|
5329 |
||
6299 | 5330 |
destination isEmptyOrNil ifTrue:[^ self]. |
5331 |
destination := destination asFilename. |
|
5332 |
||
5333 |
destination isDirectory ifFalse:[ |
|
5334 |
selectedFiles size == 1 ifTrue:[ |
|
5335 |
directory := destination directory. |
|
5336 |
directory isDirectory ifTrue:[ |
|
5337 |
LastMoveDestination := directory. |
|
7635 | 5338 |
self copyFile:selectedFiles first to:destination repairCorruptedFiles:repairingCorruptedFiles. |
6299 | 5339 |
^ self. |
5340 |
] |
|
5341 |
] |
|
5342 |
]. |
|
5343 |
||
5344 |
LastMoveDestination := destination. |
|
7635 | 5345 |
repairingCorruptedFiles ifTrue:[ |
5346 |
selectedFiles do:[:eachFile | |
|
5347 |
self copyFile:eachFile to:destination repairCorruptedFiles:repairingCorruptedFiles. |
|
5348 |
]. |
|
5349 |
^ self. |
|
5350 |
] ifFalse:[ |
|
5351 |
self copyFiles:selectedFiles to:destination |
|
5352 |
] |
|
5353 |
||
5354 |
"Created: / 07-02-2007 / 18:42:35 / cg" |
|
6107 | 5355 |
! |
5356 |
||
3892 | 5357 |
deleteFile:aFile |
6373 | 5358 |
"delete the selected files/directories" |
3892 | 5359 |
|
5360 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
5361 |
! |
|
5362 |
||
5363 |
deleteFiles:colOfFiles |
|
6373 | 5364 |
"delete some files/directories" |
5365 |
||
5081 | 5366 |
^ self deleteFiles:colOfFiles confirm:true. |
5367 |
! |
|
5368 |
||
5369 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 5370 |
"delete some files/directories" |
5371 |
||
5673 | 5372 |
|delete result| |
3892 | 5373 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5374 |
self withActivityIndicationDo:[ |
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5375 |
ProgressNotification handle:[:info | |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5376 |
self progressPercentageHolder value:info progressValue. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5377 |
info proceed |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5378 |
] do:[ |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5379 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5380 |
result := delete result. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5381 |
]. |
5673 | 5382 |
result notNil ifTrue:[ |
5383 |
result ifFalse:[ |
|
5384 |
self notify:delete errorString. |
|
5753 | 5385 |
] ifTrue:[ |
5386 |
self updateListAfterDelete:colOfFiles. |
|
5387 |
] |
|
4394 | 5388 |
]. |
5673 | 5389 |
]. |
5390 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5391 |
|
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5392 |
"Modified: / 11-10-2010 / 13:08:24 / cg" |
3892 | 5393 |
! |
5394 |
||
6169 | 5395 |
eraseFiles:colOfFiles |
6373 | 5396 |
"erase (clear and delete) some files/directories" |
5397 |
||
6169 | 5398 |
^ self eraseFiles:colOfFiles confirm:true. |
5399 |
! |
|
5400 |
||
5401 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 5402 |
"erase (clear and delete) some files/directories" |
5403 |
||
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5404 |
|deleteOperation result fileSize| |
6169 | 5405 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5406 |
self withActivityIndicationDo:[ |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5407 |
fileSize := colOfFiles first asFilename fileSize. |
8294 | 5408 |
deleteOperation := FileOperation eraseFiles:colOfFiles confirm:confirm. |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5409 |
(colOfFiles size == 1 and:[ fileSize < (10*1024*1024) ]) |
8294 | 5410 |
ifTrue:[ |
5411 |
result := deleteOperation result. |
|
5412 |
] ifFalse:[ |
|
5413 |
ProgressIndicator |
|
5414 |
displayProgressNotifications:'Erasing' |
|
5415 |
abortable:true |
|
5416 |
at:nil |
|
5417 |
during:[ |
|
5418 |
result := deleteOperation result. |
|
5419 |
]. |
|
5420 |
]. |
|
5421 |
||
6169 | 5422 |
result notNil ifTrue:[ |
5423 |
result ifFalse:[ |
|
8294 | 5424 |
self notify:deleteOperation errorString. |
6169 | 5425 |
] ifTrue:[ |
5426 |
self updateListAfterDelete:colOfFiles. |
|
5427 |
] |
|
5428 |
]. |
|
5429 |
]. |
|
5430 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5431 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5432 |
"Modified: / 25-07-2006 / 09:07:16 / cg" |
6169 | 5433 |
! |
5434 |
||
3892 | 5435 |
moveFile:aSourceFile to:aDestFile |
6373 | 5436 |
"move a file/directory" |
3892 | 5437 |
|
5438 |
|move| |
|
5439 |
||
5961 | 5440 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 5441 |
move result ifTrue:[ |
15346 | 5442 |
self notify:(resources string: 'move "%1" to "%2"' with:aSourceFile asString with:aDestFile asString). |
3892 | 5443 |
] ifFalse:[ |
4523 | 5444 |
self notify:move errorString. |
3892 | 5445 |
]. |
17871 | 5446 |
self updateCurrentDirectoryWithReread. |
3892 | 5447 |
^ move result |
5448 |
! |
|
5449 |
||
5450 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 5451 |
"move some files to aDirectory" |
5452 |
||
3892 | 5453 |
|move| |
5454 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5455 |
self withActivityIndicationDo:[ |
5961 | 5456 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5457 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5458 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5459 |
]. |
17871 | 5460 |
self updateCurrentDirectoryWithReread. |
3892 | 5461 |
]. |
6373 | 5462 |
^ move collectionOfMovedFiles |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5463 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5464 |
"Modified: / 25-07-2006 / 09:07:32 / cg" |
3892 | 5465 |
! |
5466 |
||
6107 | 5467 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5468 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5469 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5470 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5471 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5472 |
destinationDirectory := Dialog |
14588 | 5473 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items to Directory:') |
5789 | 5474 |
default:(LastMoveDestination ? self currentDirectory) |
6952 | 5475 |
ok:(resources string:'Move') |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5476 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5477 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5478 |
|
5789 | 5479 |
LastMoveDestination := destinationDirectory. |
13704 | 5480 |
self moveFiles:(self currentSelectedObjects copy) to:destinationDirectory asFilename. |
5481 |
self updateCurrentDirectoryWithReread. |
|
5482 |
||
7560 | 5483 |
|
5484 |
"Modified: / 04-12-2006 / 13:15:12 / cg" |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5485 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5486 |
|
3892 | 5487 |
newDirectory |
5488 |
"ask for and create a new directory" |
|
5489 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5490 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5491 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5492 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5493 |
directory isNil ifTrue:[ |
18175 | 5494 |
self warn:'Select a single directory to create a directory' translate:true. |
4979
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5495 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5496 |
]. |
4521 | 5497 |
|
5498 |
"/ 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
|
5499 |
selectedFiles := self currentSelectedFiles. |
4521 | 5500 |
selectedFiles size == 1 ifTrue:[ |
5501 |
singleSelectedFile := selectedFiles first. |
|
5502 |
||
5503 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
13714 | 5504 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5505 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
5506 |
||
5507 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
13714 | 5508 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5509 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
5510 |
]. |
|
5511 |
]. |
|
5512 |
]. |
|
5513 |
||
5961 | 5514 |
|
4521 | 5515 |
defaultAnswer notNil ifTrue:[ |
5961 | 5516 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 5517 |
] ifFalse:[ |
5961 | 5518 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 5519 |
]. |
5520 |
createOp result ifFalse:[ ^ self]. |
|
5521 |
newFile := createOp createdFile. |
|
3892 | 5522 |
newFile notNil ifTrue:[ |
17871 | 5523 |
self updateCurrentDirectoryWithReread. |
3892 | 5524 |
] |
17818 | 5525 |
|
5526 |
"Modified: / 29-11-2017 / 12:26:41 / cg" |
|
18175 | 5527 |
"Modified: / 01-06-2018 / 12:49:43 / Claus Gittinger" |
3892 | 5528 |
! |
5529 |
||
5530 |
newFile |
|
5531 |
"ask for and create a new file" |
|
5532 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5533 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5534 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5535 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5536 |
directory isNil ifTrue:[ |
18175 | 5537 |
self warn:'Select a single directory to create a file.' translate:true. |
4979
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5538 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5539 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5540 |
|
3982 | 5541 |
curFile := self firstSelectedFile. |
3892 | 5542 |
curFile notNil ifTrue:[ |
4414 | 5543 |
file := curFile. |
3892 | 5544 |
] ifFalse:[ |
4414 | 5545 |
file := directory. |
3892 | 5546 |
]. |
5961 | 5547 |
create := FileOperation createFileIn:file. |
3892 | 5548 |
create result ifFalse:[ ^ self]. |
5549 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
17818 | 5550 |
|
5551 |
"Modified: / 29-11-2017 / 12:26:51 / cg" |
|
18175 | 5552 |
"Modified: / 01-06-2018 / 12:49:50 / Claus Gittinger" |
3892 | 5553 |
! |
5554 |
||
5555 |
newHardLink |
|
5556 |
"ask for and create a hard link (unix only)" |
|
5557 |
||
6151 | 5558 |
self newLink:#hard. |
5559 |
! |
|
5560 |
||
5561 |
newLink:typeOfLink |
|
3892 | 5562 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
5563 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5564 |
| sel dir create createdFile| |
3892 | 5565 |
|
7560 | 5566 |
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
|
5567 |
(sel size ~= 1) ifTrue:[ |
18175 | 5568 |
self warn:'Select one directory to link' translate:true. |
4979
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5569 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5570 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5571 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5572 |
|
6151 | 5573 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 5574 |
create result ifFalse:[ ^ self]. |
5575 |
createdFile := create createdFile. |
|
5576 |
createdFile notNil ifTrue:[ |
|
6151 | 5577 |
typeOfLink == #soft ifTrue:[ |
17871 | 5578 |
self updateCurrentDirectoryWithReread. |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5579 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5580 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5581 |
] |
3892 | 5582 |
]. |
7560 | 5583 |
|
17818 | 5584 |
"Modified: / 29-11-2017 / 12:26:58 / cg" |
18175 | 5585 |
"Modified: / 01-06-2018 / 12:49:32 / Claus Gittinger" |
3892 | 5586 |
! |
5587 |
||
5588 |
newSoftLink |
|
5589 |
"ask for and create a soft link (unix only)" |
|
5590 |
||
6151 | 5591 |
self newLink:#soft. |
3892 | 5592 |
! |
5593 |
||
5594 |
pasteFiles |
|
6373 | 5595 |
"paste from clipBoard" |
5596 |
||
5597 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 5598 |
|
5599 |
files := self clipboard files. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
5600 |
files isEmptyOrNil ifTrue:[ ^ self ]. |
6373 | 5601 |
|
5602 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
5603 |
||
3892 | 5604 |
buffer := self clipboard copy. |
3982 | 5605 |
directories := self currentSelectedDirectories. |
5880 | 5606 |
directories size ~~ 1 ifTrue:[ |
4414 | 5607 |
|box dirStringCol| |
5880 | 5608 |
|
4414 | 5609 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
5610 |
box := ListSelectionBox new. |
|
6373 | 5611 |
box title:'Paste into which directory ?'. |
4414 | 5612 |
box list:dirStringCol. |
5613 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5614 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5615 |
box destroy. |
3892 | 5616 |
] ifFalse:[ |
5880 | 5617 |
destination := directories anElement. |
3892 | 5618 |
]. |
6373 | 5619 |
|
5620 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 5621 |
buffer files copy do:[:aFile| |
5622 |
aFile directory = destination ifTrue:[ |
|
5623 |
buffer files remove:aFile. |
|
5624 |
]. |
|
5625 |
]. |
|
5626 |
]. |
|
5627 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6374 | 5628 |
copiedFiles notEmptyOrNil ifTrue:[ |
5629 |
thisIsAFileMoveOperation ifTrue:[ |
|
5630 |
self deleteFiles:(copiedFiles keys) confirm:false. |
|
5631 |
]. |
|
5632 |
||
5633 |
"/ select those pasted files. |
|
5634 |
self updateCurrentDirectory:true. |
|
5635 |
self currentFileNameHolder value:copiedFiles values. |
|
5636 |
] |
|
3892 | 5637 |
! |
5638 |
||
5639 |
renameFile:aFile |
|
5640 |
"rename the selected file(s)" |
|
5641 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5642 |
^ self renameFiles:(Array with:aFile). |
3892 | 5643 |
! |
5644 |
||
4230 | 5645 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 5646 |
"rename filename to newFileString" |
5647 |
||
5648 |
|rename| |
|
5649 |
||
5961 | 5650 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 5651 |
rename result ifTrue:[ |
4230 | 5652 |
aBoolean ifTrue:[ |
5653 |
self updateAndSelect:(rename renamedFiles). |
|
5654 |
]. |
|
3892 | 5655 |
] ifFalse:[ |
4523 | 5656 |
self notify:rename errorString. |
3892 | 5657 |
]. |
5658 |
^ rename result |
|
5659 |
! |
|
5660 |
||
5661 |
renameFiles:aColOfFiles |
|
6373 | 5662 |
"rename some file(s)" |
3892 | 5663 |
|
5664 |
|rename| |
|
5665 |
||
5961 | 5666 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 5667 |
rename result ifFalse:[ |
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5668 |
self notify:rename errorString. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5669 |
^ nil. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5670 |
]. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5671 |
^ rename |
3892 | 5672 |
! |
5673 |
||
5674 |
renameSelection |
|
5675 |
"rename the selected file(s)" |
|
5676 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5677 |
|renamed| |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5678 |
|
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5679 |
renamed := self renameFiles:(self currentSelectedObjects copy). |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5680 |
renamed notNil ifTrue:[ |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5681 |
self updateAndSelect:renamed renamedFiles. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5682 |
]. |
7560 | 5683 |
|
5684 |
"Modified: / 04-12-2006 / 13:15:24 / cg" |
|
3892 | 5685 |
! ! |
5686 |
||
4080 | 5687 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 5688 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5689 |
bookmarksMenu |
3952 | 5690 |
<resource: #programMenu> |
5691 |
||
14941 | 5692 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec. |
5693 |
! |
|
5694 |
||
5695 |
bookmarksMenuForBaseSpec:aBaseMenuSpec |
|
5696 |
<resource: #programMenu> |
|
5697 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5698 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5699 |
|
14941 | 5700 |
menu := aBaseMenuSpec decodeAsLiteralArray. |
7763 | 5701 |
|
5702 |
"/ add the bookmark items ... |
|
5703 |
bookmarks := self class directoryBookmarks. |
|
5704 |
bookmarks notEmptyOrNil ifTrue:[ |
|
14604 | 5705 |
menu addSeparator. |
7763 | 5706 |
bookmarks do:[:dirName | |
12963 | 5707 |
menu addItem:(MenuItem |
5708 |
label:dirName asString |
|
5709 |
itemValue:[ |
|
5710 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
|
5711 |
self setCurrentFileName:dirName. |
|
5712 |
]. |
|
5713 |
]). |
|
7763 | 5714 |
]. |
5715 |
]. |
|
4080 | 5716 |
menu findGuiResourcesIn:self. |
7763 | 5717 |
^ menu |
5718 |
||
11135 | 5719 |
"Modified: / 14-01-2012 / 21:14:03 / cg" |
7763 | 5720 |
! |
5721 |
||
5722 |
canBackward |
|
5723 |
^ self directoryHistory canBackward. |
|
5724 |
||
5725 |
"Modified: / 27-03-2007 / 10:54:55 / cg" |
|
5726 |
! |
|
5727 |
||
5728 |
canForward |
|
5729 |
^ self directoryHistory canForward. |
|
5730 |
||
5731 |
"Modified: / 27-03-2007 / 10:54:57 / cg" |
|
5732 |
! |
|
5733 |
||
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5734 |
gotoBookmarksMenu |
7763 | 5735 |
<resource: #programMenu> |
5736 |
||
14941 | 5737 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec2. |
6099 | 5738 |
! |
5739 |
||
3892 | 5740 |
menuDirHistory:backOrForward |
7763 | 5741 |
"initialize the history menu" |
5742 |
||
3892 | 5743 |
<resource: #programMenu > |
5744 |
||
7763 | 5745 |
|hist menu pathList currentSel currentPath| |
5746 |
||
5747 |
hist := self directoryHistory. |
|
5748 |
hist isEmpty ifTrue:[^ nil]. |
|
5749 |
||
3892 | 5750 |
backOrForward == #back ifTrue:[ |
6725 | 5751 |
currentSel := self currentSelectedDirectories. |
4347 | 5752 |
currentSel size == 1 ifTrue:[ |
5753 |
currentPath := currentSel first asString. |
|
5754 |
] ifFalse:[ |
|
5755 |
currentPath := nil. |
|
5756 |
]. |
|
7763 | 5757 |
pathList := hist getBackCollection. |
3892 | 5758 |
] ifFalse:[ |
7763 | 5759 |
pathList := hist getForwardCollection. |
3892 | 5760 |
]. |
4022 | 5761 |
pathList isEmpty ifTrue:[ ^ nil]. |
7763 | 5762 |
|
6370 | 5763 |
pathList size > 30 ifTrue:[ |
5764 |
pathList := pathList copyTo:30 |
|
5765 |
]. |
|
7763 | 5766 |
|
5767 |
menu := Menu new. |
|
5768 |
||
3964 | 5769 |
pathList do:[:aPath| |
14593 | 5770 |
menu addItem:(MenuItem |
5771 |
label:aPath |
|
5772 |
itemValue:[ self setCurrentFileName:(aPath asFilename) ] |
|
5773 |
translateLabel:false). |
|
3952 | 5774 |
]. |
7763 | 5775 |
menu findGuiResourcesIn:self. |
3892 | 5776 |
^ menu |
7763 | 5777 |
|
11783 | 5778 |
"Modified: / 09-09-2012 / 13:07:22 / cg" |
3892 | 5779 |
! |
5780 |
||
5781 |
menuDirHistoryBack |
|
5782 |
"initialize the directory menu |
|
5783 |
" |
|
5784 |
<resource: #programMenu > |
|
5785 |
||
5786 |
^ self menuDirHistory:#back. |
|
5787 |
! |
|
5788 |
||
5789 |
menuDirHistoryForward |
|
5790 |
"initialize the directory menu |
|
5791 |
" |
|
5792 |
<resource: #programMenu > |
|
5793 |
||
5794 |
^ self menuDirHistory:#forward. |
|
3906 | 5795 |
! |
5796 |
||
5797 |
menuFileHistory |
|
5798 |
"initialize the file history menu |
|
5799 |
" |
|
5800 |
<resource: #programMenu > |
|
5801 |
||
7763 | 5802 |
|menu hist text removeItem| |
3906 | 5803 |
|
5804 |
hist := self fileHistory. |
|
5805 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5806 |
|
7763 | 5807 |
menu := Menu new. |
5808 |
||
5809 |
hist copy do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5810 |
aFileItem fileName exists ifTrue:[ |
12963 | 5811 |
menu addItem:(MenuItem |
5812 |
label: aFileItem fileName asString |
|
14593 | 5813 |
itemValue: |
5814 |
[ |
|
5815 |
self setCurrentFileName:(aFileItem fileName). |
|
5816 |
self openApplByFileItem:aFileItem |
|
5817 |
] |
|
5818 |
translateLabel:false). |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5819 |
] ifFalse:[ |
7763 | 5820 |
"/ remove all not existing history entries |
5821 |
hist remove:aFileItem. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5822 |
] |
3906 | 5823 |
]. |
7763 | 5824 |
menu addSeparator. |
5825 |
||
4080 | 5826 |
removeItem := MenuItem new. |
5827 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5828 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5829 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 5830 |
removeItem label:text. |
11783 | 5831 |
removeItem |
5832 |
itemValue:[ |
|
5833 |
self fileHistory removeAll. |
|
5834 |
self enableFileHistory value:false. |
|
5835 |
]. |
|
3906 | 5836 |
menu addItem:removeItem. |
7763 | 5837 |
menu findGuiResourcesIn:self. |
3906 | 5838 |
^ menu |
7763 | 5839 |
|
11783 | 5840 |
"Modified (format): / 09-09-2012 / 13:07:36 / cg" |
3952 | 5841 |
! |
5842 |
||
4080 | 5843 |
sortMenu |
5844 |
<resource: #programMenu > |
|
5845 |
||
5846 |
|menu| |
|
5847 |
||
7763 | 5848 |
menu := Menu decodeFromLiteralArray:self class sortMenu. |
4080 | 5849 |
menu findGuiResourcesIn:self. |
5850 |
^ menu |
|
7763 | 5851 |
|
5852 |
"Modified: / 27-03-2007 / 10:47:42 / cg" |
|
4080 | 5853 |
! |
5854 |
||
5855 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5856 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5857 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5858 |
specHere := self class viewDetailsMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5859 |
itemsHere := specHere at:2. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5860 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5861 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5862 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5863 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5864 |
spec := specHere copy. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5865 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5866 |
^ spec |
4080 | 5867 |
! |
5868 |
||
5869 |
viewInContentsBrowserMenu |
|
5009 | 5870 |
self |
5871 |
applicationNamed:#DirectoryContentsBrowser |
|
5872 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
5873 |
||
5874 |
^ nil. |
|
4080 | 5875 |
! |
5876 |
||
3952 | 5877 |
visitedDirectoriesMenu |
5878 |
<resource: #programMenu > |
|
5879 |
||
5880 |
|menu histCopy text removeItem| |
|
5881 |
||
7763 | 5882 |
histCopy := self directoryHistory. |
5883 |
histCopy isEmpty ifTrue:[^ nil]. |
|
5884 |
||
3952 | 5885 |
menu := Menu new. |
7763 | 5886 |
|
5887 |
histCopy do:[:aFile| |
|
12963 | 5888 |
menu addItem:(MenuItem |
5889 |
label:aFile asString |
|
5890 |
itemValue:[ |
|
5891 |
self setCurrentFileName:(aFile path asFilename). |
|
5892 |
]). |
|
7763 | 5893 |
]. |
5894 |
menu addSeparator. |
|
5895 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5896 |
"/ 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
|
5897 |
text := (resources string:'Clear History'). |
3952 | 5898 |
removeItem := MenuItem new. |
4040 | 5899 |
removeItem translateLabel:true. |
3952 | 5900 |
removeItem label:text. |
11783 | 5901 |
removeItem |
5902 |
itemValue:[ |
|
5903 |
self directoryHistory removeAll. |
|
5904 |
self enableForward value:self canForward. |
|
5905 |
self enableBack value:self canBackward. |
|
5906 |
]. |
|
7763 | 5907 |
|
3952 | 5908 |
menu addItem:removeItem. |
7763 | 5909 |
menu findGuiResourcesIn:self. |
3952 | 5910 |
^ menu |
7763 | 5911 |
|
11783 | 5912 |
"Modified: / 09-09-2012 / 13:07:45 / cg" |
3892 | 5913 |
! ! |
5914 |
||
5880 | 5915 |
!AbstractFileBrowser methodsFor:'menu actions'! |
5916 |
||
5917 |
doCompareTwoFiles |
|
5918 |
self openDiffView. |
|
5919 |
! |
|
5920 |
||
5921 |
doGoDirectoryUp |
|
18511 | 5922 |
"navigate up to the parent folder" |
5923 |
||
5960 | 5924 |
| upDir directory rootInTreeView| |
5880 | 5925 |
|
5926 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
5927 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 5928 |
directory := self currentDirectory. |
5929 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 5930 |
] ifFalse:[ |
5931 |
rootInTreeView := self |
|
5932 |
applicationNamed:#DirectoryTreeBrowser |
|
5933 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 5934 |
directory := rootInTreeView value asFilename. |
5935 |
]. |
|
5936 |
upDir := directory directory. |
|
5959 | 5937 |
self setCurrentFileName:upDir. |
5880 | 5938 |
! |
5939 |
||
5940 |
doGotoDefaultDirectory |
|
18511 | 5941 |
"navigate to the default folder (is the current directory)" |
5942 |
||
5880 | 5943 |
self gotoFile:(Filename defaultDirectory). |
5944 |
! |
|
5945 |
||
8091 | 5946 |
doGotoDesktopDirectory |
18511 | 5947 |
"navigate to the desktop folder" |
5948 |
||
8091 | 5949 |
self gotoFile:(Filename desktopDirectory). |
5950 |
! |
|
5951 |
||
18036 | 5952 |
doGotoDocumentsDirectory |
18511 | 5953 |
"navigate to the documents folder" |
5954 |
||
18036 | 5955 |
self gotoFile:(Filename documentsDirectory). |
5956 |
! |
|
5957 |
||
5958 |
doGotoDownloadsDirectory |
|
18511 | 5959 |
"navigate to the downloads folder" |
5960 |
||
18036 | 5961 |
self gotoFile:(Filename downloadsDirectory). |
5962 |
! |
|
5963 |
||
5880 | 5964 |
doGotoHomeDirectory |
18511 | 5965 |
"navigate to the home folder" |
5966 |
||
8091 | 5967 |
self gotoFile:(Filename homeDirectory). |
5880 | 5968 |
! |
5969 |
||
6434 | 5970 |
doGotoSmalltalkDirectory |
18511 | 5971 |
"navigate to the smalltalk bin folder (where the stx executable is)" |
5972 |
||
6434 | 5973 |
self gotoFile:(self smalltalkDirectory). |
5974 |
! |
|
5975 |
||
17187 | 5976 |
doGotoSmalltalkWorkspaceDirectory |
18511 | 5977 |
"navigate to the user's smalltalk workspace folder" |
5978 |
||
17187 | 5979 |
self gotoFile:(UserPreferences current workspaceDirectory). |
5980 |
! |
|
5981 |
||
9677 | 5982 |
doGotoTempDirectory |
5983 |
self gotoFile:(self tempDirectory). |
|
5984 |
||
5985 |
"Created: / 29-12-2010 / 11:03:17 / cg" |
|
5986 |
! |
|
5987 |
||
9596 | 5988 |
doMakeCurrentDirectory |
17582 | 5989 |
<resource: #obsolete> |
5990 |
||
5991 |
"/ no longer |
|
5992 |
^ self |
|
5993 |
"/ OperatingSystem setCurrentDirectory:(self currentDirectory pathName). |
|
5994 |
"/ self currentFileNameHolderChangedForCommon. |
|
9596 | 5995 |
|
5996 |
"Created: / 26-10-2010 / 17:21:19 / cg" |
|
17582 | 5997 |
"Modified (format): / 17-07-2017 / 10:09:39 / cg" |
9596 | 5998 |
! |
5999 |
||
5880 | 6000 |
fileGetInfo:longInfo |
6001 |
"get info on selected file - show it in a box" |
|
6002 |
||
6003 |
|string box updater| |
|
6004 |
||
6005 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
6006 |
string notNil ifTrue:[ |
|
6007 |
box := InfoBox title:string. |
|
6008 |
updater := [ |
|
6009 |
[true] whileTrue:[ |
|
6010 |
Delay waitForSeconds:2. |
|
6011 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
6012 |
string isNil ifTrue:[ ^ self]. |
|
6013 |
box title:string |
|
6014 |
] |
|
6015 |
] fork. |
|
6016 |
box show. |
|
6017 |
updater terminate. |
|
6018 |
box destroy |
|
6019 |
] |
|
6434 | 6020 |
! |
6021 |
||
17686 | 6022 |
showDeltaBetweenTwoImageFiles |
6023 |
|i1 i2 delta| |
|
6024 |
||
6025 |
i1 := Image fromFile:(self selectedFileNames first). |
|
6026 |
i2 := Image fromFile:(self selectedFileNames second). |
|
6027 |
delta := ImageAlgorithms new differenceImageBetween:i1 and:i2. |
|
6028 |
ImageView openOn:delta. |
|
6029 |
||
6030 |
"Created: / 10-09-2017 / 16:59:08 / cg" |
|
6031 |
! |
|
6032 |
||
6434 | 6033 |
smalltalkDirectory |
8590 | 6034 |
|stxPath| |
6434 | 6035 |
|
6036 |
stxPath := OperatingSystem pathOfSTXExecutable. |
|
8590 | 6037 |
stxPath isNil ifTrue:[ |
6038 |
^ Filename currentDirectory |
|
6039 |
]. |
|
6040 |
^ stxPath asFilename directory. |
|
9677 | 6041 |
! |
6042 |
||
6043 |
tempDirectory |
|
6044 |
^ Filename tempDirectory. |
|
6045 |
||
6046 |
"Created: / 29-12-2010 / 11:03:00 / cg" |
|
5880 | 6047 |
! ! |
6048 |
||
11139 | 6049 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
6050 |
||
14262 | 6051 |
addDirToJavaSourcePath |
6052 |
"add the current path to java's sourcePath |
|
6053 |
(only available with ST/J System" |
|
6054 |
||
6055 |
Java addToSourcePath:self currentDirectory pathName |
|
6056 |
||
6057 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
6058 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
6059 |
! |
|
6060 |
||
11139 | 6061 |
copyFiles |
6062 |
self |
|
6063 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
6064 |
! |
|
6065 |
||
6066 |
cutFiles |
|
6067 |
self |
|
6068 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
6069 |
! |
|
6070 |
||
6071 |
deleteFiles |
|
6072 |
self |
|
6073 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
6074 |
! |
|
6075 |
||
6076 |
eraseFiles |
|
6077 |
self |
|
6078 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
6079 |
! |
|
6080 |
||
14262 | 6081 |
fileAddToJavaSourcePath |
6082 |
"add the current path to java's sourcePath |
|
6083 |
(only available with ST/J System" |
|
6084 |
||
17865 | 6085 |
Java notNil ifTrue:[ |
6086 |
self currentSelectedObjects do:[:each | |
|
6087 |
Java addToSourcePath:(each pathName) |
|
6088 |
]. |
|
14262 | 6089 |
]. |
6090 |
||
6091 |
"Created: / 9.11.1998 / 05:41:34 / cg" |
|
6092 |
"Modified: / 9.11.1998 / 05:56:00 / cg" |
|
6093 |
! |
|
6094 |
||
11139 | 6095 |
openSettingsDialog |
6096 |
|dialog| |
|
6097 |
||
6098 |
dialog := FileBrowserV2SettingsDialog new. |
|
6099 |
dialog settingsDialog:self. |
|
6100 |
dialog allButOpen. |
|
6101 |
dialog doReload. |
|
6102 |
dialog openWindow |
|
6103 |
! |
|
6104 |
||
6105 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
6106 |
|files dirs| |
|
6107 |
||
6108 |
files := self currentSelectedFiles. |
|
6109 |
files notEmpty ifTrue:[ |
|
6110 |
aBlock value:files. |
|
6111 |
] ifFalse:[ |
|
6112 |
dirs := self currentSelectedDirectories. |
|
6113 |
dirs notEmpty ifTrue:[ |
|
6114 |
aBlock value:dirs. |
|
6115 |
]. |
|
6116 |
]. |
|
6117 |
! ! |
|
6118 |
||
6119 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
|
6120 |
||
6121 |
openAboutThisApplication |
|
6122 |
"opens an about box for this application." |
|
6123 |
||
6124 |
Dialog aboutClass:self class. |
|
6125 |
! |
|
6126 |
||
6127 |
openHTMLDocument:relativeDocPath |
|
6128 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
6129 |
! ! |
|
6130 |
||
6131 |
!AbstractFileBrowser methodsFor:'menu actions-scm-cvs'! |
|
3892 | 6132 |
|
15905 | 6133 |
canCvsAddAndCommit |
6134 |
||
6135 |
|selectedFiles| |
|
6136 |
||
6137 |
selectedFiles := self currentSelectedObjects. |
|
6138 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
6139 |
! |
|
6140 |
||
6141 |
canRemoveCVSContainer |
|
6142 |
^ self currentSelectedFiles |
|
6143 |
contains:[:fileName| |
|
6144 |
|dirOfFile cvsDir| |
|
6145 |
||
6146 |
dirOfFile := self getDirWithoutFileName:fileName. |
|
6147 |
cvsDir := dirOfFile construct:'CVS'. |
|
6148 |
cvsDir isDirectory |
|
6149 |
]. |
|
6150 |
! |
|
6151 |
||
12777 | 6152 |
commitFilesToCVS:files |
6153 |
|numFiles| |
|
6154 |
||
6155 |
(numFiles := files size) > 0 ifTrue:[ |
|
6156 |
self withActivityIndicationDo:[ |
|
6157 |
self cvsCommitFiles:files |
|
6158 |
] |
|
6159 |
] |
|
6160 |
! |
|
6161 |
||
3892 | 6162 |
cvsAddAndCommit |
4849 | 6163 |
self cvsAddAndCommitAsBinary:false |
6164 |
! |
|
6165 |
||
6166 |
cvsAddAndCommitAsBinary:asBinary |
|
8588 | 6167 |
|sel log logArg binArg cmd dir executionBlock nameString| |
3892 | 6168 |
|
6169 |
log := Dialog |
|
11139 | 6170 |
requestText:(resources string:'Enter initial log message:') |
4414 | 6171 |
lines:10 |
6172 |
columns:70 |
|
6173 |
initialAnswer:nil. |
|
8322
cf10f08b6164
care for cancel in #cvsAddAndCommitAsBinary:
Claus Gittinger <cg@exept.de>
parents:
8294
diff
changeset
|
6174 |
log isNil ifTrue:[^ self]. |
3892 | 6175 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6176 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6177 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6178 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6179 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6180 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6181 |
|
8588 | 6182 |
binArg := ''. |
6183 |
asBinary ifTrue:[ |
|
6184 |
binArg := '-kb '. |
|
6185 |
]. |
|
3982 | 6186 |
sel := self currentSelectedFiles. |
11139 | 6187 |
executionBlock := |
6188 |
[:stream | |
|
6189 |
log notNil ifTrue:[ |
|
17416 | 6190 |
sel notEmptyOrNil ifTrue:[ |
11139 | 6191 |
sel do:[:fn | |
6192 |
|nameArg| |
|
6193 |
||
6194 |
nameArg := '"',fn baseName,'"'. |
|
6195 |
||
6196 |
dir := self getDirWithoutFileName:fn. |
|
6197 |
cmd := 'cvs add ',logArg,' ',binArg,nameArg. |
|
6198 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6199 |
||
6200 |
cmd := ('cvs commit -l ',logArg,' ',nameArg). |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6201 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
11139 | 6202 |
"/ mhmh - it seems that only old CVS implementations (at least turqoise) |
6203 |
"/ support and need the 'admin -kb' command. |
|
6204 |
"/ newer ones use the '-kb' option in the 'cvs add' command |
|
6205 |
asBinary ifTrue:[ |
|
6206 |
cmd := ('cvs admin -kb ' , nameArg). |
|
6207 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6208 |
||
6209 |
cmd := ('cvs upd ' , nameArg). |
|
6210 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6211 |
]. |
|
6212 |
] |
|
6213 |
] |
|
6214 |
] |
|
6215 |
]. |
|
4107 | 6216 |
nameString := 'Command> cvs add and commit'. |
3892 | 6217 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
11139 | 6218 |
|
17416 | 6219 |
"Modified: / 17-02-2017 / 08:25:16 / cg" |
3892 | 6220 |
! |
6221 |
||
4849 | 6222 |
cvsAddBinaryAndCommit |
6223 |
self cvsAddAndCommitAsBinary:true |
|
6224 |
! |
|
6225 |
||
3892 | 6226 |
cvsCommit |
12777 | 6227 |
|selectedFiles| |
3892 | 6228 |
|
3982 | 6229 |
selectedFiles:= self currentSelectedFiles. |
12777 | 6230 |
self cvsCommitFiles:selectedFiles |
6231 |
! |
|
6232 |
||
6233 |
cvsCommitFiles:files |
|
6234 |
|nFiles log logTmp s logArg msg executionBlock nameString | |
|
6235 |
||
6236 |
nFiles := files size. |
|
6237 |
nFiles == 0 ifTrue:[^ self]. |
|
6238 |
||
6239 |
nFiles == 1 ifTrue:[ |
|
6240 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(files first baseName) |
|
3892 | 6241 |
] ifFalse:[ |
12777 | 6242 |
nFiles > 1 ifTrue:[ |
6243 |
msg := resources string:'Enter log message for %1 files to checkIn' with:nFiles printString |
|
4414 | 6244 |
] ifFalse:[ |
6627 | 6245 |
msg := resources string:'Enter log message for checkIn' |
4414 | 6246 |
] |
3892 | 6247 |
]. |
6248 |
||
6249 |
log := Dialog |
|
4414 | 6250 |
requestText:msg |
6251 |
lines:10 |
|
6252 |
columns:70 |
|
6253 |
initialAnswer:nil. |
|
3892 | 6254 |
|
4663 | 6255 |
log isNil ifTrue:[^ self]. |
12777 | 6256 |
log := log replChar:$" withString:'\"'. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6257 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6258 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
12777 | 6259 |
"/ save the log message into another tempFile ... |
13121 | 6260 |
s := FileStream newTemporary. |
6261 |
logTmp := s fileName. |
|
12777 | 6262 |
s nextPutAll:log. |
6263 |
s close. |
|
6264 |
||
6265 |
logArg := '-F "', logTmp pathName, '"'. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6266 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6267 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6268 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6269 |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6270 |
executionBlock := [:stream | |
12777 | 6271 |
[ |
6272 |
files do:[:fn | |
|
6273 |
| dir nameArg cmd | |
|
6274 |
||
6275 |
nameArg := '"',fn baseName,'"'. |
|
6276 |
dir := fn directory. |
|
6277 |
cmd := 'cvs commit ',logArg,' ' , nameArg. |
|
6278 |
stream showCR:fn pathName. |
|
6279 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
4663 | 6280 |
] |
12777 | 6281 |
] ensure:[ |
6282 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6283 |
]. |
|
4107 | 6284 |
]. |
6285 |
nameString := 'Command> cvs commit'. |
|
6286 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 6287 |
! |
6288 |
||
14527 | 6289 |
cvsCommitFolder |
6290 |
|dir log logTmp s logArg msg executionBlock nameString | |
|
6291 |
||
6292 |
(dir := self currentDirectory) isNil ifTrue:[ ^ self ]. |
|
6293 |
||
6294 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(dir baseName). |
|
6295 |
log := Dialog |
|
6296 |
requestText:msg |
|
6297 |
lines:10 |
|
6298 |
columns:70 |
|
6299 |
initialAnswer:nil. |
|
6300 |
||
6301 |
log isNil ifTrue:[^ self]. |
|
6302 |
log := log replChar:$" withString:'\"'. |
|
6303 |
||
6304 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6305 |
"/ save the log message into another tempFile ... |
|
6306 |
s := FileStream newTemporary. |
|
6307 |
logTmp := s fileName. |
|
6308 |
s nextPutAll:log. |
|
6309 |
s close. |
|
6310 |
||
6311 |
logArg := '-F "', logTmp pathName, '"'. |
|
6312 |
] ifFalse:[ |
|
6313 |
logArg := '-m ''' , log , ''''. |
|
6314 |
]. |
|
6315 |
||
6316 |
executionBlock := [:stream | |
|
6317 |
[ |
|
6318 |
|cmd| |
|
6319 |
||
6320 |
cmd := 'cvs commit ',logArg. |
|
6321 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6322 |
] ensure:[ |
|
6323 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6324 |
]. |
|
6325 |
]. |
|
6326 |
||
6327 |
nameString := 'Command> cvs commit'. |
|
6328 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6329 |
! |
|
6330 |
||
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6331 |
cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6332 |
|selectedFiles| |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6333 |
|
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6334 |
selectedFiles:= self currentSelectedFiles. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6335 |
selectedFiles do:[:each | |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6336 |
|out diffs| |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6337 |
|
15589 | 6338 |
out := CharacterWriteStream new:100. |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6339 |
OperatingSystem |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6340 |
executeCommand:'cvs diff -b ',each baseName |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6341 |
outputTo:out |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6342 |
inDirectory:each directoryName. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6343 |
diffs := out contents. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6344 |
TextView openWith:diffs. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6345 |
]. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6346 |
|
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6347 |
"Modified: / 23-01-2012 / 14:08:28 / cg" |
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6348 |
! |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6349 |
|
15211 | 6350 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
6351 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
6352 |
||
6353 |
|toRemove updateRunning executionBlock nameString| |
|
6354 |
||
6355 |
updateRunning := self backgroundProcesses value notEmpty. |
|
6356 |
self killAllRunningBackgroundProcesses. |
|
6357 |
toRemove := OrderedCollection new. |
|
6358 |
||
6359 |
executionBlock := |
|
6360 |
[:stream | |
|
6361 |
|cmd logArg prevDir prevFiles| |
|
6362 |
||
6363 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6364 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
|
6365 |
] ifFalse:[ |
|
6366 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
|
6367 |
]. |
|
6368 |
prevFiles := ''. |
|
6369 |
||
6370 |
filesToRemove do:[:fileName | |
|
6371 |
|dir file| |
|
6372 |
||
6373 |
dir := fileName directory. |
|
6374 |
(prevDir notNil and:[prevDir ~= dir]) ifTrue:[ |
|
6375 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6376 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6377 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6378 |
prevFiles := ''. |
|
6379 |
]. |
|
6380 |
||
17116 | 6381 |
OsError handle:[:ex| |
15211 | 6382 |
"was not able to remove it" |
6383 |
| lastError msg | |
|
6384 |
lastError := OperatingSystem lastErrorString. |
|
6385 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
6386 |
lastError isNil ifFalse:[ |
|
6387 |
msg := msg , '\\(' , lastError , ')' |
|
6388 |
]. |
|
6389 |
Dialog warn:msg withCRs |
|
6390 |
] do:[ |
|
6391 |
(fileName isSymbolicLink) ifFalse:[ |
|
6392 |
fileName remove. |
|
6393 |
file := fileName baseName. |
|
6394 |
cmd := ('cvs remove -f "',file,'"'). |
|
6395 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6396 |
"/ Transcript show:dir; space; showCR:cmd. |
|
6397 |
] |
|
6398 |
]. |
|
6399 |
prevDir := dir. |
|
6400 |
prevFiles := prevFiles,' ',file. |
|
6401 |
]. |
|
6402 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6403 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6404 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6405 |
]. |
|
6406 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
|
6407 |
filesToRemove size > 1 ifTrue:[ |
|
6408 |
nameString := nameString, ' ...'. |
|
6409 |
]. |
|
6410 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6411 |
! |
|
3892 | 6412 |
|
6413 |
cvsRemoveFileAndCVSContainer |
|
12493 | 6414 |
|files| |
6415 |
||
6416 |
files := self currentSelectedFiles copy. |
|
6417 |
self removeFilesAndCVSContainers:files |
|
3892 | 6418 |
! |
6419 |
||
9338 | 6420 |
cvsRevisionLog |
6421 |
| cmd sel executionBlock nameString| |
|
6422 |
||
6423 |
sel := self currentSelectedObjects. |
|
6424 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6425 |
||
6426 |
executionBlock := [:stream | |
|
6427 |
sel do:[:fn | |
|
6428 |
| dir nameArg | |
|
6429 |
||
6430 |
nameArg := '"',fn baseName,'"'. |
|
6431 |
dir := fn directory. |
|
6432 |
cmd := 'cvs log ' , nameArg. |
|
6433 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6434 |
] |
|
6435 |
]. |
|
6436 |
nameString := 'Command> cvs log'. |
|
6437 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6438 |
! |
|
6439 |
||
8562 | 6440 |
cvsTagSelection |
12856 | 6441 |
|tag tags cmd| |
6442 |
||
6443 |
tag := Dialog |
|
6444 |
request:(resources string:'Tag (possibly multiple, separated by ";"):') |
|
6445 |
initialAnswer:(CVSSourceCodeManager recentTag). |
|
6446 |
tag isEmptyOrNil ifTrue:[^ self ]. |
|
6447 |
||
6448 |
CVSSourceCodeManager recentTag:tag. |
|
8562 | 6449 |
|
6450 |
CVSSourceCodeManager notNil ifTrue:[ |
|
6451 |
cmd := CVSSourceCodeManager cvsExecutable. |
|
6452 |
] ifFalse:[ |
|
6453 |
cmd := 'cvs'. |
|
6454 |
]. |
|
6455 |
||
12856 | 6456 |
tags := tag asCollectionOfSubstringsSeparatedByAny:',;'. |
6457 |
tags do:[:eachTag | |
|
6458 |
self executeCommand:('%1 tag -F "%2" %3' |
|
6459 |
bindWith:cmd |
|
12858 | 6460 |
with:(eachTag withoutSeparators) |
12856 | 6461 |
with:(self makeFileNameArgumentString)) |
6462 |
]. |
|
8562 | 6463 |
! |
6464 |
||
3892 | 6465 |
cvsUpdateAll |
6466 |
| cmd | |
|
6467 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6468 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6469 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6470 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6471 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6472 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6473 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6474 |
self executeCommand:(cmd, ' upd -l'). |
3892 | 6475 |
! |
6476 |
||
6477 |
cvsUpdateAllRecursive |
|
6478 |
| cmd | |
|
6479 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6480 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6481 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6482 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6483 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6484 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6485 |
self executeCommand:(cmd, ' upd -d'). |
3892 | 6486 |
! |
6487 |
||
6488 |
cvsUpdateSelection |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6489 |
|stream cmd| |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6490 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6491 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6492 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6493 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6494 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6495 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6496 |
|
15589 | 6497 |
stream := CharacterWriteStream new. |
8563 | 6498 |
stream |
6499 |
nextPutAll:cmd; |
|
6500 |
nextPutAll:' upd '; |
|
6501 |
nextPutAll:(self makeFileNameArgumentString). |
|
6502 |
||
6503 |
self executeCommand:stream contents. |
|
6504 |
! |
|
6505 |
||
6506 |
makeFileNameArgumentString |
|
6507 |
|stream| |
|
6508 |
||
15589 | 6509 |
stream := CharacterWriteStream new. |
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6510 |
self currentSelectedFiles do:[: file | |
8563 | 6511 |
stream nextPut:$". |
4414 | 6512 |
stream nextPutAll:file baseName. |
8563 | 6513 |
stream nextPutAll:'" '. |
6514 |
]. |
|
6515 |
^ stream contents. |
|
12493 | 6516 |
! |
6517 |
||
6518 |
removeFilesAndCVSContainers:files |
|
6519 |
|numFiles question aswer| |
|
6520 |
||
6521 |
(numFiles := files size) > 0 ifTrue:[ |
|
6522 |
numFiles > 1 ifTrue:[ |
|
6523 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:numFiles |
|
6524 |
] ifFalse:[ |
|
6525 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(files first baseName allBold) |
|
6526 |
]. |
|
6527 |
||
6528 |
aswer := Dialog |
|
6529 |
confirm:question withCRs |
|
6530 |
yesLabel:(resources string:'Remove') |
|
6531 |
noLabel:(resources string:'Cancel'). |
|
6532 |
||
6533 |
aswer ifTrue:[ |
|
6534 |
self withActivityIndicationDo:[ |
|
6535 |
self cvsRemoveAndRemoveFromCVS:files |
|
6536 |
] |
|
6537 |
] |
|
6538 |
] |
|
3892 | 6539 |
! ! |
6540 |
||
14126 | 6541 |
|
11139 | 6542 |
!AbstractFileBrowser methodsFor:'menu actions-scm-mercurial'! |
6543 |
||
6544 |
mercurialAdd |
|
6545 |
|executionBlock sel maxCmdSize| |
|
6546 |
||
6547 |
maxCmdSize := 512. |
|
6548 |
||
6549 |
sel := self currentSelectedObjects. |
|
6550 |
sel isEmptyOrNil ifTrue:[ |
|
6551 |
^ self |
|
6552 |
]. |
|
6553 |
||
6554 |
executionBlock := |
|
6555 |
[:stream | |
|
6556 |
|prevDir cmd| |
|
6557 |
||
6558 |
prevDir := nil. |
|
6559 |
sel do:[:fn | |
|
6560 |
|nameArg dir| |
|
6561 |
||
6562 |
nameArg := '"',fn baseName,'"'. |
|
6563 |
dir := fn directory. |
|
6564 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6565 |
"/ flush |
|
6566 |
cmd notNil ifTrue:[ |
|
6567 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6568 |
cmd := nil. |
|
6569 |
] |
|
6570 |
]. |
|
6571 |
cmd isNil ifTrue:[ |
|
6572 |
cmd := 'hg add'. |
|
6573 |
]. |
|
6574 |
cmd := cmd,' ',nameArg. |
|
6575 |
prevDir := dir. |
|
6576 |
]. |
|
6577 |
cmd notNil ifTrue:[ |
|
6578 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6579 |
cmd := nil. |
|
6580 |
]. |
|
6581 |
stream nextPutLine:'Commit to finish the transaction'. |
|
6582 |
]. |
|
6583 |
||
6584 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg add'. |
|
6585 |
||
6586 |
"Created: / 15-01-2012 / 15:55:47 / cg" |
|
6587 |
! |
|
6588 |
||
6589 |
mercurialCommit |
|
6590 |
|dir executionBlock| |
|
6591 |
||
6592 |
"/ dir := self currentDirectory. |
|
6593 |
dir := self directoryContentsBrowser directory. |
|
6594 |
executionBlock := |
|
6595 |
[:stream | |
|
6596 |
(self getExecutionBlockForCommand:'hg commit' |
|
6597 |
inDirectory:dir) value:stream. |
|
6598 |
stream nextPutLine:'Push to sync other repositories'. |
|
6169 | 6599 |
]. |
11139 | 6600 |
|
6601 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg commit'. |
|
6602 |
||
6603 |
"Created: / 15-01-2012 / 16:21:27 / cg" |
|
6604 |
! |
|
6605 |
||
11144 | 6606 |
mercurialInit |
6607 |
|dir executionBlock| |
|
6608 |
||
6609 |
dir := self directoryContentsBrowser directory. |
|
6610 |
||
6611 |
(Dialog confirm:(resources |
|
6612 |
string:'Initialize new Mercurial Repository in %1?' |
|
6613 |
with:dir baseName)) ifFalse:[^ self]. |
|
6614 |
||
6615 |
executionBlock := |
|
6616 |
[:stream | |
|
6617 |
(self getExecutionBlockForCommand:('hg init') |
|
6618 |
inDirectory:dir) value:stream. |
|
6619 |
]. |
|
6620 |
||
6621 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg init'. |
|
6622 |
||
6623 |
"Created: / 17-01-2012 / 15:58:46 / cg" |
|
6624 |
! |
|
6625 |
||
11139 | 6626 |
mercurialPush |
6627 |
|destination dir executionBlock| |
|
6628 |
||
6629 |
destination := Dialog request:'Mercurial Repository' |
|
6630 |
initialAnswer:(LastMercurialRepository ? MercurialSourceCodeManager repositoryName). |
|
6631 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
6632 |
||
6633 |
LastMercurialRepository := destination. |
|
6634 |
||
6635 |
dir := self directoryContentsBrowser directory. |
|
6636 |
executionBlock := |
|
6637 |
[:stream | |
|
6638 |
(self getExecutionBlockForCommand:('hg push "%1"' bindWith:destination) |
|
6639 |
inDirectory:dir) value:stream. |
|
6640 |
]. |
|
6641 |
||
6642 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg push'. |
|
6643 |
||
6644 |
"Created: / 15-01-2012 / 16:29:41 / cg" |
|
6645 |
! |
|
6646 |
||
6647 |
mercurialStatus |
|
6648 |
|executionBlock sel maxCmdSize| |
|
6649 |
||
6650 |
maxCmdSize := 512. |
|
6651 |
||
6652 |
sel := self currentSelectedObjects. |
|
6653 |
sel isEmptyOrNil ifTrue:[ |
|
6654 |
^ self |
|
6655 |
]. |
|
6656 |
||
6657 |
executionBlock := |
|
6658 |
[:stream | |
|
6659 |
|prevDir cmd| |
|
6660 |
||
6661 |
prevDir := nil. |
|
6662 |
sel do:[:fn | |
|
6663 |
|nameArg dir| |
|
6664 |
||
6665 |
nameArg := '"',fn baseName,'"'. |
|
6666 |
dir := fn directory. |
|
6667 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6668 |
"/ flush |
|
6669 |
cmd notNil ifTrue:[ |
|
6670 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6671 |
cmd := nil. |
|
6672 |
] |
|
6673 |
]. |
|
6674 |
cmd isNil ifTrue:[ |
|
6675 |
cmd := 'hg status'. |
|
6676 |
]. |
|
6677 |
cmd := cmd,' ',nameArg. |
|
6678 |
prevDir := dir. |
|
6679 |
]. |
|
6680 |
cmd notNil ifTrue:[ |
|
6681 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6682 |
cmd := nil. |
|
6683 |
]. |
|
6684 |
]. |
|
6685 |
||
6686 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg status'. |
|
6687 |
||
6688 |
"Created: / 15-01-2012 / 19:43:08 / cg" |
|
3892 | 6689 |
! ! |
6690 |
||
4849 | 6691 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
3892 | 6692 |
|
8510 | 6693 |
allFilesInSelectedDirectoriesForWhich:aBlock |
17868 | 6694 |
^ self class allFilesInDirectories:(self currentSelectedDirectories) forWhich:aBlock |
8510 | 6695 |
! |
6696 |
||
18426 | 6697 |
changeSetFromGSTSource |
6698 |
GSTFileReader isNil ifTrue:[ Smalltalk loadPackage:'stx:libbasic2']. |
|
6699 |
||
6700 |
self withWaitCursorDo:[ |
|
6701 |
self currentSelectedFiles do:[:fn | |
|
6702 |
|changeSet| |
|
6703 |
||
18746 | 6704 |
(fn suffix sameAs:'st') ifTrue:[ |
18426 | 6705 |
changeSet := GSTFileReader new changeSetFromStream:fn readStream. |
6706 |
(Tools::ChangeSetBrowser2 |
|
6707 |
on: changeSet |
|
6708 |
label: fn baseName) |
|
6709 |
beTwoColumn; |
|
6710 |
targetNamespace:nil; |
|
6711 |
targetPackage:nil; |
|
6712 |
open |
|
6713 |
] |
|
6714 |
] |
|
6715 |
] |
|
6716 |
||
6717 |
"Created: / 23-09-2018 / 01:32:46 / Claus Gittinger" |
|
18746 | 6718 |
"Modified: / 01-05-2019 / 11:21:34 / Claus Gittinger" |
18426 | 6719 |
! |
6720 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6721 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6722 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6723 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6724 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6725 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6726 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6727 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6728 |
"/ 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
|
6729 |
"/ 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
|
6730 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6731 |
conv := OrderedCollection new. |
4722 | 6732 |
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
|
6733 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6734 |
outSuffix = 'png' ifTrue:[ |
4722 | 6735 |
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
|
6736 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6737 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6738 |
outSuffix = 'gif' ifTrue:[ |
4722 | 6739 |
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
|
6740 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6741 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6742 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 6743 |
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
|
6744 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6745 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6746 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 6747 |
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
|
6748 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6749 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6750 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6751 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6752 |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6753 |
convertImageFrom:fileName to:outFile onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6754 |
|writer image outSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6755 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6756 |
outSuffix := outFile suffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6757 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6758 |
((writer := MIMETypes imageReaderForSuffix:outSuffix) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6759 |
and:[ (image := Image fromFile:fileName) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6760 |
and:[ writer canRepresent:image ]]) ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6761 |
"/ can do it with Smalltalk tools |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6762 |
writer save:image onFile:outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6763 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6764 |
"/ use external tools (pbm-package, if available) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6765 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6766 |
convertImageUsingExternalFileToolsFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6767 |
toSuffix:outSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6768 |
onError:exceptionBlock. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6769 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6770 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6771 |
"Created: / 20-05-2010 / 11:12:36 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6772 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6773 |
|
4367 | 6774 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6775 |
self convertImageToSuffix:'gif' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6776 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6777 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6778 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6779 |
self convertImageToSuffix:'jpg' |
4531 | 6780 |
! |
6781 |
||
6782 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6783 |
self convertImageToSuffix:'png' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6784 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6785 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6786 |
convertImageToSuffix:outSuffix |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6787 |
|outFile filesToConvert| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6788 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6789 |
self withActivityIndicationDo:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6790 |
filesToConvert := self currentSelectedObjects copy. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6791 |
filesToConvert do:[:fileName | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6792 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6793 |
|
18453 | 6794 |
fileName isRegularFile ifTrue:[ |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6795 |
|skip| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6796 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6797 |
skip := false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6798 |
outFile := fileName withSuffix:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6799 |
outFile exists ifTrue:[ |
4722 | 6800 |
|answer| |
6801 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6802 |
answer := Dialog |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6803 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6804 |
default:false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6805 |
answer isNil ifTrue:[AbortSignal raise]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6806 |
answer ifFalse:[ skip := true ]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6807 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6808 |
skip ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6809 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6810 |
convertImageFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6811 |
to:outFile |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6812 |
onError:[:errMsg | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6813 |
filesToConvert size == 1 ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6814 |
Dialog warn:errMsg |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6815 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6816 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6817 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6818 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6819 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6820 |
]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6821 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6822 |
self updateAndSelect:nil. |
4367 | 6823 |
] |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6824 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6825 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6826 |
self notify:nil. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6827 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6828 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6829 |
"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
|
6830 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6831 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6832 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6833 |
self convertImageToSuffix:'xpm' |
4367 | 6834 |
! |
6835 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6836 |
convertImageUsingExternalFileToolsFrom:fileName toSuffix:outSuffix onError:exceptionBlock |
13121 | 6837 |
|inFile outFile chainOfConversions conversionStream |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6838 |
eachConversionSuffixCommandPair eachConversionCommand eachConversionSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6839 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6840 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6841 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6842 |
chainOfConversions isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6843 |
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
|
6844 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6845 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6846 |
conversionStream := chainOfConversions readStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6847 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6848 |
inFile := fileName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6849 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6850 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6851 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6852 |
eachConversionCommand == #readToXPM ifTrue:[ |
13121 | 6853 |
|image tempStreamXPM| |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6854 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6855 |
image := Image fromFile:(inFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6856 |
image isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6857 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6858 |
^ false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6859 |
]. |
13121 | 6860 |
tempStreamXPM := FileStream newTemporaryWithSuffix:'xpm'. |
6861 |
XPMReader save:image onStream:tempStreamXPM. |
|
6862 |
tempStreamXPM close. |
|
6863 |
inFile := tempStreamXPM fileName. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6864 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6865 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6866 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6867 |
[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6868 |
|command errOutput errMsg| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6869 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6870 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6871 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6872 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6873 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6874 |
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
|
6875 |
|
13121 | 6876 |
outFile := (FileStream newTemporaryWithSuffix:eachConversionSuffix) close pathName. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6877 |
command := eachConversionCommand |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6878 |
bindWith:(inFile pathName) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6879 |
with:(outFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6880 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6881 |
errOutput := String writeStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6882 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6883 |
(OperatingSystem executeCommand:command errorTo:errOutput) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6884 |
errMsg := resources |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6885 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6886 |
with:inFile baseName allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6887 |
with:eachConversionSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6888 |
with:eachConversionCommand allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6889 |
with:errOutput contents. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6890 |
exceptionBlock value:errMsg. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6891 |
|
18024 | 6892 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
6893 |
outFile remove. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6894 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6895 |
]. |
18024 | 6896 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6897 |
inFile := outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6898 |
eachConversionSuffixCommandPair := conversionStream next |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6899 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6900 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6901 |
] ifCurtailed:[ |
18024 | 6902 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
6903 |
outFile remove. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6904 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6905 |
^ true. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6906 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6907 |
"Created: / 20-05-2010 / 11:05:50 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6908 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6909 |
|
3892 | 6910 |
createProjectAndOpenProjectBrowser |
6911 |
|nm f s directory| |
|
6912 |
||
6913 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 6914 |
directory := self currentDirectory. |
3892 | 6915 |
nm := directory baseName. |
6916 |
f := (directory construct:nm) withSuffix:'prj'. |
|
6917 |
f exists ifTrue:[ |
|
4414 | 6918 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
6919 |
^ self. |
|
3892 | 6920 |
]. |
6921 |
s := f writeStream. |
|
6922 |
s nextPutAll:' |
|
6923 |
name ''' , nm , ''' |
|
6924 |
type #classLibrary |
|
6925 |
package #''private:' , nm , ''' |
|
6926 |
prerequisites nil |
|
6927 |
||
6928 |
classes #( ) |
|
6929 |
'. |
|
6930 |
s close. |
|
6931 |
ProjectBrowser openOnFile:f. |
|
6932 |
! |
|
6933 |
||
5880 | 6934 |
doExecuteCommand |
6935 |
"execute an OperatingSystem-command" |
|
6936 |
||
6937 |
| action fileName| |
|
6938 |
||
6939 |
fileName := self firstSelectedFile. |
|
6940 |
action := [:command | |
|
6941 |
self addToCommandHistory:command for:fileName. |
|
6942 |
self executeCommand:command. |
|
6943 |
]. |
|
6944 |
self askForCommandFor:fileName thenDo:action |
|
6945 |
! |
|
6946 |
||
6947 |
doExecuteScript |
|
16941 | 6948 |
"execute a Smalltalk script" |
5880 | 6949 |
|
6950 |
|textHolder dialog template dummyClass dummyInstance| |
|
6951 |
||
6952 |
template := |
|
6953 |
'"/ Smalltalk script: |
|
6954 |
||
16084 | 6955 |
"/ the following variables are accessible: |
5880 | 6956 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
6957 |
"/ selectedFiles (= ...) |
|
6958 |
"/ |
|
6959 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
6960 |
"/ |
|
6961 |
"/ Useful operations are: |
|
6962 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
6963 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
6964 |
"/ directory directory |
|
6965 |
"/ |
|
6966 |
"/ example: move all files which match a aarticular pattern to |
|
6967 |
"/ a separate directory: |
|
6968 |
"/ |
|
6969 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
6970 |
"/ |
|
6971 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
6972 |
"/ |
|
6973 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
6974 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
6975 |
"/ idx := eachBaseNameString indexOf:$_. |
|
6976 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
6977 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
6978 |
"/ newDir := directory construct:prefix. |
|
6979 |
"/ newDir exists ifFalse:[ |
|
6980 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
6981 |
"/ newDir makeDirectory. |
|
6982 |
"/ ]. |
|
6983 |
"/ ]. |
|
6984 |
"/ newDir exists ifTrue:[ |
|
6985 |
"/ oldFile := directory construct:eachBaseNameString. |
|
6986 |
"/ newFile := newDir construct:rest. |
|
6987 |
"/ oldFile moveTo:newFile |
|
6988 |
"/ ] |
|
6989 |
"/ ] |
|
6990 |
"/ ] |
|
6991 |
'. |
|
6992 |
||
6993 |
LastScriptBlockString isNil ifTrue:[ |
|
6994 |
LastScriptBlockString := template. |
|
6995 |
]. |
|
6996 |
||
6997 |
textHolder := ValueHolder new. |
|
6998 |
dialog := Dialog |
|
6999 |
forRequestText:(resources string:'Enter script') |
|
7000 |
editViewClass:CodeView |
|
7001 |
lines:25 |
|
7002 |
columns:70 |
|
7003 |
initialAnswer:LastScriptBlockString |
|
7004 |
model:textHolder. |
|
7005 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
7006 |
dialog open. |
|
7007 |
dialog accepted ifFalse:[^ self]. |
|
7008 |
||
7009 |
LastScriptBlockString := textHolder value. |
|
7010 |
||
7011 |
Class classConventionViolationConfirmationQuerySignal |
|
7012 |
answer:true |
|
7013 |
do:[ |
|
7014 |
dummyClass := Object class |
|
7015 |
name:#Dummy |
|
7016 |
inEnvironment:nil |
|
7017 |
subclassOf:Object |
|
7018 |
instanceVariableNames:'directory selectedFiles' |
|
7019 |
variable:false |
|
7020 |
words:true |
|
7021 |
pointers:true |
|
7022 |
classVariableNames:'' |
|
7023 |
poolDictionaries:'' |
|
7024 |
category:#dummyCategory |
|
7025 |
comment:nil |
|
7026 |
changed:true. |
|
7027 |
]. |
|
7028 |
||
7029 |
dummyInstance := dummyClass basicNew. |
|
7030 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
7031 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
7032 |
||
7033 |
Compiler |
|
7034 |
evaluate:textHolder value |
|
7035 |
in:nil |
|
7036 |
receiver:dummyInstance |
|
7037 |
notifying:nil |
|
7038 |
logged:false |
|
7039 |
ifFail:[] |
|
7040 |
compile:true. |
|
7041 |
||
7042 |
"/ fileName := self firstSelectedFile. |
|
7043 |
"/ action := [:command | |
|
7044 |
"/ self addToCommandHistory:command for:fileName. |
|
7045 |
"/ self executeCommand:command. |
|
7046 |
"/ ]. |
|
7047 |
"/ self askForCommandFor:fileName thenDo:action |
|
7048 |
! |
|
7049 |
||
4230 | 7050 |
doMake |
7938 | 7051 |
|dir cmd| |
4230 | 7052 |
|
13856 | 7053 |
cmd := self makeCommandHolder value. |
7054 |
||
7055 |
"Make" |
|
7056 |
cmd = 'make' ifTrue:[ |
|
7057 |
dir := self theSingleSelectedDirectoryOrNil. |
|
7058 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
7059 |
dir notNil ifTrue:[ |
|
7060 |
(dir construct:'bmake.bat') exists ifTrue:[ |
|
7061 |
cmd := 'bmake.bat'. |
|
7062 |
] |
|
7938 | 7063 |
] |
13856 | 7064 |
]. |
7065 |
self executeCommand:cmd. |
|
7066 |
^self. |
|
7067 |
]. |
|
7068 |
||
7069 |
"Apache ant" |
|
7070 |
cmd = 'ant' ifTrue:[ |
|
7071 |
self executeCommand:cmd. |
|
7072 |
^self. |
|
7073 |
]. |
|
7074 |
||
7075 |
"Add more here..." |
|
7076 |
||
7077 |
"Modified (comment): / 13-04-2012 / 17:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4230 | 7078 |
! |
7079 |
||
8256 | 7080 |
doOpenCBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7081 |
"the CBrowser is an eXept-internal C-language IDE tool. |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7082 |
(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
|
7083 |
20 years ago ;-)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7084 |
|
8256 | 7085 |
|destDir| |
7086 |
||
18433 | 7087 |
((Smalltalk at:#'CBrowser') isNil or:[ (Smalltalk at:#'CBrowser::Browser') isNil ]) ifTrue:[ |
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7088 |
Smalltalk loadPackage:'exept:CC' |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7089 |
]. |
8256 | 7090 |
destDir := self currentDirectory. |
18433 | 7091 |
(Smalltalk at:#'CBrowser::Browser') openIn:destDir pathName |
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7092 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7093 |
"Modified: / 04-10-2011 / 13:41:31 / cg" |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7094 |
"Modified (comment): / 27-07-2012 / 20:41:40 / cg" |
18433 | 7095 |
"Modified: / 26-09-2018 / 12:37:34 / Claus Gittinger" |
8256 | 7096 |
! |
7097 |
||
7829 | 7098 |
doOpenExplorer |
18433 | 7099 |
"corresponding menu item is visible on a windows machine only" |
7100 |
||
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7101 |
self currentDirectory asFilename openExplorer |
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7102 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7103 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
18433 | 7104 |
"Modified (comment): / 26-09-2018 / 12:38:08 / Claus Gittinger" |
7829 | 7105 |
! |
7106 |
||
12473 | 7107 |
doOpenFinder |
18433 | 7108 |
"corresponding menu item is visible on a mac only" |
7109 |
||
12473 | 7110 |
self currentDirectory asFilename openFinder |
7111 |
||
7112 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
|
18433 | 7113 |
"Modified (comment): / 26-09-2018 / 12:38:00 / Claus Gittinger" |
12473 | 7114 |
! |
7115 |
||
18432 | 7116 |
doOpenGDBApplication |
7117 |
"the GDBApplication is a cg-private debugging tool" |
|
7118 |
||
7119 |
|destDir| |
|
7120 |
||
7121 |
(Smalltalk at:#'GDBApplication') isNil ifTrue:[ |
|
7122 |
Smalltalk loadPackage:'cg:tools' |
|
7123 |
]. |
|
7124 |
destDir := self currentDirectory. |
|
7125 |
(Smalltalk at:#'GDBApplication') openOn:destDir |
|
7126 |
||
7127 |
"Created: / 26-09-2018 / 12:09:32 / Claus Gittinger" |
|
7128 |
! |
|
7129 |
||
12811 | 7130 |
doOpenMonticelloBrowser |
18433 | 7131 |
(Smalltalk at:#'MCMczReader') isNil ifTrue:[ |
7132 |
Smalltalk loadPackage:'stx:goodies/monticello'. |
|
7133 |
(Smalltalk at:#'MCMczReader') isNil ifTrue:[ |
|
7134 |
Dialog warn:'Failed to load the monticello package'. |
|
7135 |
^ self. |
|
7136 |
]. |
|
7137 |
]. |
|
12874
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
7138 |
|
12811 | 7139 |
self withWaitCursorDo:[ |
7140 |
self currentSelectedFiles do:[:fn | |
|
7141 |
|version snapshot| |
|
7142 |
||
18746 | 7143 |
(fn suffix sameAs:'mcz') ifTrue:[ |
18433 | 7144 |
version := (Smalltalk at:#'MCMczReader') versionFromFile:fn. |
12811 | 7145 |
snapshot := version snapshot. |
7146 |
(Tools::ChangeSetBrowser2 |
|
7147 |
on: snapshot asChangeSet |
|
7148 |
label: version info name) |
|
7149 |
beTwoColumn; |
|
7150 |
targetNamespace:nil; |
|
7151 |
targetPackage:nil; |
|
7152 |
open |
|
7153 |
] |
|
7154 |
] |
|
7155 |
] |
|
18433 | 7156 |
|
18746 | 7157 |
"Modified: / 01-05-2019 / 11:23:23 / Claus Gittinger" |
12811 | 7158 |
! |
7159 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7160 |
doOpenSettings |
8168 | 7161 |
self openSettingsDialog |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7162 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7163 |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7164 |
doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7165 |
"open using win32-shell" |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7166 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7167 |
|fileName| |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7168 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7169 |
fileName := self firstSelectedFile. |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7170 |
fileName notNil ifTrue:[ |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7171 |
OperatingSystem |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7172 |
openApplicationForDocument:fileName pathName |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7173 |
operation:#open |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7174 |
] |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7175 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7176 |
"Modified: / 21-07-2012 / 12:26:10 / cg" |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7177 |
! |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7178 |
|
7104 | 7179 |
editMode:aSymbol |
7180 |
self |
|
7181 |
applicationNamed:#FileApplicationNoteBook |
|
7182 |
ifPresentDo:[:appl | |
|
7183 |
|subApp| |
|
7184 |
||
7185 |
subApp := appl selectedApplication. |
|
7186 |
subApp notNil ifTrue:[ |
|
7187 |
^ subApp perform:aSymbol |
|
7188 |
] |
|
7189 |
]. |
|
7190 |
||
7191 |
"Created: / 11-09-2006 / 12:42:08 / cg" |
|
7192 |
! |
|
7193 |
||
7194 |
editModeInsert |
|
7195 |
self editMode:#editModeInsert |
|
7196 |
||
7197 |
"Created: / 11-09-2006 / 12:40:36 / cg" |
|
7198 |
! |
|
7199 |
||
7200 |
editModeInsertAndSelect |
|
7201 |
self editMode:#editModeInsertAndSelect |
|
7202 |
||
7203 |
"Created: / 11-09-2006 / 12:40:45 / cg" |
|
7204 |
! |
|
7205 |
||
7206 |
editModeOverwrite |
|
7207 |
self editMode:#editModeOverwrite |
|
7208 |
||
7209 |
"Modified: / 11-09-2006 / 12:42:26 / cg" |
|
7210 |
! |
|
7211 |
||
15528 | 7212 |
fetchFileByURL |
7213 |
|url destinationFilename| |
|
7214 |
||
17818 | 7215 |
url := Dialog request:(resources string:'URL to Fetch:') initialAnswer:'http://host/path'. |
15528 | 7216 |
url isEmptyOrNil ifTrue:[^ self]. |
7217 |
url := url asURL. |
|
7218 |
||
17818 | 7219 |
destinationFilename := Dialog request:(resources string:'Download As:') initialAnswer:(UnixFilename named:url path) baseName. |
15528 | 7220 |
destinationFilename isEmptyOrNil ifTrue:[^ self]. |
7221 |
||
7222 |
destinationFilename := self currentDirectory asFilename / destinationFilename. |
|
7223 |
destinationFilename exists ifTrue:[ |
|
7224 |
|answer| |
|
7225 |
||
7226 |
answer := Dialog |
|
7227 |
confirm:(resources string:'Overwrite existing %1 ?' with:destinationFilename baseName allBold) |
|
7228 |
default:false. |
|
7229 |
answer ~~ true ifTrue:[^ self]. |
|
7230 |
]. |
|
7231 |
self withActivityIndicationDo:[ |
|
7232 |
self notify:(resources string:'Fetching %1' with:url). |
|
7233 |
HTTPInterface get:url destinationFile:destinationFilename. |
|
7234 |
self notify:nil. |
|
7235 |
] |
|
7236 |
||
17818 | 7237 |
"Modified: / 29-11-2017 / 12:26:13 / cg" |
15528 | 7238 |
! |
7239 |
||
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7240 |
fileContentsAsByteArray |
17769 | 7241 |
|file fileSize| |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7242 |
|
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7243 |
file := self firstSelectedFile. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7244 |
file isNil ifTrue:[^ self ]. |
17769 | 7245 |
|
7246 |
file := file asFilename. |
|
7247 |
||
7248 |
(fileSize := file fileSize) > (1024*1024) ifTrue:[ |
|
7249 |
fileSize > (128*1024*1024) ifTrue:[ |
|
11889 | 7250 |
Dialog warn:(resources string:'File is too big'). |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7251 |
^ self. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7252 |
]. |
17769 | 7253 |
(Dialog confirm:(resources |
7254 |
string:'File is big (%1) - proceed?' |
|
7255 |
with:(UnitConverter fileSizeStringFor:fileSize)) |
|
7256 |
) ifFalse:[^ self]. |
|
7257 |
]. |
|
7258 |
file binaryContentsOfEntireFile inspect |
|
7259 |
||
7260 |
"Modified: / 19-11-2017 / 14:58:43 / cg" |
|
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7261 |
! |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7262 |
|
3892 | 7263 |
fileFileIn |
7264 |
"fileIn the selected file(s)" |
|
7265 |
||
7266 |
self fileFileInLazy:false |
|
7267 |
! |
|
7268 |
||
7324 | 7269 |
fileFileIn:aFilename lazy:lazy |
7270 |
"fileIn a file" |
|
7271 |
||
7272 |
self withActivityIndicationDo:[ |
|
7273 |
self notify:('File in:', aFilename asFilename baseName). |
|
7274 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7275 |
self notify:nil. |
|
7276 |
] |
|
7277 |
||
7278 |
"Created: / 20-09-2006 / 14:28:35 / cg" |
|
7279 |
! |
|
7280 |
||
3892 | 7281 |
fileFileInLazy |
7282 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
7283 |
||
7284 |
self fileFileInLazy:true |
|
7285 |
! |
|
7286 |
||
7287 |
fileFileInLazy:lazy |
|
7288 |
"fileIn the selected file(s)" |
|
7289 |
||
7324 | 7290 |
self currentSelectedFiles do:[:fileName | |
7291 |
self fileIn:fileName lazy:lazy |
|
7292 |
]. |
|
7293 |
||
7294 |
"Modified: / 20-09-2006 / 14:29:24 / cg" |
|
3892 | 7295 |
! |
7296 |
||
12497 | 7297 |
fileFileInPackage |
7298 |
"assuming the current directory is a package directory, load it" |
|
7299 |
||
7300 |
|packageDir dir path top packageID| |
|
7301 |
||
7302 |
"/ find a reasonable package-id (walk up until we find stx) |
|
7303 |
path := ''. |
|
7304 |
dir := packageDir := self currentDirectory. |
|
7305 |
||
7306 |
top := (Smalltalk projectDirectoryForPackage:'stx') asFilename. |
|
7307 |
[ (dir / 'stx') = top ] whileFalse:[ |
|
7308 |
path := dir baseName , '/' , path. |
|
7309 |
dir := dir directory. |
|
7310 |
dir isNil ifTrue:[ |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7311 |
Dialog warn:'Could not find a path from "stx" to the current directory.'. |
12497 | 7312 |
"/ should ask the user for a packageID and proceed... |
7313 |
^ self. |
|
7314 |
]. |
|
7315 |
]. |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7316 |
packageID := path copyButLast:1. |
12497 | 7317 |
Smalltalk loadPackage:packageID fromDirectory:packageDir asAutoloaded:true |
7318 |
! |
|
7319 |
||
3892 | 7320 |
fileFileInToNameSpace |
7321 |
"fileIn the selected file(s)<into a nameSpace" |
|
7322 |
||
7323 |
|ns listOfKnownNameSpaces| |
|
7324 |
||
7325 |
listOfKnownNameSpaces := Set new. |
|
7326 |
NameSpace |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
7327 |
allNameSpaces |
4414 | 7328 |
do:[:eachNameSpace | |
7329 |
listOfKnownNameSpaces add:eachNameSpace name |
|
7330 |
]. |
|
3892 | 7331 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
7332 |
||
7333 |
ns := Dialog |
|
4414 | 7334 |
request:'During fileIn, new classes are created in nameSpace:' |
7335 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
7336 |
list:listOfKnownNameSpaces. |
|
3892 | 7337 |
ns isEmptyOrNil ifTrue:[^ self]. |
7338 |
||
7339 |
LastEnforcedNameSpace := ns. |
|
7340 |
ns := NameSpace name:ns. |
|
7341 |
||
7342 |
Class nameSpaceQuerySignal |
|
4414 | 7343 |
answer:ns |
7344 |
do:[ |
|
7345 |
self fileFileInLazy:false |
|
7346 |
] |
|
3892 | 7347 |
! |
7348 |
||
7349 |
fileFindAllDuplicates |
|
7350 |
"scan directory and all subdirs for duplicate files" |
|
7351 |
||
7352 |
|fileNames dir infoDir filesBySize |
|
7353 |
result info dirPrefix myName stream textBox maxLength directories| |
|
7354 |
||
7355 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7356 |
self withActivityIndicationDo:[ |
4414 | 7357 |
result := Dictionary new. |
7358 |
myName := self class name asString. |
|
7359 |
directories := self currentSelectedDirectories. |
|
7360 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 7361 |
|
4414 | 7362 |
dir := directories first. |
3892 | 7363 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7364 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7365 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7366 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 7367 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
7368 |
with:ex pathName |
|
7369 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7370 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7371 |
]. |
4765 | 7372 |
fileNames := fileNames |
7373 |
collect:[:fn | dir construct:fn] |
|
18453 | 7374 |
thenSelect:[:fn | fn isRegularFile]. |
3892 | 7375 |
|
7376 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 7377 |
infoDir := Dictionary new. |
7378 |
fileNames do:[:fn | |
|
7379 |
infoDir at:fn put:(fn fileSize) |
|
7380 |
]. |
|
7381 |
||
14497 | 7382 |
"/ for each, get the file's size. |
4414 | 7383 |
"/ in a first pass, look for files of the same size and |
7384 |
"/ compare them ... |
|
3892 | 7385 |
|
7386 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 7387 |
filesBySize := Dictionary new. |
7388 |
infoDir keysAndValuesDo:[:fn :sz | |
|
7389 |
|entry| |
|
7390 |
||
7391 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7392 |
entry add:fn. |
|
7393 |
]. |
|
7394 |
||
7395 |
"/ any of same size ? |
|
3892 | 7396 |
|
7397 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 7398 |
filesBySize do:[:entry | |
7399 |
|files| |
|
7400 |
||
7401 |
entry size > 1 ifTrue:[ |
|
7402 |
files := entry asArray. |
|
7403 |
1 to:files size-1 do:[:idx1 | |
|
7404 |
idx1+1 to:files size do:[:idx2 | |
|
7405 |
|fn1 fn2| |
|
7406 |
||
7407 |
fn1 := files at:idx1. |
|
7408 |
fn2 := files at:idx2. |
|
3892 | 7409 |
|
7410 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 7411 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
7412 |
"/ compare the files |
|
7413 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7414 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 7415 |
result at:fn1 put:fn2. |
7416 |
] |
|
7417 |
] |
|
7418 |
] |
|
7419 |
] |
|
7420 |
] |
|
7421 |
]. |
|
3892 | 7422 |
|
7423 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 7424 |
dirPrefix := dir pathName. |
7425 |
result := result associations. |
|
7426 |
result := result collect:[:assoc | |
|
7427 |
|f1 f2| |
|
7428 |
||
7429 |
f1 := assoc key name. |
|
7430 |
f2 := assoc value name. |
|
7431 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
7432 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
7433 |
]. |
|
7434 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
7435 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
7436 |
]. |
|
7437 |
f1 < f2 ifTrue:[ |
|
7438 |
f2 -> f1 |
|
7439 |
] ifFalse:[ |
|
7440 |
f1 -> f2 |
|
7441 |
] |
|
7442 |
]. |
|
7443 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
7444 |
||
7445 |
info := OrderedCollection new. |
|
7446 |
result do:[:assoc | |
|
7447 |
info add:(assoc key , ' same as ' , assoc value) |
|
7448 |
]. |
|
7449 |
info isEmpty ifTrue:[ |
|
11889 | 7450 |
Dialog information:(resources string:'No duplicate files found.'). |
5543 | 7451 |
^ self. |
4414 | 7452 |
]. |
3892 | 7453 |
]. |
7454 |
||
15589 | 7455 |
stream := CharacterWriteStream new. |
11688 | 7456 |
stream nextPutAllLines:info. |
5542 | 7457 |
|
3892 | 7458 |
textBox := TextBox new. |
7459 |
textBox initialText:(stream contents). |
|
5542 | 7460 |
stream close. |
11889 | 7461 |
textBox title:(resources string:'File duplicates in directory: %1' with:dir asString). |
3892 | 7462 |
textBox readOnly:true. |
7463 |
textBox noCancel. |
|
11889 | 7464 |
textBox label:(resources string:'Duplicates in %1' with:dir asString). |
3892 | 7465 |
maxLength := 10. |
7466 |
info do:[: el | |
|
4414 | 7467 |
maxLength := maxLength max:(el size). |
3892 | 7468 |
]. |
7469 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 7470 |
textBox maxExtent:Screen current extent. |
7471 |
textBox openModeless. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7472 |
|
11688 | 7473 |
"Modified: / 27-07-2012 / 09:29:00 / cg" |
3892 | 7474 |
! |
7475 |
||
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7476 |
fileFindDuplicateFile |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7477 |
"scan directory for duplicates of the selected files" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7478 |
|
10306 | 7479 |
|files filesBySize samePerFile stream textBox mustHaveMatches| |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7480 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7481 |
files := self currentSelectedFiles. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7482 |
files isEmpty ifTrue:[^ self]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7483 |
|
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7484 |
self withWaitCursorDo:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7485 |
filesBySize := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7486 |
files do:[:fn | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7487 |
|sz entry| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7488 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7489 |
sz := fn asFilename fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7490 |
(filesBySize at:sz ifAbsentPut:[Set new]) add:fn. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7491 |
]. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7492 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7493 |
samePerFile := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7494 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7495 |
self currentSelectedDirectories do:[:eachDir | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7496 |
eachDir recursiveDirectoryContentsAsFilenamesDo:[:eachFile | |
18453 | 7497 |
eachFile isRegularFile ifTrue:[ |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7498 |
|sz possibleMatches| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7499 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7500 |
sz := eachFile fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7501 |
possibleMatches := filesBySize at:sz ifAbsent:nil. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7502 |
possibleMatches notNil ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7503 |
possibleMatches do:[:eachFileWithSameSize | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7504 |
eachFileWithSameSize ~= eachFile ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7505 |
(eachFileWithSameSize sameContentsAs:eachFile) ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7506 |
(samePerFile at:eachFileWithSameSize ifAbsentPut:[Set new]) add:eachFile |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7507 |
] |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7508 |
] |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7509 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7510 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7511 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7512 |
] |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7513 |
]. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7514 |
]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7515 |
|
15589 | 7516 |
stream := CharacterWriteStream with:'Duplicates:'. |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7517 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7518 |
do:[:origFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7519 |
|sameFiles| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7520 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7521 |
sameFiles := samePerFile at:origFile. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7522 |
stream nextPutLine:origFile baseName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7523 |
(sameFiles asOrderedCollection collect:[:each | each baseName]) sort do:[:eachSameName | |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7524 |
stream nextPutAll:' '; nextPutLine:eachSameName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7525 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7526 |
]. |
10306 | 7527 |
stream nextPutLine:'Files without duplicates:'. |
7528 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7529 |
do:[:origFile | |
|
7530 |
|sameFiles| |
|
7531 |
||
7532 |
sameFiles := samePerFile at:origFile. |
|
7533 |
sameFiles isEmpty ifTrue:[ |
|
7534 |
stream nextPutLine:origFile baseName. |
|
7535 |
]. |
|
7536 |
]. |
|
7537 |
||
7538 |
mustHaveMatches := Dialog request:'Must have for duplicates matching ?:' initialAnswer:(LastMustMatchPattern ? '[a-z][a-z][a-z]_[0-9][0-9][0-9].*'). |
|
7539 |
mustHaveMatches notEmptyOrNil ifTrue:[ |
|
7540 |
LastMustMatchPattern := mustHaveMatches. |
|
7541 |
||
7542 |
stream nextPutLine:'Files without duplicates in xxx_nnn.jpg:'. |
|
7543 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7544 |
do:[:origFile | |
|
7545 |
|sameFiles| |
|
7546 |
||
7547 |
sameFiles := samePerFile at:origFile. |
|
7548 |
sameFiles notEmpty ifTrue:[ |
|
7549 |
(sameFiles contains:[:file | mustHaveMatches match:file baseName]) ifFalse:[ |
|
7550 |
stream nextPutLine:origFile baseName. |
|
7551 |
] |
|
7552 |
]. |
|
7553 |
]. |
|
7554 |
]. |
|
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7555 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7556 |
textBox := TextBox new. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7557 |
textBox initialText:(stream contents). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7558 |
textBox title:'Files with same contents'. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7559 |
textBox readOnly:true. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7560 |
textBox noCancel. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7561 |
textBox extent:(350@400). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7562 |
textBox maxExtent:Screen current extent. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7563 |
textBox openModeless. "/ showAtPointer. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7564 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7565 |
"Created: / 11-07-2011 / 12:39:44 / cg" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7566 |
! |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7567 |
|
3892 | 7568 |
fileFindDuplicates |
7569 |
"scan directory for duplicate files" |
|
7570 |
||
17869 | 7571 |
|directories duplicates info |
7572 |
commonDir prefixSize stream titleStream textBox maxLength| |
|
8510 | 7573 |
|
7574 |
directories := self currentSelectedDirectories. |
|
17869 | 7575 |
duplicates := self class fileFindDuplicatesIn:directories. |
7576 |
duplicates isEmpty ifTrue:[ |
|
17868 | 7577 |
Dialog information:'No duplicate files found.'. |
7578 |
^ self. |
|
7579 |
]. |
|
7580 |
||
7581 |
info := OrderedCollection new. |
|
17869 | 7582 |
commonDir := self getBestDirectory. |
7583 |
prefixSize := commonDir asString size. |
|
7584 |
duplicates do:[:assoc | |
|
17871 | 7585 |
|dup orig| |
7586 |
||
7587 |
dup := assoc key. |
|
7588 |
orig := assoc value. |
|
17868 | 7589 |
prefixSize > 1 ifTrue:[ |
17871 | 7590 |
dup := dup pathNameRelativeFrom:commonDir. |
7591 |
orig := orig pathNameRelativeFrom:commonDir. |
|
17869 | 7592 |
"/ fn1 := ('..', (fn1 name copyFrom:(prefixSize + 1))). |
7593 |
"/ fn2 := ('..', (fn2 copyFrom:(prefixSize + 1))). |
|
17868 | 7594 |
]. |
17871 | 7595 |
(dup includes:Character space) ifTrue:[ |
7596 |
dup := '"' , dup , '"' |
|
7597 |
]. |
|
7598 |
(orig includes:Character space) ifTrue:[ |
|
7599 |
orig := '"' , orig , '"' |
|
7600 |
]. |
|
7601 |
info add:(dup , ' duplicate of ' , orig) |
|
17868 | 7602 |
]. |
7603 |
||
15589 | 7604 |
stream := CharacterWriteStream new. |
11688 | 7605 |
stream nextPutAllLines:info. |
7606 |
||
17869 | 7607 |
titleStream := CharacterWriteStream with:'File duplicates in director'. |
3892 | 7608 |
directories size == 1 ifTrue:[ |
12602 | 7609 |
titleStream nextPutAll:'y: '; nextPutAll: directories first asString. |
3892 | 7610 |
] ifFalse:[ |
4535 | 7611 |
titleStream nextPutLine:'ies: '. |
4355 | 7612 |
directories do:[:dir| |
17868 | 7613 |
prefixSize > 1 ifTrue:[ |
4355 | 7614 |
titleStream nextPutAll:'..'. |
17868 | 7615 |
titleStream nextPutLine:((dir asString) copyFrom:(prefixSize + 1)). |
4355 | 7616 |
] ifFalse:[ |
4535 | 7617 |
titleStream nextPutLine:(dir asString). |
4355 | 7618 |
]. |
7619 |
] |
|
3892 | 7620 |
]. |
5543 | 7621 |
|
3892 | 7622 |
textBox := TextBox new. |
7623 |
textBox initialText:(stream contents). |
|
7624 |
textBox title:(titleStream contents). |
|
7625 |
textBox readOnly:true. |
|
7626 |
textBox noCancel. |
|
14715 | 7627 |
stream := WriteStream on:''. |
7628 |
stream nextPutAll:'Duplicates in '. |
|
4170 | 7629 |
directories do:[ :aDirectory | |
4355 | 7630 |
stream nextPutAll:aDirectory baseName. |
7631 |
stream space. |
|
4050 | 7632 |
]. |
4170 | 7633 |
textBox label:stream contents. |
3892 | 7634 |
maxLength := 10. |
7635 |
info do:[: el | |
|
4355 | 7636 |
maxLength := maxLength max:(el size). |
3892 | 7637 |
]. |
5092 | 7638 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
7639 |
textBox maxExtent:Screen current extent. |
|
17869 | 7640 |
textBox addButton:(Button |
7641 |
label:(resources string:'Remove Duplicates') |
|
7642 |
action:[ |
|
7643 |
(Dialog confirm:(resources string:'Remove %1 duplicate files?' with:duplicates size)) ifTrue:[ |
|
7644 |
duplicates do:[:eachAssoc | |
|
17871 | 7645 |
eachAssoc key remove |
17869 | 7646 |
]. |
17871 | 7647 |
]. |
7648 |
textBox close. |
|
7649 |
self updateCurrentDirectoryWithReread. |
|
17869 | 7650 |
]). |
4355 | 7651 |
textBox openModeless. "/ showAtPointer. |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7652 |
|
11688 | 7653 |
"Modified: / 27-07-2012 / 09:29:14 / cg" |
3892 | 7654 |
! |
7655 |
||
7656 |
fileFindFile |
|
5961 | 7657 |
|filename| |
7658 |
||
7659 |
filename := self firstSelectedFileName. |
|
7660 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7661 |
filename := Filename homeDirectory. |
3892 | 7662 |
]. |
4101 | 7663 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 7664 |
! |
7665 |
||
8510 | 7666 |
fileFindSimilarImages |
7667 |
"scan directory for similar image files" |
|
7668 |
||
8512 | 7669 |
|result stream textBox directories imageFiles histogramsV histogramsH |
7670 |
similarV similarH similar alreadyPrinted| |
|
8510 | 7671 |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7672 |
self withWaitCursorDo:[ |
8510 | 7673 |
self withActivityIndicationDo:[ |
7674 |
result := Dictionary new. |
|
7675 |
||
7676 |
directories := self currentSelectedDirectories. |
|
7677 |
directories isEmpty ifTrue:[^ self]. |
|
7678 |
||
13714 | 7679 |
imageFiles := self allFilesInSelectedDirectoriesForWhich:[:f | f mimeTypeFromName isImageType]. |
8511 | 7680 |
"/ imageFiles := imageFiles select:[:f | f baseName startsWith:'foo']. |
7681 |
imageFiles sort:[:a :b | a pathName < b pathName]. |
|
7682 |
||
8510 | 7683 |
"/ for each, get the color histogram |
7684 |
histogramsV := Dictionary new. |
|
7685 |
histogramsH := Dictionary new. |
|
7686 |
imageFiles do:[:fn | |
|
7687 |
|hist image| |
|
7688 |
||
7689 |
image := Image fromFile:fn. |
|
7690 |
Transcript showCR:'generating histogram for ',fn baseName. |
|
7691 |
hist := ImageColorHistogram new forImage:image. |
|
7692 |
histogramsV at:fn put:(hist histogramVectorV). |
|
7693 |
histogramsH at:fn put:(hist histogramVectorH). |
|
7694 |
]. |
|
7695 |
||
7696 |
similarH := Dictionary new. |
|
7697 |
similarV := Dictionary new. |
|
7698 |
similar := Dictionary new. |
|
7699 |
||
8512 | 7700 |
(self firstSelectedFile notNil |
7701 |
ifTrue:[ Array with:self firstSelectedFile ] |
|
7702 |
ifFalse:[ imageFiles ]) |
|
7703 |
do:[:eachFile1 | |
|
8510 | 7704 |
|setOfSimilar distancesV distancesH| |
7705 |
||
7706 |
distancesV := OrderedCollection new. |
|
7707 |
distancesH := OrderedCollection new. |
|
7708 |
setOfSimilar := OrderedCollection new. |
|
7709 |
||
7710 |
imageFiles do:[:eachFile2 | |
|
7711 |
|v1 v2 dV dH| |
|
7712 |
||
7713 |
eachFile1 ~= eachFile2 ifTrue:[ |
|
7714 |
v1 := histogramsV at:eachFile1. |
|
7715 |
v2 := histogramsV at:eachFile2. |
|
7716 |
dV := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7717 |
distancesV add:(eachFile2 -> dV). |
|
7718 |
v1 := histogramsH at:eachFile1. |
|
7719 |
v2 := histogramsH at:eachFile2. |
|
7720 |
dH := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7721 |
distancesH add:(eachFile2 -> dH). |
|
7722 |
(dV < 10000 and:[dH < 10000]) ifTrue:[ |
|
8512 | 7723 |
setOfSimilar add:eachFile2->(dV + dH). |
8510 | 7724 |
]. |
7725 |
] |
|
7726 |
]. |
|
7727 |
distancesV sort:[:a1 :a2 | a1 value < a2 value]. |
|
7728 |
distancesH sort:[:a1 :a2 | a1 value < a2 value]. |
|
7729 |
similarV at:eachFile1 put:distancesV. |
|
7730 |
similarH at:eachFile1 put:distancesH. |
|
7731 |
setOfSimilar notEmpty ifTrue:[ similar at:eachFile1 put:setOfSimilar ]. |
|
7732 |
]. |
|
7733 |
||
7734 |
similar isEmpty ifTrue:[ |
|
7735 |
Dialog information:'No similarities found.'. |
|
7736 |
^ self. |
|
7737 |
]. |
|
7738 |
]. |
|
7739 |
||
15589 | 7740 |
stream := CharacterWriteStream new. |
8512 | 7741 |
alreadyPrinted := Set new. |
7742 |
||
7743 |
imageFiles do:[:eachFile | |
|
7744 |
|eachSet| |
|
7745 |
||
7746 |
(alreadyPrinted includes:eachFile) ifFalse:[ |
|
7747 |
eachSet := similar at:eachFile ifAbsent:nil. |
|
7748 |
eachSet notNil ifTrue:[ |
|
7749 |
stream nextPutLine:eachFile pathName. |
|
7750 |
eachSet do:[:info | |
|
7751 |
|fn2 dist| |
|
7752 |
||
7753 |
fn2 := info key. |
|
7754 |
dist := info value. |
|
7755 |
stream nextPutAll:' '. |
|
7756 |
stream nextPutAll:fn2 pathName. |
|
7757 |
stream nextPutLine:' (',dist printString,')'. |
|
7758 |
alreadyPrinted add:fn2. |
|
7759 |
]. |
|
7760 |
stream cr. |
|
7761 |
]. |
|
8510 | 7762 |
]. |
7763 |
]. |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7764 |
]. |
8510 | 7765 |
|
7766 |
textBox := TextBox new. |
|
7767 |
textBox initialText:(stream contents). |
|
7768 |
textBox title:'File similarities:'. |
|
7769 |
textBox readOnly:true. |
|
7770 |
textBox noCancel. |
|
7771 |
||
7772 |
textBox label:'File similarities'. |
|
7773 |
textBox extent:(400@((similar size max:40)* 10)). |
|
7774 |
textBox maxExtent:Screen current extent. |
|
7775 |
textBox openModeless. "/ showAtPointer. |
|
7776 |
||
7777 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
|
7778 |
! |
|
7779 |
||
4618 | 7780 |
fileHexDump |
17744 | 7781 |
|file item| |
4618 | 7782 |
|
7783 |
file := self firstSelectedFile. |
|
7784 |
file notNil ifTrue:[ |
|
7785 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 7786 |
self |
7787 |
applicationNamed:#FileApplicationNoteBook |
|
7788 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 7789 |
]. |
17744 | 7790 |
|
7791 |
"Modified (format): / 12-11-2017 / 11:19:56 / cg" |
|
4618 | 7792 |
! |
7793 |
||
7324 | 7794 |
fileIn:aFilename |
7795 |
"fileIn a file" |
|
7796 |
||
7797 |
self fileIn:aFilename lazy:false |
|
7798 |
||
7799 |
"Created: / 20-09-2006 / 14:30:06 / cg" |
|
7800 |
! |
|
7801 |
||
7802 |
fileIn:aFilename lazy:lazy |
|
7803 |
"fileIn a file" |
|
7804 |
||
7805 |
self withActivityIndicationDo:[ |
|
7806 |
self notify:('File in:', aFilename asFilename baseName). |
|
7807 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7808 |
self notify:nil. |
|
7809 |
] |
|
7810 |
||
7811 |
"Created: / 20-09-2006 / 14:29:21 / cg" |
|
7812 |
! |
|
7813 |
||
4930 | 7814 |
filterSelectedFiles:whichFilter |
7815 |
|selectedFiles numFiles msg filterBlock| |
|
7816 |
||
7560 | 7817 |
selectedFiles := self currentSelectedObjects. |
4930 | 7818 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
7819 |
||
7820 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
7821 |
numFiles > 1 ifTrue:[ |
|
7822 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
7823 |
]. |
|
7824 |
||
7825 |
(Dialog |
|
6352 | 7826 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 7827 |
initialAnswer:false |
7828 |
) ifFalse:[ |
|
7829 |
^ self |
|
7830 |
]. |
|
7831 |
||
7832 |
whichFilter == #rot13 ifTrue:[ |
|
7833 |
filterBlock := [:charIn | charIn rot13 ]. |
|
7834 |
]. |
|
7835 |
"/ add more here... |
|
7836 |
||
7837 |
filterBlock isNil ifTrue:[ |
|
7838 |
self information:'No such filter: ' , whichFilter. |
|
7839 |
^ self. |
|
7840 |
]. |
|
7841 |
||
7842 |
selectedFiles do:[:fileName | |
|
7843 |
|s| |
|
7844 |
||
7845 |
self notify:('Processing:', fileName baseName). |
|
18453 | 7846 |
fileName isRegularFile ifTrue:[ |
4930 | 7847 |
[ |
7848 |
|inFile outFile in out| |
|
7849 |
||
7850 |
inFile := fileName asFilename. |
|
7851 |
outFile := (fileName pathName , '.filter') asFilename. |
|
7852 |
||
7853 |
[ |
|
7854 |
|charIn charOut| |
|
7855 |
||
7856 |
in := inFile readStream. |
|
7857 |
out := outFile writeStream. |
|
7858 |
[in atEnd] whileFalse:[ |
|
7859 |
charIn := in next. |
|
7860 |
charOut := filterBlock value:charIn. |
|
7861 |
out nextPut:charOut. |
|
7862 |
]. |
|
13683 | 7863 |
out close. out:= nil. |
4930 | 7864 |
outFile renameTo:inFile. |
7865 |
] ensure:[ |
|
7866 |
out notNil ifTrue:[ out close ]. |
|
7867 |
in notNil ifTrue:[ in close ]. |
|
18024 | 7868 |
outFile remove. |
4930 | 7869 |
] |
7870 |
] on:FileStream openErrorSignal do:[:ex| |
|
7871 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
7872 |
]. |
|
7873 |
] |
|
7874 |
]. |
|
6190 | 7875 |
self notify:nil. |
7560 | 7876 |
|
7877 |
"Modified: / 04-12-2006 / 13:14:48 / cg" |
|
4930 | 7878 |
! |
7879 |
||
9784 | 7880 |
forEachParsedXmlFileDo:aBlock |
7881 |
"parse all selected XML files, for each dom-tree, evaluate aBlock" |
|
7882 |
||
7883 |
self withActivityIndicationDo:[ |
|
7884 |
| selectedFiles xmlDocument | |
|
7885 |
||
7886 |
selectedFiles:= self currentSelectedFiles. |
|
7887 |
selectedFiles do:[:fileName | |
|
7888 |
XML::XMLSignal handle:[:ex | |
|
14551 | 7889 |
Dialog |
7890 |
information:('Error while reading XML:\ %1' bindWith:ex description) withCRs |
|
7891 |
title:'XML Error'. |
|
9784 | 7892 |
^ self. |
7893 |
] do:[ |
|
7894 |
|s d magic encoder document| |
|
7895 |
||
7896 |
s := fileName asFilename readStream. |
|
14012 | 7897 |
[ |
7898 |
s binary. |
|
7899 |
magic := (s next:2). |
|
7900 |
magic = #[254 255] ifTrue:[ |
|
7901 |
"/ UTF16BE |
|
7902 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16be. |
|
7903 |
] ifFalse:[ |
|
7904 |
magic = #[255 254] ifTrue:[ |
|
7905 |
"/ UTF16LE |
|
7906 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16le. |
|
7907 |
]. |
|
7908 |
]. |
|
7909 |
] ensure:[ |
|
7910 |
s close. |
|
7911 |
]. |
|
9784 | 7912 |
document notNil ifTrue:[ |
7913 |
xmlDocument := XML::XMLParser |
|
7914 |
processDocumentString:document |
|
7915 |
beforeScanDo:[:parse| parse validate:false]. |
|
7916 |
] ifFalse:[ |
|
7917 |
xmlDocument := XML::XMLParser |
|
7918 |
processDocumentInFilename:fileName |
|
7919 |
beforeScanDo:[:parse| parse validate:false]. |
|
7920 |
] |
|
7921 |
]. |
|
7922 |
aBlock value:xmlDocument. |
|
7923 |
]. |
|
7924 |
] |
|
7925 |
||
7926 |
"Created: / 17-02-2011 / 13:58:21 / cg" |
|
7927 |
! |
|
7928 |
||
8832 | 7929 |
forEachSelectedFileIgnoringDirectories:ignoreDirs do:aBlock |
7930 |
|numItems path files| |
|
7931 |
||
7932 |
files := self currentSelectedFiles. |
|
7933 |
||
7934 |
(numItems := files size) > 2 ifTrue:[ |
|
7935 |
(self |
|
7936 |
confirm:(resources string:'Open for each of the %1 items ?' |
|
7937 |
with:numItems)) ifFalse:[^ self]. |
|
7938 |
]. |
|
7939 |
||
7940 |
self withActivityIndicationDo:[ |
|
7941 |
files do:[:fileName | |
|
7942 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
7943 |
fileName isAbsolute ifTrue:[ |
|
17239 | 7944 |
path := fileName name. |
8832 | 7945 |
] ifFalse:[ |
7946 |
path := fileName pathName. |
|
7947 |
]. |
|
7948 |
aBlock value:path |
|
7949 |
] |
|
7950 |
]. |
|
7951 |
]. |
|
17239 | 7952 |
|
7953 |
"Modified: / 19-01-2017 / 16:57:03 / stefan" |
|
8832 | 7954 |
! |
7955 |
||
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7956 |
generateDetachedSignaturesForSelectedFiles |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7957 |
"generate detached signature (pkcs7) files from the contents of the selected files. |
16941 | 7958 |
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
|
7959 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7960 |
self withActivityIndicationDo:[ |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7961 |
self currentSelectedFiles do:[:fn | |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7962 |
|data hash signature signatureFile| |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7963 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7964 |
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
|
7965 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7966 |
data := fn contentsAsString. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7967 |
hash := SHA1Stream hashValueOf:data. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7968 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7969 |
signature := Expecco::KeyFileGenerator new signExpeccoCode:hash. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7970 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7971 |
signatureFile := fn addSuffix:'sig'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7972 |
signatureFile contents:signature. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7973 |
]. |
13677 | 7974 |
self updateCurrentDirectoryWithReread. |
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7975 |
self notify:nil. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7976 |
] |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7977 |
! |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7978 |
|
15211 | 7979 |
generatePatchInstallerForSelectedFiles |
7980 |
"generate an expecco patch, which installs the selected file(s). |
|
7981 |
Opens a dialog asking for the target directory and if the patch should be signed" |
|
7982 |
||
7983 |
|dialog targetDirHolder targetDir |
|
7984 |
generateSignedPatchHolder patchFileNameHolder patchFileName| |
|
7985 |
||
7986 |
targetDirHolder := '.' asValue. |
|
7987 |
generateSignedPatchHolder := true asValue. |
|
7988 |
patchFileNameHolder := '/tmp/00nn_patchFile.st' asValue. |
|
7989 |
||
7990 |
dialog := Dialog new. |
|
7991 |
dialog label:(resources string:'Patch Installer for File(s)'). |
|
7992 |
dialog addTextLabel:'Patchfile Name' adjust:#left. |
|
7993 |
dialog addInputFieldOn:patchFileNameHolder tabable:true. |
|
7994 |
dialog addTextLabel:'Target directory (relative to executable''s directory at execution time)' adjust:#left. |
|
7995 |
dialog addInputFieldOn:targetDirHolder tabable:true. |
|
7996 |
dialog addCheckBox:'Generate Signed Patch' on:generateSignedPatchHolder. |
|
7997 |
dialog addAbortAndOkButtons. |
|
7998 |
dialog open. |
|
7999 |
||
8000 |
dialog accepted ifFalse:[^ self]. |
|
8001 |
||
8002 |
targetDir := targetDirHolder value asFilename. |
|
8003 |
patchFileName := patchFileNameHolder value asFilename. |
|
8004 |
||
8005 |
self withActivityIndicationDo:[ |
|
8006 |
|outStream zipArchive pkcs7SignedData signatureFilename| |
|
8007 |
||
8008 |
self notify:'Generating self extracting st script: ', patchFileName name, '...'. |
|
8009 |
outStream := patchFileName writeStream. |
|
8010 |
outStream nextPutAll:' |
|
8011 |
|patchStream zipArchive| |
|
8012 |
patchStream := Expecco::Browser::CurrentPatchStreamQuery query. |
|
8013 |
patchStream isNil ifTrue:[ self error:''sorry, this patch can only be installed in expecco 2.6.2 and newer (missing CurrentPatchStreamQuery)'']. |
|
8014 |
zipArchive := ZipArchive readingFrom:patchStream. |
|
8015 |
zipArchive members do:[:each | zipArchive extract:each fileName]. |
|
8016 |
patchStream setToEnd. "/ to force fileIn to finish |
|
8017 |
!! |
|
8018 |
||
8019 |
!! !! |
|
8020 |
||
8021 |
'. |
|
8022 |
zipArchive := ZipArchive writingTo:outStream. "/ newFileNamed:(patchFileName). |
|
8023 |
||
8024 |
self currentSelectedFiles do:[:fn | |
|
8025 |
|inStream signatureFilename| |
|
8026 |
||
8027 |
inStream := fn asFilename readStream. |
|
8028 |
zipArchive addFile: (targetDir construct:fn asFilename baseName) name fromStream:inStream. |
|
8029 |
inStream close. |
|
8030 |
]. |
|
8031 |
||
16975 | 8032 |
zipArchive close. |
15211 | 8033 |
|
8034 |
generateSignedPatchHolder value ifTrue:[ |
|
8035 |
self notify:'Generating signed file from: ', patchFileName name, '...'. |
|
8036 |
||
8037 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:patchFileName contentsOfEntireFile. |
|
8038 |
signatureFilename := patchFileName withSuffix:'expeccoPatch'. |
|
8039 |
signatureFilename contents:pkcs7SignedData. |
|
8040 |
]. |
|
8041 |
self notify:nil. |
|
8042 |
] |
|
8043 |
! |
|
13783 | 8044 |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8045 |
generateSignaturesForSelectedFiles |
13783 | 8046 |
"generate signed pkcs7 files from the contents of the selected files. |
8047 |
These can be delivered as expeccoPatch files" |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8048 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8049 |
self withActivityIndicationDo:[ |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8050 |
self currentSelectedFiles do:[:fn | |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8051 |
|pkcs7SignedData signatureFilename| |
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8052 |
|
8646 | 8053 |
self notify:'Generating signed file from: ', (fn baseName), '...'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8054 |
|
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8055 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:fn contentsOfEntireFile. |
12094 | 8056 |
signatureFilename := fn withSuffix:'expeccoPatch'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8057 |
signatureFilename contents:pkcs7SignedData. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8058 |
]. |
13677 | 8059 |
self updateCurrentDirectoryWithReread. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8060 |
self notify:nil. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8061 |
] |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8062 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8063 |
|
9784 | 8064 |
inspectXmlFile |
8065 |
"Show an XML file - either in an XMLInspector or fall back to |
|
8066 |
a plain inspector on the XML tree" |
|
8067 |
||
8068 |
self forEachParsedXmlFileDo:[:xmlDocument | |
|
8069 |
XML::XMLInspector notNil ifTrue:[ |
|
8070 |
XML::XMLInspector openOn:xmlDocument. |
|
8071 |
] ifFalse:[ |
|
8072 |
"fall back..." |
|
8073 |
xmlDocument inspect. |
|
8074 |
] |
|
8075 |
]. |
|
8076 |
||
8077 |
"Modified: / 17-02-2011 / 13:58:16 / cg" |
|
8078 |
! |
|
8079 |
||
3892 | 8080 |
installAllAsAutoloaded |
8081 |
"install all classes found here as autoloaded classes" |
|
8082 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8083 |
self installAllAsAutoloadedRecursive:false |
3892 | 8084 |
! |
8085 |
||
6521 | 8086 |
installAllAsAutoloadedRecursive |
8087 |
"install all classes found here and in subdirectories as autoloaded classes" |
|
8088 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8089 |
self installAllAsAutoloadedRecursive:true |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8090 |
! |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8091 |
|
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8092 |
installAllAsAutoloadedRecursive:aBoolean |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8093 |
"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
|
8094 |
|
6521 | 8095 |
[ |
15507 | 8096 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
8097 |
|installAction| |
|
8098 |
||
8099 |
installAction := |
|
8100 |
[:fn | |
|
8101 |
(fn suffix = 'st') ifTrue:[ |
|
8102 |
self notify:('Install as autoloaded: ', fn baseName). |
|
8103 |
self installAsAutoloaded:fn. |
|
8104 |
] |
|
8105 |
]. |
|
8106 |
||
8107 |
self withActivityIndicationDo:[ |
|
8108 |
self currentSelectedDirectories do:[:dir| |
|
8109 |
aBoolean ifTrue:[ |
|
8110 |
dir recursiveDirectoryContentsAsFilenamesDo:installAction |
|
8111 |
] ifFalse:[ |
|
8112 |
dir directoryContentsAsFilenamesDo:installAction |
|
15152 | 8113 |
]. |
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8114 |
]. |
15507 | 8115 |
self notify:nil. |
8116 |
]. |
|
8117 |
] |
|
6521 | 8118 |
] fork. |
8119 |
! |
|
8120 |
||
3892 | 8121 |
installAsAutoloaded:aFilename |
8122 |
"install aFilename as autoloaded class" |
|
8123 |
||
13292 | 8124 |
Smalltalk installAutoloadedClassFromSourceFile:aFilename |
8125 |
||
8126 |
"Modified: / 01-08-2013 / 16:58:09 / cg" |
|
3892 | 8127 |
! |
8128 |
||
15211 | 8129 |
joinSelectedFiles |
8130 |
|selectedFiles numFiles msg outFileName outFile outStream| |
|
8131 |
||
8132 |
selectedFiles := self currentSelectedObjects. |
|
8133 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
8134 |
||
8135 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
8136 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
8137 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
|
8138 |
outFile := selectedFiles first directory construct:outFileName. |
|
8139 |
||
8140 |
outStream := outFile writeStream. |
|
8141 |
||
8142 |
selectedFiles do:[:fileName | |
|
8143 |
self notify:('Adding:', fileName baseName). |
|
17997 | 8144 |
fileName readingFileDo:[:inStream | |
8145 |
inStream copyToEndInto:outStream. |
|
8146 |
]. |
|
15211 | 8147 |
]. |
8148 |
outStream close. |
|
8149 |
self notify:nil. |
|
8150 |
||
8151 |
"Modified: / 04-12-2006 / 13:15:10 / cg" |
|
8152 |
! |
|
4558 | 8153 |
|
6292 | 8154 |
loadImageThenDo:aBlock |
3892 | 8155 |
|img path files| |
8156 |
||
3982 | 8157 |
files := self currentSelectedFiles. |
3892 | 8158 |
files isEmpty ifTrue:[ ^ self]. |
8159 |
files do:[:fileName | |
|
4414 | 8160 |
path := fileName. |
18453 | 8161 |
path isRegularFile ifTrue:[ |
4414 | 8162 |
img := Image fromFile:(path pathName). |
8163 |
img notNil ifTrue:[ |
|
6292 | 8164 |
aBlock value:img |
4414 | 8165 |
] ifFalse:[ |
15346 | 8166 |
Dialog warn:(resources string:'Unknown image format: "%1"' with:fileName asString) |
4414 | 8167 |
] |
8168 |
] |
|
3892 | 8169 |
]. |
8170 |
! |
|
8171 |
||
13089 | 8172 |
loadSignatureSupport |
8173 |
Expecco::KeyFileGenerator isNil ifTrue:[ |
|
14047 | 8174 |
Smalltalk loadPackage:'exept:expecco/license' |
13089 | 8175 |
]. |
8176 |
! |
|
8177 |
||
3892 | 8178 |
openASN1Browser |
8179 |
||
8180 |
self openTool:OSI::ASN1Browser |
|
8181 |
! |
|
8182 |
||
8183 |
openAppletViewer |
|
8184 |
|numItems files| |
|
8185 |
||
3982 | 8186 |
files := self currentSelectedFiles. |
3892 | 8187 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 8188 |
(self |
8189 |
confirm:(resources string:'open for each of the %1 items ?' |
|
8190 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 8191 |
]. |
8192 |
||
8193 |
Java startupJavaSystem. |
|
8194 |
"/ Java markAllClassesUninitialized. |
|
8195 |
"/ Java initAllStaticFields. |
|
8196 |
"/ Java initAllClasses. |
|
8197 |
||
8198 |
files do:[:fileName | |
|
4414 | 8199 |
|p path| |
8200 |
||
8201 |
path := fileName. |
|
18453 | 8202 |
path isRegularFile ifTrue:[ |
4414 | 8203 |
p := Java |
8204 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
8205 |
argumentString:path pathName. |
|
8206 |
p resume. |
|
8207 |
] |
|
3892 | 8208 |
]. |
8209 |
! |
|
8210 |
||
8211 |
openCBrowser |
|
6031 | 8212 |
|dir files| |
5880 | 8213 |
|
8214 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8215 |
dir isNil ifTrue:[ ^ self]. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8216 |
self withActivityIndicationDo:[ |
7560 | 8217 |
files := self currentSelectedObjects. |
6031 | 8218 |
files notEmptyOrNil ifTrue:[ |
8219 |
CBrowser::Browser openOn:files first. |
|
8220 |
] ifFalse:[ |
|
8221 |
CBrowser::Browser openIn:dir. |
|
8222 |
] |
|
3892 | 8223 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8224 |
|
7560 | 8225 |
"Modified: / 04-12-2006 / 13:15:19 / cg" |
3892 | 8226 |
! |
8227 |
||
4230 | 8228 |
openChangeSetBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8229 |
"open a changeSet browser on the selected file(s)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8230 |
|
4230 | 8231 |
self |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8232 |
openTool:(UserPreferences current changeSetBrowserClass) |
4230 | 8233 |
with:#openOnFile: |
8234 |
ignoreDirectories:true |
|
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8235 |
|
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8236 |
"Modified (comment): / 27-07-2012 / 20:42:55 / cg" |
4230 | 8237 |
! |
8238 |
||
3892 | 8239 |
openChangesBrowser |
8240 |
"open a change browser on the selected file(s)" |
|
8241 |
||
18246 | 8242 |
self currentSelectedDirectories notEmptyOrNil ifTrue:[ |
18248 | 8243 |
GitHubSmalltalkPackageReader notNil ifTrue:[ |
8244 |
self currentSelectedDirectories do:[:fn | |
|
8245 |
(fn suffix = 'package') ifTrue:[ |
|
8246 |
ChangeSetBrowser openOn:(GitHubSmalltalkPackageReader readPackageFrom:fn). |
|
8247 |
]. |
|
8248 |
(fn suffix = 'class') ifTrue:[ |
|
8249 |
ChangeSetBrowser openOn:(GitHubSmalltalkClassReader readClassFrom:fn). |
|
8250 |
]. |
|
8251 |
]. |
|
8252 |
^ self. |
|
8253 |
]. |
|
18246 | 8254 |
]. |
8255 |
||
3892 | 8256 |
self openTool:(UserPreferences current changesBrowserClass) |
18246 | 8257 |
|
18248 | 8258 |
"Modified: / 30-06-2018 / 20:33:24 / Claus Gittinger" |
3892 | 8259 |
! |
8260 |
||
8261 |
openDiffView |
|
15215 | 8262 |
"open a diff-view on the two selected files" |
8263 |
||
8264 |
|name1 name2 files title |
|
8265 |
defaultName defaultDir| |
|
6460 | 8266 |
|
8267 |
files := self currentSelectedObjects. |
|
3892 | 8268 |
files isEmpty ifTrue:[ |
6460 | 8269 |
Dialog warn:(resources string:'You have to select a file first'). |
4414 | 8270 |
^ self. |
3892 | 8271 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8272 |
|
3892 | 8273 |
(files size == 2) ifTrue:[ |
4414 | 8274 |
name1 := files last. |
8275 |
name2 := files first. |
|
3892 | 8276 |
] ifFalse:[ |
4414 | 8277 |
LastFileDiffFile notNil ifTrue:[ |
11052 | 8278 |
LastFileDiffFile exists ifTrue:[ |
8279 |
name1 := LastFileDiffFile. |
|
8280 |
]. |
|
8281 |
"/ | directory | |
|
8282 |
"/ directory := self currentDirectory. |
|
8283 |
"/ directory notNil ifTrue:[ |
|
8284 |
"/ lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
8285 |
"/ (lastFile exists and:[lastFile isReadable]) ifTrue:[ |
|
8286 |
"/ name1 := lastFile. |
|
8287 |
"/ ] |
|
8288 |
"/ ] |
|
4414 | 8289 |
]. |
8290 |
name2 := files first. |
|
6460 | 8291 |
title := resources string:'Show differences between "%1" and:' with:name2 baseName. |
4414 | 8292 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
11052 | 8293 |
defaultDir := name1 notNil ifTrue:[name1 directory] ifFalse:[self currentDirectory]. |
4414 | 8294 |
name1 := DialogBox |
8295 |
requestFileName:title |
|
8296 |
default:defaultName |
|
6460 | 8297 |
ok:(resources string:'OK') |
8298 |
abort:(resources string:'Compare against File List') |
|
4414 | 8299 |
pattern:'*' |
11052 | 8300 |
fromDirectory:defaultDir. |
3892 | 8301 |
]. |
15215 | 8302 |
self openDiffViewOn:name1 and:name2 |
8303 |
||
8304 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
|
8305 |
! |
|
8306 |
||
8307 |
openDiffViewOn:fileArg1 and:fileArg2 |
|
8308 |
"open a diff-view on two files" |
|
8309 |
||
17769 | 8310 |
|file1 file2 file1Size file2Size text1 text2 d err nm l1 sameContents msg| |
15215 | 8311 |
|
8312 |
file1 := fileArg1. |
|
8313 |
file2 := fileArg2. |
|
3892 | 8314 |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8315 |
self withWaitCursorDo:[ |
15215 | 8316 |
(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
|
8317 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
14126 | 8318 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l string]]. |
15215 | 8319 |
file1 := nil. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8320 |
l1 := 'browser contents' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8321 |
] ifFalse:[ |
15215 | 8322 |
file1 := file1 asFilename. |
8323 |
LastFileDiffFile := file1. |
|
8324 |
file1 isReadable ifFalse:[ |
|
8325 |
nm := file1. |
|
8326 |
file1 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8327 |
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
|
8328 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8329 |
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
|
8330 |
]. |
4414 | 8331 |
]. |
15215 | 8332 |
l1 := file1 pathName |
4414 | 8333 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8334 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8335 |
err isNil ifTrue:[ |
15215 | 8336 |
file2 isReadable ifFalse:[ |
8337 |
nm := file2. |
|
8338 |
file2 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8339 |
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
|
8340 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8341 |
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
|
8342 |
]. |
4414 | 8343 |
]. |
8344 |
]. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8345 |
err notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8346 |
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
|
8347 |
^ self |
6176 | 8348 |
]. |
8349 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8350 |
self withActivityIndicationDo:[ |
17769 | 8351 |
file1Size := file1 isNil ifTrue:[0] ifFalse:[file1 fileSize]. |
8352 |
file2Size := file2 isNil ifTrue:[0] ifFalse:[file2 fileSize]. |
|
8353 |
||
8354 |
((file1Size > (1024*1024*32)) or:[ file2Size > (1024*1024*32) ]) ifTrue:[ |
|
8355 |
file1Size = file2Size ifTrue:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8356 |
ProgressIndicator |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8357 |
displayBusyIndicator:'Comparing...' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8358 |
at:(Screen default center) |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8359 |
during:[ |
15215 | 8360 |
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
|
8361 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8362 |
sameContents ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8363 |
self information:'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8364 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8365 |
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
|
8366 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8367 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8368 |
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
|
8369 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8370 |
^ self. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8371 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8372 |
|
15215 | 8373 |
file1 notNil ifTrue:[ |
8374 |
file1 isDirectory ifTrue:[ |
|
8375 |
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
|
8376 |
] ifFalse:[ |
15215 | 8377 |
text1 := file1 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8378 |
] |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8379 |
]. |
15215 | 8380 |
file2 isDirectory ifTrue:[ |
8381 |
text2 := file2 directoryContents asString. |
|
6460 | 8382 |
] ifFalse:[ |
15215 | 8383 |
text2 := file2 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8384 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8385 |
text1 = text2 ifTrue:[ |
15215 | 8386 |
(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
|
8387 |
msg := 'Same filename lists.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8388 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8389 |
msg := 'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8390 |
]. |
16911 | 8391 |
self information:msg |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8392 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8393 |
d := DiffTextView |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8394 |
openOn:text1 label:l1 |
15215 | 8395 |
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
|
8396 |
d topView label:(resources string:'File Differences'). |
6460 | 8397 |
] |
4414 | 8398 |
] |
3892 | 8399 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8400 |
|
17769 | 8401 |
"Modified: / 19-11-2017 / 15:00:47 / cg" |
3892 | 8402 |
! |
8403 |
||
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8404 |
openDirectoryDiffView |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8405 |
"open a directory diff-view" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8406 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8407 |
|name1 name2 files| |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8408 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8409 |
files := self currentSelectedObjects. |
11108 | 8410 |
files notEmpty ifTrue:[ |
8411 |
name1 := files first asFilename. |
|
18453 | 8412 |
name1 asFilename isRegularFile ifTrue:[ |
11108 | 8413 |
name1 := name1 directory |
8414 |
]. |
|
8415 |
]. |
|
8416 |
||
8417 |
(files size == 2) ifTrue:[ |
|
8418 |
name2 := files second. |
|
8419 |
] ifFalse:[ |
|
8420 |
(files size ~= 1) ifTrue:[ |
|
8421 |
Dialog warn:(resources string:'Please select one or two directories.'). |
|
8422 |
^ self. |
|
8423 |
]. |
|
8424 |
name2 := Dialog |
|
8425 |
requestDirectoryName:(resources |
|
8426 |
string:'Recursive compare "%1" with folder:' |
|
8427 |
with:name1 asFilename baseName) |
|
8428 |
default:(LastFileDiffDirectory ? self currentDirectory). |
|
8429 |
name2 isEmptyOrNil ifTrue:[^ self]. |
|
8430 |
LastFileDiffDirectory := name2. |
|
8431 |
]. |
|
8432 |
name2 := name2 asFilename. |
|
8433 |
||
18453 | 8434 |
name2 asFilename isRegularFile ifTrue:[ |
11108 | 8435 |
name2 := name2 directory |
8436 |
]. |
|
8437 |
||
8438 |
self |
|
8439 |
applicationNamed:#FileApplicationNoteBook |
|
8440 |
ifPresentDo:[:appl | ^ appl openCompareDirectory:name1 with:name2]. |
|
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8441 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8442 |
"Created: / 20-05-2010 / 15:01:17 / cg" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8443 |
! |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8444 |
|
3892 | 8445 |
openEditor |
8446 |
self openTool:EditTextView |
|
8447 |
! |
|
8448 |
||
4957 | 8449 |
openGV |
8450 |
self openOSCommandWithFiles:'gv' |
|
8451 |
! |
|
8452 |
||
3892 | 8453 |
openHTMLReader |
8454 |
||
8455 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
8456 |
! |
|
8457 |
||
8458 |
openImageEditor |
|
6292 | 8459 |
[ |
8460 |
self loadImageThenDo:[:img | img edit] |
|
8461 |
] fork |
|
3892 | 8462 |
! |
8463 |
||
8464 |
openImageInspector |
|
6292 | 8465 |
[ |
8466 |
self loadImageThenDo:[:img | img inspect] |
|
8467 |
] fork |
|
3892 | 8468 |
! |
8469 |
||
8470 |
openImagePreview |
|
5778 | 8471 |
[ |
8472 |
self |
|
6292 | 8473 |
loadImageThenDo: |
5778 | 8474 |
[:img | |
8475 |
|i top viewer| |
|
8476 |
||
8477 |
top := StandardSystemView new. |
|
8478 |
||
8479 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8480 |
i := img. |
|
8481 |
top extent:200@200. |
|
8482 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
8483 |
top openAndWait. |
|
8484 |
||
8485 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
8486 |
i := i magnifiedPreservingRatioTo:200@200. |
|
8487 |
]. |
|
8488 |
viewer image:i. |
|
8489 |
]. |
|
3892 | 8490 |
] fork |
8491 |
! |
|
8492 |
||
8493 |
openMP3Player |
|
8494 |
|file| |
|
8495 |
||
3982 | 8496 |
file := self currentSelectedFiles. |
3892 | 8497 |
(file isEmpty) ifTrue:[ |
4414 | 8498 |
^ self. |
3892 | 8499 |
]. |
8500 |
file := file first. |
|
8501 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
8502 |
! |
|
8503 |
||
4957 | 8504 |
openOSCommandWithFiles:command |
8505 |
|files fileNames| |
|
8506 |
||
8507 |
files := self currentSelectedFiles. |
|
8508 |
(files isEmpty) ifTrue:[ |
|
8509 |
^ self. |
|
8510 |
]. |
|
8511 |
||
8512 |
fileNames := files collect:[:each | |
|
8513 |
'"' , each asFilename pathName , '"' |
|
8514 |
]. |
|
8515 |
||
8516 |
[ |
|
8517 |
OperatingSystem |
|
4959 | 8518 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
8519 |
inDirectory:(files first asFilename directory). |
|
4957 | 8520 |
] fork |
8521 |
! |
|
8522 |
||
4820 | 8523 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8524 |
|files fileNames cmd arg| |
4820 | 8525 |
|
8526 |
files := self currentSelectedFiles. |
|
8527 |
(files isEmpty) ifTrue:[ |
|
8528 |
^ self. |
|
8529 |
]. |
|
12972 | 8530 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'. |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8531 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8532 |
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
|
8533 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8534 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8535 |
|
4820 | 8536 |
fileNames := |
8537 |
files |
|
8538 |
collect: |
|
8539 |
[:each | |
|
8540 |
'"' , each asFilename pathName , '"' |
|
8541 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8542 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8543 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8544 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8545 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8546 |
]. |
4820 | 8547 |
|
4950 | 8548 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8549 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 8550 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8551 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8552 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 8553 |
! |
8554 |
||
4958 | 8555 |
openRP |
8556 |
self openOSCommandWithFiles:'realplay' |
|
8557 |
! |
|
8558 |
||
8426 | 8559 |
openResourceFileEditor |
8560 |
||
8561 |
self |
|
8562 |
openTool: Tools::InternationalLanguageTranslationEditor |
|
8563 |
with: #openOnFile: |
|
8564 |
! |
|
8565 |
||
3892 | 8566 |
openSlideShow |
5880 | 8567 |
|dir| |
8568 |
||
8569 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8570 |
dir isNil ifTrue:[^ self]. |
|
8571 |
||
3892 | 8572 |
CodingExamples_GUI::SlideShow openIn:dir. |
8573 |
! |
|
8574 |
||
8575 |
openSnapshotImageBrowser |
|
4491 | 8576 |
"Sorry, for now, only the old browser can handle snapShotImages." |
8577 |
||
3892 | 8578 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
8579 |
! |
|
8580 |
||
8581 |
openTerminal |
|
5880 | 8582 |
|dir| |
8583 |
||
8584 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 8585 |
|
5300 | 8586 |
TerminalApplication notNil ifTrue:[ |
8587 |
TerminalApplication openIn:dir |
|
8588 |
] ifFalse:[ |
|
8589 |
VT100TerminalView openShellIn:dir. |
|
8590 |
]. |
|
3892 | 8591 |
! |
8592 |
||
8593 |
openTool:aToolClass |
|
8594 |
"open a tool on the selected file(s)" |
|
8595 |
||
8596 |
^ self openTool:aToolClass ignoreDirectories:true |
|
8597 |
! |
|
8598 |
||
8599 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
8600 |
"open a tool on the selected file(s)" |
|
8601 |
||
8602 |
^ self |
|
4414 | 8603 |
openTool:aToolClass |
8604 |
with:#openOn: |
|
8605 |
ignoreDirectories:ignoreDirs |
|
3892 | 8606 |
! |
8607 |
||
8426 | 8608 |
openTool:aToolClass with:aSelector |
8609 |
"open a tool on the selected file(s)" |
|
8610 |
||
8611 |
^ self openTool:aToolClass with:aSelector ignoreDirectories:true |
|
8612 |
! |
|
8613 |
||
3892 | 8614 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
8615 |
"open a tool on the selected file(s)" |
|
8616 |
||
8832 | 8617 |
|tool| |
3892 | 8618 |
|
8619 |
aToolClass isNil ifTrue:[ |
|
4414 | 8620 |
Dialog warn:'Sorry, that tool seems to be not available'. |
8621 |
^ nil. |
|
3892 | 8622 |
]. |
8832 | 8623 |
self forEachSelectedFileIgnoringDirectories:ignoreDirs do:[:path | |
8624 |
tool := aToolClass perform:aSelector with:path. |
|
3892 | 8625 |
]. |
8626 |
^ tool |
|
8832 | 8627 |
! |
8628 |
||
8629 |
openWebBrowser |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8630 |
self |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8631 |
forEachSelectedFileIgnoringDirectories:true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8632 |
do:[:path | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8633 |
Error |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8634 |
handle:[:ex | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8635 |
Dialog warn:'Shell execution failed: ',ex description |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8636 |
] do:[ |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8637 |
OperatingSystem openApplicationForDocument:path operation:#open. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8638 |
^ self. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8639 |
] |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8640 |
]. |
3892 | 8641 |
! |
8642 |
||
6022 | 8643 |
openWorkspace |
8644 |
self |
|
8645 |
openTool:WorkspaceApplication |
|
8646 |
with:#openOnFile: |
|
8647 |
ignoreDirectories:true |
|
8648 |
! |
|
8649 |
||
4950 | 8650 |
openXV |
4957 | 8651 |
self openOSCommandWithFiles:'xv' |
4950 | 8652 |
! |
8653 |
||
3892 | 8654 |
openZipTool |
5880 | 8655 |
|zipTool| |
3892 | 8656 |
|
8657 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 8658 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 8659 |
]. |
8660 |
! |
|
8661 |
||
8662 |
readAbbrevFile |
|
8663 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
8664 |
||
5880 | 8665 |
|directories| |
3892 | 8666 |
|
3982 | 8667 |
directories := self currentSelectedDirectories. |
3892 | 8668 |
directories isEmpty ifTrue:[^ self]. |
8669 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8670 |
self withActivityIndicationDo:[ |
5880 | 8671 |
directories do:[:eachDir | |
8672 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
8673 |
] |
|
5828 | 8674 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8675 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8676 |
"Modified: / 25-07-2006 / 09:07:43 / cg" |
3892 | 8677 |
! |
8678 |
||
6460 | 8679 |
readAndShowResources |
8680 |
self withActivityIndicationDo:[ |
|
8681 |
| selectedFiles| |
|
8682 |
||
8683 |
selectedFiles:= self currentSelectedFiles. |
|
8684 |
selectedFiles do:[:fileName | |
|
8685 |
resources := ResourcePack fromFile:fileName. |
|
8686 |
resources inspect. |
|
8687 |
]. |
|
8688 |
] |
|
8689 |
! |
|
8690 |
||
17831 | 8691 |
removeBakAndSavFiles |
8692 |
"remove all .sav and .bak files (after confirmation)" |
|
8693 |
||
8694 |
|filesToRemove directories| |
|
8695 |
||
8696 |
directories := self currentSelectedDirectories. |
|
8697 |
directories isEmptyOrNil ifTrue:[ |
|
8698 |
directories := Array with:self currentDirectory |
|
8699 |
]. |
|
8700 |
||
8701 |
self withActivityIndicationDo:[ |
|
8702 |
filesToRemove := OrderedCollection new. |
|
8703 |
directories do:[:eachDirectoryToScan | |
|
8704 |
eachDirectoryToScan filesDo:[:fn | |
|
8705 |
(#('sav' 'bak') includes:fn suffix) ifTrue:[ |
|
8706 |
filesToRemove add:fn. |
|
8707 |
] |
|
8708 |
] |
|
8709 |
]. |
|
8710 |
filesToRemove isEmpty ifTrue:[ |
|
8711 |
Dialog information:(resources string:'Nothing to remove'). |
|
8712 |
^ self. |
|
8713 |
]. |
|
8714 |
(Dialog confirm:(resources string:'Remove %1 file(s) ?' with:filesToRemove size)) ifFalse:[ |
|
8715 |
^ self |
|
8716 |
]. |
|
8717 |
filesToRemove do:[:each | |
|
8718 |
each remove |
|
8719 |
]. |
|
17871 | 8720 |
self updateCurrentDirectoryWithReread |
17831 | 8721 |
]. |
8722 |
! |
|
8723 |
||
3892 | 8724 |
singleFileFileIn:fileName lazy:lazy |
8725 |
"fileIn the selected file(s)" |
|
8726 |
||
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8727 |
|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
|
8728 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8729 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8730 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8731 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8732 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8733 |
[ |
4345 | 8734 |
(ObjectFileLoader notNil |
5491 | 8735 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 8736 |
AbortOperationRequest catch:[ |
8737 |
|p| |
|
8738 |
||
8739 |
"/ |
|
8740 |
"/ look if already loaded ... then unload first |
|
8741 |
"/ |
|
8742 |
p := fileName pathName. |
|
8743 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
8744 |
(Dialog confirm:(resources |
|
8745 |
string:'%1 is already loaded; load anyway ?' |
|
8746 |
with:p)) ifFalse:[ |
|
8747 |
^ self |
|
8748 |
]. |
|
8749 |
notifyString := 'unloading old ' , p , ' ...'. |
|
8750 |
Transcript showCR:notifyString. |
|
4523 | 8751 |
self notify:notifyString. |
4345 | 8752 |
ObjectFileLoader unloadObjectFile:p. |
8753 |
]. |
|
8754 |
||
8755 |
notifyString := 'loading ' , p , ' ...'. |
|
8756 |
Transcript showCR:notifyString. |
|
4523 | 8757 |
self notify:notifyString. |
12426 | 8758 |
(ObjectFileLoader loadObjectFile:p) isNil ifTrue:[ |
8759 |
notifyString := 'Error: could not load ' , p. |
|
8760 |
Transcript showCR:notifyString. |
|
8761 |
self notify:notifyString. |
|
8762 |
] ifFalse:[ |
|
8763 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
8764 |
]. |
|
4345 | 8765 |
] |
8766 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
8767 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
8768 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
8769 |
aStream := fileName readStreamOrNil. |
4345 | 8770 |
aStream notNil ifTrue:[ |
8771 |
aStream fileInBinary. |
|
8772 |
] |
|
8773 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8774 |
((fileName hasSuffix:'class') or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 8775 |
"/ loading a java class file |
8776 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 8777 |
JavaClassReader loadFile:fileName |
4345 | 8778 |
] |
8779 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
8780 |
"/ loading a sif (smalltalk interchange format) file |
|
8781 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
8782 |
SmalltalkInterchangeFileManager newForFileIn |
|
8783 |
fileName: fileName pathName; |
|
8784 |
fileIn. |
|
8785 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
|
8786 |
Parcel isNil ifTrue:[ |
|
8787 |
Dialog warn:'Parcel support not loaded.' |
|
8788 |
] ifFalse:[ |
|
8789 |
Parcel loadParcelFrom: fileName pathName |
|
8790 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8791 |
] ifFalse:[ (fileName hasSuffix:'jar') ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8792 |
JavaVM isNil ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8793 |
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
|
8794 |
^ self. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8795 |
] ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8796 |
JavaVM booted ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8797 |
(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
|
8798 |
JavaVM boot. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8799 |
]. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8800 |
JavaVM loadClassesIn: fileName. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8801 |
] |
4345 | 8802 |
] ifFalse:[ |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8803 |
"/ ask programming languages... |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8804 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
14360 | 8805 |
(lang isNil and:[(fileName hasSuffix:'js')]) ifTrue:[ |
14362 | 8806 |
Smalltalk loadPackage:'stx:libjavascript'. |
14360 | 8807 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
8808 |
]. |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8809 |
(lang notNil and:[lang ~= SmalltalkLanguage]) ifTrue:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8810 |
lang fileIn:fileName. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8811 |
] ifFalse:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8812 |
"/ loading a regular (chunk) or xml source file |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8813 |
Error handle:[:ex | |
15675 | 8814 |
self errorNotify:'Error during file in: ', ex description. |
15981 | 8815 |
ex resume. |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8816 |
] do:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8817 |
aStream := fileName readStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8818 |
[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8819 |
Class withoutUpdatingChangesDo:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8820 |
wasLazy := Compiler compileLazy:lazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8821 |
Smalltalk fileInStream:aStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8822 |
]. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8823 |
Class addInfoRecord:('fileIn ' , fileName asString) |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8824 |
] ensure:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8825 |
Compiler compileLazy:wasLazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8826 |
aStream close |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8827 |
] |
4345 | 8828 |
] |
8829 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8830 |
]]]] |
4345 | 8831 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8832 |
] 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
|
8833 |
|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
|
8834 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8835 |
isRedef := false. |
12684 | 8836 |
sig := ex creator. |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8837 |
(dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8838 |
action := #continue |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8839 |
] ifFalse:[ |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8840 |
(sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8841 |
ex reject |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8842 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8843 |
sig == Class methodRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8844 |
msg := 'trying to overwrite method:\\ ' , ex oldMethod whoString , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8845 |
, ex oldPackage , ''' with method from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8846 |
label := 'Method redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8847 |
redefKind := 'method'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8848 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8849 |
] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8850 |
msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8851 |
, ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8852 |
label := 'Class redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8853 |
redefKind := 'class'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8854 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8855 |
] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender| |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8856 |
label := msg := 'Breakpoint/Halt in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8857 |
sender := ex suspendedContext. |
18666 | 8858 |
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
|
8859 |
] ifFalse:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8860 |
label := 'Error in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8861 |
msg := 'error in fileIn: %1' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8862 |
]]]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8863 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8864 |
msg := msg bindWith:ex description. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8865 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8866 |
labels := #('Cancel' 'Skip' 'Debug' 'Compare Sources'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8867 |
values := #(abort skip debug compareSources). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8868 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8869 |
isRedef ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8870 |
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
|
8871 |
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
|
8872 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8873 |
labels := labels , #('Keep Package' ). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8874 |
values := values , #(keep). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8875 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8876 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8877 |
labels := labels , #( 'Continue' 'ContinueForAll'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8878 |
values := values , #( continue continueForAll). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8879 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8880 |
AbortAllOperationWantedQuery query ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8881 |
labels := #('Cancel All') , labels. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8882 |
values := #(cancelAll) , values. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8883 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8884 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8885 |
action := Dialog |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8886 |
choose:(msg withCRs) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8887 |
label:label |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8888 |
image:(WarningBox iconBitmap) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8889 |
labels:labels |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8890 |
values:values |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8891 |
default:#continue |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8892 |
onCancel:#abort. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8893 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8894 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8895 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8896 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8897 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8898 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8899 |
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
|
8900 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8901 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8902 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8903 |
(action == #compareSources) ifTrue:[ |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8904 |
DiffCodeView |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8905 |
openOn:(ex oldMethod source) label:'Old Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8906 |
and:(ex newMethod source) label:'New Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8907 |
title:ex description. |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8908 |
ex resignalAs:ex |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8909 |
]. |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
8910 |
(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
|
8911 |
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
|
8912 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8913 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8914 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8915 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8916 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8917 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8918 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8919 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8920 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8921 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8922 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8923 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8924 |
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
|
8925 |
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
|
8926 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8927 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8928 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8929 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8930 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8931 |
] |
7040 | 8932 |
|
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8933 |
"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
|
8934 |
"Modified: / 19-02-2014 / 12:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4531 | 8935 |
! |
8936 |
||
4558 | 8937 |
splitFile:infile intoPiecesOfSize:kiloBytes |
8938 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
8939 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
8940 |
||
8941 |
bufferSize := 32*1024. |
|
8942 |
||
8943 |
inStream := infile readStream. |
|
8944 |
||
8945 |
bytesPerSplit := kiloBytes * 1024. |
|
8946 |
||
8947 |
remaining := infile fileSize. |
|
8948 |
splitIndex := 1. |
|
8949 |
[remaining > 0] whileTrue:[ |
|
8950 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8951 |
outStream := outFile asFilename writeStream. |
|
8952 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
8953 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
8954 |
buffer := ByteArray new:bufferSize. |
|
8955 |
n := inStream |
|
8956 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
8957 |
into:buffer |
|
8958 |
startingAt:1. |
|
8959 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
8960 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
8961 |
remaining := remaining - n. |
|
8962 |
]. |
|
8963 |
outStream close. |
|
8964 |
splitIndex := splitIndex + 1. |
|
8965 |
]. |
|
8966 |
inStream close. |
|
8967 |
! |
|
8968 |
||
15906 | 8969 |
splitFile:infile intoPiecesWithNumberOfLines:numberOfLines |
8970 |
|splitIndex line |
|
8971 |
inStream outFile outStream remainingLinesInThisOutfile| |
|
8972 |
||
8973 |
inStream := infile readStream. |
|
8974 |
||
8975 |
splitIndex := 1. |
|
8976 |
[inStream atEnd] whileFalse:[ |
|
8977 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8978 |
outStream := outFile asFilename writeStream. |
|
8979 |
remainingLinesInThisOutfile := numberOfLines. |
|
8980 |
[(remainingLinesInThisOutfile > 0) and:[inStream atEnd not]] whileTrue:[ |
|
8981 |
line := inStream nextLine. |
|
15910 | 8982 |
outStream nextPutLine:line. |
15906 | 8983 |
remainingLinesInThisOutfile := remainingLinesInThisOutfile - 1. |
8984 |
]. |
|
8985 |
outStream close. |
|
8986 |
splitIndex := splitIndex + 1. |
|
8987 |
]. |
|
8988 |
inStream close. |
|
8989 |
! |
|
8990 |
||
4558 | 8991 |
splitSelectedFiles |
6264 | 8992 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 8993 |
|
12871 | 8994 |
selectedFiles := self currentSelectedFiles. |
4558 | 8995 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
8996 |
||
6265 | 8997 |
msg := (numFiles > 1) |
8998 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
8999 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 9000 |
|
6352 | 9001 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 9002 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
9003 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 9004 |
kiloBytes isNil ifTrue:[^ self]. |
9005 |
||
9006 |
selectedFiles do:[:fileName | |
|
18453 | 9007 |
fileName isRegularFile ifTrue:[ |
9008 |
self notify:('Splitting:', fileName baseName). |
|
4558 | 9009 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
9010 |
] |
|
9011 |
]. |
|
6190 | 9012 |
self notify:nil. |
6265 | 9013 |
|
7560 | 9014 |
"Modified: / 04-12-2006 / 13:15:26 / cg" |
4558 | 9015 |
! |
9016 |
||
15906 | 9017 |
splitSelectedFilesByLines |
9018 |
|selectedFiles numFiles msg numLinesString numLines| |
|
9019 |
||
9020 |
selectedFiles := self currentSelectedFiles. |
|
9021 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
9022 |
||
9023 |
msg := (numFiles > 1) |
|
9024 |
ifTrue:'Split each of the %1 files into pieces with number of lines:' |
|
9025 |
ifFalse:'Split %2 into pieces with number of lines:'. |
|
9026 |
||
9027 |
numLinesString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
9028 |
numLinesString isEmptyOrNil ifTrue:[^ self]. |
|
9029 |
||
9030 |
numLines := Integer readFrom:numLinesString onError:nil. |
|
9031 |
numLines isNil ifTrue:[^ self]. |
|
9032 |
||
9033 |
selectedFiles do:[:fileName | |
|
18453 | 9034 |
fileName isRegularFile ifTrue:[ |
9035 |
self notify:('Splitting:', fileName baseName). |
|
15906 | 9036 |
self splitFile:fileName intoPiecesWithNumberOfLines:numLines |
9037 |
] |
|
9038 |
]. |
|
9039 |
self notify:nil. |
|
9040 |
! |
|
9041 |
||
15211 | 9042 |
truncateSelectedFilesToZeroSize |
9043 |
|selectedFiles numFiles msg| |
|
9044 |
||
9045 |
selectedFiles := self currentSelectedObjects. |
|
9046 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
9047 |
||
9048 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
|
9049 |
numFiles > 1 ifTrue:[ |
|
9050 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
|
9051 |
]. |
|
9052 |
||
9053 |
(Dialog |
|
9054 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
|
9055 |
initialAnswer:false |
|
9056 |
) ifFalse:[ |
|
9057 |
^ self |
|
9058 |
]. |
|
9059 |
||
9060 |
selectedFiles do:[:fileName | |
|
9061 |
|s| |
|
9062 |
||
18453 | 9063 |
fileName isRegularFile ifTrue:[ |
9064 |
self notify:('Truncating:', fileName baseName). |
|
15211 | 9065 |
[ |
9066 |
s := fileName writeStream. |
|
9067 |
s close. |
|
9068 |
] on:FileStream openErrorSignal do:[:ex| |
|
9069 |
self warn:('Cannot truncate "%1".' bindWith:fileName baseName allBold). |
|
9070 |
]. |
|
9071 |
] |
|
9072 |
]. |
|
9073 |
self notify:nil. |
|
9074 |
||
9075 |
"Modified: / 04-12-2006 / 13:15:28 / cg" |
|
9076 |
! ! |
|
3892 | 9077 |
|
4849 | 9078 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 9079 |
|
9080 |
anySTFilesPresent |
|
9081 |
^ self anyFilesPresentWithSuffix:'st' |
|
9082 |
! |
|
9083 |
||
9084 |
canCreateNewProject |
|
9085 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
17865 | 9086 |
^ self currentSelectedFiles |
9087 |
contains:[:fileName| |
|
9088 |
| suffix| |
|
9089 |
suffix := fileName suffix asLowercase. |
|
9090 |
(suffix = 'prj' or:[suffix = 'st']) |
|
9091 |
] |
|
3892 | 9092 |
! |
9093 |
||
9094 |
canDoTerminal |
|
9095 |
||
9096 |
^ OperatingSystem isUNIXlike |
|
9097 |
or:[OperatingSystem isMSWINDOWSlike] |
|
9098 |
! |
|
9099 |
||
9100 |
canDoTerminalAndSystemIsDOS |
|
9101 |
||
9102 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
9103 |
! |
|
9104 |
||
9105 |
canDoTerminalAndSystemIsUnix |
|
9106 |
||
9107 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
9108 |
! |
|
9109 |
||
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9110 |
canGenerateSignatureFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
9111 |
"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
|
9112 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9113 |
Expecco::KeyFileGenerator isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9114 |
Expecco::KeyFile isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9115 |
|
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
9116 |
^ self currentSelectedFiles notEmptyOrNil |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9117 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9118 |
|
12811 | 9119 |
canOpenMonticelloBrowser |
9120 |
^ self currentSelectedFiles |
|
9121 |
contains:[:fileName| |
|
18746 | 9122 |
fileName suffix sameAs:'mcz' |
12811 | 9123 |
] |
18746 | 9124 |
|
9125 |
"Modified: / 01-05-2019 / 11:21:16 / Claus Gittinger" |
|
12811 | 9126 |
! |
9127 |
||
3892 | 9128 |
canReadAbbrevFile |
9129 |
||
5960 | 9130 |
|currentDirectory| |
3892 | 9131 |
|
9132 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 9133 |
currentDirectory := self currentDirectory. |
9134 |
^ currentDirectory notNil |
|
9135 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 9136 |
! |
9137 |
||
9138 |
canRemoveFromSourcePath |
|
9139 |
||
9140 |
^ false |
|
9141 |
! |
|
9142 |
||
13089 | 9143 |
cannotGenerateSignatureFiles |
9144 |
^ self canGenerateSignatureFiles not |
|
9145 |
! |
|
9146 |
||
3892 | 9147 |
hasASN1 |
9148 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 9149 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 9150 |
|
9151 |
! |
|
9152 |
||
9153 |
hasASN1AndSelection |
|
9154 |
^ [ self hasSelection value |
|
17416 | 9155 |
and:[self currentSelectedFiles notEmptyOrNil |
4414 | 9156 |
and:[OSI::ASN1Parser notNil |
9157 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
17416 | 9158 |
|
9159 |
"Modified: / 17-02-2017 / 08:25:09 / cg" |
|
3892 | 9160 |
! |
9161 |
||
9162 |
hasCBrowser |
|
9163 |
^ [ CBrowser::Browser notNil ] |
|
9164 |
! |
|
9165 |
||
9166 |
hasJava |
|
9167 |
||
14298 | 9168 |
^ [ JavaVM notNil |
9169 |
and:[JavaClassReader notNil |
|
9170 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 9171 |
! |
9172 |
||
9173 |
hasJavaAndSelection |
|
9174 |
||
12871 | 9175 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 9176 |
and:[JavaClassReader notNil |
9177 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 9178 |
! |
9179 |
||
9180 |
hasMP3Player |
|
9181 |
||
9182 |
^ [ MP3PlayerApplication notNil |
|
4414 | 9183 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 9184 |
! |
9185 |
||
9186 |
hasMP3PlayerAndSelection |
|
9187 |
||
12871 | 9188 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 9189 |
and:[ self hasMP3Player value]] |
3892 | 9190 |
! |
9191 |
||
8426 | 9192 |
hasResourceFileSelected |
12871 | 9193 |
^ (self currentSelectedFiles) |
9194 |
contains:[:fn | |
|
18746 | 9195 |
fn suffix sameAs:'rs' |
9196 |
]. |
|
9197 |
||
9198 |
"Modified: / 01-05-2019 / 11:23:30 / Claus Gittinger" |
|
8426 | 9199 |
! |
9200 |
||
3892 | 9201 |
hasSlideShow |
9202 |
||
9203 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
9204 |
! |
|
9205 |
||
9206 |
hasSnapshotSelection |
|
9207 |
||
9208 |
^ [ |
|
4414 | 9209 |
| files | |
8426 | 9210 |
|
4414 | 9211 |
files := self currentSelectedFiles. |
9212 |
((files size == 1) |
|
9213 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 9214 |
] |
9215 |
! |
|
9216 |
||
7869 | 9217 |
hasXml |
9206 | 9218 |
^ [ XML::XMLParser notNil ] |
7869 | 9219 |
! |
9220 |
||
9221 |
hasXmlFileSelected |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
9222 |
"/ 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
|
9223 |
"/ then handle the error when it ever fails during xml-parsing. |
7869 | 9224 |
|
8426 | 9225 |
^ [ |
9226 |
|sel fileName| |
|
7869 | 9227 |
|
9228 |
sel := self currentSelectedFiles. |
|
9229 |
sel size == 1 ifTrue:[ |
|
9230 |
fileName := sel first. |
|
9231 |
fileName notNil ifTrue:[ |
|
15936 | 9232 |
#('xml' 'xsd' 'vdx') includes:fileName suffix asLowercase |
7869 | 9233 |
] ifFalse:[ |
9234 |
false |
|
9235 |
] |
|
9236 |
] ifFalse:[ |
|
9237 |
false |
|
9238 |
] |
|
9239 |
] |
|
9240 |
! |
|
9241 |
||
3892 | 9242 |
hasZipFileSelected |
17982 | 9243 |
|sel fileName suff mime| |
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9244 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9245 |
sel := self currentSelectedFiles. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9246 |
sel size == 1 ifFalse:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9247 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9248 |
fileName := sel first. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9249 |
fileName isNil ifTrue:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9250 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9251 |
suff := fileName suffix asLowercase. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9252 |
(suff = 'zip' or:[suff = 'jar']) ifTrue:[^ true]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9253 |
|
17982 | 9254 |
mime := fileName mimeTypeOfContents. |
9255 |
"/ prepare for change (iana has obsoleted the x- types) |
|
9256 |
^ (mime = 'application/x-zip-compressed') or:[mime = 'application/zip'] |
|
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9257 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9258 |
"Modified: / 14-02-2011 / 17:17:03 / cg" |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9259 |
! |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9260 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9261 |
hasZipFileSelectedHolder |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9262 |
^ [ self hasZipFileSelected ] |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9263 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9264 |
"Created: / 14-02-2011 / 17:16:08 / cg" |
3892 | 9265 |
! |
9266 |
||
9267 |
javaSupportLoaded |
|
9268 |
||
9269 |
^ false |
|
9270 |
! ! |
|
9271 |
||
14126 | 9272 |
|
9273 |
||
3906 | 9274 |
!AbstractFileBrowser methodsFor:'presentation'! |
9275 |
||
9276 |
getModeString:modeBits |
|
9277 |
"convert file-mode bits into a more user-friendly string. |
|
9278 |
This is wrong here - should be moved into OperatingSystem." |
|
9279 |
||
9280 |
^ self getModeString:modeBits |
|
4414 | 9281 |
with:#( 'owner:' $r $w $x |
9282 |
' group:' $r $w $x |
|
9283 |
' others:' $r $w $x ) |
|
3906 | 9284 |
! |
9285 |
||
9286 |
getModeString:modeBits with:texts |
|
9287 |
"convert file-mode bits into a more user-friendly string. |
|
9288 |
This is wrong here - should be moved into OperatingSystem." |
|
9289 |
||
9290 |
|bits modeString| |
|
9291 |
||
9292 |
bits := modeBits bitAnd:8r777. |
|
9293 |
modeString := ''. |
|
9294 |
||
9295 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
9296 |
with: texts do:[:bitMask :access | |
|
4414 | 9297 |
|ch| |
9298 |
||
9299 |
bitMask isNil ifTrue:[ |
|
9300 |
modeString := modeString , access |
|
9301 |
] ifFalse:[ |
|
9302 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
9303 |
ch := $- |
|
9304 |
] ifFalse:[ |
|
9305 |
ch := access |
|
9306 |
]. |
|
9307 |
modeString := modeString copyWith:ch |
|
9308 |
] |
|
3906 | 9309 |
]. |
9310 |
^ modeString |
|
9311 |
! ! |
|
9312 |
||
5880 | 9313 |
!AbstractFileBrowser methodsFor:'private'! |
9314 |
||
9315 |
theSingleSelectedDirectoryOrHomeDir |
|
9316 |
|dir| |
|
9317 |
||
5888 | 9318 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 9319 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
9320 |
^ dir. |
|
9321 |
! |
|
9322 |
||
9323 |
theSingleSelectedDirectoryOrNil |
|
9324 |
|dirs| |
|
9325 |
||
9326 |
dirs := self currentSelectedDirectories. |
|
9327 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
9328 |
^ dirs anElement. |
|
14577 | 9329 |
! |
9330 |
||
9331 |
theSingleSelectedFileOrNil |
|
9332 |
|dirs| |
|
9333 |
||
9334 |
dirs := self currentSelectedFiles. |
|
9335 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
9336 |
^ dirs anElement. |
|
5880 | 9337 |
! ! |
9338 |
||
3892 | 9339 |
!AbstractFileBrowser methodsFor:'queries'! |
9340 |
||
8256 | 9341 |
cBrowserLoaded |
18432 | 9342 |
^ (Smalltalk at:#'CBrowser::Browser') notNil |
9343 |
||
9344 |
"Modified: / 26-09-2018 / 12:06:32 / Claus Gittinger" |
|
8256 | 9345 |
! |
9346 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9347 |
cBrowserMenuItemVisible |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9348 |
^ self cBrowserLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9349 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9350 |
"Created: / 04-10-2011 / 13:40:38 / cg" |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9351 |
! |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9352 |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9353 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9354 |
"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
|
9355 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9356 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9357 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9358 |
|
3906 | 9359 |
getFileInfoStringForFirstSelectedFile:longInfo |
9360 |
"get stat info on selected file - return a string which can be |
|
9361 |
shown in a box" |
|
9362 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9363 |
|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
|
9364 |
sizeString fileSize tAccess tModification buffer| |
3906 | 9365 |
|
7560 | 9366 |
selFiles := self currentSelectedObjects. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9367 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 9368 |
filename := selFiles first. |
9369 |
||
8364 | 9370 |
info := filename linkInfo. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9371 |
info isNil ifTrue:[ |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9372 |
^ 'Cannot get fileInfo'. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9373 |
^ nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9374 |
]. |
8364 | 9375 |
|
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
9376 |
buffer := Text writeStream. |
4765 | 9377 |
|
9378 |
buffer |
|
9379 |
nextPutAll:'filename: '; |
|
9380 |
nextPutLine:filename asString. |
|
9381 |
||
8364 | 9382 |
OperatingSystem isMSDOSlike ifTrue: [ |
9383 |
(info alternativeName notNil |
|
9384 |
and:[ info alternativeName ~= info fullName ]) ifTrue:[ |
|
9385 |
buffer nextPutAll:'shortname: '. |
|
9386 |
buffer nextPutLine:info alternativeName. |
|
9387 |
] |
|
9388 |
]. |
|
9389 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9390 |
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
|
9391 |
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
|
9392 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9393 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9394 |
]. |
4765 | 9395 |
buffer |
9396 |
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
|
9397 |
nextPutLine:(info path ? '???'). |
3906 | 9398 |
] 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
|
9399 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9400 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9401 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9402 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9403 |
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
|
9404 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9405 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9406 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9407 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9408 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9409 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9410 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9411 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9412 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9413 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9414 |
fileSize > 1024 ifTrue:[ |
8172 | 9415 |
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
|
9416 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9417 |
]. |
4765 | 9418 |
buffer nextPutLine:sizeString. |
3906 | 9419 |
|
9420 |
modeBits := info mode. |
|
9421 |
modeString := self getModeString:modeBits. |
|
4765 | 9422 |
|
9423 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 9424 |
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
|
9425 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 9426 |
]. |
4765 | 9427 |
buffer |
9428 |
cr; |
|
9429 |
nextPutAll:'owner: '; |
|
9430 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
9431 |
||
3906 | 9432 |
longInfo ifTrue:[ |
4765 | 9433 |
buffer |
9434 |
nextPutAll:'group: '; |
|
9435 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
9436 |
||
9437 |
tAccess := info accessTime. |
|
9438 |
buffer |
|
9439 |
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
|
9440 |
nextPutAll:tAccess asDate printString; |
4765 | 9441 |
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
|
9442 |
nextPutLine:tAccess asTime printString. |
4765 | 9443 |
|
9444 |
tModification := info modificationTime. |
|
9445 |
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
|
9446 |
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
|
9447 |
nextPutAll:tModification asDate printString; |
4765 | 9448 |
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
|
9449 |
nextPutLine:tModification asTime printString. |
3906 | 9450 |
]. |
4765 | 9451 |
^ buffer contents |
7560 | 9452 |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
9453 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
3906 | 9454 |
! |
9455 |
||
8510 | 9456 |
hasImageColorHistogram |
9457 |
^ ImageColorHistogram notNil |
|
9458 |
! |
|
9459 |
||
17686 | 9460 |
hasImageHistogram |
9461 |
^ ImageAlgorithms notNil |
|
9462 |
||
9463 |
"Created: / 10-09-2017 / 16:50:34 / cg" |
|
9464 |
! |
|
9465 |
||
10258 | 9466 |
hasSubversionSupport |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
9467 |
^ ConfigurableFeatures includesFeature: #SubversionSupport |
10258 | 9468 |
|
9469 |
"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
|
9470 |
"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
|
9471 |
"Modified: / 19-01-2012 / 10:43:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10258 | 9472 |
! |
9473 |
||
3892 | 9474 |
initialCommandFor:fileName into:aBox |
9475 |
"set a useful initial command for execute box." |
|
9476 |
||
18734 | 9477 |
self class |
9478 |
initialCommandFor:fileName |
|
9479 |
in:self "Filename" currentDirectory |
|
9480 |
intoBox:aBox |
|
9481 |
||
9482 |
"Modified: / 10-04-2019 / 05:55:21 / Claus Gittinger" |
|
3892 | 9483 |
! |
9484 |
||
9485 |
isAbstractFileBrowser |
|
9486 |
||
9487 |
^ true |
|
9488 |
! |
|
9489 |
||
18432 | 9490 |
stxgdbLoaded |
9491 |
^ (Smalltalk at:#GDBApplication) notNil |
|
9492 |
||
9493 |
"Created: / 26-09-2018 / 12:06:23 / Claus Gittinger" |
|
9494 |
! |
|
9495 |
||
9496 |
stxgdbMenuItemVisible |
|
9497 |
^ self stxgdbLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
|
9498 |
||
9499 |
"Created: / 26-09-2018 / 12:05:45 / Claus Gittinger" |
|
9500 |
! |
|
9501 |
||
3892 | 9502 |
systemIsDOS |
9503 |
^ OperatingSystem isMSDOSlike |
|
9504 |
! |
|
9505 |
||
12473 | 9506 |
systemIsOSX |
9507 |
^ OperatingSystem isOSXlike |
|
9508 |
! |
|
9509 |
||
3892 | 9510 |
systemIsUnix |
9511 |
^ OperatingSystem isUNIXlike |
|
14980 | 9512 |
! |
9513 |
||
9514 |
systemSupportsVolumes |
|
9515 |
^ OperatingSystem supportsVolumes |
|
3892 | 9516 |
! ! |
9517 |
||
9518 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
9519 |
||
9520 |
allItemsOfCurrentDirectory |
|
5009 | 9521 |
self |
4774 | 9522 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 9523 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
9524 |
||
9525 |
^ nil |
|
3892 | 9526 |
! |
9527 |
||
9528 |
anyFilesPresentWithSuffix:suffix |
|
6725 | 9529 |
self currentSelectedDirectories do:[:dir| |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9530 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
9531 |
(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
|
9532 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 9533 |
]. |
9534 |
^ false. |
|
9535 |
! |
|
9536 |
||
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9537 |
commonPrefixOfSelectedFiles |
4773 | 9538 |
|selFiles stringCol firstPre| |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9539 |
|
7560 | 9540 |
selFiles := self currentSelectedObjects. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9541 |
selFiles isEmpty ifTrue:[^ nil]. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9542 |
|
17865 | 9543 |
stringCol := selFiles collect:#asString. |
4773 | 9544 |
firstPre := stringCol at:1. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9545 |
stringCol from:2 do:[:el| |
4773 | 9546 |
firstPre := firstPre commonPrefixWith:el. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9547 |
]. |
4773 | 9548 |
^ firstPre asFilename |
7560 | 9549 |
|
9550 |
"Modified: / 04-12-2006 / 13:14:25 / cg" |
|
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9551 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9552 |
|
12481 | 9553 |
compressTabsOnSave |
9554 |
"if true, compress leading spaces (multiples of 8) with a tab character |
|
9555 |
when saving. |
|
9556 |
Default is true" |
|
9557 |
||
9558 |
^ true |
|
9559 |
! |
|
9560 |
||
3892 | 9561 |
currentFilesAreInSameDirectory |
9562 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9563 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 9564 |
! |
9565 |
||
9566 |
currentFilesHasDirectories |
|
9567 |
||
6725 | 9568 |
^ self currentSelectedDirectories notEmpty. |
3892 | 9569 |
! |
9570 |
||
3982 | 9571 |
directoriesForFiles:aFileCol |
11743 | 9572 |
^ aFileCol collect:[:file| self getDirWithoutFileName:file] as:Set. |
3982 | 9573 |
! |
9574 |
||
3892 | 9575 |
fileListIsEmpty |
5009 | 9576 |
self |
9577 |
applicationNamed:#DirectoryContentsBrowser |
|
9578 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
9579 |
||
9580 |
^ nil. |
|
3892 | 9581 |
! |
9582 |
||
9583 |
fileListIsNotEmpty |
|
9584 |
||
9585 |
^ self fileListIsEmpty not. |
|
9586 |
! |
|
9587 |
||
9588 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 9589 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 9590 |
|
9591 |
| file1 file2 | |
|
9592 |
||
6284 | 9593 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 9594 |
file1 := aFilename1 asFilename. |
9595 |
file2 := aFilename2 asFilename. |
|
6284 | 9596 |
|
3892 | 9597 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 9598 |
|
3892 | 9599 |
((file1 isDirectory) |
9600 |
and:[(file2 isDirectory) |
|
9601 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 9602 |
^ file1 baseName = file2 baseName |
3892 | 9603 |
]. |
3982 | 9604 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 9605 |
! |
9606 |
||
9607 |
getAllFilesAsStringCollection |
|
5009 | 9608 |
self |
9609 |
applicationNamed:#DirectoryContentsBrowser |
|
9610 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
9611 |
||
9612 |
^ nil |
|
3892 | 9613 |
! |
9614 |
||
9615 |
getBestDirectory |
|
17868 | 9616 |
"from a set of directories, return the common parent directory" |
9617 |
||
9618 |
^ self class getBestDirectoryFrom:(self currentSelectedDirectories) |
|
3892 | 9619 |
! |
9620 |
||
9621 |
getDirWithoutFileName:aFileName |
|
9622 |
||
9623 |
| dir | |
|
9624 |
aFileName isNil ifTrue:[ |
|
4414 | 9625 |
^ aFileName. |
3892 | 9626 |
]. |
9627 |
dir := aFileName asFilename. |
|
9628 |
dir isDirectory ifFalse:[ |
|
4414 | 9629 |
dir := dir directory. |
3892 | 9630 |
]. |
9631 |
^ dir. |
|
9632 |
! |
|
9633 |
||
9634 |
getInfoItem |
|
9635 |
"get filename of a description-file (.dir.info, README etc.); |
|
16778 | 9636 |
This file is automatically shown when a directory is entered. |
3892 | 9637 |
You can add more names below if you like." |
9638 |
||
5880 | 9639 |
|dir| |
9640 |
||
9641 |
dir := self theSingleSelectedDirectoryOrNil. |
|
9642 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 9643 |
|
16778 | 9644 |
#( |
3892 | 9645 |
'.dir.info' |
9646 |
'README' |
|
9647 |
'ReadMe' |
|
9648 |
'Readme' |
|
9649 |
'readme' |
|
9650 |
'read.me' |
|
9651 |
'Read.me' |
|
9652 |
'READ.ME' |
|
9653 |
'README.TXT' |
|
15915 | 9654 |
'README.txt' |
3892 | 9655 |
'readme.txt' |
9656 |
'Readme.txt' |
|
9657 |
'Info.txt' |
|
9658 |
'info.txt' |
|
9659 |
'INFO.TXT' |
|
15915 | 9660 |
'INFO.txt' |
16778 | 9661 |
) do:[:f | |
5883 | 9662 |
|n| |
4414 | 9663 |
|
5880 | 9664 |
n := dir construct:f. |
18453 | 9665 |
(n isReadable and:[n isRegularFile]) ifTrue:[ |
4414 | 9666 |
^ DirectoryContentsBrowser itemClass fileName:n |
9667 |
] |
|
3892 | 9668 |
]. |
9669 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9670 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9671 |
|
12497 | 9672 |
hasPackageDirectorySelected |
9673 |
|dir| |
|
9674 |
||
9675 |
dir := self currentDirectory. |
|
9676 |
^ dir notNil |
|
9677 |
and:[ dir exists |
|
9678 |
and:[ (dir / 'abbrev.stc') exists ]] |
|
9679 |
! |
|
9680 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9681 |
parentDirectoriesOfCurrentFiles |
11743 | 9682 |
^ self currentSelectedObjects |
9683 |
collect:[:file | file directory] as:Set |
|
7560 | 9684 |
|
9685 |
"Modified: / 04-12-2006 / 13:15:21 / cg" |
|
6521 | 9686 |
! |
9687 |
||
9688 |
recursiveAnyFilesPresentWithSuffix:suffix |
|
6652 | 9689 |
^ true. "/ the code below is too slow for a menu enabling operation |
9690 |
||
9691 |
"/ |directories| |
|
9692 |
"/ |
|
9693 |
"/ directories := self currentDirectories value. |
|
9694 |
"/ directories do:[:dir| |
|
9695 |
"/ [ |
|
9696 |
"/ dir recursiveDirectoryContentsDo:[:f | |
|
9697 |
"/ (f asFilename suffix = suffix) ifTrue:[ ^ true] |
|
9698 |
"/ ] |
|
9699 |
"/ ] on:FileStream openErrorSignal do:[:ex|]. |
|
9700 |
"/ ]. |
|
9701 |
"/ ^ false. |
|
6586 | 9702 |
! |
9703 |
||
9704 |
recursiveAnySTFilesPresent |
|
9705 |
^ self recursiveAnyFilesPresentWithSuffix:'st' |
|
3982 | 9706 |
! ! |
9707 |
||
9708 |
!AbstractFileBrowser methodsFor:'selection'! |
|
9709 |
||
9710 |
currentSelectedDirectories |
|
6725 | 9711 |
^ self currentDirectoriesValue. |
3982 | 9712 |
! |
9713 |
||
9714 |
currentSelectedFiles |
|
17865 | 9715 |
^ self currentSelectedObjects reject:#isDirectory. |
7560 | 9716 |
|
9717 |
"Modified: / 04-12-2006 / 13:14:39 / cg" |
|
3982 | 9718 |
! |
9719 |
||
6460 | 9720 |
currentSelectedObjects |
9721 |
^ self currentFileNameHolder value |
|
9722 |
! |
|
9723 |
||
3982 | 9724 |
firstSelectedFile |
7560 | 9725 |
^ self currentSelectedObjects |
12102 | 9726 |
detect:[:file | (file ? '') asFilename isDirectory not] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9727 |
ifNone:[]. |
7560 | 9728 |
|
9729 |
"Modified: / 04-12-2006 / 13:14:50 / cg" |
|
4414 | 9730 |
! |
9731 |
||
9490 | 9732 |
hasOnlyDirectoriesSelected |
9733 |
^ self currentSelectedObjects conform:[:file | file isDirectory]. |
|
9734 |
||
9735 |
"Created: / 20-05-2010 / 10:45:03 / cg" |
|
9736 |
! |
|
9737 |
||
4414 | 9738 |
hasOnlyFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9739 |
|
7560 | 9740 |
^ self currentSelectedObjects conform:[:file | file isDirectory not]. |
9741 |
||
9742 |
"Modified: / 04-12-2006 / 13:15:01 / cg" |
|
4414 | 9743 |
! |
9744 |
||
9490 | 9745 |
hasTwoDirectoriesSelected |
9746 |
||
9747 |
^ self currentSelectedObjects size == 2 |
|
9748 |
and:[self hasOnlyDirectoriesSelected] |
|
9749 |
||
9750 |
"Created: / 20-05-2010 / 10:45:18 / cg" |
|
9751 |
! |
|
9752 |
||
4414 | 9753 |
hasTwoFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9754 |
|
7560 | 9755 |
^ self currentSelectedObjects size == 2 |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9756 |
and:[self hasOnlyFilesSelected] |
7560 | 9757 |
|
9758 |
"Modified: / 04-12-2006 / 13:15:04 / cg" |
|
14577 | 9759 |
! |
9760 |
||
9761 |
selectNextFile |
|
9762 |
self |
|
9763 |
applicationNamed:#DirectoryContentsBrowser |
|
9764 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectNextFile ]]. |
|
9765 |
! |
|
9766 |
||
9767 |
selectPreviousFile |
|
9768 |
self |
|
9769 |
applicationNamed:#DirectoryContentsBrowser |
|
9770 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectPreviousFile ]]. |
|
3892 | 9771 |
! ! |
9772 |
||
3964 | 9773 |
!AbstractFileBrowser methodsFor:'sorting'! |
9774 |
||
3989 | 9775 |
currentSortOrder |
17790 | 9776 |
^ self |
9777 |
aspectFor:#currentSortOrder |
|
9778 |
ifAbsent:[ |
|
9779 |
(Dictionary new |
|
9780 |
at:#column put:nil; |
|
9781 |
at:#reverse put:false; |
|
9782 |
at:#sortCaseless put:false; |
|
9783 |
yourself |
|
9784 |
) asValue |
|
9785 |
]. |
|
9786 |
||
9787 |
"Modified: / 25-11-2017 / 17:43:00 / cg" |
|
3989 | 9788 |
! |
9789 |
||
9790 |
sortBlockHolder |
|
9791 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 9792 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9793 |
selector:#fileName |
|
9794 |
sortCaseless:self sortCaseless value |
|
9795 |
sortReverse:false) asValue. |
|
3989 | 9796 |
]. |
9797 |
! |
|
9798 |
||
9799 |
sortBlockProperty |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9800 |
|v| |
4027 | 9801 |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9802 |
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
|
9803 |
v addDependent:self. |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9804 |
^ v. |
3989 | 9805 |
! |
9806 |
||
9807 |
sortCaseless |
|
4201 | 9808 |
" aspect for sort caseless " |
3989 | 9809 |
|
13000 | 9810 |
^ self |
9811 |
aspectFor:#sortCaseless |
|
9812 |
ifAbsent:[ (Filename isCaseSensitive not) asValue ] |
|
3989 | 9813 |
! |
9814 |
||
4074 | 9815 |
sortDirectoriesBeforeFiles |
9816 |
||
4201 | 9817 |
" aspect for sort directories always before files" |
4074 | 9818 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
9819 |
! |
|
9820 |
||
3989 | 9821 |
sortFileListsBy:instanceName |
9822 |
||
9823 |
self sortFileListsBy:instanceName withReverse:true |
|
9824 |
! |
|
9825 |
||
9826 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
9827 |
| aSymbol sortCaselessLocal currentSortOrder sorter isReverse| |
3964 | 9828 |
|
9829 |
aSymbol := instanceName asSymbol. |
|
4027 | 9830 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 9831 |
sortCaselessLocal := self sortCaseless value. |
4027 | 9832 |
currentSortOrder := self currentSortOrder value. |
17790 | 9833 |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9834 |
currentSortOrder isEmptyOrNil ifTrue:[ |
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9835 |
self currentSortOrder value:(currentSortOrder := Dictionary new). |
4343 | 9836 |
currentSortOrder at:#column put:aSymbol. |
9837 |
currentSortOrder at:#reverse put:false. |
|
9838 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 9839 |
] ifFalse:[ |
4343 | 9840 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
9841 |
"/ sort caseless changed |
|
9842 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
9843 |
] ifFalse:[ |
|
9844 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
9845 |
"/ same column like before - change sort order ifReverse is true |
|
9846 |
aBoolean ifTrue:[ |
|
9847 |
isReverse := currentSortOrder at:#reverse. |
|
9848 |
currentSortOrder at:#reverse put:(isReverse not). |
|
9849 |
]. |
|
9850 |
] ifFalse:[ |
|
9851 |
"/ another column - remark column |
|
9852 |
currentSortOrder at:#column put:aSymbol. |
|
9853 |
] |
|
9854 |
] |
|
3964 | 9855 |
]. |
4027 | 9856 |
self currentSortOrder changed. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9857 |
|
5383 | 9858 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9859 |
selector:instanceName |
|
9860 |
sortCaseless:sortCaselessLocal |
|
9861 |
sortReverse:(currentSortOrder at:#reverse). |
|
9862 |
self sortBlockHolder value:sorter. |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9863 |
|
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9864 |
"Modified: / 18-09-2007 / 09:42:47 / cg" |
17790 | 9865 |
"Modified (format): / 25-11-2017 / 17:43:31 / cg" |
3964 | 9866 |
! ! |
9867 |
||
3892 | 9868 |
!AbstractFileBrowser methodsFor:'startup & release'! |
9869 |
||
16720 | 9870 |
initializeAspects |
9871 |
aspects := IdentityDictionary new. |
|
9872 |
aspects at:#applications put:(IdentityDictionary new). |
|
9873 |
! |
|
9874 |
||
3892 | 9875 |
makeDependent |
4074 | 9876 |
self filterModel addDependent:self. |
4004 | 9877 |
self currentFileNameHolder addDependent:self. |
4074 | 9878 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 9879 |
self sortCaseless addDependent:self. |
4011 | 9880 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
9881 |
self rootHolder addDependent:self. |
3892 | 9882 |
! |
9883 |
||
9884 |
masterApplication:anApplication |
|
9885 |
||
9886 |
masterApplication isNil ifTrue:[ |
|
4414 | 9887 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
9888 |
aspects := anApplication aspects |
|
9889 |
] ifFalse:[ |
|
9890 |
aspects isNil ifTrue:[ |
|
16721 | 9891 |
self initializeAspects. |
4414 | 9892 |
] |
9893 |
]. |
|
9894 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9895 |
"/ self makeDependent. |
3892 | 9896 |
]. |
3952 | 9897 |
^ super masterApplication:anApplication. |
3892 | 9898 |
! |
9899 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9900 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9901 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9902 |
super postBuildWith:aBuilder. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9903 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9904 |
|
3892 | 9905 |
postOpenWith:aBuilder |
9906 |
||
9907 |
super postOpenWith:aBuilder. |
|
14655 | 9908 |
"/ now done for all windowGroups by the group itself |
9909 |
"/ self windowGroup showWaitCursorWhenBusyForMillis:100. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9910 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9911 |
"Modified: / 25-07-2006 / 09:12:45 / cg" |
3892 | 9912 |
! ! |
9913 |
||
9914 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
9915 |
||
9916 |
files |
|
9917 |
"return the value of the instance variable 'files' (automatically generated)" |
|
9918 |
||
9919 |
^ files |
|
9920 |
! |
|
9921 |
||
9922 |
files:something |
|
9923 |
"set the value of the instance variable 'files' (automatically generated)" |
|
9924 |
||
9925 |
files := something. |
|
9926 |
! |
|
9927 |
||
9928 |
method |
|
9929 |
"return the value of the instance variable 'method' (automatically generated)" |
|
9930 |
||
9931 |
^ method |
|
9932 |
! |
|
9933 |
||
9934 |
method:something |
|
9935 |
"set the value of the instance variable 'method' (automatically generated)" |
|
9936 |
||
9937 |
method := something. |
|
9938 |
! ! |
|
9939 |
||
9940 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
9941 |
||
9942 |
locked |
|
9943 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
9944 |
||
9945 |
locked isNil ifTrue:[ |
|
4414 | 9946 |
locked := false. |
3892 | 9947 |
]. |
9948 |
^ locked |
|
9949 |
! ! |
|
9950 |
||
9951 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
9952 |
||
9953 |
doIfUnLocked:aBlock |
|
9954 |
||
9955 |
self locked ifFalse:[ |
|
4414 | 9956 |
aBlock value. |
3892 | 9957 |
]. |
9958 |
! |
|
9959 |
||
9960 |
doLocked:aBlock |
|
9961 |
||
9962 |
locked := true. |
|
4004 | 9963 |
aBlock ensure:[ |
4414 | 9964 |
locked := false. |
4004 | 9965 |
] |
3892 | 9966 |
! ! |
9967 |
||
3952 | 9968 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
9969 |
||
6369 | 9970 |
defaultHistorySize |
9971 |
^ 50 |
|
3892 | 9972 |
! ! |
9973 |
||
6371 | 9974 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 9975 |
|
9976 |
new |
|
6371 | 9977 |
^ (super new) initializeHistory. |
6369 | 9978 |
! ! |
9979 |
||
9980 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
9981 |
||
9982 |
historySize |
|
9983 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
9984 |
^ historySize |
|
9985 |
! |
|
9986 |
||
9987 |
historySize:aNumber |
|
9988 |
historySize := aNumber |
|
4032 | 9989 |
! ! |
9990 |
||
3892 | 9991 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
9992 |
||
3952 | 9993 |
addToHistory:aPath |
15803 | 9994 |
| item pathToAdd sep| |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9995 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9996 |
pathToAdd := aPath. |
15803 | 9997 |
(pathToAdd endsWith:(sep := Filename separator)) ifTrue:[ |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9998 |
pathToAdd asFilename isRootDirectory ifFalse:[ |
15803 | 9999 |
pathToAdd := pathToAdd copyButLast:(sep asString size). |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10000 |
] |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10001 |
]. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10002 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10003 |
item := self getItemFor:pathToAdd. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10004 |
self backForwardListAdd:pathToAdd. |
3952 | 10005 |
item isNil ifTrue:[ |
4347 | 10006 |
" not already in history" |
6369 | 10007 |
self size >= self historySize ifTrue:[ |
4347 | 10008 |
self removeLast. |
10009 |
]. |
|
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10010 |
item := DirectoryHistoryItem path:pathToAdd. |
3952 | 10011 |
] ifFalse:[ |
4347 | 10012 |
"already been there before; move the entry to |
10013 |
the beginning, so it will fall out later." |
|
10014 |
self remove:item. |
|
10381
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10015 |
]. |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10016 |
self addFirst:item |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10017 |
|
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10018 |
"Modified: / 24-07-2011 / 07:12:54 / cg" |
3952 | 10019 |
! |
10020 |
||
4347 | 10021 |
backForwardListAdd:aPath |
10022 |
|pathIndex| |
|
10023 |
||
10024 |
pathIndex := backForwardList indexOf:aPath. |
|
10025 |
pathIndex == 0 ifTrue:[ |
|
10026 |
" a new path comes in remove forward paths " |
|
10027 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
10028 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
10029 |
]. |
|
10030 |
] ifFalse:[ |
|
10031 |
backForwardList remove:aPath. |
|
10032 |
pathIndex <= backForwardIndex ifTrue:[ |
|
10033 |
backForwardIndex := backForwardIndex - 1. |
|
10034 |
] |
|
4022 | 10035 |
]. |
4347 | 10036 |
backForwardList add:aPath afterIndex:backForwardIndex. |
10037 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 10038 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 10039 |
backForwardList removeFirst. |
10040 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 10041 |
]. |
4347 | 10042 |
! |
10043 |
||
10044 |
goBackward |
|
4288 | 10045 |
"return the first path of the backward list; |
10046 |
remove it from the back list and add it ti the forward list." |
|
4022 | 10047 |
|
4347 | 10048 |
|retPath| |
10049 |
||
10050 |
self canBackward ifTrue:[ |
|
10051 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
10052 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 10053 |
]. |
4022 | 10054 |
^ retPath. |
10055 |
! |
|
10056 |
||
10057 |
goForward |
|
4288 | 10058 |
"return the first path of the forward list; |
10059 |
remove it from the list." |
|
4022 | 10060 |
|
4347 | 10061 |
|retPath| |
10062 |
||
10063 |
self canForward ifTrue:[ |
|
10064 |
retPath := backForwardList at:backForwardIndex + 1. |
|
10065 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 10066 |
]. |
4022 | 10067 |
^ retPath. |
10068 |
! |
|
10069 |
||
10070 |
resetForwardBackward |
|
10071 |
||
4347 | 10072 |
self initialize |
4022 | 10073 |
! |
10074 |
||
10075 |
setPosition:aPosition for:aPath |
|
10076 |
||
10077 |
self do:[:item| |
|
4414 | 10078 |
item path = aPath ifTrue:[ |
10079 |
item position:aPosition. |
|
10080 |
] |
|
4022 | 10081 |
]. |
3892 | 10082 |
! ! |
10083 |
||
4870 | 10084 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 10085 |
|
6371 | 10086 |
initializeHistory |
4032 | 10087 |
|
4347 | 10088 |
backForwardList := OrderedCollection new. |
10089 |
self reverseDo:[:el| |
|
10090 |
backForwardList add:el path. |
|
10091 |
]. |
|
10092 |
backForwardIndex := backForwardList size. |
|
4032 | 10093 |
! ! |
10094 |
||
3892 | 10095 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
10096 |
||
4288 | 10097 |
canBackward |
4347 | 10098 |
|
10099 |
^ backForwardIndex > 1 |
|
4288 | 10100 |
! |
10101 |
||
3892 | 10102 |
canForward |
4347 | 10103 |
|
10104 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
10105 |
! |
|
10106 |
||
10107 |
getBackCollection |
|
10108 |
||
10109 |
| backCol | |
|
10110 |
||
10111 |
backCol := OrderedCollection new. |
|
10112 |
self canBackward ifTrue:[ |
|
10113 |
| tmpCol | |
|
10114 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
10115 |
tmpCol reverseDo:[ :el| |
|
10116 |
backCol add:el. |
|
10117 |
] |
|
10118 |
]. |
|
10119 |
^ backCol |
|
3952 | 10120 |
! |
10121 |
||
10122 |
getForwardCollection |
|
10123 |
||
4347 | 10124 |
| forwCol | |
10125 |
||
10126 |
forwCol := OrderedCollection new. |
|
10127 |
self canForward ifTrue:[ |
|
10128 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
10129 |
]. |
|
10130 |
^ forwCol |
|
3952 | 10131 |
! |
10132 |
||
10133 |
getItemFor:aPath |
|
6627 | 10134 |
^ self detect:[:item| item path = aPath] ifNone:nil. |
10135 |
"/ self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
10136 |
"/ ^ nil. |
|
3952 | 10137 |
! |
10138 |
||
10139 |
getPositionFor:aPath |
|
10140 |
||
10141 |
|item| |
|
10142 |
||
10143 |
item := self getItemFor:aPath. |
|
10144 |
||
10145 |
item notNil ifTrue:[ |
|
4414 | 10146 |
^ item position. |
3952 | 10147 |
]. |
10148 |
^ nil |
|
10149 |
! |
|
10150 |
||
10151 |
includesPath:aPath |
|
6627 | 10152 |
^ self contains:[:item | item path = aPath]. |
10153 |
||
10154 |
"/ self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
10155 |
"/ ^ false. |
|
4347 | 10156 |
! |
10157 |
||
10158 |
nextBackwardItem |
|
10159 |
"return the first path of the backward list" |
|
10160 |
||
10161 |
|retPath| |
|
10162 |
||
10163 |
self canBackward ifTrue:[ |
|
10164 |
retPath := backForwardList at:backForwardIndex. |
|
10165 |
]. |
|
10166 |
^ retPath. |
|
10167 |
! |
|
10168 |
||
10169 |
nextForwardItem |
|
10170 |
"return the first path of the forward list" |
|
10171 |
||
10172 |
|retPath| |
|
10173 |
||
10174 |
self canForward ifTrue:[ |
|
10175 |
retPath := backForwardList at:backForwardIndex + 1. |
|
10176 |
]. |
|
10177 |
^ retPath. |
|
3952 | 10178 |
! ! |
10179 |
||
10180 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
10181 |
||
10182 |
path:aPath |
|
10183 |
||
10184 |
^ self new path:aPath |
|
10185 |
! ! |
|
10186 |
||
10187 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
10188 |
||
6433 | 10189 |
asFilename |
10190 |
^ path asFilename |
|
10191 |
! |
|
10192 |
||
3952 | 10193 |
path |
10194 |
"return the value of the instance variable 'path' (automatically generated)" |
|
10195 |
||
10196 |
^ path |
|
10197 |
! |
|
10198 |
||
10199 |
path:something |
|
10200 |
"set the value of the instance variable 'path' (automatically generated)" |
|
10201 |
||
10202 |
path := something. |
|
10203 |
! |
|
10204 |
||
10205 |
position |
|
10206 |
"return the value of the instance variable 'position' (automatically generated)" |
|
10207 |
||
10208 |
^ position |
|
10209 |
! |
|
10210 |
||
10211 |
position:something |
|
10212 |
"set the value of the instance variable 'position' (automatically generated)" |
|
10213 |
||
10214 |
position := something. |
|
10215 |
! |
|
10216 |
||
10217 |
printString |
|
10218 |
||
10219 |
^ self path asString |
|
3892 | 10220 |
! ! |
10221 |
||
10222 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
10223 |
||
10224 |
withValue:aValue isHolder:aBoolean |
|
10225 |
||
10226 |
| instance | |
|
10227 |
||
10228 |
instance := self basicNew. |
|
10229 |
instance value:aValue. |
|
10230 |
instance isHolder:aBoolean. |
|
10231 |
^ instance |
|
10232 |
! ! |
|
10233 |
||
10234 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
10235 |
||
10236 |
isHolder |
|
10237 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
10238 |
||
10239 |
^ isHolder |
|
10240 |
! |
|
10241 |
||
10242 |
isHolder:something |
|
10243 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
|
10244 |
||
10245 |
isHolder := something. |
|
10246 |
! |
|
10247 |
||
10248 |
value |
|
10249 |
"return the value of the instance variable 'value' (automatically generated)" |
|
10250 |
||
10251 |
^ value |
|
10252 |
! |
|
10253 |
||
10254 |
value:something |
|
10255 |
"set the value of the instance variable 'value' (automatically generated)" |
|
10256 |
||
10257 |
value := something. |
|
10258 |
! ! |
|
10259 |
||
10260 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
10261 |
||
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10262 |
version |
15803 | 10263 |
^ '$Header$' |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10264 |
! |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10265 |
|
8832 | 10266 |
version_CVS |
15803 | 10267 |
^ '$Header$' |
3892 | 10268 |
! ! |
12094 | 10269 |