author | Stefan Vogel <sv@exept.de> |
Wed, 11 Sep 2019 16:45:03 +0200 | |
changeset 19158 | 008bb4bbb5a5 |
parent 19152 | be7202db2c28 |
child 19173 | 71aa982cb0cf |
permissions | -rw-r--r-- |
19152 | 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" |
|
18770 | 157 |
|
158 |
MaxFileSizeShownWithoutAsking notNil ifTrue:[^ MaxFileSizeShownWithoutAsking]. |
|
159 |
ExternalAddress pointerSize == 8 ifTrue:[ |
|
160 |
^ (32*1024*1024) |
|
161 |
]. |
|
162 |
^ (4*1024*1024) |
|
17768 | 163 |
|
164 |
"Created: / 19-11-2017 / 14:48:19 / cg" |
|
18770 | 165 |
"Modified: / 22-05-2019 / 18:19:24 / Claus Gittinger" |
17768 | 166 |
! |
167 |
||
168 |
maxFileSizeShownWithoutAsking:anIntegerOrNilForDefault |
|
169 |
"the max. filesize which is loaded without asking if only the first |
|
17769 | 170 |
part should be shown. |
171 |
Nil resets to the default (currently 1Mb)" |
|
17768 | 172 |
|
173 |
MaxFileSizeShownWithoutAsking := anIntegerOrNilForDefault |
|
174 |
||
17769 | 175 |
" |
176 |
self maxFileSizeShownWithoutAsking:nil |
|
177 |
" |
|
178 |
||
17768 | 179 |
"Created: / 19-11-2017 / 14:48:45 / cg" |
180 |
! |
|
181 |
||
3952 | 182 |
resetClassVars |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
183 |
VisitedDirectories := nil. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
184 |
LastFileSelection := nil. |
5936 | 185 |
|
186 |
" |
|
187 |
AbstractFileBrowser resetClassVars |
|
188 |
" |
|
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
189 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
190 |
"Modified: / 21-11-2012 / 08:45:53 / cg" |
4368
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 |
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 |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
196 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
197 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
198 |
rootHolder:aRoot |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
199 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
200 |
RootHolder := aRoot |
3952 | 201 |
! ! |
202 |
||
4915 | 203 |
!AbstractFileBrowser class methodsFor:'accessing-bookmarks'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
204 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
205 |
addBookmark:aDirectoryPath |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
206 |
"add aDirectoryPath to the list of our known bookmarks. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
207 |
Do not add duplicates." |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
208 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
209 |
|bookmarks| |
4672
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 |
bookmarks := self directoryBookmarks. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
212 |
(bookmarks includes:aDirectoryPath) ifFalse:[ |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
213 |
bookmarks add:aDirectoryPath asFilename. |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
214 |
]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
215 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
216 |
|
8013 | 217 |
bookmarksFrom:aFileNameOrString |
12390 | 218 |
|bookmarks s fileName line| |
8013 | 219 |
|
220 |
fileName := aFileNameOrString asFilename. |
|
221 |
[ |
|
222 |
s := fileName readStream. |
|
223 |
] on:OpenError do:[:ex| |
|
224 |
^ nil. |
|
225 |
]. |
|
226 |
||
227 |
bookmarks := OrderedCollection new. |
|
228 |
[s atEnd] whileFalse:[ |
|
12390 | 229 |
line := s nextLine. |
230 |
(line startsWith:';') ifFalse:[ |
|
231 |
bookmarks add:(Base64Coder decode:line) asString. |
|
232 |
] |
|
8013 | 233 |
]. |
234 |
s close. |
|
235 |
||
236 |
^ bookmarks |
|
237 |
! |
|
238 |
||
4679 | 239 |
defaultBookMarksFileDirectory |
12390 | 240 |
"the directory, where the default bookmarks are stored (as defaultBookMarksFilename)" |
241 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
242 |
^ Filename homeDirectory |
4679 | 243 |
! |
244 |
||
245 |
defaultBookMarksFilename |
|
12390 | 246 |
"the filename, in which the default bookmarks are stored (in defaultBookMarksDirectory)" |
247 |
||
4679 | 248 |
^ '.fileBrowserBookmarks' |
249 |
! |
|
250 |
||
251 |
directoryBookmarks |
|
252 |
DirectoryBookmarks isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
253 |
self loadBookmarksFrom:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename). |
4679 | 254 |
|
255 |
DirectoryBookmarks isEmptyOrNil ifTrue:[ |
|
17979 | 256 |
DirectoryBookmarks := |
257 |
OrderedCollection |
|
258 |
with:(Filename homeDirectory asAbsoluteFilename) |
|
259 |
with:(Filename currentDirectory asAbsoluteFilename). |
|
4679 | 260 |
] |
261 |
]. |
|
262 |
^ DirectoryBookmarks |
|
263 |
||
264 |
" |
|
5438
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
265 |
DirectoryBookmarks := nil. |
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
266 |
self directoryBookmarks. |
4679 | 267 |
" |
268 |
! |
|
269 |
||
8013 | 270 |
directoryBookmarks: collectionOfFilenames |
271 |
||
272 |
DirectoryBookmarks := collectionOfFilenames. |
|
273 |
self saveBookmarksInDefaultBookmarksFile. |
|
274 |
! |
|
275 |
||
276 |
editBookmarksWithDefault: aFilenameOrNil |
|
277 |
| oldBookmarks newBookmarks | |
|
278 |
||
279 |
oldBookmarks := self directoryBookmarks copy. |
|
280 |
newBookmarks := BookmarksEditDialog openWith: oldBookmarks defaultBookmark: aFilenameOrNil. |
|
281 |
newBookmarks isNil ifTrue:[^ self]. |
|
282 |
self directoryBookmarks: newBookmarks. |
|
9681
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
283 |
|
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
284 |
"Modified: / 13-01-2011 / 12:52:28 / cg" |
8013 | 285 |
! |
286 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
287 |
hasBookmarks |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
288 |
^ self directoryBookmarks notEmptyOrNil |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
289 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
290 |
|
4679 | 291 |
loadBookmarksFrom:aFileNameOrString |
8013 | 292 |
|bookmarks| |
293 |
||
294 |
bookmarks := self bookmarksFrom: aFileNameOrString. |
|
295 |
bookmarks isNil ifTrue:[^ self]. |
|
4679 | 296 |
|
297 |
DirectoryBookmarks := OrderedCollection new. |
|
298 |
bookmarks do:[:eachPath | |
|
299 |
self addBookmark:eachPath asFilename |
|
300 |
]. |
|
301 |
! |
|
302 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
303 |
removeBookmark:aDirectoryPath |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
304 |
|bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
305 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
306 |
bookmarks := self directoryBookmarks. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
307 |
bookmarks isEmptyOrNil ifTrue:[ ^ self]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
308 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
309 |
bookmarks remove:aDirectoryPath ifAbsent:[]. |
4679 | 310 |
! |
311 |
||
312 |
saveBookmarks |
|
313 |
|fn| |
|
314 |
||
315 |
fn := Dialog |
|
18747 | 316 |
requestFileNameForSave:(self resources string:'Save Bookmarks') |
4679 | 317 |
default:(self defaultBookMarksFilename) |
318 |
fromDirectory:(self defaultBookMarksFileDirectory). |
|
319 |
fn isEmptyOrNil ifTrue:[^ self]. |
|
320 |
||
321 |
self saveBookmarksIn:fn |
|
9607 | 322 |
|
323 |
"Modified: / 27-10-2010 / 11:27:09 / cg" |
|
18747 | 324 |
"Modified: / 01-05-2019 / 11:45:37 / Claus Gittinger" |
4679 | 325 |
! |
326 |
||
8013 | 327 |
saveBookmarks: bookmarks in:aFileNameOrString |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
328 |
"save the bokmarks in aFileNameOrString. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
329 |
Use Base64 coding" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
330 |
|
13683 | 331 |
|bookmarkStream fileName coder| |
4679 | 332 |
|
333 |
fileName := aFileNameOrString asFilename. |
|
334 |
fileName exists ifTrue:[ |
|
13683 | 335 |
fileName renameTo:(fileName addSuffix:'sav'). |
4679 | 336 |
]. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
337 |
bookmarkStream := fileName writeStream. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
338 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
339 |
"save each bookmark in one line" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
340 |
coder := (Base64Coder on:bookmarkStream) lineLimit:nil. |
4679 | 341 |
bookmarks do:[:eachPath | |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
342 |
eachPath asFilename pathName acceptVisitor:coder. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
343 |
coder flush. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
344 |
bookmarkStream cr. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
345 |
]. |
12391 | 346 |
bookmarkStream syncData; close. |
5960 | 347 |
! |
348 |
||
8013 | 349 |
saveBookmarksIn:aFileNameOrString |
350 |
"save the bokmarks in aFileNameOrString. |
|
351 |
Use Base64 coding" |
|
352 |
||
353 |
| bookmarks | |
|
354 |
||
355 |
bookmarks := self directoryBookmarks. |
|
356 |
self saveBookmarks: bookmarks in:aFileNameOrString |
|
357 |
! |
|
358 |
||
5960 | 359 |
saveBookmarksInDefaultBookmarksFile |
360 |
self saveBookmarksIn:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename) |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
361 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
362 |
|
4915 | 363 |
!AbstractFileBrowser class methodsFor:'accessing-classes'! |
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 |
directoryHistoryClass |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
366 |
^ DirectoryHistory |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
367 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
368 |
"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
|
369 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
370 |
|
18820 | 371 |
!AbstractFileBrowser class methodsFor:'aspects-visibility'! |
372 |
||
373 |
cvsMenusAreShown |
|
374 |
^ ConfigurableFeatures includesFeature: #CVSSupportEnabled |
|
375 |
||
376 |
"Created: / 15-01-2012 / 13:00:05 / cg" |
|
377 |
"Modified: / 19-01-2012 / 10:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
378 |
! |
|
379 |
||
380 |
gitMenusAreShown |
|
381 |
^ (ConfigurableFeatures includesFeature: #GITSupportEnabled) |
|
382 |
||
383 |
"Created: / 10-06-2019 / 15:56:33 / Claus Gittinger" |
|
384 |
! |
|
385 |
||
386 |
hgMenusAreShown |
|
387 |
^ (ConfigurableFeatures includesFeature: #HGSupportEnabled) |
|
388 |
||
389 |
"Created: / 14-01-2013 / 11:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
390 |
! |
|
391 |
||
392 |
mercurialMenusAreShown |
|
393 |
^ ConfigurableFeatures hasMercurialSupportEnabled |
|
394 |
||
395 |
"Created: / 15-01-2012 / 13:00:00 / cg" |
|
396 |
! |
|
397 |
||
398 |
perforceMenusAreShown |
|
399 |
^ (ConfigurableFeatures includesFeature: #PerforceSupportEnabled) |
|
400 |
and:[ ConfigurableFeatures hasPerforceSupportEnabled ] |
|
401 |
||
402 |
"Created: / 15-01-2012 / 13:12:11 / cg" |
|
403 |
"Modified: / 19-01-2012 / 10:43:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
404 |
"Modified: / 02-11-2012 / 11:19:59 / cg" |
|
405 |
! |
|
406 |
||
407 |
svnMenusAreShown |
|
408 |
^ ConfigurableFeatures includesFeature: #SubversionSupportEnabled |
|
409 |
||
410 |
"Created: / 15-01-2012 / 13:02:03 / cg" |
|
411 |
"Modified: / 19-01-2012 / 10:43:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
412 |
! ! |
|
413 |
||
3892 | 414 |
!AbstractFileBrowser class methodsFor:'defaults'! |
415 |
||
416 |
commandHistory |
|
417 |
||
418 |
CommandHistory isNil ifTrue:[ |
|
4414 | 419 |
CommandHistory := OrderedCollection new. |
3892 | 420 |
]. |
421 |
^ CommandHistory |
|
422 |
! |
|
423 |
||
424 |
commandHistorySize |
|
4190 | 425 |
"max no of entries in the HistoryList " |
6369 | 426 |
|
3892 | 427 |
CommandHistorySize isNil ifTrue:[ |
6369 | 428 |
CommandHistorySize := 150 |
3892 | 429 |
]. |
430 |
^ CommandHistorySize |
|
431 |
! |
|
432 |
||
433 |
defaultFilterList |
|
434 |
||
435 |
DefaultFilters isNil ifTrue:[ |
|
4414 | 436 |
DefaultFilters := #( '*' |
437 |
'*.st' |
|
438 |
'*.[h,c]*' |
|
12760 | 439 |
'*.txt; *.htm*' |
440 |
'*.gif; *.xpm; *.jpg; *.png' |
|
441 |
'~*o; ~*.obj; ~*.dll;' |
|
4414 | 442 |
) |
3892 | 443 |
]. |
444 |
^ DefaultFilters. |
|
12760 | 445 |
|
446 |
" |
|
447 |
DefaultFilters := nil |
|
448 |
" |
|
3892 | 449 |
! |
450 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
451 |
initialCommandFor:fileName in:aDirectory intoBox:aBox |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
452 |
"set a useful initial command in an execute box." |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
453 |
|
4523 | 454 |
|mime cmd select path suffix baseName pathName| |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
455 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
456 |
path := aDirectory filenameFor:fileName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
457 |
baseName := path baseName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
458 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
459 |
|
16160 | 460 |
cmd := UserPreferences current defaultFileOpenCommandFor:suffix. |
461 |
cmd notNil ifTrue:[ |
|
462 |
aBox initialText:(cmd bindWith:fileName pathName). |
|
463 |
^ self |
|
464 |
]. |
|
465 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
466 |
mime := MIMETypes mimeTypeForSuffix:suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
467 |
"/ mime notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
468 |
"/ cmd := self initialCommandForMIME:mime file:path |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
469 |
"/ ]. |
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 |
"/ 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
|
472 |
"/ XXX or from resources. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
473 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
474 |
(path type == #regular) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
475 |
path isExecutableProgram ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
476 |
aBox initialText:(path pathName , ' <arguments>'). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
477 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
478 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
479 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
480 |
select := true. |
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 |
"some heuristics - my personal preferences ... |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
483 |
(actually this should come from a configfile)" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
484 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
485 |
(baseName endsWith:'akefile') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
486 |
aBox initialText:'make target' selectFrom:6 to:11. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
487 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
488 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
489 |
|
18264 | 490 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:mime. |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
491 |
cmd notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
492 |
select := false |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
493 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
494 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
495 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
496 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
497 |
(suffix = 'C') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
498 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
499 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
500 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
501 |
suffix := suffix asLowercase. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
502 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
503 |
(suffix = 'taz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
504 |
aBox initialText:'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
505 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
506 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
507 |
(suffix = 'tar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
508 |
cmd := 'tar tvf %1'. |
18578 | 509 |
select := 'tar tvf' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
510 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
511 |
(suffix = 'zoo') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
512 |
cmd := 'zoo -list %1'. |
18578 | 513 |
select := 'zoo -list' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
514 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
515 |
(suffix = 'zip') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
516 |
cmd := 'unzip -l %1'. |
18578 | 517 |
select := 'unzip -l' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
518 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
519 |
(suffix = 'jar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
520 |
cmd := 'unzip -l %1'. |
18578 | 521 |
select := 'unzip -l' size |
4496
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 |
(suffix = 'z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
524 |
(baseName asLowercase endsWith:'tar.z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
525 |
cmd := 'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
526 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
527 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
528 |
cmd := 'uncompress %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
529 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
530 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
531 |
(suffix = 'gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
532 |
(baseName asLowercase endsWith:'tar.gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
533 |
cmd := ('gunzip < %1 | tar tvf -' ). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
534 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
535 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
536 |
cmd := 'gunzip %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
537 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
538 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
539 |
(suffix = 'html') ifTrue:[ |
18578 | 540 |
"/ cmd := 'netscape %1' |
541 |
cmd := 'firefox %1'. |
|
542 |
select := 'firefox' size |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
543 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
544 |
(suffix = 'htm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
545 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
546 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
547 |
(suffix = 'uue') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
548 |
cmd := 'uudecode %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
549 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
550 |
(suffix = 'c') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
551 |
cmd := 'cc -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
552 |
select := 5. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
553 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
554 |
(suffix = 'cc') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
555 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
556 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
557 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
558 |
(suffix = 'xbm') ifTrue:[ |
18578 | 559 |
cmd := 'bitmap %1'. |
560 |
select := 'bitmap' size |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
561 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
562 |
(suffix = 'ps') ifTrue:[ |
18578 | 563 |
cmd := 'ghostview %1'. |
564 |
select := 'ghostview' size |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
565 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
566 |
((suffix = '1') or:[suffix = 'man']) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
567 |
cmd := 'nroff -man %1'. |
18578 | 568 |
select := 'nroff -man' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
569 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
570 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
571 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
572 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
573 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
574 |
DefaultCommandPerSuffix isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
575 |
cmd := '<cmd>' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
576 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
577 |
cmd := DefaultCommandPerSuffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
578 |
at:suffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
579 |
ifAbsent:'<cmd>'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
580 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
581 |
cmd := cmd , ' %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
582 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
583 |
|
4523 | 584 |
pathName := path pathName. |
585 |
OperatingSystem isUNIXlike ifTrue:[ |
|
586 |
pathName includesSeparator ifTrue:[ |
|
587 |
pathName := '"' , pathName , '"' |
|
588 |
] |
|
589 |
]. |
|
590 |
||
591 |
cmd := cmd bindWith:pathName. |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
592 |
select == false ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
593 |
aBox initialText:cmd |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
594 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
595 |
select class == Interval ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
596 |
aBox initialText:cmd selectFrom:select start to:select stop |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
597 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
598 |
select isInteger ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
599 |
select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
600 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
601 |
aBox initialText:cmd selectFrom:1 to:select |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
602 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
603 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
604 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
605 |
|
18264 | 606 |
"Modified: / 24-09-1997 / 16:34:52 / stefan" |
607 |
"Modified: / 09-04-1998 / 17:15:57 / cg" |
|
608 |
"Modified: / 09-07-2018 / 11:16:30 / Stefan Vogel" |
|
18578 | 609 |
"Modified: / 05-02-2019 / 10:23:20 / Claus Gittinger" |
3892 | 610 |
! |
611 |
||
5941 | 612 |
listOfRuntimeValuesToRemember |
613 |
" list of all aspects that will be remembered after closing a FileBrowserV2" |
|
614 |
||
615 |
^ #( |
|
616 |
"/ #filterModel |
|
617 |
#enableFileHistory |
|
618 |
#fileHistory |
|
619 |
#currentSortOrder |
|
620 |
#sortBlockProperty |
|
621 |
) |
|
3892 | 622 |
! |
623 |
||
624 |
resetAspects |
|
625 |
||
626 |
RuntimeAspects := nil. |
|
627 |
||
5941 | 628 |
" |
629 |
self resetAspects |
|
630 |
" |
|
3892 | 631 |
! |
632 |
||
633 |
runtimeAspects |
|
634 |
||
635 |
RuntimeAspects isNil ifTrue:[ |
|
4414 | 636 |
RuntimeAspects := Dictionary new. |
3892 | 637 |
]. |
638 |
^ RuntimeAspects |
|
639 |
! |
|
640 |
||
4201 | 641 |
userPreferencesAspectList |
642 |
" list of all aspects that will be saved with save settings |
|
643 |
that aspects will be image consistent if the settings are saved in Launcher |
|
11501 | 644 |
don't forget to add a access methods in UserPreferences if you add a aspect here |
4201 | 645 |
" |
646 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
647 |
^ Dictionary |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
648 |
withKeysAndValues:#( |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
649 |
viewDirsInContentsBrowser true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
650 |
showDirectoryTree true |
11501 | 651 |
showHiddenFiles true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
652 |
viewDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
653 |
viewDetails true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
654 |
viewDirectoryDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
655 |
viewFilesInDirectoryTree false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
656 |
viewGroup false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
657 |
viewOwner false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
658 |
viewPermissions false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
659 |
viewPreview false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
660 |
viewSize true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
661 |
viewSizeInKiloBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
662 |
viewSizeInBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
663 |
viewTime true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
664 |
viewType false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
665 |
openMultipleApplicationsForType false |
7788 | 666 |
filenameEntryFieldVisibleHolder true |
667 |
toolBarVisibleHolder true |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
668 |
sortDirectoriesBeforeFiles true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
669 |
openAlwaysInTextEditor false |
15111 | 670 |
alwaysUseSmalltalkTools true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
671 |
sortCaseless false |
13011 | 672 |
"/ 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
|
673 |
showDirectoriesOnTop false |
4201 | 674 |
) |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
675 |
|
11501 | 676 |
"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
|
677 |
"Modified: / 12-08-2014 / 13:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3892 | 678 |
! ! |
679 |
||
17202 | 680 |
!AbstractFileBrowser class methodsFor:'drag & drop'! |
681 |
||
682 |
doStartDrag:aDropSource in:aView |
|
683 |
"set the cursors before starting the drag & drop operation" |
|
684 |
||
685 |
|hdl| |
|
686 |
||
687 |
hdl := DragAndDropManager new. |
|
688 |
||
689 |
hdl disabledCursor:self disabledCursorIcon. |
|
690 |
hdl enabledCursor:self enabledCursorIcon. |
|
691 |
hdl alienCursor:nil. |
|
692 |
||
693 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft. |
|
694 |
||
695 |
"Modified: / 23-07-2007 / 23:00:38 / cg" |
|
696 |
! ! |
|
697 |
||
5398 | 698 |
!AbstractFileBrowser class methodsFor:'help specs'! |
699 |
||
17889 | 700 |
basicHelpSpec |
6099 | 701 |
<resource: #help> |
702 |
||
17889 | 703 |
^ super helpSpec addPairsFrom:#( |
6099 | 704 |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
705 |
#lockFileEncoding |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
706 |
'Do not guess the encoding from the file''s contents.' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
707 |
|
6100 | 708 |
#closeTabButton |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
709 |
'Close this tab' |
6100 | 710 |
|
6099 | 711 |
#addTerminal |
17182 | 712 |
'Add a shell terminal page' |
6099 | 713 |
|
714 |
#make |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
715 |
'Call the make command' |
6099 | 716 |
|
717 |
#searchFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
718 |
'Search a file' |
6099 | 719 |
|
720 |
#directoryUp |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
721 |
'Directory up' |
6099 | 722 |
|
723 |
#directoryBack |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
724 |
'Directory back' |
6099 | 725 |
|
726 |
#directoryForward |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
727 |
'Directory forward' |
6099 | 728 |
|
729 |
#directoryHistory |
|
730 |
'Directory' |
|
731 |
||
732 |
#copyFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
733 |
'Copy the selected file(s)' |
6099 | 734 |
|
735 |
#cutFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
736 |
'Cut the selected file(s)' |
6099 | 737 |
|
738 |
#editFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
739 |
'Edit the selected file' |
6099 | 740 |
|
741 |
#fileHome |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
742 |
'Goto home directory' |
6099 | 743 |
|
8093 | 744 |
#fileDesktop |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
745 |
'Goto desktop directory' |
8093 | 746 |
|
6099 | 747 |
#fileGotoDefault |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
748 |
'Goto default directory (ST/X start directory)' |
6099 | 749 |
|
6454 | 750 |
#fileGotoSmalltalkDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
751 |
'Goto Smalltalk directory (ST/X application)' |
6454 | 752 |
|
6456 | 753 |
#fileGotoDefaultDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
754 |
'Goto current directory' |
6456 | 755 |
|
6099 | 756 |
#pasteFile |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
757 |
'Paste file(s)' |
6099 | 758 |
|
759 |
#deleteFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
760 |
'Delete the selected file(s)' |
6099 | 761 |
|
762 |
#fileIn |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
763 |
'File in' |
6099 | 764 |
|
765 |
#fileHistory |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
766 |
'File history' |
6099 | 767 |
|
768 |
#fileGotoBookmark |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
769 |
'Goto bookmarked directory' |
6099 | 770 |
|
771 |
#hideToolBar |
|
13910 | 772 |
'Hide the toolbar (show again via "View"-menu)' |
6099 | 773 |
|
774 |
#hideFilenameEntryField |
|
13910 | 775 |
'Hide filename & filter fields (show again via "View"-menu)' |
776 |
||
777 |
#hideBookmarks |
|
778 |
'Hide the bookmarks (show again via "View"-menu)' |
|
6099 | 779 |
|
780 |
#openChangeBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
781 |
'Open a Changebrowser on file' |
6099 | 782 |
|
783 |
#showFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
784 |
'Show file details' |
6099 | 785 |
|
786 |
#hideFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
787 |
'Hide file details' |
6099 | 788 |
|
789 |
#toggleDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
790 |
'Show/hide file details' |
6099 | 791 |
|
792 |
#viewDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
793 |
'Show/hide file details' |
6099 | 794 |
|
795 |
#selectDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
796 |
'Select file details to be shown' |
6099 | 797 |
|
8088 | 798 |
#showDifferences |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
799 |
'Show differences between file and editor versions' |
8088 | 800 |
|
801 |
#toggleHexDisplay |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
802 |
'Toggle between hexadecimal and textual representation' |
8088 | 803 |
|
804 |
#findInBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
805 |
'Navigate the browser''s file list to the edited file' |
8088 | 806 |
|
807 |
#saveFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
808 |
'Save the editor''s contents into the file' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
809 |
|
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
810 |
#saveFileAs |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
811 |
'Save the editor''s contents into another file' |
8088 | 812 |
|
813 |
#reloadFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
814 |
'Reload from the file' |
8088 | 815 |
|
816 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
817 |
'Send to the printer' |
8088 | 818 |
|
6099 | 819 |
). |
820 |
||
8261 | 821 |
" |
17889 | 822 |
self helpSpec |
8261 | 823 |
" |
824 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
825 |
"Modified: / 06-10-2011 / 14:55:27 / cg" |
8261 | 826 |
! |
827 |
||
17889 | 828 |
helpSpec |
8261 | 829 |
<resource: #programHelp> |
830 |
||
831 |
|spec hist resources| |
|
832 |
||
17889 | 833 |
spec := self basicHelpSpec. |
8261 | 834 |
|
835 |
"/ add help items for the history |
|
6099 | 836 |
hist := self directoryHistory. |
837 |
hist notNil ifTrue:[ |
|
838 |
resources := self classResources. |
|
839 |
hist canForward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
840 |
spec at:#directoryForward put:[ resources string:'Forward to: %1' with:hist nextForwardItem ]. |
6099 | 841 |
]. |
842 |
hist canBackward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
843 |
spec at:#directoryBack put:[ resources string:'Back to: %1' with:hist nextBackwardItem ]. |
6099 | 844 |
]. |
845 |
]. |
|
846 |
^ spec. |
|
847 |
||
848 |
" |
|
17889 | 849 |
self helpSpec |
6099 | 850 |
" |
851 |
||
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
852 |
"Modified: / 03-11-2007 / 12:05:01 / cg" |
5398 | 853 |
! ! |
854 |
||
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
855 |
!AbstractFileBrowser class methodsFor:'image specs'! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
856 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
857 |
clearHistoryIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
858 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
859 |
|
17413 | 860 |
^ ToolbarIconLibrary deleteIcon |
861 |
"/ ^ Icon deleteIcon |
|
862 |
||
863 |
"Modified: / 15-02-2017 / 19:45:24 / cg" |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
864 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
865 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
866 |
copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
867 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
868 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
869 |
^ ToolbarIconLibrary copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
870 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
871 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
872 |
cutIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
873 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
874 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
875 |
^ ToolbarIconLibrary cut20x20Icon2 "cut28x28Icon" |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
876 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
877 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
878 |
deleteIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
879 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
880 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
881 |
^ ToolbarIconLibrary erase20x20Icon "/ delete28x28Icon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
882 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
883 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
884 |
directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
885 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
886 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
887 |
^ ToolbarIconLibrary directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
888 |
! |
3892 | 889 |
|
15211 | 890 |
disabledCursorIcon |
891 |
"This resource specification was automatically generated |
|
892 |
by the ImageEditor of ST/X." |
|
893 |
||
894 |
"Do not manually edit this!! If it is corrupted, |
|
895 |
the ImageEditor may not be able to read the specification." |
|
896 |
||
897 |
" |
|
17202 | 898 |
self disabledCursorIcon inspect |
899 |
ImageEditor openOnClass:self andSelector:#disabledCursorIcon |
|
15211 | 900 |
Icon flushCachedIcons |
901 |
" |
|
902 |
||
903 |
<resource: #image> |
|
904 |
||
905 |
^Icon |
|
906 |
constantNamed:#'AbstractFileBrowser class disabledCursorIcon' |
|
907 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
908 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@XF@@@H@P@@DOB@@BLLP@AA@"@@RHD @H1AD@BRHI@@$QBP@IBH$@BPQI@@"BLP@D QH@ADBB@@H0Q@@AC |
|
909 |
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:' |
|
910 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@_>@@@O?0@@G?>@@C<O0@A?@>@@_8G @O?A<@C38O@@<_C0@OC8<@C0_O@@>C?0@G _8@A<C>@@O0_@@A? |
|
911 |
? @@O?0@@A?8@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
912 |
! |
|
6337 | 913 |
|
15211 | 914 |
enabledCursorIcon |
915 |
"This resource specification was automatically generated |
|
916 |
by the ImageEditor of ST/X." |
|
917 |
||
918 |
"Do not manually edit this!! If it is corrupted, |
|
919 |
the ImageEditor may not be able to read the specification." |
|
920 |
||
921 |
" |
|
17202 | 922 |
self enabledCursorIcon inspect |
923 |
ImageEditor openOnClass:self andSelector:#enabledCursorIcon |
|
15211 | 924 |
Icon flushCachedIcons |
925 |
" |
|
926 |
||
927 |
<resource: #image> |
|
928 |
||
929 |
^Icon |
|
930 |
constantNamed:#'AbstractFileBrowser class enabledCursorIcon' |
|
931 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
932 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@@@@@?0_0@@@@@@C?A?@@@@@@@@AP@@@@T@@@@E@@@@A |
|
933 |
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:' |
|
934 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@?8?0@O>O<@C?#?@@@G@@@@A0@@@@\@@@@G@@@@A |
|
935 |
0@@@@\@@@@G@@@@A0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
936 |
! |
|
6337 | 937 |
|
3892 | 938 |
fileInIcon |
939 |
<resource: #programImage> |
|
940 |
||
6116 | 941 |
^ ToolbarIconLibrary fileInIcon |
3892 | 942 |
! |
943 |
||
6079 | 944 |
historyBackIcon |
945 |
<resource: #programImage> |
|
946 |
||
947 |
^ ToolbarIconLibrary historyBackIcon |
|
948 |
! |
|
949 |
||
950 |
historyForwardIcon |
|
951 |
<resource: #programImage> |
|
952 |
||
953 |
^ ToolbarIconLibrary historyForwardIcon |
|
954 |
! |
|
955 |
||
3892 | 956 |
homeIcon |
957 |
<resource: #programImage> |
|
958 |
||
6079 | 959 |
^ ToolbarIconLibrary homeIcon |
3892 | 960 |
! |
961 |
||
6074 | 962 |
homeIcon2 |
6079 | 963 |
<resource: #programImage> |
964 |
||
965 |
^ ToolbarIconLibrary homeIcon2 |
|
6074 | 966 |
! |
967 |
||
968 |
htmlReloadIcon |
|
969 |
<resource: #programImage> |
|
970 |
||
971 |
^ ToolbarIconLibrary reload22x22Icon |
|
972 |
! |
|
973 |
||
15211 | 974 |
leftDownIcon |
975 |
<resource: #image> |
|
976 |
"This resource specification was automatically generated |
|
977 |
by the ImageEditor of ST/X." |
|
978 |
"Do not manually edit this!! If it is corrupted, |
|
979 |
the ImageEditor may not be able to read the specification." |
|
980 |
" |
|
981 |
self leftDownIcon inspect |
|
982 |
ImageEditor openOnClass:self andSelector:#leftDownIcon" |
|
983 |
||
984 |
^ Icon constantNamed:#'AbstractFileBrowser class leftDownIcon' |
|
985 |
ifAbsentPut:[ |
|
986 |
(Depth2Image new) |
|
987 |
width:28; |
|
988 |
height:28; |
|
989 |
photometric:(#palette); |
|
990 |
bitsPerSample:(#( 2 )); |
|
991 |
samplesPerPixel:(1); |
|
992 |
bits:(ByteArray |
|
993 |
fromPackedString:' |
|
994 |
UUUUUUUUUUUPAUUUUUUUP@UUUUUUUPB!!UUUUUU@B*AUUUUU@B*(UUUUUPB** UUUUPB***AUUUTB***(EUUUB****%UUUR*****UUUUU@*%UUUUUUPJ)UUUU |
|
995 |
UUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*$@@@@AUPJ*****)UTB******UU@******%UPJ*****)UTAUUUU |
|
996 |
UUUU@@@@@@@AUUUUUUUUUP@a'); |
|
997 |
colorMapFromArray:#[ 255 255 255 0 0 0 40 40 100 255 0 0 ]; |
|
998 |
mask:((ImageMask new) |
|
999 |
width:28; |
|
1000 |
height:28; |
|
1001 |
bits:(ByteArray |
|
1002 |
fromPackedString:' |
|
1003 |
@@@@@@@@@@@@ @@@@\@@@@O @@@G<@@@C? @@A?<@@@?? @@_?<@@G?? @@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C??? @???8@O? |
|
1004 |
?>@C??? @???8@O??>@@@@@@@@@@@@@a'); |
|
1005 |
yourself); |
|
1006 |
yourself |
|
1007 |
] |
|
1008 |
! |
|
1009 |
||
1010 |
menuHistoryList9x20Icon |
|
1011 |
<resource: #image> |
|
1012 |
"This resource specification was automatically generated |
|
1013 |
by the ImageEditor of ST/X." |
|
1014 |
"Do not manually edit this!! If it is corrupted, |
|
1015 |
the ImageEditor may not be able to read the specification." |
|
1016 |
" |
|
1017 |
self menuHistoryList9x20Icon inspect |
|
1018 |
ImageEditor openOnClass:self andSelector:#menuHistoryList9x20Icon |
|
1019 |
Icon flushCachedIcons" |
|
1020 |
||
1021 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryList9x20Icon' |
|
1022 |
ifAbsentPut:[ |
|
1023 |
(Depth1Image new) |
|
1024 |
width:9; |
|
1025 |
height:20; |
|
1026 |
photometric:(#palette); |
|
1027 |
bitsPerSample:(#( 1 )); |
|
1028 |
samplesPerPixel:(1); |
|
1029 |
bits:(ByteArray |
|
1030 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
1031 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
1032 |
mask:((ImageMask new) |
|
1033 |
width:9; |
|
1034 |
height:20; |
|
1035 |
bits:(ByteArray |
|
1036 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
1037 |
yourself); |
|
1038 |
yourself |
|
1039 |
] |
|
1040 |
! |
|
1041 |
||
1042 |
menuHistoryListIcon |
|
1043 |
<resource: #image> |
|
1044 |
"This resource specification was automatically generated |
|
1045 |
by the ImageEditor of ST/X." |
|
1046 |
"Do not manually edit this!! If it is corrupted, |
|
1047 |
the ImageEditor may not be able to read the specification." |
|
1048 |
" |
|
1049 |
self menuHistoryListIcon inspect |
|
1050 |
ImageEditor openOnClass:self andSelector:#menuHistoryListIcon" |
|
1051 |
||
1052 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryListIcon' |
|
1053 |
ifAbsentPut:[ |
|
1054 |
(Depth1Image new) |
|
1055 |
width:12; |
|
1056 |
height:12; |
|
1057 |
photometric:(#palette); |
|
1058 |
bitsPerSample:(#( 1 )); |
|
1059 |
samplesPerPixel:(1); |
|
1060 |
bits:(ByteArray fromPackedString:'??S?<O?0??C?<O?0??/?=_?0??C?<O?0'); |
|
1061 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
1062 |
mask:((ImageMask new) |
|
1063 |
width:12; |
|
1064 |
height:12; |
|
1065 |
bits:(ByteArray fromPackedString:'@@@O@@<@C0A?8C?@G8@O@@X@@@A?8@@@'); |
|
1066 |
yourself); |
|
1067 |
yourself |
|
1068 |
] |
|
1069 |
! |
|
3892 | 1070 |
|
6087 | 1071 |
newDirectoryIcon |
6074 | 1072 |
<resource: #programImage> |
1073 |
||
6087 | 1074 |
^ ToolbarIconLibrary newDirectoryIcon |
3923 | 1075 |
! |
1076 |
||
6091 | 1077 |
removeTabIcon |
1078 |
<resource: #programImage> |
|
1079 |
||
1080 |
^ ToolbarIconLibrary removeTabIcon |
|
1081 |
! |
|
1082 |
||
3892 | 1083 |
vt100Terminal |
1084 |
<resource: #programImage> |
|
1085 |
||
1086 |
^ ToolbarIconLibrary shell20x20Icon |
|
1087 |
! ! |
|
1088 |
||
5528 | 1089 |
!AbstractFileBrowser class methodsFor:'interface specs'! |
1090 |
||
15211 | 1091 |
encodingDialogSpec |
1092 |
"This resource specification was automatically generated |
|
1093 |
by the UIPainter of ST/X." |
|
1094 |
||
1095 |
"Do not manually edit this!! If it is corrupted, |
|
1096 |
the UIPainter may not be able to read the specification." |
|
1097 |
||
1098 |
" |
|
1099 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#encodingDialogSpec |
|
1100 |
AbstractFileBrowser new openInterface:#encodingDialogSpec |
|
1101 |
" |
|
1102 |
||
1103 |
<resource: #canvas> |
|
1104 |
||
1105 |
^ |
|
1106 |
#(FullSpec |
|
1107 |
name: encodingDialogSpec |
|
1108 |
window: |
|
1109 |
(WindowSpec |
|
1110 |
label: 'File Encoding' |
|
1111 |
name: 'File Encoding' |
|
1112 |
min: (Point 10 10) |
|
1113 |
bounds: (Rectangle 0 0 379 590) |
|
1114 |
) |
|
1115 |
component: |
|
1116 |
(SpecCollection |
|
1117 |
collection: ( |
|
1118 |
(LabelSpec |
|
1119 |
label: 'Select the External (File-) Encoding:' |
|
1120 |
name: 'Label1' |
|
1121 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1122 |
translateLabel: true |
|
1123 |
adjust: left |
|
1124 |
) |
|
1125 |
(DataSetSpec |
|
1126 |
name: 'Table1' |
|
1127 |
layout: (LayoutFrame 0 0 30 0 0 1 -60 1) |
|
1128 |
model: selectedEncoding |
|
1129 |
hasHorizontalScrollBar: true |
|
1130 |
hasVerticalScrollBar: true |
|
1131 |
dataList: encodingList |
|
1132 |
has3Dseparators: true |
|
1133 |
columns: |
|
1134 |
(Array |
|
1135 |
||
1136 |
(DataSetColumnSpec |
|
1137 |
label: 'Encoding' |
|
1138 |
labelButtonType: Button |
|
1139 |
height: heightOfFirstRow |
|
1140 |
model: at: |
|
1141 |
canSelect: false |
|
1142 |
isResizeable: false |
|
1143 |
showRowSeparator: false |
|
1144 |
showColSeparator: false |
|
1145 |
) |
|
1146 |
(DataSetColumnSpec |
|
1147 |
label: 'Description' |
|
1148 |
labelButtonType: Button |
|
1149 |
height: heightOfFirstRow |
|
1150 |
model: at: |
|
1151 |
canSelect: false |
|
1152 |
isResizeable: false |
|
1153 |
showRowSeparator: false |
|
1154 |
showColSeparator: false |
|
1155 |
) |
|
1156 |
) |
|
1157 |
doubleClickChannel: accept |
|
1158 |
) |
|
1159 |
(CheckBoxSpec |
|
1160 |
label: 'Lock Encoding' |
|
1161 |
name: 'LockEncodingCheckBox' |
|
1162 |
layout: (LayoutFrame 3 0 -60 1 217 0 -30 1) |
|
1163 |
activeHelpKey: lockFileEncoding |
|
1164 |
model: lockFileEncoding |
|
1165 |
translateLabel: true |
|
1166 |
) |
|
1167 |
(HorizontalPanelViewSpec |
|
1168 |
name: 'ButtonPanel' |
|
1169 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1170 |
horizontalLayout: fitSpace |
|
1171 |
verticalLayout: center |
|
1172 |
horizontalSpace: 3 |
|
1173 |
verticalSpace: 3 |
|
1174 |
reverseOrderIfOKAtLeft: true |
|
1175 |
component: |
|
1176 |
(SpecCollection |
|
1177 |
collection: ( |
|
1178 |
(ActionButtonSpec |
|
1179 |
label: 'Cancel' |
|
1180 |
name: 'Button2' |
|
1181 |
translateLabel: true |
|
1182 |
model: cancel |
|
1183 |
extent: (Point 183 22) |
|
1184 |
) |
|
1185 |
(ActionButtonSpec |
|
1186 |
label: 'OK' |
|
1187 |
name: 'Button1' |
|
1188 |
translateLabel: true |
|
1189 |
model: accept |
|
1190 |
isDefault: true |
|
1191 |
extent: (Point 184 22) |
|
1192 |
) |
|
1193 |
) |
|
1194 |
||
1195 |
) |
|
1196 |
) |
|
1197 |
) |
|
1198 |
||
1199 |
) |
|
1200 |
) |
|
1201 |
! |
|
1202 |
||
1203 |
lineEndConventionDialogSpec |
|
1204 |
"This resource specification was automatically generated |
|
1205 |
by the UIPainter of ST/X." |
|
1206 |
||
1207 |
"Do not manually edit this!! If it is corrupted, |
|
1208 |
the UIPainter may not be able to read the specification." |
|
1209 |
||
1210 |
" |
|
1211 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#lineEndConventionDialogSpec |
|
1212 |
AbstractFileBrowser new openInterface:#lineEndConventionDialogSpec |
|
1213 |
" |
|
1214 |
||
1215 |
<resource: #canvas> |
|
1216 |
||
1217 |
^ |
|
15212 | 1218 |
#(FullSpec |
1219 |
name: lineEndConventionDialogSpec |
|
1220 |
window: |
|
1221 |
(WindowSpec |
|
1222 |
label: 'Line-End Convention' |
|
1223 |
name: 'Line-End Convention' |
|
1224 |
min: (Point 10 10) |
|
1225 |
bounds: (Rectangle 0 0 379 239) |
|
1226 |
) |
|
1227 |
component: |
|
1228 |
(SpecCollection |
|
1229 |
collection: ( |
|
1230 |
(LabelSpec |
|
1231 |
label: 'Select the Line-End Convention (used when saving files):' |
|
1232 |
name: 'Label1' |
|
1233 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1234 |
translateLabel: true |
|
1235 |
adjust: left |
|
1236 |
) |
|
1237 |
(VerticalPanelViewSpec |
|
1238 |
name: 'VerticalPanel1' |
|
1239 |
layout: (LayoutFrame 20 0 40 0 0 1 -30 1) |
|
1240 |
horizontalLayout: fit |
|
1241 |
verticalLayout: topSpace |
|
1242 |
horizontalSpace: 3 |
|
1243 |
verticalSpace: 3 |
|
1244 |
component: |
|
1245 |
(SpecCollection |
|
1246 |
collection: ( |
|
1247 |
(RadioButtonSpec |
|
1248 |
label: 'NL (Unix)' |
|
1249 |
name: 'RadioButton1' |
|
1250 |
translateLabel: true |
|
1251 |
model: lineEndConvention |
|
1252 |
isTriggerOnDown: true |
|
1253 |
select: nl |
|
1254 |
extent: (Point 359 22) |
|
1255 |
) |
|
1256 |
(RadioButtonSpec |
|
1257 |
label: 'CR-NL (MSDOS)' |
|
1258 |
name: 'RadioButton4' |
|
1259 |
translateLabel: true |
|
1260 |
model: lineEndConvention |
|
1261 |
isTriggerOnDown: true |
|
1262 |
select: crlf |
|
1263 |
extent: (Point 359 22) |
|
1264 |
) |
|
1265 |
(RadioButtonSpec |
|
1266 |
label: 'CR (VMS and pre OSX mac)' |
|
1267 |
name: 'RadioButton5' |
|
1268 |
translateLabel: true |
|
1269 |
model: lineEndConvention |
|
1270 |
isTriggerOnDown: true |
|
1271 |
select: cr |
|
1272 |
extent: (Point 359 22) |
|
15211 | 1273 |
) |
15212 | 1274 |
(RadioButtonSpec |
1275 |
label: 'ETX (some modem protocols and mainframe files)' |
|
1276 |
name: 'RadioButton6' |
|
1277 |
translateLabel: true |
|
1278 |
model: lineEndConvention |
|
1279 |
isTriggerOnDown: true |
|
1280 |
select: etx |
|
1281 |
extent: (Point 359 22) |
|
1282 |
) |
|
1283 |
(RadioButtonSpec |
|
1284 |
label: 'EOT (some modem protocols and mainframe files)' |
|
1285 |
name: 'RadioButton7' |
|
1286 |
translateLabel: true |
|
1287 |
model: lineEndConvention |
|
1288 |
isTriggerOnDown: true |
|
1289 |
select: eot |
|
1290 |
extent: (Point 359 22) |
|
15211 | 1291 |
) |
15212 | 1292 |
) |
1293 |
||
1294 |
) |
|
15211 | 1295 |
) |
15212 | 1296 |
(HorizontalPanelViewSpec |
1297 |
name: 'ButtonPanel' |
|
1298 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1299 |
horizontalLayout: fitSpace |
|
1300 |
verticalLayout: center |
|
1301 |
horizontalSpace: 3 |
|
1302 |
verticalSpace: 3 |
|
1303 |
reverseOrderIfOKAtLeft: true |
|
1304 |
component: |
|
1305 |
(SpecCollection |
|
1306 |
collection: ( |
|
1307 |
(ActionButtonSpec |
|
1308 |
label: 'Cancel' |
|
1309 |
name: 'Button2' |
|
1310 |
translateLabel: true |
|
1311 |
model: cancel |
|
1312 |
extent: (Point 185 22) |
|
1313 |
) |
|
1314 |
(ActionButtonSpec |
|
1315 |
label: 'OK' |
|
1316 |
name: 'Button1' |
|
1317 |
translateLabel: true |
|
1318 |
model: accept |
|
1319 |
isDefault: true |
|
1320 |
extent: (Point 185 22) |
|
1321 |
) |
|
1322 |
) |
|
1323 |
||
1324 |
) |
|
1325 |
) |
|
1326 |
) |
|
1327 |
||
1328 |
) |
|
1329 |
) |
|
15211 | 1330 |
! |
1331 |
||
1332 |
tabStopConversionDialogSpec |
|
1333 |
"This resource specification was automatically generated |
|
1334 |
by the UIPainter of ST/X." |
|
1335 |
||
1336 |
"Do not manually edit this!! If it is corrupted, |
|
1337 |
the UIPainter may not be able to read the specification." |
|
1338 |
||
1339 |
" |
|
1340 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#tabStopConversionDialogSpec |
|
1341 |
AbstractFileBrowser new openInterface:#tabStopConversionDialogSpec |
|
1342 |
" |
|
1343 |
||
1344 |
<resource: #canvas> |
|
1345 |
||
1346 |
^ |
|
1347 |
#(FullSpec |
|
1348 |
name: 'tabStopConversionDialogSpec' |
|
1349 |
window: |
|
1350 |
(WindowSpec |
|
1351 |
label: 'Tab-Stop Conversion' |
|
1352 |
name: 'Tab-Stop Conversion' |
|
1353 |
min: (Point 10 10) |
|
1354 |
bounds: (Rectangle 0 0 379 239) |
|
1355 |
) |
|
1356 |
component: |
|
1357 |
(SpecCollection |
|
1358 |
collection: ( |
|
1359 |
(LabelSpec |
|
1360 |
label: 'Select the Tab-Stop Conversion (used when saving files):' |
|
1361 |
name: 'Label1' |
|
1362 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1363 |
translateLabel: true |
|
1364 |
adjust: left |
|
1365 |
) |
|
1366 |
(VerticalPanelViewSpec |
|
1367 |
name: 'VerticalPanel1' |
|
1368 |
layout: (LayoutFrame 0 0 30 0 0 1 -30 1) |
|
1369 |
horizontalLayout: center |
|
1370 |
verticalLayout: center |
|
1371 |
horizontalSpace: 3 |
|
1372 |
verticalSpace: 3 |
|
1373 |
component: |
|
1374 |
(SpecCollection |
|
1375 |
collection: ( |
|
1376 |
(RadioButtonSpec |
|
1377 |
label: '4' |
|
1378 |
name: 'RadioButton1' |
|
1379 |
translateLabel: true |
|
1380 |
model: tabStops |
|
1381 |
isTriggerOnDown: true |
|
1382 |
select: 4 |
|
1383 |
extent: (Point 136 22) |
|
1384 |
) |
|
1385 |
(RadioButtonSpec |
|
1386 |
label: '8' |
|
1387 |
name: 'RadioButton4' |
|
1388 |
translateLabel: true |
|
1389 |
model: tabStops |
|
1390 |
isTriggerOnDown: true |
|
1391 |
select: 8 |
|
1392 |
extent: (Point 136 22) |
|
1393 |
) |
|
1394 |
) |
|
1395 |
||
1396 |
) |
|
1397 |
) |
|
1398 |
(HorizontalPanelViewSpec |
|
1399 |
name: 'ButtonPanel' |
|
1400 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1401 |
horizontalLayout: fitSpace |
|
1402 |
verticalLayout: center |
|
1403 |
horizontalSpace: 3 |
|
1404 |
verticalSpace: 3 |
|
1405 |
reverseOrderIfOKAtLeft: true |
|
1406 |
component: |
|
1407 |
(SpecCollection |
|
1408 |
collection: ( |
|
1409 |
(ActionButtonSpec |
|
1410 |
label: 'Cancel' |
|
1411 |
name: 'Button2' |
|
1412 |
translateLabel: true |
|
1413 |
model: cancel |
|
1414 |
extent: (Point 185 22) |
|
1415 |
) |
|
1416 |
(ActionButtonSpec |
|
1417 |
label: 'OK' |
|
1418 |
name: 'Button1' |
|
1419 |
translateLabel: true |
|
1420 |
model: accept |
|
1421 |
isDefault: true |
|
1422 |
extent: (Point 185 22) |
|
1423 |
) |
|
1424 |
) |
|
1425 |
||
1426 |
) |
|
1427 |
) |
|
1428 |
) |
|
1429 |
||
1430 |
) |
|
1431 |
) |
|
1432 |
||
1433 |
"Modified: / 28-02-2012 / 11:12:38 / cg" |
|
1434 |
! ! |
|
5528 | 1435 |
|
3892 | 1436 |
!AbstractFileBrowser class methodsFor:'menu specs'! |
1437 |
||
15211 | 1438 |
baseBookmarksMenuSpec |
1439 |
"This resource specification was automatically generated |
|
1440 |
by the MenuEditor of ST/X." |
|
1441 |
||
1442 |
"Do not manually edit this!! If it is corrupted, |
|
1443 |
the MenuEditor may not be able to read the specification." |
|
1444 |
||
19001 | 1445 |
|
15211 | 1446 |
" |
1447 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec |
|
1448 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec)) startUp |
|
1449 |
" |
|
1450 |
||
1451 |
<resource: #menu> |
|
1452 |
||
1453 |
^ |
|
19001 | 1454 |
#(Menu |
1455 |
(MenuItem |
|
1456 |
enabled: currentFilesHasDirectories |
|
1457 |
label: 'Add Bookmark' |
|
1458 |
itemValue: addBookmark |
|
1459 |
) |
|
1460 |
(MenuItem |
|
1461 |
enabled: hasBookmarksToRemove |
|
1462 |
label: 'Remove Bookmark' |
|
1463 |
itemValue: removeBookmark |
|
1464 |
) |
|
1465 |
(MenuItem |
|
1466 |
label: 'Save Bookmarks In...' |
|
1467 |
itemValue: saveBookmarks |
|
1468 |
) |
|
1469 |
) |
|
15211 | 1470 |
! |
1471 |
||
1472 |
baseBookmarksMenuSpec2 |
|
1473 |
"This resource specification was automatically generated |
|
1474 |
by the MenuEditor of ST/X." |
|
1475 |
||
1476 |
"Do not manually edit this!! If it is corrupted, |
|
1477 |
the MenuEditor may not be able to read the specification." |
|
1478 |
||
19001 | 1479 |
|
15211 | 1480 |
" |
1481 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec2 |
|
1482 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec2)) startUp |
|
1483 |
" |
|
1484 |
||
1485 |
<resource: #menu> |
|
1486 |
||
1487 |
^ |
|
19001 | 1488 |
#(Menu |
1489 |
(MenuItem |
|
1490 |
label: 'Edit Bookmarks' |
|
1491 |
itemValue: editBookmarks |
|
1492 |
) |
|
1493 |
(MenuItem |
|
1494 |
label: '-' |
|
1495 |
) |
|
1496 |
(MenuItem |
|
1497 |
enabled: currentFilesHasDirectories |
|
1498 |
label: 'Add Bookmark' |
|
1499 |
itemValue: addBookmark |
|
1500 |
) |
|
1501 |
) |
|
15211 | 1502 |
! |
1503 |
||
1504 |
browserMenu |
|
1505 |
"This resource specification was automatically generated |
|
1506 |
by the MenuEditor of ST/X." |
|
1507 |
||
1508 |
"Do not manually edit this!! If it is corrupted, |
|
1509 |
the MenuEditor may not be able to read the specification." |
|
1510 |
||
1511 |
||
1512 |
" |
|
1513 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#browserMenu |
|
1514 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser browserMenu)) startUp |
|
1515 |
" |
|
1516 |
||
1517 |
<resource: #menu> |
|
1518 |
||
1519 |
^ |
|
19001 | 1520 |
#(Menu |
1521 |
(MenuItem |
|
1522 |
label: 'Spawn Filebrowser' |
|
1523 |
itemValue: doSpawn |
|
1524 |
shortcutKey: Ctrln |
|
1525 |
) |
|
1526 |
(MenuItem |
|
1527 |
label: 'Windows Explorer' |
|
1528 |
itemValue: doOpenExplorer |
|
1529 |
isVisible: systemIsDOS |
|
1530 |
) |
|
1531 |
(MenuItem |
|
1532 |
label: 'Open Finder' |
|
1533 |
itemValue: doOpenFinder |
|
1534 |
isVisible: systemIsOSX |
|
1535 |
) |
|
1536 |
(MenuItem |
|
1537 |
label: 'C Browser' |
|
1538 |
itemValue: doOpenCBrowser |
|
1539 |
isVisible: cBrowserMenuItemVisible |
|
1540 |
) |
|
1541 |
(MenuItem |
|
1542 |
label: 'STXGDB Debugger' |
|
1543 |
itemValue: doOpenGDBApplication |
|
1544 |
isVisible: stxgdbMenuItemVisible |
|
1545 |
) |
|
1546 |
(MenuItem |
|
1547 |
label: '-' |
|
1548 |
) |
|
1549 |
(MenuItem |
|
1550 |
label: 'Add Text Editor Page' |
|
1551 |
itemValue: newTextEditor |
|
1552 |
shortcutKey: Ctrlt |
|
1553 |
) |
|
1554 |
(MenuItem |
|
1555 |
label: 'Add Shell Terminal Page' |
|
1556 |
itemValue: doAddTerminal |
|
1557 |
) |
|
1558 |
(MenuItem |
|
1559 |
label: 'Add Archiver Page' |
|
1560 |
itemValue: doAddArchiver |
|
1561 |
) |
|
1562 |
(MenuItem |
|
1563 |
label: 'Add Search Page' |
|
1564 |
itemValue: doOpenSearchFile |
|
1565 |
) |
|
1566 |
(MenuItem |
|
1567 |
label: '-' |
|
1568 |
isVisible: false |
|
1569 |
) |
|
1570 |
(MenuItem |
|
1571 |
label: 'Settings...' |
|
1572 |
itemValue: doOpenSettings |
|
1573 |
isVisible: false |
|
1574 |
) |
|
1575 |
(MenuItem |
|
1576 |
label: 'Encoding...' |
|
1577 |
itemValue: fileEncodingDialog |
|
1578 |
isVisible: false |
|
1579 |
) |
|
1580 |
(MenuItem |
|
1581 |
label: 'Line End Convention...' |
|
1582 |
itemValue: lineEndConventionDialog |
|
1583 |
isVisible: false |
|
1584 |
) |
|
1585 |
(MenuItem |
|
1586 |
label: 'Tab Stop Conversion...' |
|
1587 |
itemValue: tabStopConversionDialog |
|
1588 |
isVisible: false |
|
1589 |
) |
|
1590 |
(MenuItem |
|
1591 |
label: '-' |
|
1592 |
) |
|
1593 |
(MenuItem |
|
1594 |
label: 'Exit' |
|
1595 |
itemValue: closeRequest |
|
1596 |
) |
|
1597 |
) |
|
15211 | 1598 |
! |
1599 |
||
1600 |
directoryMenu |
|
1601 |
"This resource specification was automatically generated |
|
1602 |
by the MenuEditor of ST/X." |
|
1603 |
||
1604 |
"Do not manually edit this!! If it is corrupted, |
|
1605 |
the MenuEditor may not be able to read the specification." |
|
1606 |
||
1607 |
||
1608 |
" |
|
1609 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#directoryMenu |
|
1610 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser directoryMenu)) startUp |
|
1611 |
" |
|
1612 |
||
1613 |
<resource: #menu> |
|
1614 |
||
1615 |
^ |
|
19001 | 1616 |
#(Menu |
1617 |
(MenuItem |
|
1618 |
label: 'New..' |
|
1619 |
itemValue: newDirectory |
|
1620 |
) |
|
1621 |
(MenuItem |
|
1622 |
label: 'Bookmarks' |
|
1623 |
submenuChannel: bookmarksMenu |
|
1624 |
) |
|
1625 |
(MenuItem |
|
1626 |
label: 'Visited Directories' |
|
1627 |
submenuChannel: visitedDirectoriesMenu |
|
1628 |
) |
|
1629 |
(MenuItem |
|
1630 |
label: '-' |
|
1631 |
) |
|
1632 |
(MenuItem |
|
1633 |
label: 'Up' |
|
1634 |
itemValue: doGoDirectoryUp |
|
1635 |
) |
|
1636 |
(MenuItem |
|
1637 |
activeHelpKey: directoryBack |
|
1638 |
enabled: enableBack |
|
1639 |
label: 'Back' |
|
1640 |
itemValue: doBack |
|
1641 |
) |
|
1642 |
(MenuItem |
|
1643 |
activeHelpKey: directoryBack |
|
1644 |
enabled: enableForward |
|
1645 |
label: 'Forward' |
|
1646 |
itemValue: doForward |
|
1647 |
) |
|
1648 |
(MenuItem |
|
1649 |
label: '-' |
|
1650 |
) |
|
1651 |
(MenuItem |
|
1652 |
enabled: enableHome |
|
1653 |
label: 'Home Directory' |
|
1654 |
itemValue: doGotoHomeDirectory |
|
1655 |
) |
|
1656 |
(MenuItem |
|
1657 |
enabled: enableGotoDesktopDirectory |
|
1658 |
label: 'Desktop' |
|
1659 |
itemValue: doGotoDesktopDirectory |
|
1660 |
) |
|
1661 |
(MenuItem |
|
1662 |
enabled: enableGotoDocumentsDirectory |
|
1663 |
label: 'Documents' |
|
1664 |
itemValue: doGotoDocumentsDirectory |
|
1665 |
) |
|
1666 |
(MenuItem |
|
1667 |
enabled: enableGotoDownloadsDirectory |
|
1668 |
label: 'Downloads' |
|
1669 |
itemValue: doGotoDownloadsDirectory |
|
1670 |
) |
|
1671 |
(MenuItem |
|
1672 |
enabled: enableGotoDefaultDirectory |
|
1673 |
label: 'Default (Current) Directory' |
|
1674 |
itemValue: doGotoDefaultDirectory |
|
1675 |
) |
|
1676 |
(MenuItem |
|
1677 |
enabled: enableGotoSmalltalkDirectory |
|
1678 |
label: 'Smalltalk (Application) Directory' |
|
1679 |
itemValue: doGotoSmalltalkDirectory |
|
1680 |
) |
|
1681 |
(MenuItem |
|
1682 |
enabled: enableGotoSmalltalkWorkspaceDirectory |
|
1683 |
label: 'Smalltalk Workspace Directory' |
|
1684 |
itemValue: doGotoSmalltalkWorkspaceDirectory |
|
1685 |
) |
|
1686 |
(MenuItem |
|
1687 |
enabled: enableGotoTempDirectory |
|
1688 |
label: 'Smalltalk Temp Directory' |
|
1689 |
itemValue: doGotoTempDirectory |
|
1690 |
) |
|
1691 |
(MenuItem |
|
1692 |
label: '-' |
|
1693 |
isVisible: false |
|
1694 |
) |
|
1695 |
(MenuItem |
|
1696 |
enabled: enableMakeCurrentDirectory |
|
1697 |
label: 'Make this the Default (Current) Directory' |
|
1698 |
itemValue: doMakeCurrentDirectory |
|
1699 |
isVisible: false |
|
1700 |
) |
|
1701 |
) |
|
15211 | 1702 |
! |
1703 |
||
1704 |
editMenu |
|
1705 |
"This resource specification was automatically generated |
|
1706 |
by the MenuEditor of ST/X." |
|
1707 |
||
1708 |
"Do not manually edit this!! If it is corrupted, |
|
1709 |
the MenuEditor may not be able to read the specification." |
|
1710 |
||
19001 | 1711 |
|
15211 | 1712 |
" |
1713 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#editMenu |
|
1714 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser editMenu)) startUp |
|
1715 |
" |
|
1716 |
||
1717 |
<resource: #menu> |
|
1718 |
||
1719 |
^ |
|
19001 | 1720 |
#(Menu |
1721 |
(MenuItem |
|
1722 |
enabled: hasFileSelection |
|
1723 |
label: 'Copy Selected Filenames to Clipboard' |
|
1724 |
itemValue: copySelectedFilenames |
|
1725 |
) |
|
1726 |
(MenuItem |
|
1727 |
enabled: fileListIsNotEmpty |
|
1728 |
label: 'Copy all Filenames to Clipboard' |
|
1729 |
itemValue: copyFileList |
|
1730 |
) |
|
1731 |
) |
|
15211 | 1732 |
! |
1733 |
||
1734 |
emptyMenuSpec |
|
1735 |
"This resource specification was automatically generated |
|
1736 |
by the MenuEditor of ST/X." |
|
1737 |
||
1738 |
"Do not manually edit this!! If it is corrupted, |
|
1739 |
the MenuEditor may not be able to read the specification." |
|
1740 |
||
19001 | 1741 |
|
15211 | 1742 |
" |
1743 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#emptyMenuSpec |
|
1744 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser emptyMenuSpec)) startUp |
|
1745 |
" |
|
1746 |
||
1747 |
<resource: #menu> |
|
1748 |
||
1749 |
^ |
|
19001 | 1750 |
#(Menu |
1751 |
) |
|
15211 | 1752 |
! |
1753 |
||
1754 |
extraMenu |
|
1755 |
"This resource specification was automatically generated |
|
1756 |
by the MenuEditor of ST/X." |
|
1757 |
||
1758 |
"Do not manually edit this!! If it is corrupted, |
|
1759 |
the MenuEditor may not be able to read the specification." |
|
1760 |
||
1761 |
||
1762 |
" |
|
1763 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#extraMenu |
|
1764 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser extraMenu)) startUp |
|
1765 |
" |
|
1766 |
||
1767 |
<resource: #menu> |
|
1768 |
||
1769 |
^ |
|
19001 | 1770 |
#(Menu |
1771 |
(MenuItem |
|
1772 |
label: 'Encoding...' |
|
1773 |
itemValue: fileEncodingDialog |
|
1774 |
) |
|
1775 |
(MenuItem |
|
1776 |
label: 'Line End Convention...' |
|
1777 |
itemValue: lineEndConventionDialog |
|
1778 |
) |
|
1779 |
(MenuItem |
|
1780 |
label: 'Tab Stop Conversion...' |
|
1781 |
itemValue: tabStopConversionDialog |
|
1782 |
) |
|
1783 |
(MenuItem |
|
1784 |
label: '-' |
|
1785 |
) |
|
1786 |
(MenuItem |
|
1787 |
label: 'Settings...' |
|
1788 |
itemValue: doOpenSettings |
|
1789 |
labelImage: (ResourceRetriever ToolbarIconLibrary settings16x16Icon 'Settings...') |
|
1790 |
) |
|
1791 |
) |
|
15211 | 1792 |
! |
1793 |
||
1794 |
fileMenu |
|
1795 |
"This resource specification was automatically generated |
|
1796 |
by the MenuEditor of ST/X." |
|
1797 |
||
1798 |
"Do not manually edit this!! If it is corrupted, |
|
1799 |
the MenuEditor may not be able to read the specification." |
|
1800 |
||
1801 |
||
1802 |
" |
|
1803 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileMenu |
|
1804 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileMenu)) startUp |
|
1805 |
" |
|
1806 |
||
1807 |
<resource: #menu> |
|
1808 |
||
1809 |
^ |
|
19001 | 1810 |
#(Menu |
1811 |
(MenuItem |
|
1812 |
label: 'New' |
|
1813 |
submenuChannel: newMenu |
|
1814 |
keepLinkedMenu: true |
|
1815 |
) |
|
1816 |
(MenuItem |
|
1817 |
enabled: enableFileHistory |
|
1818 |
label: 'File History' |
|
1819 |
submenuChannel: menuFileHistory |
|
1820 |
) |
|
1821 |
(MenuItem |
|
1822 |
label: '-' |
|
1823 |
) |
|
1824 |
(MenuItem |
|
1825 |
label: 'Open' |
|
1826 |
itemValue: doShowFileContents |
|
1827 |
) |
|
19009 | 1828 |
(MenuItem |
1829 |
label: 'Find' |
|
1830 |
submenu: |
|
1831 |
(Menu |
|
1832 |
(MenuItem |
|
1833 |
label: 'File...' |
|
1834 |
itemValue: fileFindFile |
|
1835 |
) |
|
1836 |
(MenuItem |
|
1837 |
enabled: hasFileSelection |
|
1838 |
label: 'Same Contents as Selected...' |
|
1839 |
itemValue: fileFindDuplicateFile |
|
1840 |
) |
|
1841 |
(MenuItem |
|
1842 |
label: 'Duplicate Files' |
|
1843 |
itemValue: fileFindDuplicates |
|
1844 |
) |
|
1845 |
(MenuItem |
|
1846 |
enabled: hasSelection |
|
1847 |
label: 'All Duplicate Files (Recursive)' |
|
1848 |
itemValue: fileFindAllDuplicates |
|
1849 |
) |
|
1850 |
(MenuItem |
|
1851 |
label: 'Similar Image Files (by Colors)' |
|
1852 |
itemValue: fileFindSimilarImages |
|
1853 |
isVisible: hasImageColorHistogram |
|
1854 |
) |
|
1855 |
(MenuItem |
|
1856 |
label: 'Similar Image Files (by Form)' |
|
1857 |
itemValue: fileFindSimilarImagesByForm |
|
1858 |
isVisible: hasImageHistogram |
|
1859 |
) |
|
1860 |
) |
|
1861 |
) |
|
19001 | 1862 |
(MenuItem |
1863 |
label: '-' |
|
1864 |
) |
|
1865 |
(MenuItem |
|
1866 |
enabled: hasFileSelection |
|
1867 |
label: 'FileIn' |
|
1868 |
itemValue: fileFileIn |
|
1869 |
) |
|
1870 |
(MenuItem |
|
1871 |
enabled: hasFileSelection |
|
1872 |
label: 'FileIn to Namespace...' |
|
1873 |
itemValue: fileFileInToNameSpace |
|
1874 |
) |
|
1875 |
(MenuItem |
|
1876 |
enabled: hasPackageDirectorySelected |
|
1877 |
label: 'Load Package from Here' |
|
1878 |
itemValue: fileFileInPackage |
|
1879 |
) |
|
1880 |
(MenuItem |
|
1881 |
label: '-' |
|
1882 |
) |
|
1883 |
(MenuItem |
|
1884 |
enabled: hasSelection |
|
1885 |
label: 'Cut' |
|
1886 |
itemValue: cutFiles |
|
1887 |
) |
|
1888 |
(MenuItem |
|
1889 |
enabled: hasSelection |
|
1890 |
label: 'Copy' |
|
1891 |
itemValue: copyFiles |
|
1892 |
) |
|
1893 |
(MenuItem |
|
1894 |
enabled: canPaste |
|
1895 |
label: 'Paste' |
|
1896 |
itemValue: pasteFiles |
|
1897 |
) |
|
1898 |
(MenuItem |
|
1899 |
enabled: hasSelection |
|
1900 |
label: 'Delete' |
|
1901 |
itemValue: deleteFiles |
|
1902 |
) |
|
1903 |
(MenuItem |
|
1904 |
enabled: hasSelection |
|
1905 |
label: 'Erase' |
|
1906 |
itemValue: eraseFiles |
|
1907 |
) |
|
1908 |
(MenuItem |
|
1909 |
label: '-' |
|
1910 |
) |
|
1911 |
(MenuItem |
|
1912 |
enabled: hasSelection |
|
1913 |
label: 'Rename...' |
|
1914 |
itemValue: renameSelection |
|
1915 |
shortcutKey: Rename |
|
1916 |
) |
|
1917 |
(MenuItem |
|
1918 |
enabled: hasSelection |
|
1919 |
label: 'Move To...' |
|
1920 |
itemValue: moveSelectionTo |
|
1921 |
) |
|
1922 |
(MenuItem |
|
1923 |
enabled: hasSelection |
|
1924 |
label: 'Copy To...' |
|
1925 |
itemValue: copySelectionTo |
|
1926 |
) |
|
1927 |
(MenuItem |
|
19009 | 1928 |
label: '-' |
1929 |
) |
|
1930 |
(MenuItem |
|
19001 | 1931 |
enabled: hasSelection |
1932 |
label: 'Properties...' |
|
1933 |
itemValue: doShowProperties |
|
1934 |
) |
|
1935 |
(MenuItem |
|
1936 |
label: '-' |
|
1937 |
isVisible: javaSupportLoaded |
|
1938 |
) |
|
1939 |
(MenuItem |
|
1940 |
enabled: canAddToClassPath |
|
1941 |
label: 'Add to Java Class Path' |
|
1942 |
isVisible: javaSupportLoaded |
|
1943 |
) |
|
1944 |
(MenuItem |
|
1945 |
enabled: canRemoveFromClassPath |
|
1946 |
label: 'Remove from Java Class Path' |
|
1947 |
isVisible: javaSupportLoaded |
|
1948 |
) |
|
1949 |
(MenuItem |
|
1950 |
enabled: canAddToSourcePath |
|
1951 |
label: 'Add to Java Source Path' |
|
1952 |
isVisible: javaSupportLoaded |
|
1953 |
) |
|
1954 |
(MenuItem |
|
1955 |
enabled: canRemoveFromSourcePath |
|
1956 |
label: 'Remove from Java Source Path' |
|
1957 |
isVisible: javaSupportLoaded |
|
1958 |
) |
|
1959 |
) |
|
15211 | 1960 |
! |
1961 |
||
1962 |
fileOpMenu |
|
1963 |
"This resource specification was automatically generated |
|
1964 |
by the MenuEditor of ST/X." |
|
1965 |
||
1966 |
"Do not manually edit this!! If it is corrupted, |
|
1967 |
the MenuEditor may not be able to read the specification." |
|
1968 |
||
1969 |
||
1970 |
" |
|
1971 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileOpMenu |
|
1972 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileOpMenu)) startUp |
|
1973 |
" |
|
1974 |
||
1975 |
<resource: #menu> |
|
1976 |
||
1977 |
^ |
|
19001 | 1978 |
#(Menu |
1979 |
(MenuItem |
|
1980 |
enabled: hasFileSelection |
|
1981 |
label: 'Split (by size)...' |
|
1982 |
itemValue: splitSelectedFiles |
|
1983 |
) |
|
1984 |
(MenuItem |
|
1985 |
enabled: hasFileSelection |
|
1986 |
label: 'Split (by #lines)...' |
|
1987 |
itemValue: splitSelectedFilesByLines |
|
1988 |
) |
|
1989 |
(MenuItem |
|
1990 |
enabled: hasFileSelection |
|
1991 |
label: 'Join...' |
|
1992 |
itemValue: joinSelectedFiles |
|
1993 |
) |
|
1994 |
(MenuItem |
|
1995 |
enabled: hasFileSelection |
|
1996 |
label: 'Copy Corrupted File To...' |
|
1997 |
itemValue: copySelectionToRepairingCorruptedFiles |
|
1998 |
) |
|
1999 |
(MenuItem |
|
2000 |
label: 'Copy Corrupted File From -> To...' |
|
2001 |
itemValue: copyFromToRepairingCorruptedFiles |
|
2002 |
) |
|
2003 |
(MenuItem |
|
2004 |
label: '-' |
|
2005 |
) |
|
2006 |
(MenuItem |
|
2007 |
enabled: hasFileSelection |
|
2008 |
label: 'Rot13...' |
|
2009 |
itemValue: filterSelectedFiles: |
|
2010 |
argument: rot13 |
|
2011 |
) |
|
2012 |
(MenuItem |
|
2013 |
label: '-' |
|
2014 |
) |
|
2015 |
(MenuItem |
|
2016 |
enabled: hasFileSelection |
|
2017 |
label: 'Truncate...' |
|
2018 |
itemValue: truncateSelectedFilesToZeroSize |
|
2019 |
) |
|
2020 |
(MenuItem |
|
2021 |
label: '-' |
|
2022 |
) |
|
2023 |
(MenuItem |
|
2024 |
label: 'Load Signature Support Package' |
|
2025 |
itemValue: loadSignatureSupport |
|
2026 |
isVisible: cannotGenerateSignatureFiles |
|
2027 |
) |
|
2028 |
(MenuItem |
|
2029 |
enabled: canGenerateSignatureFiles |
|
2030 |
label: 'Generate Signed Files' |
|
2031 |
itemValue: generateSignaturesForSelectedFiles |
|
2032 |
) |
|
2033 |
(MenuItem |
|
2034 |
enabled: canGenerateSignatureFiles |
|
2035 |
label: 'Generate Detached Signature Files (use for dll)' |
|
2036 |
itemValue: generateDetachedSignaturesForSelectedFiles |
|
2037 |
) |
|
2038 |
(MenuItem |
|
2039 |
enabled: canGenerateSignatureFiles |
|
2040 |
label: 'Generate Patch Installer for File(s)' |
|
2041 |
itemValue: generatePatchInstallerForSelectedFiles |
|
2042 |
) |
|
2043 |
(MenuItem |
|
2044 |
label: '-' |
|
2045 |
) |
|
2046 |
(MenuItem |
|
2047 |
enabled: hasFileSelection |
|
2048 |
label: 'File Differences' |
|
2049 |
itemValue: openDiffView |
|
2050 |
isVisible: hasTwoFilesSelectedHolder |
|
2051 |
) |
|
2052 |
(MenuItem |
|
2053 |
enabled: hasFileSelection |
|
2054 |
label: 'File Differences...' |
|
2055 |
itemValue: openDiffView |
|
2056 |
isVisible: hasNotTwoFilesSelectedHolder |
|
2057 |
) |
|
2058 |
(MenuItem |
|
2059 |
enabled: hasSelection |
|
2060 |
label: 'Directory Differences' |
|
2061 |
itemValue: openDirectoryDiffView |
|
2062 |
isVisible: hasTwoDirectoriesSelectedHolder |
|
2063 |
) |
|
2064 |
(MenuItem |
|
2065 |
enabled: hasSelection |
|
2066 |
label: 'Directory Differences...' |
|
2067 |
itemValue: openDirectoryDiffView |
|
2068 |
isVisible: hasNotTwoDirectoriesSelectedHolder |
|
2069 |
) |
|
2070 |
(MenuItem |
|
2071 |
label: '-' |
|
2072 |
) |
|
2073 |
(MenuItem |
|
2074 |
label: 'Remove .bak and .sav Files...' |
|
2075 |
itemValue: removeBakAndSavFiles |
|
2076 |
) |
|
2077 |
) |
|
15211 | 2078 |
! |
2079 |
||
2080 |
newMenu |
|
2081 |
"This resource specification was automatically generated |
|
2082 |
by the MenuEditor of ST/X." |
|
2083 |
||
2084 |
"Do not manually edit this!! If it is corrupted, |
|
2085 |
the MenuEditor may not be able to read the specification." |
|
2086 |
||
19001 | 2087 |
|
15211 | 2088 |
" |
19001 | 2089 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#newMenu |
2090 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser newMenu)) startUp |
|
15211 | 2091 |
" |
2092 |
||
2093 |
<resource: #menu> |
|
2094 |
||
2095 |
^ |
|
19001 | 2096 |
#(Menu |
2097 |
(MenuItem |
|
2098 |
label: 'Directory...' |
|
2099 |
itemValue: newDirectory |
|
2100 |
) |
|
2101 |
(MenuItem |
|
2102 |
label: 'File...' |
|
2103 |
itemValue: newFile |
|
2104 |
) |
|
2105 |
(MenuItem |
|
2106 |
label: 'Hard Link...' |
|
2107 |
itemValue: newHardLink |
|
2108 |
) |
|
2109 |
(MenuItem |
|
2110 |
label: 'Symbolic Link...' |
|
2111 |
itemValue: newSoftLink |
|
2112 |
) |
|
2113 |
) |
|
15211 | 2114 |
! |
2115 |
||
2116 |
scmMenuSlice |
|
2117 |
"This resource specification was automatically generated |
|
2118 |
by the MenuEditor of ST/X." |
|
2119 |
||
2120 |
"Do not manually edit this!! If it is corrupted, |
|
2121 |
the MenuEditor may not be able to read the specification." |
|
2122 |
||
2123 |
||
2124 |
" |
|
2125 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#scmMenuSlice |
|
2126 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser scmMenuSlice)) startUp |
|
2127 |
" |
|
2128 |
||
2129 |
<resource: #menu> |
|
2130 |
||
2131 |
^ |
|
19001 | 2132 |
#(Menu |
2133 |
(MenuItem |
|
2134 |
label: 'CVS' |
|
2135 |
isVisible: cvsMenusAreShown |
|
2136 |
submenuChannel: cvsMenu |
|
2137 |
) |
|
2138 |
(MenuItem |
|
2139 |
label: 'SVN' |
|
2140 |
isVisible: svnMenusAreShown |
|
2141 |
submenuChannel: svnMenu |
|
2142 |
) |
|
2143 |
(MenuItem |
|
2144 |
label: 'Mercurial' |
|
2145 |
isVisible: mercurialMenusAreShown |
|
2146 |
submenuChannel: mercurialMenu |
|
2147 |
) |
|
2148 |
(MenuItem |
|
2149 |
label: 'HG' |
|
2150 |
isVisible: hgMenusAreShown |
|
2151 |
submenuChannel: hgMenu |
|
2152 |
) |
|
2153 |
(MenuItem |
|
2154 |
label: 'Git' |
|
2155 |
isVisible: gitMenusAreShown |
|
2156 |
submenuChannel: gitMenu |
|
2157 |
) |
|
2158 |
(MenuItem |
|
2159 |
label: 'Perforce' |
|
2160 |
isVisible: perforceMenusAreShown |
|
2161 |
submenuChannel: perforceMenu |
|
2162 |
) |
|
2163 |
) |
|
15211 | 2164 |
! |
2165 |
||
2166 |
showMenuSpec |
|
2167 |
"This resource specification was automatically generated |
|
2168 |
by the MenuEditor of ST/X." |
|
2169 |
||
2170 |
"Do not manually edit this!! If it is corrupted, |
|
2171 |
the MenuEditor may not be able to read the specification." |
|
2172 |
||
19001 | 2173 |
|
15211 | 2174 |
" |
2175 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpec |
|
2176 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpec)) startUp |
|
2177 |
" |
|
2178 |
||
2179 |
<resource: #menu> |
|
2180 |
||
2181 |
^ |
|
19001 | 2182 |
#(Menu |
2183 |
(MenuItem |
|
2184 |
label: 'Hidden Files' |
|
2185 |
indication: showHiddenFiles |
|
2186 |
hideMenuOnActivated: false |
|
2187 |
) |
|
2188 |
(MenuItem |
|
2189 |
label: '-' |
|
2190 |
) |
|
2191 |
(MenuItem |
|
2192 |
label: 'Directory Tree' |
|
2193 |
indication: showDirectoryTree |
|
2194 |
hideMenuOnActivated: false |
|
2195 |
) |
|
2196 |
(MenuItem |
|
2197 |
label: 'Regular Files in TreeView (Left)' |
|
2198 |
indication: viewFilesInDirectoryTree |
|
2199 |
hideMenuOnActivated: false |
|
2200 |
) |
|
2201 |
(MenuItem |
|
2202 |
label: 'Directories in ContentsView (Right)' |
|
2203 |
indication: viewDirsInContentsBrowser |
|
2204 |
hideMenuOnActivated: false |
|
2205 |
) |
|
2206 |
(MenuItem |
|
2207 |
enabled: enableViewNoteBookApplication |
|
2208 |
label: 'File Applications' |
|
2209 |
indication: viewNoteBookApplicationHolder |
|
2210 |
hideMenuOnActivated: false |
|
2211 |
) |
|
2212 |
(MenuItem |
|
2213 |
label: '-' |
|
2214 |
) |
|
2215 |
(MenuItem |
|
2216 |
label: 'DiskUsage' |
|
2217 |
indication: showDiskUsageHolder |
|
2218 |
hideMenuOnActivated: false |
|
2219 |
) |
|
2220 |
) |
|
15211 | 2221 |
! |
2222 |
||
2223 |
showMenuSpecForDialog |
|
2224 |
"This resource specification was automatically generated |
|
2225 |
by the MenuEditor of ST/X." |
|
2226 |
||
2227 |
"Do not manually edit this!! If it is corrupted, |
|
2228 |
the MenuEditor may not be able to read the specification." |
|
2229 |
||
19001 | 2230 |
|
15211 | 2231 |
" |
2232 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpecForDialog |
|
2233 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpecForDialog)) startUp |
|
2234 |
" |
|
2235 |
||
2236 |
<resource: #menu> |
|
2237 |
||
2238 |
^ |
|
19001 | 2239 |
#(Menu |
2240 |
(MenuItem |
|
2241 |
label: 'Hidden Files' |
|
2242 |
indication: showHiddenFiles |
|
2243 |
hideMenuOnActivated: false |
|
2244 |
) |
|
2245 |
) |
|
15211 | 2246 |
! |
2247 |
||
2248 |
sortMenu |
|
2249 |
"This resource specification was automatically generated |
|
2250 |
by the MenuEditor of ST/X." |
|
2251 |
||
2252 |
"Do not manually edit this!! If it is corrupted, |
|
2253 |
the MenuEditor may not be able to read the specification." |
|
2254 |
||
19001 | 2255 |
|
15211 | 2256 |
" |
2257 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#sortMenu |
|
2258 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser sortMenu)) startUp |
|
2259 |
" |
|
2260 |
||
2261 |
<resource: #menu> |
|
2262 |
||
2263 |
^ |
|
19001 | 2264 |
#(Menu |
2265 |
(MenuItem |
|
2266 |
label: 'By Filename' |
|
2267 |
choice: sortBlockProperty |
|
2268 |
choiceValue: baseName |
|
2269 |
hideMenuOnActivated: false |
|
2270 |
) |
|
2271 |
(MenuItem |
|
2272 |
label: 'By Extension' |
|
2273 |
choice: sortBlockProperty |
|
2274 |
choiceValue: suffix |
|
2275 |
hideMenuOnActivated: false |
|
2276 |
) |
|
2277 |
(MenuItem |
|
2278 |
label: 'By Permissions' |
|
2279 |
choice: sortBlockProperty |
|
2280 |
choiceValue: permissions |
|
2281 |
hideMenuOnActivated: false |
|
2282 |
) |
|
2283 |
(MenuItem |
|
2284 |
label: 'By Owner' |
|
2285 |
isVisible: viewOwner |
|
2286 |
choice: sortBlockProperty |
|
2287 |
choiceValue: owner |
|
2288 |
hideMenuOnActivated: false |
|
2289 |
) |
|
2290 |
(MenuItem |
|
2291 |
label: 'By Group' |
|
2292 |
isVisible: viewOwner |
|
2293 |
choice: sortBlockProperty |
|
2294 |
choiceValue: group |
|
2295 |
hideMenuOnActivated: false |
|
2296 |
) |
|
2297 |
(MenuItem |
|
2298 |
label: 'By Size' |
|
2299 |
choice: sortBlockProperty |
|
2300 |
choiceValue: fileSize |
|
2301 |
hideMenuOnActivated: false |
|
2302 |
) |
|
2303 |
(MenuItem |
|
2304 |
label: 'By Date && Time' |
|
2305 |
choice: sortBlockProperty |
|
2306 |
choiceValue: modificationTime |
|
2307 |
hideMenuOnActivated: false |
|
2308 |
) |
|
2309 |
(MenuItem |
|
2310 |
label: '-' |
|
2311 |
) |
|
2312 |
(MenuItem |
|
2313 |
label: 'Ignore Case in Sort' |
|
2314 |
indication: sortCaseless |
|
2315 |
hideMenuOnActivated: false |
|
2316 |
) |
|
2317 |
(MenuItem |
|
2318 |
label: 'Directories before Files' |
|
2319 |
indication: sortDirectoriesBeforeFiles |
|
2320 |
hideMenuOnActivated: false |
|
2321 |
) |
|
2322 |
) |
|
15211 | 2323 |
! |
2324 |
||
2325 |
toolsMenuSpec |
|
2326 |
"This resource specification was automatically generated |
|
2327 |
by the MenuEditor of ST/X." |
|
2328 |
||
2329 |
"Do not manually edit this!! If it is corrupted, |
|
2330 |
the MenuEditor may not be able to read the specification." |
|
2331 |
||
2332 |
||
2333 |
" |
|
2334 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec |
|
2335 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp |
|
2336 |
" |
|
2337 |
||
2338 |
<resource: #menu> |
|
2339 |
||
2340 |
^ |
|
19001 | 2341 |
#(Menu |
2342 |
(MenuItem |
|
2343 |
label: 'Open (Win32-Shell)' |
|
2344 |
itemValue: doOpenWithShellCommand |
|
2345 |
isVisible: systemIsDOS |
|
2346 |
) |
|
2347 |
(MenuItem |
|
2348 |
label: 'Open (OSX-Application)' |
|
2349 |
itemValue: doOpenWithShellCommand |
|
2350 |
isVisible: systemIsOSX |
|
2351 |
) |
|
2352 |
(MenuItem |
|
2353 |
label: 'Execute UNIX Command...' |
|
2354 |
itemValue: doExecuteCommand |
|
2355 |
isVisible: systemIsUnix |
|
2356 |
) |
|
2357 |
(MenuItem |
|
2358 |
label: 'Execute DOS Command...' |
|
2359 |
itemValue: doExecuteCommand |
|
2360 |
isVisible: systemIsDOS |
|
2361 |
) |
|
2362 |
(MenuItem |
|
2363 |
label: 'Execute Script...' |
|
2364 |
itemValue: doExecuteScript |
|
2365 |
) |
|
2366 |
(MenuItem |
|
2367 |
enabled: canDoTerminal |
|
2368 |
label: 'Shell Terminal' |
|
2369 |
itemValue: openTerminal |
|
2370 |
isVisible: canDoTerminalAndSystemIsUnix |
|
2371 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'Shell Terminal') |
|
2372 |
) |
|
2373 |
(MenuItem |
|
2374 |
enabled: canDoTerminal |
|
2375 |
label: 'DOS Terminal' |
|
2376 |
itemValue: openTerminal |
|
2377 |
isVisible: canDoTerminalAndSystemIsDOS |
|
2378 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'DOS Terminal') |
|
2379 |
) |
|
2380 |
(MenuItem |
|
2381 |
label: '-' |
|
2382 |
) |
|
2383 |
(MenuItem |
|
2384 |
enabled: hasFileSelection |
|
2385 |
label: 'Changes Browser' |
|
2386 |
itemValue: openChangesBrowser |
|
2387 |
labelImage: (ResourceRetriever ToolbarIconLibrary changesBrowser16x16Icon 'Changes Browser') |
|
2388 |
) |
|
2389 |
(MenuItem |
|
2390 |
enabled: hasFileOrCypressPackageSelection |
|
2391 |
label: 'ChangeSet Browser' |
|
2392 |
itemValue: openChangeSetBrowser |
|
2393 |
isVisible: changeSetBrowserItemVisible |
|
2394 |
) |
|
2395 |
(MenuItem |
|
2396 |
enabled: hasFileSelection |
|
2397 |
label: 'Workspace' |
|
2398 |
itemValue: openWorkspace |
|
2399 |
) |
|
2400 |
(MenuItem |
|
2401 |
label: '-' |
|
2402 |
) |
|
2403 |
(MenuItem |
|
2404 |
enabled: canReadAbbrevFile |
|
2405 |
label: 'Install Autoloaded' |
|
2406 |
itemValue: readAbbrevFile |
|
2407 |
) |
|
2408 |
(MenuItem |
|
2409 |
enabled: anySTFilesPresent |
|
2410 |
label: 'Install all ST-Files as Autoloaded' |
|
2411 |
itemValue: installAllAsAutoloaded |
|
2412 |
) |
|
2413 |
(MenuItem |
|
2414 |
enabled: recursiveAnySTFilesPresent |
|
2415 |
label: 'Recursive Install all ST-Files as Autoloaded' |
|
2416 |
itemValue: installAllAsAutoloadedRecursive |
|
2417 |
) |
|
2418 |
(MenuItem |
|
2419 |
label: '-' |
|
2420 |
) |
|
2421 |
(MenuItem |
|
2422 |
enabled: hasJava |
|
2423 |
label: 'Add Directory to Java Source Path (stx:libjava)' |
|
2424 |
itemValue: addDirToJavaSourcePath |
|
2425 |
) |
|
2426 |
(MenuItem |
|
2427 |
enabled: hasJava |
|
2428 |
label: 'Add Selected Files to Java Source Path (stx:libjava)' |
|
2429 |
itemValue: fileAddToJavaSourcePath |
|
2430 |
) |
|
2431 |
(MenuItem |
|
2432 |
label: '-' |
|
2433 |
) |
|
2434 |
(MenuItem |
|
2435 |
label: 'File Operations' |
|
2436 |
submenuChannel: fileOpMenu |
|
2437 |
) |
|
2438 |
(MenuItem |
|
2439 |
label: 'File Utilities' |
|
2440 |
submenu: |
|
2441 |
(Menu |
|
2442 |
(MenuItem |
|
2443 |
enabled: hasFileSelection |
|
2444 |
label: 'Editor' |
|
2445 |
itemValue: openEditor |
|
2446 |
) |
|
2447 |
(MenuItem |
|
2448 |
enabled: hasFileSelection |
|
2449 |
label: 'HTML Reader' |
|
2450 |
itemValue: openHTMLReader |
|
2451 |
) |
|
2452 |
(MenuItem |
|
2453 |
enabled: hasFileSelection |
|
2454 |
label: 'Web Browser' |
|
2455 |
itemValue: openWebBrowser |
|
2456 |
) |
|
2457 |
(MenuItem |
|
2458 |
label: 'XML Inspector' |
|
2459 |
itemValue: inspectXmlFile |
|
2460 |
isVisible: hasXml |
|
2461 |
showBusyCursorWhilePerforming: true |
|
2462 |
) |
|
2463 |
(MenuItem |
|
2464 |
enabled: hasFileSelection |
|
2465 |
label: 'PDF Viewer' |
|
2466 |
itemValue: openPDFViewer |
|
2467 |
) |
|
2468 |
(MenuItem |
|
2469 |
enabled: hasASN1AndSelection |
|
2470 |
label: 'ASN.1 Browser' |
|
2471 |
itemValue: openASN1Browser |
|
2472 |
isVisible: hasASN1 |
|
2473 |
) |
|
2474 |
(MenuItem |
|
2475 |
enabled: hasCBrowser |
|
2476 |
label: 'C Browser' |
|
2477 |
itemValue: openCBrowser |
|
2478 |
isVisible: hasCBrowser |
|
2479 |
) |
|
2480 |
(MenuItem |
|
2481 |
enabled: canOpenMonticelloBrowser |
|
2482 |
label: 'Monticello Browser' |
|
2483 |
itemValue: doOpenMonticelloBrowser |
|
2484 |
) |
|
2485 |
(MenuItem |
|
2486 |
enabled: hasJavaAndSelection |
|
2487 |
label: 'Applet Viewer' |
|
2488 |
itemValue: openAppletViewer |
|
2489 |
isVisible: hasJava |
|
2490 |
) |
|
2491 |
(MenuItem |
|
2492 |
enabled: hasMP3PlayerAndSelection |
|
2493 |
label: 'MP3 Player' |
|
2494 |
itemValue: openMP3Player |
|
2495 |
isVisible: hasMP3Player |
|
2496 |
) |
|
2497 |
(MenuItem |
|
2498 |
enabled: hasFileSelection |
|
2499 |
label: 'xv (Image Viewer)' |
|
2500 |
itemValue: openXV |
|
2501 |
isVisible: systemIsUnix |
|
2502 |
) |
|
2503 |
(MenuItem |
|
2504 |
enabled: currentFilesAreInSameDirectory |
|
2505 |
label: 'Slide Show' |
|
2506 |
itemValue: openSlideShow |
|
2507 |
isVisible: hasSlideShow |
|
2508 |
) |
|
2509 |
(MenuItem |
|
2510 |
enabled: hasFileSelection |
|
2511 |
label: 'gv (Postscript Viewer)' |
|
2512 |
itemValue: openGV |
|
2513 |
isVisible: systemIsUnix |
|
2514 |
) |
|
2515 |
(MenuItem |
|
2516 |
enabled: hasMP3PlayerAndSelection |
|
2517 |
label: 'MP3 Player' |
|
2518 |
itemValue: openMP3Player |
|
2519 |
isVisible: hasMP3Player |
|
2520 |
) |
|
2521 |
(MenuItem |
|
2522 |
enabled: hasFileSelection |
|
2523 |
label: 'VLC (Play video)' |
|
2524 |
itemValue: openVideoPlayer |
|
2525 |
) |
|
2526 |
(MenuItem |
|
2527 |
label: '-' |
|
2528 |
) |
|
2529 |
(MenuItem |
|
2530 |
label: 'Smalltalk' |
|
2531 |
submenu: |
|
2532 |
(Menu |
|
15211 | 2533 |
(MenuItem |
19001 | 2534 |
enabled: hasSnapshotSelection |
2535 |
label: 'Snapshot Image Browser' |
|
2536 |
itemValue: openSnapshotImageBrowser |
|
2537 |
) |
|
15211 | 2538 |
(MenuItem |
19001 | 2539 |
enabled: canCreateNewProject |
2540 |
label: 'Create Smalltalk Project' |
|
2541 |
itemValue: createProjectAndOpenProjectBrowser |
|
2542 |
) |
|
15211 | 2543 |
(MenuItem |
19001 | 2544 |
label: '-' |
2545 |
) |
|
15211 | 2546 |
(MenuItem |
19001 | 2547 |
enabled: hasResourceFileSelected |
2548 |
label: 'Show Contents of Resourcefile' |
|
2549 |
itemValue: readAndShowResources |
|
2550 |
) |
|
15211 | 2551 |
(MenuItem |
19001 | 2552 |
enabled: hasResourceFileSelected |
2553 |
label: 'Resource File Editor' |
|
2554 |
itemValue: openResourceFileEditor |
|
2555 |
showBusyCursorWhilePerforming: true |
|
2556 |
) |
|
15211 | 2557 |
(MenuItem |
19001 | 2558 |
label: '-' |
2559 |
) |
|
15211 | 2560 |
(MenuItem |
2561 |
enabled: hasFileSelection |
|
19001 | 2562 |
label: 'Contents as ByteArray' |
2563 |
itemValue: fileContentsAsByteArray |
|
2564 |
) |
|
15211 | 2565 |
(MenuItem |
19001 | 2566 |
label: '-' |
2567 |
) |
|
15211 | 2568 |
(MenuItem |
2569 |
enabled: hasFileSelection |
|
19001 | 2570 |
label: 'Changes from GNU Smalltalk Source' |
2571 |
itemValue: changeSetFromGSTSource |
|
2572 |
) |
|
2573 |
) |
|
2574 |
) |
|
2575 |
(MenuItem |
|
2576 |
label: 'Image' |
|
2577 |
submenu: |
|
2578 |
(Menu |
|
2579 |
(MenuItem |
|
2580 |
enabled: hasFileSelection |
|
2581 |
label: 'Image Editor' |
|
2582 |
itemValue: openImageEditor |
|
2583 |
) |
|
2584 |
(MenuItem |
|
2585 |
enabled: hasFileSelection |
|
2586 |
label: 'Image Preview' |
|
2587 |
itemValue: openImagePreview |
|
2588 |
) |
|
2589 |
(MenuItem |
|
2590 |
enabled: hasFileSelection |
|
2591 |
label: 'Image Inspector' |
|
2592 |
itemValue: openImageInspector |
|
2593 |
) |
|
15211 | 2594 |
(MenuItem |
2595 |
label: '-' |
|
19001 | 2596 |
) |
15211 | 2597 |
(MenuItem |
19001 | 2598 |
enabled: hasFileSelection |
2599 |
label: 'Convert to GIF' |
|
2600 |
itemValue: convertImageToGIF |
|
2601 |
) |
|
15211 | 2602 |
(MenuItem |
19001 | 2603 |
enabled: hasFileSelection |
2604 |
label: 'Convert to PNG' |
|
2605 |
itemValue: convertImageToPNG |
|
2606 |
) |
|
15211 | 2607 |
(MenuItem |
19001 | 2608 |
enabled: hasFileSelection |
2609 |
label: 'Convert to XPM' |
|
2610 |
itemValue: convertImageToXPM |
|
2611 |
) |
|
15211 | 2612 |
(MenuItem |
2613 |
enabled: hasFileSelection |
|
19001 | 2614 |
label: 'Convert to JPG' |
2615 |
itemValue: convertImageToJPG |
|
15211 | 2616 |
) |
19001 | 2617 |
) |
2618 |
) |
|
2619 |
(MenuItem |
|
2620 |
label: 'Web' |
|
2621 |
submenu: |
|
2622 |
(Menu |
|
15211 | 2623 |
(MenuItem |
19001 | 2624 |
label: 'Fetch File by URL...' |
2625 |
itemValue: fetchFileByURL |
|
15211 | 2626 |
) |
19001 | 2627 |
) |
2628 |
) |
|
2629 |
(MenuItem |
|
2630 |
enabled: hasZipFileSelectedHolder |
|
2631 |
label: 'ZipFile Tool' |
|
2632 |
itemValue: openZipTool |
|
2633 |
) |
|
2634 |
(MenuItem |
|
2635 |
enabled: hasFileSelection |
|
2636 |
label: 'Hex Dump' |
|
2637 |
itemValue: fileHexDump |
|
2638 |
) |
|
15211 | 2639 |
) |
19001 | 2640 |
) |
19009 | 2641 |
|
19001 | 2642 |
) |
15211 | 2643 |
! |
2644 |
||
2645 |
viewDetailsMenuSpec |
|
2646 |
"This resource specification was automatically generated |
|
2647 |
by the MenuEditor of ST/X." |
|
2648 |
||
2649 |
"Do not manually edit this!! If it is corrupted, |
|
2650 |
the MenuEditor may not be able to read the specification." |
|
2651 |
||
19001 | 2652 |
|
15211 | 2653 |
" |
2654 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#viewDetailsMenuSpec |
|
2655 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser viewDetailsMenuSpec)) startUp |
|
2656 |
" |
|
2657 |
||
2658 |
<resource: #menu> |
|
2659 |
||
2660 |
^ |
|
19001 | 2661 |
#(Menu |
2662 |
(MenuItem |
|
2663 |
label: '-' |
|
2664 |
) |
|
2665 |
(MenuItem |
|
2666 |
label: 'Hidden Files' |
|
2667 |
indication: showHiddenFiles |
|
2668 |
) |
|
2669 |
) |
|
15211 | 2670 |
! ! |
3892 | 2671 |
|
11144 | 2672 |
!AbstractFileBrowser class methodsFor:'menu specs-scm'! |
2673 |
||
15211 | 2674 |
cvsMenu |
2675 |
"This resource specification was automatically generated |
|
2676 |
by the MenuEditor of ST/X." |
|
2677 |
||
2678 |
"Do not manually edit this!! If it is corrupted, |
|
2679 |
the MenuEditor may not be able to read the specification." |
|
2680 |
||
2681 |
||
2682 |
" |
|
2683 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#cvsMenu |
|
2684 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser cvsMenu)) startUp |
|
2685 |
" |
|
2686 |
||
2687 |
<resource: #menu> |
|
2688 |
||
2689 |
^ |
|
19001 | 2690 |
#(Menu |
2691 |
(MenuItem |
|
2692 |
label: 'Commit (CVS)...' |
|
2693 |
itemValue: cvsCommit |
|
2694 |
) |
|
2695 |
(MenuItem |
|
2696 |
enabled: canCvsAddAndCommit |
|
2697 |
label: 'Add && Commit...' |
|
2698 |
itemValue: cvsAddAndCommit |
|
2699 |
) |
|
2700 |
(MenuItem |
|
2701 |
enabled: canCvsAddAndCommit |
|
2702 |
label: 'Add as Binary && Commit...' |
|
2703 |
itemValue: cvsAddBinaryAndCommit |
|
2704 |
) |
|
2705 |
(MenuItem |
|
2706 |
label: 'Commit Folder (CVS)...' |
|
2707 |
itemValue: cvsCommitFolder |
|
2708 |
) |
|
2709 |
(MenuItem |
|
2710 |
label: '-' |
|
2711 |
) |
|
2712 |
(MenuItem |
|
2713 |
enabled: hasSelection |
|
2714 |
label: 'Update Selected Files/Directories' |
|
2715 |
itemValue: cvsUpdateSelection |
|
2716 |
) |
|
2717 |
(MenuItem |
|
2718 |
label: 'Update Directory Local' |
|
2719 |
itemValue: cvsUpdateAll |
|
2720 |
) |
|
2721 |
(MenuItem |
|
2722 |
label: 'Update Directory Recursive' |
|
2723 |
itemValue: cvsUpdateAllRecursive |
|
2724 |
) |
|
2725 |
(MenuItem |
|
2726 |
label: '-' |
|
2727 |
) |
|
2728 |
(MenuItem |
|
2729 |
enabled: hasSelection |
|
2730 |
label: 'Tag...' |
|
2731 |
itemValue: cvsTagSelection |
|
2732 |
) |
|
2733 |
(MenuItem |
|
2734 |
enabled: hasSelection |
|
2735 |
label: 'Revision Log' |
|
2736 |
itemValue: cvsRevisionLog |
|
2737 |
) |
|
2738 |
(MenuItem |
|
2739 |
enabled: hasSelection |
|
2740 |
label: 'Compare with Newest in Repository' |
|
2741 |
itemValue: cvsCompareWithNewest |
|
2742 |
) |
|
2743 |
(MenuItem |
|
2744 |
enabled: hasSelection |
|
2745 |
label: 'Browse Repository Versions' |
|
2746 |
itemValue: cvsBrowseRepositoryVersions |
|
2747 |
) |
|
2748 |
(MenuItem |
|
2749 |
label: '-' |
|
2750 |
) |
|
2751 |
(MenuItem |
|
2752 |
enabled: canRemoveCVSContainer |
|
2753 |
label: 'Remove File && CVS Container...' |
|
2754 |
itemValue: cvsRemoveFileAndCVSContainer |
|
2755 |
) |
|
2756 |
) |
|
15211 | 2757 |
! |
2758 |
||
18820 | 2759 |
gitMenu |
2760 |
"This resource specification was automatically generated |
|
2761 |
by the MenuEditor of ST/X." |
|
2762 |
||
2763 |
"Do not manually edit this!! If it is corrupted, |
|
2764 |
the MenuEditor may not be able to read the specification." |
|
2765 |
||
2766 |
||
2767 |
" |
|
19001 | 2768 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#gitMenu |
2769 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser gitMenu)) startUp |
|
2770 |
" |
|
2771 |
||
2772 |
<resource: #menu> |
|
2773 |
||
2774 |
^ |
|
2775 |
#(Menu |
|
2776 |
(MenuItem |
|
2777 |
label: 'Add' |
|
2778 |
itemValue: gitAdd |
|
2779 |
) |
|
2780 |
(MenuItem |
|
2781 |
label: 'Commit Changes' |
|
2782 |
itemValue: gitCommit |
|
2783 |
) |
|
2784 |
(MenuItem |
|
2785 |
label: 'Push...' |
|
2786 |
itemValue: gitPush |
|
2787 |
) |
|
2788 |
(MenuItem |
|
2789 |
label: 'Status' |
|
2790 |
itemValue: gitStatus |
|
2791 |
) |
|
2792 |
(MenuItem |
|
2793 |
label: '-' |
|
2794 |
) |
|
2795 |
(MenuItem |
|
2796 |
label: 'Init' |
|
2797 |
itemValue: gitInit |
|
2798 |
) |
|
2799 |
) |
|
2800 |
! |
|
2801 |
||
15211 | 2802 |
mercurialMenu |
2803 |
"This resource specification was automatically generated |
|
2804 |
by the MenuEditor of ST/X." |
|
2805 |
||
2806 |
"Do not manually edit this!! If it is corrupted, |
|
2807 |
the MenuEditor may not be able to read the specification." |
|
2808 |
||
2809 |
||
2810 |
" |
|
2811 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#mercurialMenu |
|
2812 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser mercurialMenu)) startUp |
|
2813 |
" |
|
2814 |
||
2815 |
<resource: #menu> |
|
2816 |
||
2817 |
^ |
|
19001 | 2818 |
#(Menu |
2819 |
(MenuItem |
|
2820 |
label: 'Add' |
|
2821 |
itemValue: mercurialAdd |
|
2822 |
) |
|
2823 |
(MenuItem |
|
2824 |
label: 'Commit Changes' |
|
2825 |
itemValue: mercurialCommit |
|
2826 |
) |
|
2827 |
(MenuItem |
|
2828 |
label: 'Push...' |
|
2829 |
itemValue: mercurialPush |
|
2830 |
) |
|
2831 |
(MenuItem |
|
2832 |
label: 'Status' |
|
2833 |
itemValue: mercurialStatus |
|
2834 |
) |
|
2835 |
(MenuItem |
|
2836 |
label: '-' |
|
2837 |
) |
|
2838 |
(MenuItem |
|
2839 |
label: 'Init' |
|
2840 |
itemValue: mercurialInit |
|
2841 |
) |
|
2842 |
) |
|
15211 | 2843 |
! |
2844 |
||
2845 |
perforceMenu |
|
2846 |
"This resource specification was automatically generated |
|
2847 |
by the MenuEditor of ST/X." |
|
2848 |
||
2849 |
"Do not manually edit this!! If it is corrupted, |
|
2850 |
the MenuEditor may not be able to read the specification." |
|
2851 |
||
2852 |
||
2853 |
" |
|
2854 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#perforceMenu |
|
2855 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser perforceMenu)) startUp |
|
2856 |
" |
|
2857 |
||
2858 |
<resource: #menu> |
|
2859 |
||
2860 |
^ |
|
19001 | 2861 |
#(Menu |
2862 |
(MenuItem |
|
2863 |
label: 'Commit' |
|
2864 |
itemValue: perforceCommit |
|
2865 |
) |
|
2866 |
) |
|
15211 | 2867 |
! ! |
11144 | 2868 |
|
3892 | 2869 |
!AbstractFileBrowser class methodsFor:'misc'! |
2870 |
||
2871 |
newLock |
|
2872 |
^ CodeExecutionLock new |
|
2873 |
! ! |
|
2874 |
||
17288 | 2875 |
!AbstractFileBrowser class methodsFor:'queries'! |
2876 |
||
2877 |
isAbstract |
|
2878 |
^ self == AbstractFileBrowser |
|
2879 |
! ! |
|
2880 |
||
17868 | 2881 |
!AbstractFileBrowser class methodsFor:'queries-file'! |
2882 |
||
2883 |
getBestDirectoryFrom:directories |
|
2884 |
"from a set of directories, return the common parent directory" |
|
2885 |
||
2886 |
|stringCol firstPre| |
|
2887 |
||
2888 |
directories isEmpty ifTrue:[^ nil]. |
|
2889 |
directories size == 1 ifTrue:[^ directories first]. |
|
2890 |
stringCol := (directories collect:[:file| file asString]) asOrderedCollection. |
|
2891 |
firstPre := stringCol at:1. |
|
2892 |
stringCol from:2 do:[:el| |
|
2893 |
firstPre := firstPre commonPrefixWith:el. |
|
2894 |
]. |
|
2895 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
2896 |
firstPre removeLast. |
|
2897 |
]. |
|
2898 |
^ firstPre asFilename |
|
2899 |
! ! |
|
2900 |
||
17746 | 2901 |
!AbstractFileBrowser class methodsFor:'utilities - dump'! |
4610 | 2902 |
|
18666 | 2903 |
contentsOfBytesAsDump:dataOrFileStream base:numberBase numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
17744 | 2904 |
"utility helper: generate a hexDump with addresses; |
2905 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
2906 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
2907 |
to support display of alien encoded binary data." |
|
2908 |
||
18666 | 2909 |
|dataSize lines nHexLines replacementForUnprintable colsPerByte characterDecoder| |
17744 | 2910 |
|
2911 |
(characterEncodingSymbol isNil or:[characterEncodingSymbol == #'iso8859-1']) ifFalse:[ |
|
2912 |
characterDecoder := CharacterEncoder encoderToEncodeFrom:characterEncodingSymbol into:#unicode. |
|
2913 |
]. |
|
17252 | 2914 |
|
2915 |
"/ used to be: |
|
2916 |
"/ replacementForUnprintable := $. |
|
2917 |
replacementForUnprintable := Character value:16rB7. "/ a centered dot. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2918 |
|
17744 | 2919 |
"/ cols needed per byte in the hex dump |
2920 |
colsPerByte := ((255 printStringRadix:numberBase) size). |
|
2921 |
||
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2922 |
"generate a virtual collection which evaluates and returns lines on-demand" |
18666 | 2923 |
dataSize := dataOrFileStream isStream |
2924 |
ifTrue:[ dataOrFileStream fileSize ] |
|
2925 |
ifFalse:[ dataOrFileStream size ]. |
|
2926 |
nHexLines := (dataSize + 15) // 16. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2927 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2928 |
lines := VirtualArray new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2929 |
lines setSize:nHexLines + (nHexLines // 16). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2930 |
lines |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2931 |
generator:[:lineNr | |
17744 | 2932 |
|blockNr lineNrInBlock startOffset lineStream asciiLineStream byte line |
2933 |
decodedChar charPrinted| |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2934 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2935 |
blockNr := (lineNr - 1) // 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2936 |
lineNrInBlock := (lineNr - 1) \\ 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2937 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2938 |
lineNrInBlock == 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2939 |
line := '' |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2940 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2941 |
startOffset := ((blockNr * 16) + lineNrInBlock) * 16. |
17744 | 2942 |
|
2943 |
"/ 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
|
2944 |
lineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2945 |
asciiLineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2946 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2947 |
lineStream nextPutAll:((startOffset+virtualStart) hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2948 |
lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2949 |
1 to:16 do:[:i | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2950 |
i ~~ 1 ifTrue:[ lineStream space ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2951 |
|
18666 | 2952 |
(startOffset + i) > dataSize ifTrue:[ |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2953 |
asciiLineStream nextPut:(Character space). |
17744 | 2954 |
lineStream spaces:colsPerByte. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2955 |
] ifFalse:[ |
18666 | 2956 |
dataOrFileStream isStream ifTrue:[ |
2957 |
dataOrFileStream position:(startOffset + i - 1). |
|
2958 |
byte := dataOrFileStream nextByte. |
|
2959 |
] ifFalse:[ |
|
2960 |
byte := dataOrFileStream at:startOffset + i. |
|
2961 |
]. |
|
17746 | 2962 |
lineStream nextPutAll:(byte printStringRadix:numberBase size:colsPerByte fill:$0). |
17744 | 2963 |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2964 |
|
17744 | 2965 |
decodedChar := byte. |
2966 |
characterDecoder notNil ifTrue:[ |
|
2967 |
decodedChar := characterDecoder encode:byte. |
|
2968 |
]. |
|
2969 |
||
2970 |
charPrinted := replacementForUnprintable. |
|
2971 |
decodedChar notNil ifTrue:[ |
|
2972 |
((decodedChar between:32 and:127) or:[(decodedChar between:(128+32) and:(128+127))]) ifTrue:[ |
|
2973 |
charPrinted := Character value:decodedChar. |
|
16188 | 2974 |
] ifFalse:[ |
17744 | 2975 |
(decodedChar between:0 and:31) ifTrue:[ |
2976 |
"/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400 |
|
2977 |
"/ are perfect here, but usually not available in the font |
|
2978 |
"/ and we have currently no way of knowing if they are... |
|
2979 |
"/ (could let the font draw into a bitmap and check if there is something...) |
|
19152 | 2980 |
"/ For now, write a dot.· |
17744 | 2981 |
"/ charPrinted := (Character value:(byte + 16r2400)) |
2982 |
]. |
|
16188 | 2983 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2984 |
]. |
17744 | 2985 |
asciiLineStream nextPut:charPrinted. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2986 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2987 |
]. |
17744 | 2988 |
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
|
2989 |
, asciiLineStream contents. |
11262 | 2990 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2991 |
line |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2992 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2993 |
^ lines. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2994 |
|
17744 | 2995 |
"Created: / 12-11-2017 / 11:24:29 / cg" |
17750 | 2996 |
"Modified: / 12-11-2017 / 14:17:59 / cg" |
18666 | 2997 |
"Modified: / 12-03-2019 / 16:16:53 / Claus Gittinger" |
2998 |
! |
|
2999 |
||
3000 |
contentsOfBytesAsHexDump:dataOrFileStream numberOfAddressDigits:addrDigits addressStart:virtualStart |
|
17744 | 3001 |
"utility helper: generate a hexDump with addresses; the character columns at the right show |
3002 |
the iso8859-1 characters" |
|
17753 | 3003 |
|
3004 |
^ self |
|
18666 | 3005 |
contentsOfBytesAsDump:dataOrFileStream base:16 |
17744 | 3006 |
numberOfAddressDigits:addrDigits |
3007 |
addressStart:virtualStart |
|
17753 | 3008 |
characterEncoding:#'iso8859-1' |
11262 | 3009 |
|
3010 |
"Created: / 13-02-2012 / 15:01:46 / cg" |
|
17744 | 3011 |
"Modified: / 12-11-2017 / 12:07:12 / cg" |
17753 | 3012 |
"Modified: / 14-11-2017 / 17:48:19 / mawalch" |
18666 | 3013 |
"Modified (format): / 12-03-2019 / 16:38:26 / Claus Gittinger" |
3014 |
! |
|
3015 |
||
3016 |
contentsOfBytesAsHexDump:dataOrFileStream numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
|
17744 | 3017 |
"utility helper: generate a hexDump with addresses; |
3018 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
3019 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
3020 |
to support display of alien encoded binary data." |
|
3021 |
||
3022 |
^ self |
|
18666 | 3023 |
contentsOfBytesAsDump:dataOrFileStream base:16 |
17744 | 3024 |
numberOfAddressDigits:addrDigits |
3025 |
addressStart:virtualStart |
|
3026 |
characterEncoding:characterEncodingSymbol |
|
3027 |
||
3028 |
"Created: / 12-11-2017 / 11:21:44 / cg" |
|
18666 | 3029 |
"Modified (format): / 12-03-2019 / 16:38:31 / Claus Gittinger" |
17744 | 3030 |
! |
3031 |
||
3032 |
contentsOfFileAsDump:f base:numberBase withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3033 |
"opens the file, get its contents and generates a dump for it" |
|
3034 |
||
4610 | 3035 |
|resources fileName stream data offs |
17768 | 3036 |
addrDigits lines answer sizeLimit showLastPart setNewLimit thisFileSizeString| |
4610 | 3037 |
|
3038 |
resources := self classResources. |
|
3039 |
||
3040 |
fileName := f baseName. |
|
3041 |
f isDirectory ifTrue:[ |
|
18609 | 3042 |
Dialog warn:(resources string:'"%1" is a directory.' with:fileName). |
4610 | 3043 |
^ nil |
3044 |
]. |
|
3045 |
f exists ifFalse:[ |
|
18609 | 3046 |
Dialog warn:(resources string:'oops, "%1" is gone or unreadable.' with:fileName). |
4610 | 3047 |
^ nil |
3048 |
]. |
|
3049 |
f isReadable ifFalse:[ |
|
18609 | 3050 |
Dialog warn:(resources string:'"%1" is unreadable.' with:fileName). |
4610 | 3051 |
^ nil |
3052 |
]. |
|
17768 | 3053 |
f fileSize > (self maxFileSizeShownWithoutAsking) ifTrue:[ |
8472 | 3054 |
limitOrNil notNil ifTrue:[ |
3055 |
sizeLimit := limitOrNil. |
|
3056 |
showLastPart := showLastPartOrNil |
|
3057 |
] ifFalse:[ |
|
17768 | 3058 |
setNewLimit := false. |
3059 |
thisFileSizeString := (UnitConverter fileSizeStringFor:f fileSize). |
|
3060 |
||
3061 |
Dialog |
|
3062 |
withOptoutOption:[ setNewLimit := true ] |
|
3063 |
labelled:(resources string:'No longer ask for files smaller than %1' with:thisFileSizeString) |
|
3064 |
do:[ |
|
3065 |
answer := Dialog |
|
3066 |
confirmWithCancel:(resources |
|
3067 |
stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' |
|
3068 |
with:(fileName contractTo:40) allBold |
|
3069 |
with:thisFileSizeString) |
|
3070 |
labels:#('Cancel' 'Show All' 'Show First Part' ). |
|
3071 |
]. |
|
8472 | 3072 |
answer isNil ifTrue:[^ nil]. |
3073 |
answer ifTrue:[ |
|
17769 | 3074 |
sizeLimit := (4 * 1024 * 1024) "max:self maxFileSizeShownWithoutAsking". |
17768 | 3075 |
] ifFalse:[ |
3076 |
setNewLimit ifTrue:[ |
|
3077 |
self maxFileSizeShownWithoutAsking:(self maxFileSizeShownWithoutAsking max:f fileSize). |
|
3078 |
]. |
|
3079 |
]. |
|
8436 | 3080 |
]. |
4610 | 3081 |
]. |
3082 |
||
18666 | 3083 |
[ |
3084 |
stream := f readStream binary. |
|
3085 |
sizeLimit notNil ifTrue:[ |
|
3086 |
showLastPart == true ifTrue:[ |
|
3087 |
stream position:(f fileSize - sizeLimit). |
|
3088 |
]. |
|
3089 |
data := stream nextBytes:sizeLimit. |
|
3090 |
] ifFalse:[ |
|
3091 |
f fileSize > (1024*1024) ifTrue:[ |
|
3092 |
data := stream |
|
3093 |
] ifFalse:[ |
|
3094 |
data := stream contents. |
|
3095 |
]. |
|
3096 |
]. |
|
3097 |
] ensure:[ |
|
3098 |
(stream notNil and:[stream ~~ data]) ifTrue:[ |
|
3099 |
stream close. |
|
3100 |
]. |
|
3101 |
]. |
|
3102 |
||
4610 | 3103 |
offs := 0. |
3104 |
lines := StringCollection new. |
|
3105 |
||
3106 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
3107 |
||
11262 | 3108 |
^ self |
17744 | 3109 |
contentsOfBytesAsDump:data base:numberBase |
11262 | 3110 |
numberOfAddressDigits:addrDigits |
3111 |
addressStart:0 |
|
17744 | 3112 |
characterEncoding:characterEncoding |
3113 |
||
3114 |
"Created: / 12-11-2017 / 12:08:10 / cg" |
|
17769 | 3115 |
"Modified: / 19-11-2017 / 15:01:34 / cg" |
18666 | 3116 |
"Modified: / 12-03-2019 / 16:18:46 / Claus Gittinger" |
17744 | 3117 |
! |
3118 |
||
3119 |
contentsOfFileAsHexDump:f |
|
3120 |
"opens the file, get its contents and generates a dump for it" |
|
3121 |
||
3122 |
^ self |
|
3123 |
contentsOfFileAsHexDump:f |
|
3124 |
withLimit:nil |
|
3125 |
lastPart:nil |
|
3126 |
characterEncoding:#'iso8859-1' |
|
3127 |
||
3128 |
"Modified (comment): / 12-11-2017 / 12:09:30 / cg" |
|
3129 |
! |
|
3130 |
||
3131 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil |
|
3132 |
"opens the file, get its contents and generates a dump for it" |
|
3133 |
||
3134 |
^ self |
|
3135 |
contentsOfFileAsHexDump:f |
|
3136 |
withLimit:limitOrNil |
|
3137 |
lastPart:showLastPartOrNil |
|
3138 |
characterEncoding:#'iso-8859-1' |
|
3139 |
||
3140 |
"Modified (comment): / 12-11-2017 / 12:09:34 / cg" |
|
3141 |
! |
|
3142 |
||
3143 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3144 |
"opens the file, get its contents and generates a dump for it" |
|
3145 |
||
3146 |
^ self |
|
3147 |
contentsOfFileAsDump:f base:16 |
|
3148 |
withLimit:limitOrNil |
|
3149 |
lastPart:showLastPartOrNil |
|
3150 |
characterEncoding:characterEncoding |
|
3151 |
||
3152 |
"Created: / 12-11-2017 / 12:02:05 / cg" |
|
4610 | 3153 |
! ! |
3154 |
||
17868 | 3155 |
!AbstractFileBrowser class methodsFor:'utilities - files'! |
3156 |
||
3157 |
allFilesInDirectories:directories forWhich:aBlock |
|
3158 |
|allFiles| |
|
3159 |
||
3160 |
directories isEmpty ifTrue:[^ #()]. |
|
3161 |
||
3162 |
allFiles := OrderedCollection new. |
|
3163 |
directories do:[:dir| |
|
3164 |
[ |
|
3165 |
|fileNames| |
|
3166 |
||
3167 |
fileNames := dir directoryContents. |
|
3168 |
fileNames notNil ifTrue:[ |
|
3169 |
fileNames := fileNames |
|
3170 |
collect:[:fn | dir construct:fn] |
|
3171 |
thenSelect:[:fn | fn isDirectory not and:[aBlock value:fn]]. |
|
3172 |
allFiles addAll:fileNames. |
|
3173 |
] |
|
3174 |
] on:FileStream openErrorSignal do:[:ex| |
|
3175 |
self warn:(self classResources stringWithCRs:'Cannot access: %1\(%2)' |
|
3176 |
with:ex pathName |
|
3177 |
with:ex description). |
|
3178 |
ex proceedWith:nil. |
|
3179 |
]. |
|
3180 |
]. |
|
3181 |
||
3182 |
^ allFiles |
|
3183 |
! |
|
3184 |
||
3185 |
fileFindDuplicatesIn:directories |
|
3186 |
"scan directories for duplicate files. |
|
17871 | 3187 |
return a dictionary mapping duplicate files to their original; |
3188 |
the oldest file found will be the value (original), the younger files (copies) will be the keys. |
|
17868 | 3189 |
Files without duplicate(s) will not have an entry in the dictionary." |
3190 |
||
3191 |
|infoDir filesBySize anySameSized |
|
3192 |
result allFiles| |
|
3193 |
||
3194 |
directories isEmpty ifTrue:[^ #()]. |
|
3195 |
||
3196 |
allFiles := self allFilesInDirectories:directories forWhich:[:f | true]. |
|
3197 |
allFiles isEmpty ifTrue:[^ #()]. |
|
3198 |
||
3199 |
"/ for each, get the file's info (size, modificationTime etc.). |
|
3200 |
infoDir := Dictionary new. |
|
3201 |
allFiles do:[:fn | |
|
3202 |
infoDir at:fn put:(fn info) |
|
3203 |
]. |
|
3204 |
||
3205 |
"/ in a first pass, collect groups by the same size |
|
3206 |
"/ remember those fileSizes for which multiple files exist |
|
3207 |
filesBySize := Dictionary new. |
|
3208 |
anySameSized := false. |
|
3209 |
infoDir keysAndValuesDo:[:fn :info | |
|
3210 |
|sz entry| |
|
3211 |
||
3212 |
sz := info fileSize. |
|
3213 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
3214 |
entry add:fn. |
|
3215 |
entry size > 1 ifTrue:[ anySameSized := true ]. |
|
3216 |
]. |
|
3217 |
||
3218 |
"/ any of same size ? |
|
3219 |
anySameSized ifFalse:[^ #() ]. |
|
3220 |
||
3221 |
result := Dictionary new. |
|
3222 |
||
3223 |
"/ now walk over the same-sized files and compare the contents. |
|
3224 |
filesBySize do:[:entry | |
|
3225 |
|files| |
|
3226 |
||
3227 |
entry size > 1 ifTrue:[ |
|
3228 |
files := entry asArray. |
|
3229 |
files |
|
3230 |
sort:[:a :b | |
|
3231 |
|tA tB| |
|
3232 |
tA := (infoDir at:a) modificationTime. |
|
3233 |
tB := (infoDir at:b) modificationTime. |
|
3234 |
tA < tB |
|
3235 |
]. |
|
3236 |
||
3237 |
1 to:files size-1 do:[:idx1 | |
|
3238 |
|fn1| |
|
3239 |
||
3240 |
fn1 := files at:idx1. |
|
3241 |
idx1+1 to:files size do:[:idx2 | |
|
3242 |
|fn2| |
|
3243 |
||
3244 |
fn2 := files at:idx2. |
|
3245 |
||
3246 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
3247 |
"/ compare the files |
|
3248 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3249 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
|
17871 | 3250 |
result at:fn2 put:fn1. |
17868 | 3251 |
] |
3252 |
] |
|
3253 |
] |
|
3254 |
] |
|
3255 |
] |
|
3256 |
]. |
|
3257 |
||
17869 | 3258 |
result := result associations copy. |
3259 |
"/ result := result collect:[:assoc | |
|
3260 |
"/ |f1 f2| |
|
3261 |
"/ |
|
3262 |
"/ f1 := assoc key asString. |
|
3263 |
"/ f2 := assoc value asString. |
|
3264 |
"/ f1 < f2 ifTrue:[ |
|
3265 |
"/ f2 -> f1 |
|
3266 |
"/ ] ifFalse:[ |
|
3267 |
"/ f1 -> f2 |
|
3268 |
"/ ] |
|
3269 |
"/ ]. |
|
17868 | 3270 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
3271 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
17869 | 3272 |
result sort:[:f1 :f2 | f1 key < f2 key]. |
17868 | 3273 |
^ result |
19009 | 3274 |
! |
3275 |
||
3276 |
getDirectoryOf:aFileName |
|
3277 |
|fn | |
|
3278 |
||
3279 |
aFileName isNil ifTrue:[ |
|
3280 |
^ aFileName. |
|
3281 |
]. |
|
3282 |
fn := aFileName asFilename. |
|
3283 |
||
3284 |
fn isDirectory ifFalse:[ |
|
3285 |
^ fn directory. |
|
3286 |
]. |
|
3287 |
^ fn. |
|
17868 | 3288 |
! ! |
3289 |
||
3892 | 3290 |
!AbstractFileBrowser methodsFor:'actions'! |
3291 |
||
3292 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 3293 |
"setup and launch a querybox to ask for a unix command. |
3892 | 3294 |
Then evaluate aBlock passing the command-string as argument." |
3295 |
||
16160 | 3296 |
|box osName commandString alwaysOpenLikeThisHolder openCmd suffix| |
3892 | 3297 |
|
3298 |
osName := OperatingSystem platformName. |
|
3299 |
||
3300 |
box := FilenameEnterBox |
|
4414 | 3301 |
title:(resources string:'Execute %1 command:' with:osName) |
3302 |
okText:(resources string:'Execute') |
|
4523 | 3303 |
action:[:cmd | commandString := cmd]. |
3892 | 3304 |
|
3305 |
fileName notNil ifTrue:[ |
|
4414 | 3306 |
self initialCommandFor:fileName into:box. |
3892 | 3307 |
]. |
16160 | 3308 |
alwaysOpenLikeThisHolder := false asValue. |
3309 |
box verticalPanel add:((CheckBox label:'Always use this command for this file type') model:alwaysOpenLikeThisHolder). |
|
19009 | 3310 |
box directory:(self class getDirectoryOf:fileName). |
16160 | 3311 |
box open. |
3312 |
||
3313 |
"/ box destroy. |
|
3314 |
alwaysOpenLikeThisHolder value ifTrue:[ |
|
3315 |
openCmd := commandString upTo:$". |
|
3316 |
suffix := fileName suffix. |
|
16306 | 3317 |
UserPreferences current |
3318 |
defaultFileOpenCommandFor:suffix put:(openCmd,' "%1"'); |
|
3319 |
beModified. |
|
3320 |
self breakPoint:#cg. |
|
16160 | 3321 |
]. |
3322 |
||
4523 | 3323 |
commandString notNil ifTrue:[ |
3324 |
aBlock value:commandString |
|
3325 |
]. |
|
3326 |
||
3892 | 3327 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
3328 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
3329 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
3330 |
! |
|
3331 |
||
3332 |
changeFileBrowserTitleTo:aString |
|
4774 | 3333 |
self |
3334 |
applicationNamed:#FileBrowserV2 |
|
5009 | 3335 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 3336 |
! |
3337 |
||
3338 |
copyFileList |
|
4774 | 3339 |
"copy the fileList to the clipBoard" |
3340 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3341 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3342 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3343 |
fileList := self |
4774 | 3344 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3345 |
ifPresentDo:[:app | app browserFileList]. |
3346 |
||
3347 |
fileList notNil ifTrue:[ |
|
3348 |
self copyFileListToClipBoard:fileList. |
|
3349 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3350 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3351 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3352 |
copyFileListToClipBoard:fileList |
4774 | 3353 |
"copy the itemList to the clipBoard" |
3354 |
||
3355 |
|stream| |
|
3356 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3357 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 3358 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3359 |
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
|
3360 |
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
|
3361 |
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
|
3362 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3363 |
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
|
3364 |
(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
|
3365 |
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
|
3366 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3367 |
]. |
3892 | 3368 |
]. |
6034 | 3369 |
self window setClipboardText:stream contents. |
3892 | 3370 |
! |
3371 |
||
3372 |
copySelectedFilenames |
|
4774 | 3373 |
"copy the selected fileNames to the clipBoard" |
3374 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3375 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3376 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3377 |
fileList := self |
4774 | 3378 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3379 |
ifPresentDo:[:appl | appl selectedFileNames]. |
3380 |
fileList notNil ifTrue:[ |
|
3381 |
self copyFileListToClipBoard:fileList. |
|
3382 |
]. |
|
3892 | 3383 |
! |
3384 |
||
10923 | 3385 |
doAddArchiver |
3386 |
|files| |
|
3387 |
||
3388 |
files := self currentSelectedFiles. |
|
3389 |
files size == 1 ifFalse:[ |
|
17818 | 3390 |
Dialog information:(resources string:'Select exactly one archive.'). |
10923 | 3391 |
^ self |
3392 |
]. |
|
3393 |
||
3394 |
self |
|
3395 |
applicationNamed:#FileApplicationNoteBook |
|
3396 |
ifPresentDo:[:appl | appl doAddArchiverOn:files first]. |
|
3397 |
||
3398 |
"Created: / 29-11-2011 / 19:01:31 / cg" |
|
17818 | 3399 |
"Modified: / 29-11-2017 / 12:25:47 / cg" |
10923 | 3400 |
! |
3401 |
||
3892 | 3402 |
doAddTerminal |
5960 | 3403 |
|dir| |
3404 |
||
3405 |
dir := self currentDirectory. |
|
3406 |
dir isNil ifTrue:[ |
|
4414 | 3407 |
dir := Filename homeDirectory |
3892 | 3408 |
]. |
4774 | 3409 |
|
5009 | 3410 |
self |
3411 |
applicationNamed:#FileApplicationNoteBook |
|
3412 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
18734 | 3413 |
|
3414 |
"Modified (format): / 10-04-2019 / 05:53:35 / Claus Gittinger" |
|
3892 | 3415 |
! |
3416 |
||
3417 |
doOpenSearchFile |
|
5961 | 3418 |
|item file| |
3419 |
||
3420 |
file := self firstSelectedFileName. |
|
3421 |
file isNil ifTrue:[ |
|
3422 |
file := Filename homeDirectory asAbsoluteFilename. |
|
3423 |
]. |
|
3424 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 3425 |
self openSearchFileOn:item. |
3426 |
! |
|
3427 |
||
3428 |
doShowFileContents |
|
5009 | 3429 |
self |
3430 |
applicationNamed:#DirectoryContentsBrowser |
|
3431 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
3432 |
||
3433 |
^ nil |
|
3892 | 3434 |
! |
3435 |
||
3436 |
doShowProperties |
|
3437 |
"show long stat (file)-info" |
|
3438 |
||
3439 |
self fileGetInfo:true |
|
3440 |
! |
|
3441 |
||
14577 | 3442 |
enterAction |
3443 |
self |
|
3444 |
applicationNamed:#DirectoryContentsBrowser |
|
3445 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl enterAction ]]. |
|
3446 |
! |
|
3447 |
||
5528 | 3448 |
fileEncodingDialog |
14497 | 3449 |
"open a dialog to allow change of the file's character encoding. |
5528 | 3450 |
Files are converted to internal encoding when read, and converted back |
3451 |
to this encoding when saved. |
|
3452 |
Notice: currently, not too many encodings are supported by the system." |
|
3453 |
||
3454 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
3455 |
||
3456 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
3457 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
3458 |
||
3459 |
bindings := IdentityDictionary new. |
|
3460 |
bindings at:#encodingList put:encodingDescr. |
|
3461 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 3462 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
3463 |
||
5528 | 3464 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
3465 |
ifTrue:[ |
|
3466 |
idx := (bindings at:#selectedEncoding) value. |
|
3467 |
selectedEncoding := encodings at:idx. |
|
3468 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 3469 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 3470 |
]. |
5737 | 3471 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 3472 |
]. |
3473 |
||
3474 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
3475 |
! |
|
3476 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3477 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3478 |
"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
|
3479 |
|
5959 | 3480 |
|currentFileNameHolder currentSel| |
3481 |
||
18823 | 3482 |
aFilename isNil ifTrue:[^ self]. |
3483 |
||
5959 | 3484 |
currentFileNameHolder := self currentFileNameHolder. |
3485 |
||
3486 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3487 |
(currentSel includes:aFilename) ifFalse:[ |
9677 | 3488 |
self withWaitCursorDo:[ |
3489 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
|
3490 |
] |
|
3491 |
]. |
|
3492 |
||
3493 |
"Modified: / 29-12-2010 / 11:04:29 / cg" |
|
18823 | 3494 |
"Modified: / 15-06-2019 / 08:38:21 / Claus Gittinger" |
3892 | 3495 |
! |
3496 |
||
11053 | 3497 |
lineEndConventionDialog |
3498 |
"open a dialog to allow change of the line end conventions |
|
3499 |
(when writing files)" |
|
3500 |
||
3501 |
|bindings| |
|
3502 |
||
3503 |
bindings := IdentityDictionary new. |
|
3504 |
bindings at:#lineEndConvention put:(self lineEndConvention asValue). |
|
3505 |
||
3506 |
(self openDialogInterface:#lineEndConventionDialogSpec withBindings:bindings) |
|
3507 |
ifTrue:[ |
|
15208 | 3508 |
self lineEndConventionHolder value:(bindings at:#lineEndConvention) value asSymbol |
11053 | 3509 |
]. |
3510 |
||
3511 |
"Created: / 06-01-2012 / 15:34:51 / cg" |
|
3512 |
! |
|
3513 |
||
4392 | 3514 |
newTextEditor |
5009 | 3515 |
self |
3516 |
applicationNamed:#FileApplicationNoteBook |
|
15936 | 3517 |
ifPresentDo:[:appl | |
3518 |
|editor files item| |
|
3519 |
||
3520 |
editor := appl newTextEditor. |
|
3521 |
(files := self currentSelectedFiles) size == 1 ifTrue:[ |
|
3522 |
item := DirectoryContentsBrowser itemClass fileName:files first. |
|
3523 |
editor item:item. |
|
3524 |
]. |
|
3525 |
^ editor |
|
3526 |
]. |
|
5009 | 3527 |
|
3528 |
^ nil. |
|
3529 |
! |
|
3530 |
||
3531 |
openApplByFileItem:anItem |
|
8490 | 3532 |
"/ q: is the following always wanted ? |
9267 | 3533 |
self window sensor shiftDown ifFalse:[ |
17715 | 3534 |
((anItem mimeType startsWith:'application/x-expecco-') |
3535 |
and:[(Smalltalk at:#ExpeccoStartup) notNil]) ifTrue:[ |
|
3536 |
(Smalltalk at:#ExpeccoStartup) main:{anItem fileName asString}. |
|
3537 |
^ self. |
|
3538 |
]. |
|
3539 |
||
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3540 |
"/ cg: no - batch and shell scripts are to be |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3541 |
"/ anItem fileName isExecutableProgram ifTrue:[ |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3542 |
"/ self executeCommand:anItem fileName pathName. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3543 |
"/ ^ self. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3544 |
"/ ]. |
9267 | 3545 |
|
8490 | 3546 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
3547 |
"/ Error handle:[:ex | |
|
3548 |
"/ ] do:[ |
|
3549 |
"/ OperatingSystem |
|
3550 |
"/ shellExecute:nil |
|
3551 |
"/ lpOperation:'open' |
|
3552 |
"/ lpFile:(anItem fileName pathName) |
|
3553 |
"/ lpParameters:nil |
|
3554 |
"/ lpDirectory:(self directory pathName) |
|
3555 |
"/ nShowCmd:#SW_SHOWNORMAL. |
|
3556 |
"/ ^ self. |
|
3557 |
"/ ] |
|
3558 |
"/ ] |
|
9267 | 3559 |
]. |
5306 | 3560 |
^ self |
5009 | 3561 |
applicationNamed:#FileApplicationNoteBook |
5306 | 3562 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3563 |
|
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3564 |
"Modified: / 06-09-2011 / 11:11:15 / cg" |
17715 | 3565 |
"Modified: / 18-10-2017 / 10:15:15 / stefan" |
3892 | 3566 |
! |
3567 |
||
4392 | 3568 |
openApplForFile:aFilename |
5306 | 3569 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 3570 |
! |
3571 |
||
3892 | 3572 |
openCommandResultApplication |
3573 |
||
5009 | 3574 |
self |
3575 |
applicationNamed:#FileApplicationNoteBook |
|
3576 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
3577 |
||
3578 |
^ nil |
|
3892 | 3579 |
! |
3580 |
||
5010 | 3581 |
openNewTextEditorOn:anItem |
5009 | 3582 |
self |
3583 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3584 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 3585 |
|
3586 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3587 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3588 |
|
5010 | 3589 |
openSearchFileOn:anItem |
5009 | 3590 |
self |
3591 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3592 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 3593 |
|
3594 |
^ nil. |
|
3892 | 3595 |
! |
3596 |
||
5162 | 3597 |
openTextEditorForFile:aFilename |
3598 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
3599 |
! |
|
3600 |
||
5010 | 3601 |
openTextEditorOn:anItem |
5009 | 3602 |
self |
3603 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3604 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 3605 |
|
3606 |
^ nil. |
|
3892 | 3607 |
! |
3608 |
||
5010 | 3609 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 3610 |
self |
3611 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3612 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 3613 |
|
3614 |
^ nil. |
|
4618 | 3615 |
! |
3616 |
||
5959 | 3617 |
setCurrentFileName:aFilename |
3618 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
3619 |
! |
|
3620 |
||
3621 |
setCurrentFileNames:aCollectionOfFilenames |
|
3622 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
3623 |
! |
|
3624 |
||
11053 | 3625 |
tabStopConversionDialog |
3626 |
"open a dialog to allow change of the tab stop conversion (when reading/writing files)" |
|
3627 |
||
3628 |
|bindings| |
|
3629 |
||
3630 |
bindings := IdentityDictionary new. |
|
3631 |
bindings at:#tabStops put:(self inputTabColumnConversion asValue). |
|
3632 |
||
3633 |
(self openDialogInterface:#tabStopConversionDialogSpec withBindings:bindings) |
|
3634 |
ifTrue:[ |
|
3635 |
self inputTabColumnConversionHolder value:(bindings at:#tabStops) value |
|
3636 |
]. |
|
3637 |
||
3638 |
"Created: / 06-01-2012 / 15:36:06 / cg" |
|
3639 |
! |
|
3640 |
||
3892 | 3641 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3642 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3643 |
aColOfFiles notNil ifTrue:[ |
5959 | 3644 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3645 |
]. |
3892 | 3646 |
! |
3647 |
||
3648 |
updateCurrentDirectory |
|
5739 | 3649 |
self updateCurrentDirectory:false |
3650 |
! |
|
3651 |
||
3652 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3653 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3654 |
|
5009 | 3655 |
self |
3656 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 3657 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 3658 |
self |
3659 |
applicationNamed:#DirectoryTreeBrowser |
|
3660 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 3661 |
! |
3662 |
||
5739 | 3663 |
updateCurrentDirectoryWithReread |
3664 |
self updateCurrentDirectory:true |
|
3665 |
! |
|
3666 |
||
4345 | 3667 |
withActivityIndicationDo:aBlock |
3668 |
self activityVisibilityChannel value:true. |
|
3669 |
[ |
|
19158 | 3670 |
self withWaitCursorDo:aBlock. |
4345 | 3671 |
] ensure:[ |
3672 |
self activityVisibilityChannel value:false. |
|
3673 |
] |
|
19158 | 3674 |
|
3675 |
"Modified (format): / 11-09-2019 / 16:43:07 / Stefan Vogel" |
|
3892 | 3676 |
! ! |
3677 |
||
3678 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
3679 |
||
3680 |
addBookmark |
|
3681 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
6725 | 3682 |
self addBookmarks:(self currentSelectedDirectories). |
5960 | 3683 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 3684 |
! |
3685 |
||
3686 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3687 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3688 |
self class addBookmark:path |
3892 | 3689 |
]. |
3690 |
! |
|
3691 |
||
8013 | 3692 |
editBookmarks |
17849 | 3693 |
self class editBookmarksWithDefault: self currentSelectedDirectories firstOrNil. |
3694 |
||
3695 |
"Modified: / 13-12-2017 / 23:24:39 / stefan" |
|
8013 | 3696 |
! |
3697 |
||
3892 | 3698 |
hasBookmarks |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3699 |
^ self class hasBookmarks |
3892 | 3700 |
! |
3701 |
||
3702 |
hasBookmarksToRemove |
|
3703 |
|bookmarks directories| |
|
3704 |
||
3982 | 3705 |
directories := self currentSelectedDirectories. |
3892 | 3706 |
bookmarks := self class directoryBookmarks. |
17416 | 3707 |
^ (bookmarks notEmptyOrNil and:[directories notEmpty]) |
3708 |
||
3709 |
"Modified: / 17-02-2017 / 08:25:22 / cg" |
|
3892 | 3710 |
! |
3711 |
||
3712 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3713 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3714 |
self class removeBookmark:dir |
3892 | 3715 |
]. |
4679 | 3716 |
! |
3717 |
||
3718 |
saveBookmarks |
|
3719 |
self class saveBookmarks |
|
3892 | 3720 |
! ! |
3721 |
||
3722 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
3723 |
||
3724 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 3725 |
|cmd suffix cmdHist historySize| |
3892 | 3726 |
|
3727 |
cmdHist := self class commandHistory. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
3728 |
(aCommandString notEmptyOrNil) ifTrue:[ |
4414 | 3729 |
cmdHist notNil ifTrue:[ |
3730 |
cmdHist addFirst:aCommandString. |
|
6369 | 3731 |
historySize := self class commandHistorySize. |
3732 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 3733 |
cmdHist removeLast |
3734 |
] |
|
3735 |
]. |
|
3736 |
aFilename notNil ifTrue:[ |
|
3737 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
3738 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
3739 |
DefaultCommandPerSuffix := Dictionary new. |
|
3740 |
]. |
|
3741 |
suffix := aFilename asFilename suffix. |
|
3742 |
suffix notNil ifTrue:[ |
|
3743 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
3744 |
] |
|
3745 |
] |
|
3892 | 3746 |
] |
3747 |
! |
|
3748 |
||
3749 |
doBack |
|
6286 | 3750 |
"go backward in the history" |
3892 | 3751 |
|
4022 | 3752 |
| fileName| |
3753 |
||
6369 | 3754 |
fileName := self directoryHistory goBackward. |
3892 | 3755 |
fileName notNil ifTrue:[ |
4347 | 3756 |
self gotoFile:(fileName asFilename). |
3892 | 3757 |
] |
3758 |
! |
|
3759 |
||
3760 |
doForward |
|
6286 | 3761 |
"go forward in the history" |
3892 | 3762 |
|
3964 | 3763 |
| fileName| |
3764 |
||
6369 | 3765 |
fileName := self directoryHistory goForward. |
3892 | 3766 |
fileName notNil ifTrue:[ |
4414 | 3767 |
self gotoFile:(fileName asFilename). |
4022 | 3768 |
] ifFalse:[ |
4414 | 3769 |
self enableForward value:false. |
18823 | 3770 |
]. |
3771 |
||
3772 |
"Modified (format): / 15-06-2019 / 08:38:41 / Claus Gittinger" |
|
3892 | 3773 |
! ! |
3774 |
||
3775 |
!AbstractFileBrowser methodsFor:'applications'! |
|
3776 |
||
5009 | 3777 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
3778 |
|appl| |
|
3779 |
||
3780 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
3781 |
appl notNil ifTrue:[ |
|
3782 |
^ aBlock value:appl |
|
3783 |
]. |
|
3784 |
^ nil. |
|
3785 |
! |
|
3786 |
||
4004 | 3787 |
directoryContentsBrowser |
3788 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 3789 |
! ! |
3790 |
||
3791 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
3792 |
||
3793 |
applications |
|
3794 |
^ aspects at:#applications |
|
3795 |
! |
|
3796 |
||
3797 |
backgroundProcesses |
|
3798 |
||
3799 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
3800 |
! |
|
3801 |
||
4230 | 3802 |
canMake |
15259 | 3803 |
^ self aspectFor:#canMake ifAbsent:[ ValueHolder with:false ]. |
4230 | 3804 |
! |
3805 |
||
18246 | 3806 |
canOpenChangeBrowser |
3807 |
^ self aspectFor:#canOpenChangeBrowser ifAbsent:[ false asValue ]. |
|
3808 |
||
3809 |
"Created: / 30-06-2018 / 18:29:53 / Claus Gittinger" |
|
3810 |
! |
|
3811 |
||
3892 | 3812 |
currentDirectories |
6725 | 3813 |
" returns a holder on a Collection of all currently selected directories |
3814 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3892 | 3815 |
" |
3816 |
||
3817 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
3818 |
! |
|
3819 |
||
6725 | 3820 |
currentDirectoriesValue |
3821 |
" returns a Collection of all currently selected directories |
|
3822 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3823 |
" |
|
3824 |
||
3825 |
^ self currentDirectories value |
|
3826 |
! |
|
3827 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3828 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3829 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3830 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3831 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3832 |
|
6725 | 3833 |
directories := self currentSelectedDirectories. |
19152 | 3834 |
(directories size ~~ 1) ifTrue:[ |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3835 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3836 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3837 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3838 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3839 |
|
13856 | 3840 |
currentDirectoryDisplayed |
3841 |
"Return a directory as Filename that is currently displayed in the browser" |
|
3842 |
||
3843 |
^self subclassResponsibility |
|
3844 |
||
3845 |
"Created: / 14-01-2013 / 11:57:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3846 |
! |
|
3847 |
||
3892 | 3848 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3849 |
"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
|
3850 |
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
|
3851 |
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
|
3852 |
|
6589 | 3853 |
^ self aspectFor:#currentFileNameHolder |
3854 |
ifAbsent:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3855 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3856 |
|
4692 | 3857 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3858 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3859 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3860 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3861 |
currentSel asValue |
6589 | 3862 |
] |
3863 |
notPresentDo:[:holder| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3864 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3865 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3866 |
newFilenames := Set new. |
6589 | 3867 |
filenames do:[:eachFilename| |
18805 | 3868 |
|existingFilename count| |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3869 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3870 |
existingFilename notNil ifTrue:[ |
18805 | 3871 |
count := 0. |
3872 |
[existingFilename isRootDirectory or:[existingFilename exists or:[count > 10]]] whileFalse:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3873 |
existingFilename := existingFilename directory. |
18805 | 3874 |
count := count + 1. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3875 |
]. |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3876 |
existingFilename exists ifTrue:[ |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3877 |
newFilenames add:existingFilename. |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3878 |
]. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3879 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3880 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3881 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3882 |
] |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3883 |
|
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3884 |
"Modified: / 27-11-2010 / 15:42:45 / cg" |
18805 | 3885 |
"Modified: / 05-06-2019 / 14:12:48 / Claus Gittinger" |
3892 | 3886 |
! |
3887 |
||
5528 | 3888 |
defaultFileEncoding |
3889 |
^ #'iso8859-1' "/ #'utf-8' |
|
3890 |
! |
|
3891 |
||
3892 | 3892 |
enableDirectoryUp |
3893 |
||
15259 | 3894 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[ValueHolder with:false] |
3892 | 3895 |
! |
3896 |
||
6456 | 3897 |
enableGotoDefaultDirectory |
15259 | 3898 |
^ self aspectFor:#enableGotoDefaultDirectory ifAbsent:[ ValueHolder with:true ]. |
4593 | 3899 |
! |
3900 |
||
8168 | 3901 |
enableGotoDesktop |
14308 | 3902 |
"/ backward compatibility |
3903 |
^ self enableGotoDesktopDirectory. |
|
8168 | 3904 |
! |
3905 |
||
9572 | 3906 |
enableGotoDesktopDirectory |
15259 | 3907 |
^ self aspectFor:#enableGotoDesktopDirectory ifAbsent:[ ValueHolder with:true ]. |
9572 | 3908 |
|
3909 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3910 |
! |
|
3911 |
||
18511 | 3912 |
enableGotoDocumentsDirectory |
3913 |
^ self aspectFor:#enableGotoDocumentsDirectory ifAbsent:[ ValueHolder with:true ]. |
|
3914 |
||
3915 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3916 |
! |
|
3917 |
||
18352 | 3918 |
enableGotoDownloadsDirectory |
3919 |
^ self aspectFor:#enableGotoDownloadsDirectory ifAbsent:[ ValueHolder with:true ]. |
|
3920 |
||
3921 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3922 |
! |
|
3923 |
||
6434 | 3924 |
enableGotoSmalltalkDirectory |
6456 | 3925 |
^ self aspectFor:#enableGotoSmalltalkDirectory ifAbsent:[ true asValue ]. |
6434 | 3926 |
! |
3927 |
||
17187 | 3928 |
enableGotoSmalltalkWorkspaceDirectory |
3929 |
^ self aspectFor:#enableGotoSmalltalkWorkspaceDirectory ifAbsent:[ true asValue ]. |
|
3930 |
! |
|
3931 |
||
9677 | 3932 |
enableGotoTempDirectory |
3933 |
^ self aspectFor:#enableGotoTempDirectory ifAbsent:[ true asValue ]. |
|
3934 |
||
3935 |
"Created: / 29-12-2010 / 11:01:17 / cg" |
|
3936 |
! |
|
3937 |
||
3892 | 3938 |
enableHome |
3939 |
||
3940 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
3941 |
! |
|
3942 |
||
9596 | 3943 |
enableMakeCurrentDirectory |
3944 |
^ self aspectFor:#enableMakeCurrentDirectory ifAbsent:[ true asValue ]. |
|
3945 |
||
3946 |
"Created: / 26-10-2010 / 17:17:58 / cg" |
|
3947 |
! |
|
3948 |
||
3892 | 3949 |
enableViewNoteBookApplication |
3950 |
||
3951 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
3952 |
! |
|
3953 |
||
5528 | 3954 |
fileEncoding |
3955 |
^ self fileEncodingHolder value |
|
3956 |
! |
|
3957 |
||
3958 |
fileEncoding:newEncoding |
|
5533 | 3959 |
self fileEncodingHolder value:newEncoding. |
3960 |
||
3961 |
self |
|
3962 |
applicationNamed:#FileApplicationNoteBook |
|
3963 |
ifPresentDo:[:nb | |
|
3964 |
|appl| |
|
3965 |
||
3966 |
appl := nb selectedApplication. |
|
5535 | 3967 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 3968 |
appl fileEncoding:newEncoding |
3969 |
] |
|
3970 |
]. |
|
5528 | 3971 |
! |
3972 |
||
5737 | 3973 |
fileEncodingHolder |
3974 |
^ self |
|
3975 |
aspectFor:#fileEncodingHolder |
|
3976 |
ifAbsent:[ |
|
3977 |
self |
|
3978 |
applicationNamed:#FileApplicationNoteBook |
|
3979 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
3980 |
] |
|
3981 |
! |
|
3982 |
||
17485 | 3983 |
fileEntryFieldHolder |
3984 |
^ self subclassResponsibility. |
|
3985 |
||
3986 |
"Created: / 31-03-2017 / 11:36:49 / stefan" |
|
3987 |
! |
|
3988 |
||
5961 | 3989 |
firstSelectedFileName |
3990 |
|files| |
|
3991 |
||
7560 | 3992 |
files := self currentSelectedObjects. |
5961 | 3993 |
files notEmpty ifTrue:[ |
3994 |
^ files first |
|
3995 |
]. |
|
3996 |
^ nil |
|
7560 | 3997 |
|
3998 |
"Modified: / 04-12-2006 / 13:14:53 / cg" |
|
5961 | 3999 |
! |
4000 |
||
6456 | 4001 |
gotoDefaultDirectoryIsVisible |
9596 | 4002 |
^ true. |
4003 |
"/ ^ (Filename defaultDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
4004 |
||
4005 |
"Modified: / 26-10-2010 / 17:23:51 / cg" |
|
6456 | 4006 |
! |
4007 |
||
9572 | 4008 |
gotoDesktopDirectoryIsVisible |
4009 |
Filename desktopDirectory = Filename homeDirectory ifTrue:[^ false]. |
|
4010 |
||
4011 |
^ (Filename desktopDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
4012 |
||
4013 |
"Created: / 01-10-2010 / 16:26:27 / cg" |
|
4014 |
! |
|
4015 |
||
18834 | 4016 |
hasFileOrCypressPackageSelection |
4017 |
^ self aspectFor:#hasFileOrCypressPackageSelection ifAbsentPut:[ false asValue ]. |
|
4018 |
||
4019 |
"Created: / 23-06-2019 / 13:05:51 / Claus Gittinger" |
|
4020 |
! |
|
4021 |
||
4618 | 4022 |
hasFileSelection |
4023 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
4024 |
! |
|
4025 |
||
9490 | 4026 |
hasNotTwoDirectoriesSelectedHolder |
4027 |
^ self |
|
4028 |
aspectFor:#hasNotTwoDirectoriesSelectedHolder |
|
4029 |
ifAbsent:[ |
|
4030 |
BlockValue |
|
4031 |
with:[:m | self hasTwoDirectoriesSelected not] |
|
4032 |
argument:self currentFileNameHolder |
|
4033 |
]. |
|
4034 |
||
4035 |
"Created: / 20-05-2010 / 10:45:50 / cg" |
|
4036 |
! |
|
4037 |
||
5830 | 4038 |
hasNotTwoFilesSelectedHolder |
9490 | 4039 |
^ self |
4040 |
aspectFor:#hasNotTwoFilesSelectedHolder |
|
5830 | 4041 |
ifAbsent:[ |
4042 |
BlockValue |
|
4043 |
with:[:m | self hasTwoFilesSelected not] |
|
4044 |
argument:self currentFileNameHolder |
|
4045 |
]. |
|
9490 | 4046 |
|
4047 |
"Modified: / 20-05-2010 / 10:46:01 / cg" |
|
5830 | 4048 |
! |
4049 |
||
3892 | 4050 |
hasSelection |
17923 | 4051 |
"aspect holding true, if a file is selected" |
3892 | 4052 |
|
4053 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
4054 |
! |
|
4055 |
||
9490 | 4056 |
hasTwoDirectoriesSelectedHolder |
4057 |
^ self |
|
4058 |
aspectFor:#hasTwoDirectoriesSelectedHolder |
|
4059 |
ifAbsent:[ |
|
4060 |
BlockValue |
|
4061 |
with:[:m | self hasTwoDirectoriesSelected] |
|
4062 |
argument:self currentFileNameHolder |
|
4063 |
]. |
|
4064 |
||
4065 |
"Created: / 20-05-2010 / 10:45:41 / cg" |
|
4066 |
! |
|
4067 |
||
4414 | 4068 |
hasTwoFilesSelectedHolder |
9490 | 4069 |
^ self |
4070 |
aspectFor:#hasTwoFilesSelectedHolder |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4071 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4072 |
BlockValue |
5830 | 4073 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4074 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4075 |
]. |
9490 | 4076 |
|
4077 |
"Modified: / 20-05-2010 / 10:46:08 / cg" |
|
4414 | 4078 |
! |
4079 |
||
11053 | 4080 |
inputTabColumnConversion |
4081 |
^ self inputTabColumnConversionHolder value |
|
4082 |
||
4083 |
"Created: / 06-01-2012 / 15:25:56 / cg" |
|
4084 |
! |
|
4085 |
||
4086 |
inputTabColumnConversionHolder |
|
4087 |
^ self |
|
4088 |
aspectFor:#inputTabColumnConversionHolder |
|
4089 |
ifAbsent:[ |
|
4090 |
self |
|
4091 |
applicationNamed:#FileApplicationNoteBook |
|
4092 |
ifPresentDo:[:appl | appl inputTabColumnConversionHolder]. |
|
4093 |
] |
|
4094 |
||
4095 |
"Created: / 06-01-2012 / 15:26:16 / cg" |
|
4096 |
! |
|
4097 |
||
4098 |
lineEndConvention |
|
15208 | 4099 |
^ self lineEndConventionHolder value asSymbol |
11053 | 4100 |
|
4101 |
"Created: / 06-01-2012 / 13:05:14 / cg" |
|
4102 |
! |
|
4103 |
||
11591 | 4104 |
lineEndConvention: aSymbol |
18525 | 4105 |
self lineEndConventionHolder value:(aSymbol ifNotNil:[aSymbol asSymbol]) |
11591 | 4106 |
|
4107 |
"Created: / 11-07-2012 / 19:51:58 / cg" |
|
18525 | 4108 |
"Modified: / 13-11-2018 / 11:13:41 / Stefan Vogel" |
11591 | 4109 |
! |
4110 |
||
11053 | 4111 |
lineEndConventionHolder |
4112 |
^ self |
|
4113 |
aspectFor:#lineEndConventionHolder |
|
4114 |
ifAbsent:[ |
|
4115 |
self |
|
4116 |
applicationNamed:#FileApplicationNoteBook |
|
4117 |
ifPresentDo:[:appl | appl lineEndConventionHolder]. |
|
4118 |
] |
|
4119 |
||
4120 |
"Created: / 06-01-2012 / 13:02:51 / cg" |
|
4121 |
! |
|
4122 |
||
5737 | 4123 |
lockFileEncoding:aBoolean |
4124 |
self lockFileEncodingHolder value:aBoolean. |
|
4125 |
||
4126 |
self |
|
4127 |
applicationNamed:#FileApplicationNoteBook |
|
4128 |
ifPresentDo:[:nb | |
|
4129 |
|appl| |
|
4130 |
||
4131 |
appl := nb selectedApplication. |
|
4132 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
4133 |
appl lockFileEncoding:aBoolean |
|
4134 |
] |
|
4135 |
]. |
|
4136 |
! |
|
4137 |
||
4138 |
lockFileEncodingHolder |
|
4139 |
^ self |
|
4140 |
aspectFor:#lockFileEncodingHolder |
|
4141 |
ifAbsent:[ |
|
4142 |
self |
|
4143 |
applicationNamed:#FileApplicationNoteBook |
|
4144 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
4145 |
] |
|
4146 |
! |
|
4147 |
||
13856 | 4148 |
makeCommandHolder |
4149 |
^ self aspectFor:#makeCommandHolder ifAbsent:[ nil asValue ]. |
|
4150 |
||
4151 |
"Created: / 13-04-2012 / 17:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4152 |
! |
|
4153 |
||
4523 | 4154 |
notify:aString |
11108 | 4155 |
"aString is shown in the lower pane" |
4156 |
||
4523 | 4157 |
self notifyChannel value:aString |
11108 | 4158 |
|
4159 |
"Modified (comment): / 11-01-2012 / 21:46:55 / cg" |
|
4523 | 4160 |
! |
4161 |
||
3892 | 4162 |
notifyChannel |
4163 |
||
4164 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 4165 |
! |
4166 |
||
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4167 |
progressPercentageHolder |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4168 |
^ self aspectFor:#progressPercentageHolder ifAbsent:[ nil asValue ]. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4169 |
|
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4170 |
"Created: / 11-10-2010 / 12:54:46 / cg" |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4171 |
! |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4172 |
|
4071 | 4173 |
rootHolder |
4174 |
"holder, which keeps the rootHolder of the treeView |
|
4175 |
" |
|
4176 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4177 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4178 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4179 |
]. |
8192
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4180 |
! |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4181 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4182 |
rootHolder:aHolder |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4183 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4184 |
self aspectFor:#rootHolder put:aHolder |
3892 | 4185 |
! ! |
4186 |
||
4187 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
4188 |
||
4189 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 4190 |
"returns the model for an aspect; these are stored in a common dictionary" |
4191 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4192 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 4193 |
! |
4194 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4195 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 4196 |
"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
|
4197 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4198 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4199 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4200 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4201 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4202 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4203 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4204 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4205 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4206 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4207 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4208 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4209 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4210 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4211 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4212 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4213 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4214 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4215 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4216 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4217 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4218 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4219 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4220 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4221 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4222 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4223 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4224 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4225 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4226 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4227 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4228 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4229 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4230 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4231 |
|
18834 | 4232 |
aspectFor:something ifAbsentPut:aBlock |
4233 |
"returns the model for an aspect; these are stored in a common dictionary" |
|
4234 |
||
4235 |
^ self aspectFor:something ifAbsent:[|v| v := aBlock value. self aspectFor:something put:v. v] |
|
4236 |
||
4237 |
"Created: / 23-06-2019 / 13:05:37 / Claus Gittinger" |
|
4238 |
! |
|
4239 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4240 |
aspectFor:something put:aValueHolder |
6284 | 4241 |
"stores the model for an aspect; these are stored in a common dictionary" |
4242 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4243 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4244 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4245 |
|
3892 | 4246 |
aspects |
6284 | 4247 |
"returns the common aspect dictionary" |
4248 |
||
3892 | 4249 |
^ aspects |
4250 |
! |
|
4251 |
||
4252 |
runtimeAspectValueFor:something |
|
4253 |
"returns the default aspect item from the class variable RuntimeAspects |
|
4254 |
" |
|
4255 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
4256 |
! |
|
4257 |
||
4201 | 4258 |
saveAspectValues |
16306 | 4259 |
|prefs saveAspects aspectValue| |
4260 |
||
4261 |
prefs := UserPreferences current. |
|
4262 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4263 |
saveAspects := self class userPreferencesAspectList keys. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4264 |
saveAspects do:[ :aspectKey | |
4201 | 4265 |
aspectValue := (self perform:aspectKey) value. |
16306 | 4266 |
prefs |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4267 |
at: ('fileBrowser_',aspectKey asString) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4268 |
put: aspectValue. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4269 |
]. |
16306 | 4270 |
prefs beModified. |
4271 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4272 |
"Modified: / 04-09-2006 / 10:02:41 / cg" |
4201 | 4273 |
! |
4274 |
||
3892 | 4275 |
saveRuntimeAspectValues |
4276 |
|savedAspects dictionary value isHolder aspect| |
|
4277 |
||
5941 | 4278 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 4279 |
dictionary := Dictionary new. |
5941 | 4280 |
savedAspects do:[:aspectKey | |
4414 | 4281 |
aspect := self perform:aspectKey. |
4282 |
isHolder := aspect isValueModel. |
|
5941 | 4283 |
isHolder ifTrue:[ |
4284 |
value := aspect value |
|
4285 |
] ifFalse:[ |
|
4286 |
value := aspect |
|
4287 |
]. |
|
4288 |
dictionary at:aspectKey |
|
4289 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
4290 |
]. |
|
4291 |
RuntimeAspects := dictionary. |
|
3892 | 4292 |
! |
4293 |
||
4201 | 4294 |
userPreferencesAspectValueFor:something |
4295 |
"returns the default aspect from the Userpreferences |
|
3892 | 4296 |
" |
4201 | 4297 |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4298 |
(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
|
4299 |
^ UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4300 |
at:('fileBrowser_',something) asSymbol |
9579
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4301 |
ifAbsent:nil "(self class userPreferencesAspectList at:something)". |
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4302 |
|
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4303 |
"Modified: / 14-10-2010 / 19:16:38 / cg" |
3892 | 4304 |
! ! |
4305 |
||
4011 | 4306 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
4307 |
||
9015 | 4308 |
filter:aString |
4309 |
self filterModel value:aString |
|
4310 |
! |
|
4311 |
||
4018 | 4312 |
filterBackgroundColor |
4313 |
||
4314 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
4315 |
! |
|
4316 |
||
4011 | 4317 |
filterBlockHolder |
4318 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4319 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 4320 |
! |
4321 |
||
4322 |
filterListModel |
|
4323 |
||
4324 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
4325 |
! |
|
4326 |
||
4327 |
filterModel |
|
5941 | 4328 |
|m| |
4329 |
||
4330 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
4331 |
^ m |
|
4011 | 4332 |
! |
4333 |
||
8185
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4334 |
filterModel:aHolder |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4335 |
self aspectFor:#filterModel put:aHolder. |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4336 |
! |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4337 |
|
4018 | 4338 |
filterValueBox |
4339 |
||
4340 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
4341 |
! |
|
4342 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4343 |
makeFilterBlock |
14497 | 4344 |
"return a two-arg filterblock on the file's path- and base-name. This block should return true for files |
9102 | 4345 |
to be shown" |
4346 |
||
17481 | 4347 |
| filterString filterStrings filters notFilters showHidden filterBlock caseSensitive| |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4348 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4349 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4350 |
filterString = '' ifTrue:[filterString := '*']. |
17481 | 4351 |
caseSensitive := "ignoreCaseInPattern ?" Filename isCaseSensitive. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4352 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4353 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
12760 | 4354 |
filterStrings := filterStrings |
4355 |
select:[:eachFilter | eachFilter withoutSeparators notEmpty]. |
|
4356 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4357 |
filters := filterStrings |
12760 | 4358 |
reject:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
4359 |
thenCollect: |
|
4360 |
[:eachPattern | |
|
4361 |
|pattern| |
|
4362 |
||
4363 |
pattern := eachPattern withoutSeparators. |
|
15597 | 4364 |
pattern includesMatchCharacters ifFalse:[ |
4365 |
"JV@2012-03-05: Add implict star at the beginning and at the end of pattern, |
|
4366 |
that's how most of the other applications behave - do what most users expect" |
|
17772 | 4367 |
"/ pattern first == $* ifFalse:[pattern := '*' , pattern]. |
4368 |
"/ pattern last == $* ifFalse:[pattern := pattern , '*']. |
|
4369 |
[:name :baseName | baseName asLowercase includesString:pattern caseSensitive:caseSensitive] |
|
4370 |
] ifTrue:[ |
|
4371 |
pattern = '*' ifTrue:[ |
|
4372 |
[:name :baseName | true]. |
|
4373 |
] ifFalse:[ |
|
4374 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
|
4375 |
]. |
|
15597 | 4376 |
]. |
12760 | 4377 |
]. |
4378 |
||
4379 |
notFilters := filterStrings |
|
4380 |
select:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
|
4381 |
thenCollect: |
|
4382 |
[:eachPattern | |
|
9296 | 4383 |
|pattern| |
4384 |
||
4385 |
pattern := eachPattern withoutSeparators. |
|
12760 | 4386 |
pattern := (pattern copyFrom:2) withoutSeparators. |
17481 | 4387 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
9296 | 4388 |
]. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4389 |
|
12760 | 4390 |
|
4391 |
(filters size == 1 and:[notFilters isEmpty]) ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4392 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4393 |
] ifFalse:[ |
12760 | 4394 |
filters isEmpty ifTrue:[ |
4395 |
filterBlock := [:name :baseName | |
|
4396 |
(notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not |
|
4397 |
]. |
|
4398 |
] ifFalse:[ |
|
4399 |
notFilters isEmpty ifTrue:[ |
|
4400 |
filterBlock := [:name :baseName | |
|
4401 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4402 |
]. |
|
4403 |
] ifFalse:[ |
|
4404 |
filterBlock := [:name :baseName | |
|
4405 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4406 |
and:[ (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not ] |
|
4407 |
]. |
|
4408 |
] |
|
4409 |
] |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4410 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4411 |
|
4011 | 4412 |
showHidden := self showHiddenFiles value. |
4413 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4414 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4415 |
]. |
9296 | 4416 |
^ [:name :baseName | |
4417 |
name isHidden not and:[filterBlock value:name value:baseName]]. |
|
13856 | 4418 |
|
4419 |
"Modified: / 05-02-2012 / 01:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17481 | 4420 |
"Modified: / 27-03-2017 / 12:52:08 / stefan" |
17772 | 4421 |
"Modified: / 20-11-2017 / 22:02:04 / cg" |
4018 | 4422 |
! |
4423 |
||
4424 |
shownFiles |
|
4425 |
||
4426 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 4427 |
! ! |
4428 |
||
14126 | 4429 |
|
3892 | 4430 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
4431 |
||
4432 |
dirHistory |
|
6369 | 4433 |
"obsolete" |
4434 |
^ self directoryHistory |
|
4435 |
! |
|
4436 |
||
4437 |
directoryHistory |
|
3952 | 4438 |
^ self class directoryHistory |
3892 | 4439 |
! |
4440 |
||
4441 |
enableBack |
|
4442 |
||
15259 | 4443 |
^ self aspectFor:#enableBack ifAbsent:[ValueHolder with:false] |
3892 | 4444 |
! |
4445 |
||
4446 |
enableFileHistory |
|
4447 |
||
15259 | 4448 |
^ self aspectFor:#enableFileHistory ifAbsent:[ValueHolder with:false] |
3892 | 4449 |
! |
4450 |
||
4451 |
enableForward |
|
4452 |
||
15259 | 4453 |
^ self aspectFor:#enableForward ifAbsent:[ValueHolder with:false] |
3892 | 4454 |
! |
4455 |
||
4456 |
fileHistory |
|
9820
07b7d7929e3e
variable renamed in: #fileHistory
Stefan Vogel <sv@exept.de>
parents:
9793
diff
changeset
|
4457 |
^ self aspectFor:#fileHistory ifAbsent:[OrderedSet new] |
3892 | 4458 |
! ! |
4459 |
||
4460 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
4461 |
||
4345 | 4462 |
activityVisibilityChannel |
6284 | 4463 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 4464 |
|
15259 | 4465 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ ValueHolder with:false ]. |
4345 | 4466 |
! |
4467 |
||
15111 | 4468 |
alwaysUseSmalltalkTools |
4469 |
" aspect to prevent os tools to be opened on double click" |
|
4470 |
||
15259 | 4471 |
^ self aspectFor:#alwaysUseSmalltalkTools ifAbsent:[ ValueHolder with:true ]. |
15111 | 4472 |
! |
4473 |
||
6602 | 4474 |
changeSetBrowserItemVisible |
18834 | 4475 |
^ self hasFileOrCypressPackageSelection value |
4476 |
or:[Screen current ctrlDown]. |
|
4477 |
||
4478 |
"Modified: / 23-06-2019 / 13:13:53 / Claus Gittinger" |
|
6602 | 4479 |
! |
4480 |
||
11135 | 4481 |
cvsMenusAreShown |
18820 | 4482 |
^ self class cvsMenusAreShown |
4483 |
! |
|
4484 |
||
4485 |
gitMenusAreShown |
|
4486 |
^ self class gitMenusAreShown |
|
4487 |
||
4488 |
"Created: / 10-06-2019 / 15:56:16 / Claus Gittinger" |
|
11135 | 4489 |
! |
4490 |
||
13856 | 4491 |
hgMenusAreShown |
18820 | 4492 |
^ self class hgMenusAreShown |
13856 | 4493 |
! |
4494 |
||
11135 | 4495 |
mercurialMenusAreShown |
18820 | 4496 |
^ self class mercurialMenusAreShown |
11135 | 4497 |
! |
4498 |
||
4110 | 4499 |
openAlwaysInTextEditor |
18274 | 4500 |
"aspect for open every file in TextEditor don't use e.g. HtmlEditor for *.html'" |
4110 | 4501 |
|
15111 | 4502 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
18274 | 4503 |
|
4504 |
"Modified (comment): / 19-07-2018 / 15:28:00 / Stefan Vogel" |
|
4110 | 4505 |
! |
4506 |
||
3892 | 4507 |
openMultipleApplicationsForType |
4508 |
||
4201 | 4509 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
4510 |
open TextEditor " |
|
4511 |
||
3892 | 4512 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
4513 |
! |
|
4514 |
||
11137 | 4515 |
perforceMenusAreShown |
18820 | 4516 |
^ self class perforceMenusAreShown |
11137 | 4517 |
! |
4518 |
||
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
|
4519 |
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
|
4520 |
|
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
|
4521 |
^ 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
|
4522 |
|
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
|
4523 |
"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
|
4524 |
! |
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
|
4525 |
|
4201 | 4526 |
showDirectoryTree |
4527 |
||
4528 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 4529 |
! |
4530 |
||
4554 | 4531 |
showDiskUsageHolder |
4532 |
|holder| |
|
4533 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
4534 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 4535 |
holder addDependent:self. |
4554 | 4536 |
^ holder |
4537 |
! |
|
4538 |
||
3892 | 4539 |
showHiddenFiles |
4540 |
||
9582 | 4541 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
4542 |
||
4543 |
"Modified: / 15-10-2010 / 10:28:17 / cg" |
|
3892 | 4544 |
! |
4545 |
||
9108 | 4546 |
showHiddenFiles:aHolder |
4547 |
self aspectFor:#showHiddenFiles put:aHolder. |
|
4548 |
! |
|
4549 |
||
4550 |
shownFiles:aHolder |
|
4551 |
self aspectFor:#shownFiles put:aHolder. |
|
4552 |
! |
|
4553 |
||
11135 | 4554 |
svnMenusAreShown |
18820 | 4555 |
^ self class svnMenusAreShown |
11135 | 4556 |
! |
4557 |
||
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4558 |
tagsBrowserVisibleHolder |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4559 |
masterApplication notNil ifTrue:[ |
11162
faf8af233ac0
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
11156
diff
changeset
|
4560 |
^ masterApplication perform:#tagsBrowserVisibleHolder ifNotUnderstood:false |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4561 |
]. |
10762
311190be6490
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
10757
diff
changeset
|
4562 |
^ self aspectFor:#tagsBrowserVisibleHolder ifAbsent:[ FileApplicationNoteBook::TextEditor defaultTagsBrowserVisible asValue ]. |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4563 |
|
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4564 |
"Created: / 27-06-2011 / 16:02:59 / cg" |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4565 |
! |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4566 |
|
10757
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4567 |
useCodeView2InTools |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4568 |
^ self aspectFor:#useCodeView2InTools ifAbsent:[ UserPreferences current useCodeView2InTools asValue ]. |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4569 |
|
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4570 |
"Created: / 06-10-2011 / 11:45:58 / cg" |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4571 |
! |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4572 |
|
4648 | 4573 |
userContextAvailable |
4574 |
||
4575 |
" aspect for show group and user columns in contents view |
|
4576 |
windows provides no user context" |
|
4577 |
||
4578 |
^ OperatingSystem isMSWINDOWSlike not |
|
4579 |
! |
|
4580 |
||
3892 | 4581 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4582 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4583 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4584 |
^ self directoryContentsBrowser viewDescription |
3892 | 4585 |
! |
4586 |
||
4587 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4588 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 4589 |
" |
3892 | 4590 |
|
6121 | 4591 |
|directoryContentsBrowser| |
4592 |
||
4593 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
4594 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
4595 |
^ directoryContentsBrowser viewDetails |
|
3892 | 4596 |
! |
4597 |
||
4598 |
viewDirectoryDescription |
|
4599 |
||
4201 | 4600 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
4601 |
on change directory " |
|
4602 |
||
3892 | 4603 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
4604 |
! |
|
4605 |
||
4201 | 4606 |
viewDirsInContentsBrowser |
4607 |
||
4608 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
9319
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4609 |
|
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4610 |
" |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4611 |
UserPreferences current viewDirsInContentsBrowser |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4612 |
" |
4201 | 4613 |
! |
4614 |
||
5870 | 4615 |
viewFilesInContentsBrowser |
4616 |
||
4617 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
4618 |
! |
|
4619 |
||
3892 | 4620 |
viewFilesInDirectoryTree |
4621 |
||
4201 | 4622 |
" aspect for view files in tree view (not only directories) " |
4623 |
||
3892 | 4624 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
4625 |
! |
|
4626 |
||
4627 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4628 |
" aspect for show group information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4629 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4630 |
^ self directoryContentsBrowser viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4631 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4632 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4633 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4634 |
" aspect for show file-type icon in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4635 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4636 |
^ self directoryContentsBrowser viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4637 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4638 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4639 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4640 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4641 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4642 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 4643 |
! |
4644 |
||
4645 |
viewNoteBookApplicationHolder |
|
4646 |
||
4647 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
4648 |
! |
|
4649 |
||
4650 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4651 |
" aspect for show owner information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4652 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4653 |
^ self directoryContentsBrowser viewOwner |
3892 | 4654 |
! |
4655 |
||
4656 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4657 |
" aspect for show permission information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4658 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4659 |
^ self directoryContentsBrowser viewPermissions |
3892 | 4660 |
! |
4661 |
||
4662 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4663 |
" aspect for show image previev in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4664 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4665 |
^ self directoryContentsBrowser viewPreview |
3892 | 4666 |
! |
4667 |
||
4668 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4669 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4670 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4671 |
^ self directoryContentsBrowser viewSize |
3892 | 4672 |
! |
4673 |
||
4974 | 4674 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4675 |
" aspect for show size-in-bytes information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4676 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4677 |
^ self directoryContentsBrowser viewSizeInBytes |
4974 | 4678 |
! |
4679 |
||
5312 | 4680 |
viewSizeInKiloBytes |
4681 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
4682 |
||
4683 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
4684 |
! |
|
4685 |
||
3892 | 4686 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4687 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4688 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4689 |
^ self directoryContentsBrowser viewTime |
3892 | 4690 |
! |
4691 |
||
4692 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4693 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4694 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4695 |
^ self directoryContentsBrowser viewType |
3892 | 4696 |
! ! |
4697 |
||
4698 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
4699 |
||
4700 |
executeCommand:cmd |
|
4701 |
||
4702 |
self executeCommand:cmd inDirectory:nil |
|
4703 |
! |
|
4704 |
||
5880 | 4705 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 4706 |
| nameString executionBlock| |
4707 |
||
5880 | 4708 |
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
|
4709 |
nameString := 'Execute: ', cmd. |
3892 | 4710 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4711 |
! |
|
4712 |
||
4713 |
getExecutionBlockForCommand:cmd |
|
4714 |
||
4715 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
4716 |
! |
|
4717 |
||
5880 | 4718 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
4719 |
| dir| |
|
4720 |
||
4721 |
dir := directoryOrNil. |
|
4722 |
directoryOrNil isNil ifTrue:[ |
|
4723 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6671 | 4724 |
dir isNil ifTrue:[ |
12493 | 4725 |
Dialog warn:(resources string:'Please select a single directory.'). |
16732 | 4726 |
AbortOperationRequest raise. |
6671 | 4727 |
^ nil |
4728 |
]. |
|
3892 | 4729 |
]. |
4523 | 4730 |
|
4731 |
^ [:stream| |
|
4732 |
stream notNil ifTrue:[ |
|
4414 | 4733 |
OperatingSystem |
4734 |
executeCommand:cmd |
|
4735 |
inputFrom:nil |
|
4736 |
outputTo:stream |
|
4737 |
errorTo:stream |
|
4738 |
inDirectory:dir |
|
16732 | 4739 |
lineWise:true |
16825 | 4740 |
showWindow:false |
4414 | 4741 |
onError:[:status| false]. |
4742 |
] |
|
4523 | 4743 |
]. |
3892 | 4744 |
! |
4745 |
||
4746 |
killAllRunningBackgroundProcesses |
|
4747 |
||
4748 |
self backgroundProcesses do:[ : process | |
|
4523 | 4749 |
self notify:'kill ', process name. |
4414 | 4750 |
process terminate. |
3892 | 4751 |
]. |
4752 |
! |
|
4753 |
||
4754 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
4755 |
| stream process appl nameString| |
|
4756 |
||
4757 |
appl := self openCommandResultApplication. |
|
4758 |
stream := appl resultStream. |
|
4759 |
nameString := aString ? 'Execution Result'. |
|
4760 |
appl changeTabTo:nameString. |
|
4523 | 4761 |
|
16102 | 4762 |
process := |
4763 |
[ |
|
4764 |
[aBlock value:stream] |
|
4765 |
ensure:[ |
|
4766 |
self backgroundProcesses remove:process ifAbsent:[]. |
|
4767 |
appl process value:nil. |
|
4768 |
||
4769 |
"/ close automatically, if there was no output. |
|
4571 | 4770 |
"/ appl resultStream contents isEmpty ifTrue:[ |
4771 |
"/ appl doClose. |
|
4772 |
"/ ] |
|
16102 | 4773 |
stream nextPutLine:'Done.'. |
4774 |
self enqueueMessage:#updateCurrentDirectory. |
|
4775 |
] |
|
4776 |
] newProcess. |
|
3892 | 4777 |
process priority:(Processor userBackgroundPriority). |
4778 |
process name:nameString. |
|
4779 |
self backgroundProcesses add:process. |
|
4780 |
appl process value:process. |
|
4781 |
process resume. |
|
4782 |
! ! |
|
4783 |
||
4784 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
4785 |
||
4915 | 4786 |
currentFileNameHolderChanged |
4787 |
"/ self currentFileNameHolderChangedForCommon |
|
4788 |
! |
|
4789 |
||
4577 | 4790 |
currentFileNameHolderChangedForCommon |
18389 | 4791 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty dir| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4792 |
|
7560 | 4793 |
selection := self currentSelectedObjects. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4794 |
self class currentSelection:selection. |
4734 | 4795 |
|
13521 | 4796 |
selectionNotEmpty := selection notEmptyOrNil. |
5476 | 4797 |
self hasSelection value:selectionNotEmpty. |
4798 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
18840 | 4799 |
self hasFileOrCypressPackageSelection |
4800 |
value:(selection contains:[:sel | |
|
4801 |
sel isDirectory |
|
4802 |
and:[(sel hasSuffix:'package') or:[sel hasSuffix:'class']] |
|
4803 |
]). |
|
18246 | 4804 |
self canOpenChangeBrowser value:(selectionNotEmpty). |
4734 | 4805 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4806 |
newDirectories := self directoriesForFiles:selection. |
19009 | 4807 |
newDirectories := newDirectories select:[:fn | fn exists]. |
4808 |
||
6725 | 4809 |
oldDirectories := self currentSelectedDirectories. |
4011 | 4810 |
oldDirectories ~= newDirectories ifTrue:[ |
4347 | 4811 |
self currentDirectories value:newDirectories. |
4812 |
size := newDirectories size. |
|
4774 | 4813 |
rootInTreeView := self |
4814 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 4815 |
ifPresentDo:[:appl | appl rootHolder]. |
4816 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
4817 |
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
|
4818 |
|
4347 | 4819 |
newDirectories notEmpty ifTrue:[ |
6369 | 4820 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 4821 |
]. |
18389 | 4822 |
(dir := Filename homeDirectory) notNil ifTrue:[ |
4823 |
self enableHome value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4824 |
]. |
|
14308 | 4825 |
"/ self enableGotoDesktop value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
18389 | 4826 |
(dir := Filename defaultDirectory) notNil ifTrue:[ |
4827 |
self enableGotoDefaultDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4828 |
]. |
|
4829 |
(dir := self smalltalkDirectory) notNil ifTrue:[ |
|
4830 |
self enableGotoSmalltalkDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4831 |
]. |
|
4832 |
(dir := Filename desktopDirectory) notNil ifTrue:[ |
|
4833 |
self enableGotoDesktopDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4834 |
]. |
|
4835 |
(dir := Filename downloadsDirectory) notNil ifTrue:[ |
|
4836 |
self enableGotoDownloadsDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4837 |
]. |
|
18511 | 4838 |
(dir := Filename documentsDirectory) notNil ifTrue:[ |
4839 |
self enableGotoDocumentsDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4840 |
]. |
|
18389 | 4841 |
(dir := self tempDirectory) notNil ifTrue:[ |
4842 |
self enableGotoTempDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4843 |
]. |
|
4011 | 4844 |
]. |
9599
6ffff091db22
changed: #currentFileNameHolderChangedForCommon
Claus Gittinger <cg@exept.de>
parents:
9596
diff
changeset
|
4845 |
self enableGotoDefaultDirectory value:(self currentDirectory isNil or:[self currentDirectory pathName ~= OperatingSystem getCurrentDirectory]). |
9596 | 4846 |
self enableMakeCurrentDirectory value:(newDirectories size == 1 |
4847 |
and:[ newDirectories first asFilename pathName ~= OperatingSystem getCurrentDirectory ]). |
|
4022 | 4848 |
self enableForward value:self canForward. |
4734 | 4849 |
self enableBack value:self canBackward. |
6095 | 4850 |
|
13856 | 4851 |
self updateCanMake. |
7560 | 4852 |
|
9677 | 4853 |
"Modified: / 29-12-2010 / 11:01:52 / cg" |
13856 | 4854 |
"Modified: / 17-12-2013 / 08:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18840 | 4855 |
"Modified: / 23-06-2019 / 21:42:40 / Claus Gittinger" |
4011 | 4856 |
! |
4857 |
||
4858 |
filterModelChanged |
|
4859 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4860 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 4861 |
! |
4862 |
||
3892 | 4863 |
update:something with:aParameter from:changedObject |
4864 |
||
4865 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
4866 |
and the things that have to be done if it runs standalone " |
|
4867 |
||
4868 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 4869 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4870 |
^ self |
3892 | 4871 |
]. |
3989 | 4872 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4873 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4874 |
^ self |
3989 | 4875 |
]. |
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4876 |
changedObject == self sortBlockProperty ifTrue:[ |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4877 |
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
|
4878 |
^ self |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4879 |
]. |
4011 | 4880 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4881 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4882 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4883 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4884 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4885 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4886 |
^ self |
4004 | 4887 |
]. |
4781 | 4888 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 4889 |
self notify:nil. |
4781 | 4890 |
^ self |
4891 |
]. |
|
3989 | 4892 |
|
3892 | 4893 |
super update:something with:aParameter from:changedObject |
5543 | 4894 |
! |
4895 |
||
6095 | 4896 |
updateCanMake |
4897 |
|dir can| |
|
4898 |
||
4899 |
can := false. |
|
4900 |
dir := self currentDirectory. |
|
4901 |
dir notNil ifTrue:[ |
|
13856 | 4902 |
"/ Check for make |
6095 | 4903 |
can := (dir asFilename construct:'Makefile') exists. |
13856 | 4904 |
can ifFalse:[ |
4905 |
can := (dir asFilename construct:'makefile') exists. |
|
4906 |
]. |
|
6095 | 4907 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
4908 |
can ifFalse:[ |
|
13856 | 4909 |
can := (self currentDirectory asFilename construct:'bc.mak') exists. |
6095 | 4910 |
] |
4911 |
]. |
|
13856 | 4912 |
can ifTrue:[ |
4913 |
self makeCommandHolder value: 'make'. |
|
4914 |
self canMake value: true. |
|
4915 |
^ self |
|
4916 |
]. |
|
4917 |
||
4918 |
"/Check for Apache ant |
|
4919 |
(OperatingSystem canExecuteCommand: 'ant') ifTrue:[ |
|
4920 |
can := (dir asFilename construct:'build.xml') exists. |
|
4921 |
can ifTrue:[ |
|
4922 |
self makeCommandHolder value: 'ant'. |
|
4923 |
self canMake value: true. |
|
4924 |
^ self |
|
4925 |
]. |
|
4926 |
]. |
|
4927 |
||
4928 |
"/Add more here... |
|
4929 |
||
6095 | 4930 |
]. |
4931 |
self canMake value:can. |
|
13856 | 4932 |
|
4933 |
"Modified: / 17-12-2013 / 08:13:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6095 | 4934 |
! |
4935 |
||
5543 | 4936 |
updateListAfterDelete:colOfFiles |
17871 | 4937 |
self updateCurrentDirectoryWithReread |
3892 | 4938 |
! ! |
4939 |
||
4940 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
4941 |
||
4942 |
canPaste |
|
4943 |
||
15259 | 4944 |
^ self aspectFor:#canPaste ifAbsent:[ ValueHolder with:false ]. |
3892 | 4945 |
! |
4946 |
||
4947 |
clipboard |
|
4948 |
||
4949 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
4950 |
! |
|
4951 |
||
4952 |
copyFilesToClipBoard:colOfFiles |
|
4953 |
self putInClipBoard:colOfFiles as:#copy. |
|
4954 |
! |
|
4955 |
||
4956 |
cutFilesToClipBoard:colOfFiles |
|
4957 |
"defete current selected files/directories |
|
4958 |
" |
|
4959 |
self putInClipBoard:colOfFiles as:#cut. |
|
4960 |
! |
|
4961 |
||
4962 |
emptyClipBoard |
|
4963 |
||
4964 |
self clipboard files:nil. |
|
4965 |
self canPaste value:false. |
|
4966 |
! |
|
4967 |
||
4968 |
putInClipBoard:colOfFiles as:aSymbol |
|
4969 |
| stream clp| |
|
4970 |
||
4971 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
4972 |
clp := self clipboard. |
|
4973 |
clp files:nil. |
|
4974 |
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
|
4975 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
4976 |
stream := String writeStream. |
3892 | 4977 |
stream nextPutAll:aSymbol asString. |
4978 |
stream nextPutAll:' <'. |
|
4979 |
stream nextPutAll:colOfFiles first asString. |
|
4980 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 4981 |
stream nextPutAll:' ...'. |
3892 | 4982 |
]. |
4983 |
stream nextPutAll:'> to clipboard'. |
|
4984 |
||
4523 | 4985 |
self notify:stream contents. |
3892 | 4986 |
clp files:colOfFiles. |
4987 |
self canPaste value:true. |
|
4988 |
! ! |
|
4989 |
||
4990 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
4991 |
||
4992 |
canDropFiles:dropedObjects for:filename |
|
6284 | 4993 |
|filenameDirString filenameDir| |
3892 | 4994 |
|
4995 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 4996 |
|
19009 | 4997 |
filenameDir := self class getDirectoryOf:filename. |
7491 | 4998 |
filenameDir isNil ifTrue:[^ false ]. |
13232 | 4999 |
filenameDir isWritableDirectory ifFalse:[^ false]. |
6284 | 5000 |
|
3892 | 5001 |
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
|
5002 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
5003 |
dropedObjects do:[:aDropObject | |
6284 | 5004 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
5005 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
5006 |
"/ |
|
5007 |
"/ dropFileName := aDropObject theObject. |
|
5008 |
"/ dropFileNameString := dropFileName asString. |
|
5009 |
"/ dropFileName isDirectory ifTrue:[ |
|
5010 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
5011 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
5012 |
"/ ^ false |
|
5013 |
"/ ] |
|
5014 |
"/ ] ifFalse:[ |
|
5015 |
"/ physicalPathName := dropFileName physicalPathName. |
|
5016 |
"/ (filenameDirString = dropFileName directory asString |
|
5017 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
5018 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
5019 |
"/ self notify:'Cannot drop a file into same directory'. |
|
5020 |
"/ ^ false |
|
5021 |
"/ ] |
|
5022 |
"/ ] |
|
5023 |
]. |
|
5024 |
self notify:nil. |
|
5025 |
^ true |
|
5026 |
! |
|
5027 |
||
5028 |
canDropObject:aDropObject into:aDirectory |
|
5029 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
5030 |
||
5031 |
dropFileName := aDropObject theObject. |
|
5032 |
dropFileNameString := dropFileName asString. |
|
5033 |
dropFileName isDirectory ifTrue:[ |
|
5034 |
filenameDirString := aDirectory asString. |
|
5035 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
5036 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
5037 |
^ false |
|
4414 | 5038 |
] |
6284 | 5039 |
] ifFalse:[ |
5040 |
physicalPathName := dropFileName physicalPathName. |
|
5041 |
(aDirectory = dropFileName directory |
|
5042 |
or:[ aDropObject isFileInArchive not |
|
5043 |
and:[physicalPathName notNil |
|
5044 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
5045 |
self notify:'Cannot drop a file into same directory'. |
|
5046 |
^ false |
|
5047 |
] |
|
5048 |
]. |
|
5049 |
^ true. |
|
3892 | 5050 |
! |
5051 |
||
7406 | 5052 |
canDropObjects:aCollectionOfDropObjects in:aWidget |
17865 | 5053 |
^ aCollectionOfDropObjects contains:#isFileObject |
7406 | 5054 |
|
5055 |
"Created: / 13-10-2006 / 15:52:49 / cg" |
|
5056 |
! |
|
5057 |
||
17202 | 5058 |
doStartDrag:arg1 in:arg2 |
5059 |
^ self class doStartDrag:arg1 in:arg2 |
|
6479 | 5060 |
! |
5061 |
||
7408 | 5062 |
dropObjects:aCollectionOfDropObjects in:aWidget at:position |
7990 | 5063 |
|fileEntryFieldHolder destDir dropObject fn d| |
5064 |
||
5065 |
fileEntryFieldHolder := self masterApplication notNil |
|
5066 |
ifTrue:[ self masterApplication fileEntryFieldHolder ] |
|
5067 |
ifFalse:[ self fileEntryFieldHolder ]. |
|
5068 |
||
5069 |
aWidget model == fileEntryFieldHolder ifTrue:[ |
|
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5070 |
dropObject := aCollectionOfDropObjects first. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5071 |
dropObject isFileObject ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5072 |
fn := dropObject theObject asFilename. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5073 |
dropObject isDirectory ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5074 |
d := fn. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5075 |
] ifFalse:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5076 |
d := fn directory. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5077 |
]. |
7990 | 5078 |
fileEntryFieldHolder value:d pathName. |
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5079 |
]. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5080 |
^ self. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5081 |
]. |
6479 | 5082 |
|
5083 |
destDir := self currentDirectory. |
|
5084 |
destDir isNil ifTrue:[^ self]. |
|
5085 |
||
8601 | 5086 |
self withWaitCursorDo:[ |
5087 |
aCollectionOfDropObjects do:[:dropObject | |
|
5088 |
|fn| |
|
5089 |
||
5090 |
dropObject isFileObject ifTrue:[ |
|
5091 |
fn := dropObject theObject asFilename. |
|
5092 |
dropObject isDirectory ifTrue:[ |
|
8808
cb6476c0cd3a
oops - drop of directories was broken
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
5093 |
fn recursiveCopyTo:destDir |
8601 | 5094 |
] ifFalse:[ |
8950
48c69259d82d
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
8887
diff
changeset
|
5095 |
fn copyTo:(destDir / fn baseName ) |
8601 | 5096 |
] |
6479 | 5097 |
] |
8601 | 5098 |
]. |
5099 |
]. |
|
9268
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5100 |
self directoryContentsBrowser notNil ifTrue:[ |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5101 |
self directoryContentsBrowser |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5102 |
directoryContentsChangeFlag:true; |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5103 |
wakeUp |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5104 |
]. |
7408 | 5105 |
|
5106 |
"Created: / 13-10-2006 / 18:26:41 / cg" |
|
3892 | 5107 |
! ! |
5108 |
||
5109 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
5110 |
||
5111 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 5112 |
"copy to" |
5113 |
||
7635 | 5114 |
^ self copyFile:aSourceFile to:aDestFile repairCorruptedFiles:false |
5115 |
||
5116 |
"Modified: / 07-02-2007 / 18:46:44 / cg" |
|
5117 |
! |
|
5118 |
||
5119 |
copyFile:aSourceFile to:aDestFile repairCorruptedFiles:repairCorruptedFiles |
|
5120 |
"copy to" |
|
5121 |
||
5122 |
|copyOperation msg| |
|
5123 |
||
5124 |
repairCorruptedFiles ifTrue:[ |
|
5125 |
copyOperation := FileOperation copyCorruptedFile:aSourceFile to:aDestFile |
|
5126 |
] ifFalse:[ |
|
5127 |
copyOperation := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
|
5128 |
]. |
|
5129 |
copyOperation result ifTrue:[ |
|
6190 | 5130 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 5131 |
] ifFalse:[ |
7635 | 5132 |
msg := copyOperation errorString. |
6190 | 5133 |
]. |
5134 |
self notify:msg. |
|
7635 | 5135 |
^ copyOperation result |
5136 |
||
5137 |
"Created: / 07-02-2007 / 18:46:34 / cg" |
|
3892 | 5138 |
! |
5139 |
||
5140 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
6374 | 5141 |
|copy result| |
3892 | 5142 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5143 |
self withActivityIndicationDo:[ |
5961 | 5144 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
6374 | 5145 |
copy result ifTrue:[ |
5146 |
result := Dictionary withKeys:(copy collectionOfCopiedFiles) andValues:(copy collectionOfNewFiles). |
|
5147 |
] ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5148 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5149 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5150 |
self updateCurrentDirectory. |
3892 | 5151 |
]. |
6374 | 5152 |
^ result |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5153 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5154 |
"Modified: / 25-07-2006 / 09:07:04 / cg" |
3892 | 5155 |
! |
5156 |
||
15569 | 5157 |
copyFromToRepairingCorruptedFiles |
5158 |
"ask for source and destination and copy the entered file. |
|
5159 |
Especially useful for raw devices to copy corrupted disks/files |
|
5160 |
" |
|
5161 |
||
5162 |
|source destination| |
|
5163 |
||
5164 |
source := Dialog |
|
5165 |
requestDirectoryName:(resources string:'Copy from:') |
|
5166 |
default:(LastMoveDestination ? self currentDirectory) |
|
5167 |
ok:(resources string:'Continue') |
|
5168 |
abort:nil. |
|
5169 |
||
5170 |
source isEmptyOrNil ifTrue:[^ self]. |
|
5171 |
source := source asFilename. |
|
5172 |
||
5173 |
destination := Dialog |
|
5174 |
requestDirectoryName:(resources string:'Copy "%1" to:' with:source) |
|
5175 |
default:(LastMoveDestination ? self currentDirectory) |
|
5176 |
ok:(resources string:'Copy') |
|
5177 |
abort:nil. |
|
5178 |
||
5179 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
5180 |
destination := destination asFilename. |
|
5181 |
||
5182 |
self copyFile:source to:destination repairCorruptedFiles:true. |
|
5183 |
! |
|
5184 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5185 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
12850 | 5186 |
|size msg answer file| |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5187 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5188 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5189 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5190 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5191 |
"/ 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
|
5192 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5193 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5194 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5195 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5196 |
"/ 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
|
5197 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5198 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5199 |
"/ 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
|
5200 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5201 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5202 |
"/ 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
|
5203 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5204 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5205 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5206 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5207 |
stringWithCRs:'Copy or move\\%1:\ %2\to:\ %3 ?' |
17762 | 5208 |
with:(resources string: |
5209 |
(file type == #regular |
|
5210 |
ifTrue:'file' |
|
5211 |
ifFalse:[ |
|
5212 |
file isDirectory |
|
5213 |
ifTrue:'directory' |
|
5214 |
ifFalse:'object'])) |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5215 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5216 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5217 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5218 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5219 |
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
|
5220 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5221 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 5222 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5223 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5224 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5225 |
request:msg |
8127 | 5226 |
label:(resources string:'Copy or Move') |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
5227 |
image:(WarningBox iconBitmap) |
8127 | 5228 |
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
|
5229 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5230 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5231 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5232 |
^ answer. |
17762 | 5233 |
|
5234 |
"Modified: / 17-11-2017 / 13:16:42 / cg" |
|
3892 | 5235 |
! |
5236 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5237 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 5238 |
"copy or move aColOfSourceFiles to aDirectory. |
5239 |
Asks the used if a move or a copy is wanted. |
|
5240 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
5241 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5242 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5243 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5244 |
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
|
5245 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5246 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5247 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5248 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5249 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5250 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5251 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5252 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5253 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5254 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5255 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5256 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 5257 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5258 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5259 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5260 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5261 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5262 |
|
4745 | 5263 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5264 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5265 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5266 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5267 |
^ true. |
3892 | 5268 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5269 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5270 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5271 |
^ true. |
3892 | 5272 |
]. |
4745 | 5273 |
^ false. |
3892 | 5274 |
! |
5275 |
||
6107 | 5276 |
copySelectionTo |
5277 |
"copy the selected file(s) to another directory" |
|
5278 |
||
13704 | 5279 |
self copySelectionToRepairingCorruptedFiles:false. |
5280 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5281 |
|
5282 |
"Modified: / 07-02-2007 / 18:42:48 / cg" |
|
5283 |
! |
|
5284 |
||
5285 |
copySelectionToRepairingCorruptedFiles |
|
5286 |
"copy the selected file(s) to another directory" |
|
5287 |
||
13704 | 5288 |
self copySelectionToRepairingCorruptedFiles:true. |
5289 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5290 |
|
5291 |
"Created: / 07-02-2007 / 18:42:59 / cg" |
|
5292 |
! |
|
5293 |
||
5294 |
copySelectionToRepairingCorruptedFiles:repairingCorruptedFiles |
|
5295 |
"copy the selected file(s) to another directory" |
|
5296 |
||
6299 | 5297 |
|selectedFiles msg destination directory| |
5298 |
||
7560 | 5299 |
selectedFiles := self currentSelectedObjects copy. |
6299 | 5300 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
5301 |
||
5302 |
msg := (selectedFiles size > 1) |
|
14588 | 5303 |
ifTrue:[ 'Copy Selected Items to Directory:' ] |
5304 |
ifFalse:[ 'Copy "%1" to Directory:' ]. |
|
6299 | 5305 |
|
5306 |
destination := Dialog |
|
14588 | 5307 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first baseName) |
7635 | 5308 |
default:(LastMoveDestination ? self currentDirectory) |
5309 |
ok:(resources string:'Copy') |
|
5310 |
abort:nil. |
|
5311 |
||
6299 | 5312 |
destination isEmptyOrNil ifTrue:[^ self]. |
5313 |
destination := destination asFilename. |
|
5314 |
||
5315 |
destination isDirectory ifFalse:[ |
|
5316 |
selectedFiles size == 1 ifTrue:[ |
|
5317 |
directory := destination directory. |
|
5318 |
directory isDirectory ifTrue:[ |
|
5319 |
LastMoveDestination := directory. |
|
7635 | 5320 |
self copyFile:selectedFiles first to:destination repairCorruptedFiles:repairingCorruptedFiles. |
6299 | 5321 |
^ self. |
5322 |
] |
|
5323 |
] |
|
5324 |
]. |
|
5325 |
||
5326 |
LastMoveDestination := destination. |
|
7635 | 5327 |
repairingCorruptedFiles ifTrue:[ |
5328 |
selectedFiles do:[:eachFile | |
|
5329 |
self copyFile:eachFile to:destination repairCorruptedFiles:repairingCorruptedFiles. |
|
5330 |
]. |
|
5331 |
^ self. |
|
5332 |
] ifFalse:[ |
|
5333 |
self copyFiles:selectedFiles to:destination |
|
5334 |
] |
|
5335 |
||
5336 |
"Created: / 07-02-2007 / 18:42:35 / cg" |
|
6107 | 5337 |
! |
5338 |
||
3892 | 5339 |
deleteFile:aFile |
6373 | 5340 |
"delete the selected files/directories" |
3892 | 5341 |
|
5342 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
5343 |
! |
|
5344 |
||
5345 |
deleteFiles:colOfFiles |
|
6373 | 5346 |
"delete some files/directories" |
5347 |
||
5081 | 5348 |
^ self deleteFiles:colOfFiles confirm:true. |
5349 |
! |
|
5350 |
||
5351 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 5352 |
"delete some files/directories" |
5353 |
||
5673 | 5354 |
|delete result| |
3892 | 5355 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5356 |
self withActivityIndicationDo:[ |
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5357 |
ProgressNotification handle:[:info | |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5358 |
self progressPercentageHolder value:info progressValue. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5359 |
info proceed |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5360 |
] do:[ |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5361 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5362 |
result := delete result. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5363 |
]. |
5673 | 5364 |
result notNil ifTrue:[ |
5365 |
result ifFalse:[ |
|
5366 |
self notify:delete errorString. |
|
5753 | 5367 |
] ifTrue:[ |
5368 |
self updateListAfterDelete:colOfFiles. |
|
5369 |
] |
|
4394 | 5370 |
]. |
5673 | 5371 |
]. |
5372 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5373 |
|
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5374 |
"Modified: / 11-10-2010 / 13:08:24 / cg" |
3892 | 5375 |
! |
5376 |
||
6169 | 5377 |
eraseFiles:colOfFiles |
6373 | 5378 |
"erase (clear and delete) some files/directories" |
5379 |
||
6169 | 5380 |
^ self eraseFiles:colOfFiles confirm:true. |
5381 |
! |
|
5382 |
||
5383 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 5384 |
"erase (clear and delete) some files/directories" |
5385 |
||
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5386 |
|deleteOperation result fileSize| |
6169 | 5387 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5388 |
self withActivityIndicationDo:[ |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5389 |
fileSize := colOfFiles first asFilename fileSize. |
8294 | 5390 |
deleteOperation := FileOperation eraseFiles:colOfFiles confirm:confirm. |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5391 |
(colOfFiles size == 1 and:[ fileSize < (10*1024*1024) ]) |
8294 | 5392 |
ifTrue:[ |
5393 |
result := deleteOperation result. |
|
5394 |
] ifFalse:[ |
|
5395 |
ProgressIndicator |
|
5396 |
displayProgressNotifications:'Erasing' |
|
5397 |
abortable:true |
|
5398 |
at:nil |
|
5399 |
during:[ |
|
5400 |
result := deleteOperation result. |
|
5401 |
]. |
|
5402 |
]. |
|
5403 |
||
6169 | 5404 |
result notNil ifTrue:[ |
5405 |
result ifFalse:[ |
|
8294 | 5406 |
self notify:deleteOperation errorString. |
6169 | 5407 |
] ifTrue:[ |
5408 |
self updateListAfterDelete:colOfFiles. |
|
5409 |
] |
|
5410 |
]. |
|
5411 |
]. |
|
5412 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5413 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5414 |
"Modified: / 25-07-2006 / 09:07:16 / cg" |
6169 | 5415 |
! |
5416 |
||
3892 | 5417 |
moveFile:aSourceFile to:aDestFile |
6373 | 5418 |
"move a file/directory" |
3892 | 5419 |
|
5420 |
|move| |
|
5421 |
||
5961 | 5422 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 5423 |
move result ifTrue:[ |
15346 | 5424 |
self notify:(resources string: 'move "%1" to "%2"' with:aSourceFile asString with:aDestFile asString). |
3892 | 5425 |
] ifFalse:[ |
4523 | 5426 |
self notify:move errorString. |
3892 | 5427 |
]. |
17871 | 5428 |
self updateCurrentDirectoryWithReread. |
3892 | 5429 |
^ move result |
5430 |
! |
|
5431 |
||
5432 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 5433 |
"move some files to aDirectory" |
5434 |
||
3892 | 5435 |
|move| |
5436 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5437 |
self withActivityIndicationDo:[ |
5961 | 5438 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5439 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5440 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5441 |
]. |
17871 | 5442 |
self updateCurrentDirectoryWithReread. |
3892 | 5443 |
]. |
6373 | 5444 |
^ move collectionOfMovedFiles |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5445 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5446 |
"Modified: / 25-07-2006 / 09:07:32 / cg" |
3892 | 5447 |
! |
5448 |
||
6107 | 5449 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5450 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5451 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5452 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5453 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5454 |
destinationDirectory := Dialog |
14588 | 5455 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items to Directory:') |
5789 | 5456 |
default:(LastMoveDestination ? self currentDirectory) |
6952 | 5457 |
ok:(resources string:'Move') |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5458 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5459 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5460 |
|
5789 | 5461 |
LastMoveDestination := destinationDirectory. |
13704 | 5462 |
self moveFiles:(self currentSelectedObjects copy) to:destinationDirectory asFilename. |
5463 |
self updateCurrentDirectoryWithReread. |
|
5464 |
||
7560 | 5465 |
|
5466 |
"Modified: / 04-12-2006 / 13:15:12 / cg" |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5467 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5468 |
|
3892 | 5469 |
newDirectory |
5470 |
"ask for and create a new directory" |
|
5471 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5472 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5473 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5474 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5475 |
directory isNil ifTrue:[ |
18175 | 5476 |
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
|
5477 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5478 |
]. |
4521 | 5479 |
|
5480 |
"/ 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
|
5481 |
selectedFiles := self currentSelectedFiles. |
4521 | 5482 |
selectedFiles size == 1 ifTrue:[ |
5483 |
singleSelectedFile := selectedFiles first. |
|
5484 |
||
5485 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
13714 | 5486 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5487 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
5488 |
||
5489 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
13714 | 5490 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5491 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
5492 |
]. |
|
5493 |
]. |
|
5494 |
]. |
|
5495 |
||
5961 | 5496 |
|
4521 | 5497 |
defaultAnswer notNil ifTrue:[ |
5961 | 5498 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 5499 |
] ifFalse:[ |
5961 | 5500 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 5501 |
]. |
5502 |
createOp result ifFalse:[ ^ self]. |
|
5503 |
newFile := createOp createdFile. |
|
3892 | 5504 |
newFile notNil ifTrue:[ |
17871 | 5505 |
self updateCurrentDirectoryWithReread. |
3892 | 5506 |
] |
17818 | 5507 |
|
5508 |
"Modified: / 29-11-2017 / 12:26:41 / cg" |
|
18175 | 5509 |
"Modified: / 01-06-2018 / 12:49:43 / Claus Gittinger" |
3892 | 5510 |
! |
5511 |
||
5512 |
newFile |
|
5513 |
"ask for and create a new file" |
|
5514 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5515 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5516 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5517 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5518 |
directory isNil ifTrue:[ |
18175 | 5519 |
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
|
5520 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5521 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5522 |
|
3982 | 5523 |
curFile := self firstSelectedFile. |
3892 | 5524 |
curFile notNil ifTrue:[ |
4414 | 5525 |
file := curFile. |
3892 | 5526 |
] ifFalse:[ |
4414 | 5527 |
file := directory. |
3892 | 5528 |
]. |
5961 | 5529 |
create := FileOperation createFileIn:file. |
3892 | 5530 |
create result ifFalse:[ ^ self]. |
5531 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
17818 | 5532 |
|
5533 |
"Modified: / 29-11-2017 / 12:26:51 / cg" |
|
18175 | 5534 |
"Modified: / 01-06-2018 / 12:49:50 / Claus Gittinger" |
3892 | 5535 |
! |
5536 |
||
5537 |
newHardLink |
|
5538 |
"ask for and create a hard link (unix only)" |
|
5539 |
||
6151 | 5540 |
self newLink:#hard. |
5541 |
! |
|
5542 |
||
5543 |
newLink:typeOfLink |
|
3892 | 5544 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
5545 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5546 |
| sel dir create createdFile| |
3892 | 5547 |
|
7560 | 5548 |
sel := self currentSelectedObjects. |
19152 | 5549 |
(sel size ~~ 1) ifTrue:[ |
18175 | 5550 |
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
|
5551 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5552 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5553 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5554 |
|
6151 | 5555 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 5556 |
create result ifFalse:[ ^ self]. |
5557 |
createdFile := create createdFile. |
|
5558 |
createdFile notNil ifTrue:[ |
|
6151 | 5559 |
typeOfLink == #soft ifTrue:[ |
17871 | 5560 |
self updateCurrentDirectoryWithReread. |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5561 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5562 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5563 |
] |
3892 | 5564 |
]. |
7560 | 5565 |
|
17818 | 5566 |
"Modified: / 29-11-2017 / 12:26:58 / cg" |
18175 | 5567 |
"Modified: / 01-06-2018 / 12:49:32 / Claus Gittinger" |
3892 | 5568 |
! |
5569 |
||
5570 |
newSoftLink |
|
5571 |
"ask for and create a soft link (unix only)" |
|
5572 |
||
6151 | 5573 |
self newLink:#soft. |
3892 | 5574 |
! |
5575 |
||
5576 |
pasteFiles |
|
6373 | 5577 |
"paste from clipBoard" |
5578 |
||
5579 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 5580 |
|
5581 |
files := self clipboard files. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
5582 |
files isEmptyOrNil ifTrue:[ ^ self ]. |
6373 | 5583 |
|
5584 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
5585 |
||
3892 | 5586 |
buffer := self clipboard copy. |
3982 | 5587 |
directories := self currentSelectedDirectories. |
5880 | 5588 |
directories size ~~ 1 ifTrue:[ |
4414 | 5589 |
|box dirStringCol| |
5880 | 5590 |
|
4414 | 5591 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
5592 |
box := ListSelectionBox new. |
|
6373 | 5593 |
box title:'Paste into which directory ?'. |
4414 | 5594 |
box list:dirStringCol. |
5595 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5596 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5597 |
box destroy. |
3892 | 5598 |
] ifFalse:[ |
5880 | 5599 |
destination := directories anElement. |
3892 | 5600 |
]. |
6373 | 5601 |
|
5602 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 5603 |
buffer files copy do:[:aFile| |
5604 |
aFile directory = destination ifTrue:[ |
|
5605 |
buffer files remove:aFile. |
|
5606 |
]. |
|
5607 |
]. |
|
5608 |
]. |
|
5609 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6374 | 5610 |
copiedFiles notEmptyOrNil ifTrue:[ |
5611 |
thisIsAFileMoveOperation ifTrue:[ |
|
5612 |
self deleteFiles:(copiedFiles keys) confirm:false. |
|
5613 |
]. |
|
5614 |
||
5615 |
"/ select those pasted files. |
|
5616 |
self updateCurrentDirectory:true. |
|
5617 |
self currentFileNameHolder value:copiedFiles values. |
|
5618 |
] |
|
3892 | 5619 |
! |
5620 |
||
5621 |
renameFile:aFile |
|
5622 |
"rename the selected file(s)" |
|
5623 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5624 |
^ self renameFiles:(Array with:aFile). |
3892 | 5625 |
! |
5626 |
||
4230 | 5627 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 5628 |
"rename filename to newFileString" |
5629 |
||
5630 |
|rename| |
|
5631 |
||
5961 | 5632 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 5633 |
rename result ifTrue:[ |
4230 | 5634 |
aBoolean ifTrue:[ |
5635 |
self updateAndSelect:(rename renamedFiles). |
|
5636 |
]. |
|
3892 | 5637 |
] ifFalse:[ |
4523 | 5638 |
self notify:rename errorString. |
3892 | 5639 |
]. |
5640 |
^ rename result |
|
5641 |
! |
|
5642 |
||
5643 |
renameFiles:aColOfFiles |
|
6373 | 5644 |
"rename some file(s)" |
3892 | 5645 |
|
5646 |
|rename| |
|
5647 |
||
5961 | 5648 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 5649 |
rename result ifFalse:[ |
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5650 |
self notify:rename errorString. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5651 |
^ nil. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5652 |
]. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5653 |
^ rename |
3892 | 5654 |
! |
5655 |
||
5656 |
renameSelection |
|
5657 |
"rename the selected file(s)" |
|
5658 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5659 |
|renamed| |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5660 |
|
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5661 |
renamed := self renameFiles:(self currentSelectedObjects copy). |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5662 |
renamed notNil ifTrue:[ |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5663 |
self updateAndSelect:renamed renamedFiles. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5664 |
]. |
7560 | 5665 |
|
5666 |
"Modified: / 04-12-2006 / 13:15:24 / cg" |
|
3892 | 5667 |
! ! |
5668 |
||
4080 | 5669 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 5670 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5671 |
bookmarksMenu |
3952 | 5672 |
<resource: #programMenu> |
5673 |
||
14941 | 5674 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec. |
5675 |
! |
|
5676 |
||
5677 |
bookmarksMenuForBaseSpec:aBaseMenuSpec |
|
5678 |
<resource: #programMenu> |
|
5679 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5680 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5681 |
|
14941 | 5682 |
menu := aBaseMenuSpec decodeAsLiteralArray. |
7763 | 5683 |
|
5684 |
"/ add the bookmark items ... |
|
5685 |
bookmarks := self class directoryBookmarks. |
|
5686 |
bookmarks notEmptyOrNil ifTrue:[ |
|
14604 | 5687 |
menu addSeparator. |
7763 | 5688 |
bookmarks do:[:dirName | |
12963 | 5689 |
menu addItem:(MenuItem |
5690 |
label:dirName asString |
|
5691 |
itemValue:[ |
|
5692 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
|
5693 |
self setCurrentFileName:dirName. |
|
5694 |
]. |
|
5695 |
]). |
|
7763 | 5696 |
]. |
5697 |
]. |
|
4080 | 5698 |
menu findGuiResourcesIn:self. |
7763 | 5699 |
^ menu |
5700 |
||
11135 | 5701 |
"Modified: / 14-01-2012 / 21:14:03 / cg" |
7763 | 5702 |
! |
5703 |
||
5704 |
canBackward |
|
5705 |
^ self directoryHistory canBackward. |
|
5706 |
||
5707 |
"Modified: / 27-03-2007 / 10:54:55 / cg" |
|
5708 |
! |
|
5709 |
||
5710 |
canForward |
|
5711 |
^ self directoryHistory canForward. |
|
5712 |
||
5713 |
"Modified: / 27-03-2007 / 10:54:57 / cg" |
|
5714 |
! |
|
5715 |
||
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5716 |
gotoBookmarksMenu |
7763 | 5717 |
<resource: #programMenu> |
5718 |
||
14941 | 5719 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec2. |
6099 | 5720 |
! |
5721 |
||
3892 | 5722 |
menuDirHistory:backOrForward |
7763 | 5723 |
"initialize the history menu" |
5724 |
||
3892 | 5725 |
<resource: #programMenu > |
5726 |
||
7763 | 5727 |
|hist menu pathList currentSel currentPath| |
5728 |
||
5729 |
hist := self directoryHistory. |
|
5730 |
hist isEmpty ifTrue:[^ nil]. |
|
5731 |
||
3892 | 5732 |
backOrForward == #back ifTrue:[ |
6725 | 5733 |
currentSel := self currentSelectedDirectories. |
4347 | 5734 |
currentSel size == 1 ifTrue:[ |
5735 |
currentPath := currentSel first asString. |
|
5736 |
] ifFalse:[ |
|
5737 |
currentPath := nil. |
|
5738 |
]. |
|
7763 | 5739 |
pathList := hist getBackCollection. |
3892 | 5740 |
] ifFalse:[ |
7763 | 5741 |
pathList := hist getForwardCollection. |
3892 | 5742 |
]. |
4022 | 5743 |
pathList isEmpty ifTrue:[ ^ nil]. |
7763 | 5744 |
|
6370 | 5745 |
pathList size > 30 ifTrue:[ |
5746 |
pathList := pathList copyTo:30 |
|
5747 |
]. |
|
7763 | 5748 |
|
5749 |
menu := Menu new. |
|
5750 |
||
3964 | 5751 |
pathList do:[:aPath| |
14593 | 5752 |
menu addItem:(MenuItem |
5753 |
label:aPath |
|
5754 |
itemValue:[ self setCurrentFileName:(aPath asFilename) ] |
|
5755 |
translateLabel:false). |
|
3952 | 5756 |
]. |
7763 | 5757 |
menu findGuiResourcesIn:self. |
3892 | 5758 |
^ menu |
7763 | 5759 |
|
11783 | 5760 |
"Modified: / 09-09-2012 / 13:07:22 / cg" |
3892 | 5761 |
! |
5762 |
||
5763 |
menuDirHistoryBack |
|
5764 |
"initialize the directory menu |
|
5765 |
" |
|
5766 |
<resource: #programMenu > |
|
5767 |
||
5768 |
^ self menuDirHistory:#back. |
|
5769 |
! |
|
5770 |
||
5771 |
menuDirHistoryForward |
|
5772 |
"initialize the directory menu |
|
5773 |
" |
|
5774 |
<resource: #programMenu > |
|
5775 |
||
5776 |
^ self menuDirHistory:#forward. |
|
3906 | 5777 |
! |
5778 |
||
5779 |
menuFileHistory |
|
5780 |
"initialize the file history menu |
|
5781 |
" |
|
5782 |
<resource: #programMenu > |
|
5783 |
||
7763 | 5784 |
|menu hist text removeItem| |
3906 | 5785 |
|
5786 |
hist := self fileHistory. |
|
5787 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5788 |
|
7763 | 5789 |
menu := Menu new. |
5790 |
||
5791 |
hist copy do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5792 |
aFileItem fileName exists ifTrue:[ |
12963 | 5793 |
menu addItem:(MenuItem |
5794 |
label: aFileItem fileName asString |
|
14593 | 5795 |
itemValue: |
5796 |
[ |
|
5797 |
self setCurrentFileName:(aFileItem fileName). |
|
5798 |
self openApplByFileItem:aFileItem |
|
5799 |
] |
|
5800 |
translateLabel:false). |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5801 |
] ifFalse:[ |
7763 | 5802 |
"/ remove all not existing history entries |
5803 |
hist remove:aFileItem. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5804 |
] |
3906 | 5805 |
]. |
7763 | 5806 |
menu addSeparator. |
5807 |
||
4080 | 5808 |
removeItem := MenuItem new. |
5809 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5810 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5811 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 5812 |
removeItem label:text. |
11783 | 5813 |
removeItem |
5814 |
itemValue:[ |
|
5815 |
self fileHistory removeAll. |
|
5816 |
self enableFileHistory value:false. |
|
5817 |
]. |
|
3906 | 5818 |
menu addItem:removeItem. |
7763 | 5819 |
menu findGuiResourcesIn:self. |
3906 | 5820 |
^ menu |
7763 | 5821 |
|
11783 | 5822 |
"Modified (format): / 09-09-2012 / 13:07:36 / cg" |
3952 | 5823 |
! |
5824 |
||
4080 | 5825 |
sortMenu |
5826 |
<resource: #programMenu > |
|
5827 |
||
5828 |
|menu| |
|
5829 |
||
7763 | 5830 |
menu := Menu decodeFromLiteralArray:self class sortMenu. |
4080 | 5831 |
menu findGuiResourcesIn:self. |
5832 |
^ menu |
|
7763 | 5833 |
|
5834 |
"Modified: / 27-03-2007 / 10:47:42 / cg" |
|
4080 | 5835 |
! |
5836 |
||
5837 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5838 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5839 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5840 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5841 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5842 |
|
19001 | 5843 |
"/ attn: the menuSpec format has changed. |
5844 |
"/ for reference, the following code supports both old and new formats. |
|
5845 |
specHere := self class viewDetailsMenuSpec. |
|
5846 |
((specHere at:2) isArray and:[(specHere at:2) first isSymbol]) ifTrue:[ |
|
5847 |
"/ new format |
|
5848 |
itemsHere := specHere copyFrom:2. |
|
5849 |
spec := { (specHere first) } , itemsContentsBrowser , itemsHere |
|
5850 |
] ifFalse:[ |
|
5851 |
itemsHere := specHere at:2. |
|
5852 |
||
5853 |
spec := specHere copy. |
|
5854 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
|
5855 |
]. |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5856 |
^ spec |
4080 | 5857 |
! |
5858 |
||
5859 |
viewInContentsBrowserMenu |
|
5009 | 5860 |
self |
5861 |
applicationNamed:#DirectoryContentsBrowser |
|
5862 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
5863 |
||
5864 |
^ nil. |
|
4080 | 5865 |
! |
5866 |
||
3952 | 5867 |
visitedDirectoriesMenu |
5868 |
<resource: #programMenu > |
|
5869 |
||
5870 |
|menu histCopy text removeItem| |
|
5871 |
||
7763 | 5872 |
histCopy := self directoryHistory. |
5873 |
histCopy isEmpty ifTrue:[^ nil]. |
|
5874 |
||
3952 | 5875 |
menu := Menu new. |
7763 | 5876 |
|
5877 |
histCopy do:[:aFile| |
|
12963 | 5878 |
menu addItem:(MenuItem |
5879 |
label:aFile asString |
|
5880 |
itemValue:[ |
|
5881 |
self setCurrentFileName:(aFile path asFilename). |
|
5882 |
]). |
|
7763 | 5883 |
]. |
5884 |
menu addSeparator. |
|
5885 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5886 |
"/ 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
|
5887 |
text := (resources string:'Clear History'). |
3952 | 5888 |
removeItem := MenuItem new. |
4040 | 5889 |
removeItem translateLabel:true. |
3952 | 5890 |
removeItem label:text. |
11783 | 5891 |
removeItem |
5892 |
itemValue:[ |
|
5893 |
self directoryHistory removeAll. |
|
5894 |
self enableForward value:self canForward. |
|
5895 |
self enableBack value:self canBackward. |
|
5896 |
]. |
|
7763 | 5897 |
|
3952 | 5898 |
menu addItem:removeItem. |
7763 | 5899 |
menu findGuiResourcesIn:self. |
3952 | 5900 |
^ menu |
7763 | 5901 |
|
11783 | 5902 |
"Modified: / 09-09-2012 / 13:07:45 / cg" |
3892 | 5903 |
! ! |
5904 |
||
5880 | 5905 |
!AbstractFileBrowser methodsFor:'menu actions'! |
5906 |
||
5907 |
doCompareTwoFiles |
|
5908 |
self openDiffView. |
|
5909 |
! |
|
5910 |
||
5911 |
doGoDirectoryUp |
|
18511 | 5912 |
"navigate up to the parent folder" |
5913 |
||
5960 | 5914 |
| upDir directory rootInTreeView| |
5880 | 5915 |
|
5916 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
5917 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 5918 |
directory := self currentDirectory. |
5919 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 5920 |
] ifFalse:[ |
5921 |
rootInTreeView := self |
|
5922 |
applicationNamed:#DirectoryTreeBrowser |
|
5923 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 5924 |
directory := rootInTreeView value asFilename. |
5925 |
]. |
|
5926 |
upDir := directory directory. |
|
5959 | 5927 |
self setCurrentFileName:upDir. |
5880 | 5928 |
! |
5929 |
||
5930 |
doGotoDefaultDirectory |
|
18511 | 5931 |
"navigate to the default folder (is the current directory)" |
5932 |
||
5880 | 5933 |
self gotoFile:(Filename defaultDirectory). |
5934 |
! |
|
5935 |
||
8091 | 5936 |
doGotoDesktopDirectory |
18511 | 5937 |
"navigate to the desktop folder" |
5938 |
||
18823 | 5939 |
|dir| |
5940 |
||
5941 |
(dir := Filename desktopDirectory) isNil ifTrue:[ |
|
5942 |
Dialog warn:'No desktop folder defined'. |
|
5943 |
^ self. |
|
5944 |
]. |
|
5945 |
self gotoFile:dir. |
|
5946 |
||
5947 |
"Modified: / 15-06-2019 / 08:40:25 / Claus Gittinger" |
|
8091 | 5948 |
! |
5949 |
||
18036 | 5950 |
doGotoDocumentsDirectory |
18511 | 5951 |
"navigate to the documents folder" |
5952 |
||
18823 | 5953 |
|dir| |
5954 |
||
5955 |
(dir := Filename documentsDirectory) isNil ifTrue:[ |
|
5956 |
Dialog warn:'No documents folder defined'. |
|
5957 |
^ self. |
|
5958 |
]. |
|
5959 |
self gotoFile:dir. |
|
5960 |
||
5961 |
"Modified: / 15-06-2019 / 08:40:40 / Claus Gittinger" |
|
18036 | 5962 |
! |
5963 |
||
5964 |
doGotoDownloadsDirectory |
|
18511 | 5965 |
"navigate to the downloads folder" |
5966 |
||
18823 | 5967 |
|dir| |
5968 |
||
5969 |
(dir := Filename downloadsDirectory) isNil ifTrue:[ |
|
5970 |
Dialog warn:'No downloads folder defined'. |
|
5971 |
^ self. |
|
5972 |
]. |
|
5973 |
self gotoFile:dir. |
|
5974 |
||
5975 |
"Modified: / 15-06-2019 / 08:40:53 / Claus Gittinger" |
|
18036 | 5976 |
! |
5977 |
||
5880 | 5978 |
doGotoHomeDirectory |
18511 | 5979 |
"navigate to the home folder" |
5980 |
||
18823 | 5981 |
|dir| |
5982 |
||
5983 |
(dir := Filename homeDirectory) isNil ifTrue:[ |
|
5984 |
Dialog warn:'No home folder defined'. |
|
5985 |
^ self. |
|
5986 |
]. |
|
5987 |
self gotoFile:dir. |
|
5988 |
||
5989 |
"Modified: / 15-06-2019 / 08:41:08 / Claus Gittinger" |
|
5880 | 5990 |
! |
5991 |
||
6434 | 5992 |
doGotoSmalltalkDirectory |
18511 | 5993 |
"navigate to the smalltalk bin folder (where the stx executable is)" |
5994 |
||
18823 | 5995 |
|dir| |
5996 |
||
5997 |
(dir := self smalltalkDirectory) isNil ifTrue:[ |
|
5998 |
Dialog warn:'No smalltalk folder defined'. |
|
5999 |
^ self. |
|
6000 |
]. |
|
6001 |
self gotoFile:dir. |
|
6002 |
||
6003 |
"Modified: / 15-06-2019 / 08:41:26 / Claus Gittinger" |
|
6434 | 6004 |
! |
6005 |
||
17187 | 6006 |
doGotoSmalltalkWorkspaceDirectory |
18511 | 6007 |
"navigate to the user's smalltalk workspace folder" |
6008 |
||
18823 | 6009 |
|dir| |
6010 |
||
6011 |
(dir := UserPreferences current workspaceDirectory) isNil ifTrue:[ |
|
6012 |
Dialog warn:'No smalltalk workspace folder defined'. |
|
6013 |
^ self. |
|
6014 |
]. |
|
6015 |
self gotoFile:dir. |
|
6016 |
||
6017 |
"Modified: / 15-06-2019 / 08:42:03 / Claus Gittinger" |
|
17187 | 6018 |
! |
6019 |
||
9677 | 6020 |
doGotoTempDirectory |
18823 | 6021 |
|dir| |
6022 |
||
6023 |
(dir := self tempDirectory) isNil ifTrue:[ |
|
6024 |
Dialog warn:'No temp folder defined'. |
|
6025 |
^ self. |
|
6026 |
]. |
|
6027 |
self gotoFile:dir. |
|
9677 | 6028 |
|
6029 |
"Created: / 29-12-2010 / 11:03:17 / cg" |
|
18823 | 6030 |
"Modified: / 15-06-2019 / 08:41:59 / Claus Gittinger" |
9677 | 6031 |
! |
6032 |
||
9596 | 6033 |
doMakeCurrentDirectory |
17582 | 6034 |
<resource: #obsolete> |
6035 |
||
6036 |
"/ no longer |
|
6037 |
^ self |
|
6038 |
"/ OperatingSystem setCurrentDirectory:(self currentDirectory pathName). |
|
6039 |
"/ self currentFileNameHolderChangedForCommon. |
|
9596 | 6040 |
|
6041 |
"Created: / 26-10-2010 / 17:21:19 / cg" |
|
17582 | 6042 |
"Modified (format): / 17-07-2017 / 10:09:39 / cg" |
9596 | 6043 |
! |
6044 |
||
5880 | 6045 |
fileGetInfo:longInfo |
6046 |
"get info on selected file - show it in a box" |
|
6047 |
||
6048 |
|string box updater| |
|
6049 |
||
6050 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
6051 |
string notNil ifTrue:[ |
|
6052 |
box := InfoBox title:string. |
|
6053 |
updater := [ |
|
6054 |
[true] whileTrue:[ |
|
6055 |
Delay waitForSeconds:2. |
|
6056 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
6057 |
string isNil ifTrue:[ ^ self]. |
|
6058 |
box title:string |
|
6059 |
] |
|
6060 |
] fork. |
|
6061 |
box show. |
|
6062 |
updater terminate. |
|
6063 |
box destroy |
|
6064 |
] |
|
6434 | 6065 |
! |
6066 |
||
17686 | 6067 |
showDeltaBetweenTwoImageFiles |
6068 |
|i1 i2 delta| |
|
6069 |
||
6070 |
i1 := Image fromFile:(self selectedFileNames first). |
|
6071 |
i2 := Image fromFile:(self selectedFileNames second). |
|
6072 |
delta := ImageAlgorithms new differenceImageBetween:i1 and:i2. |
|
6073 |
ImageView openOn:delta. |
|
6074 |
||
6075 |
"Created: / 10-09-2017 / 16:59:08 / cg" |
|
6076 |
! |
|
6077 |
||
6434 | 6078 |
smalltalkDirectory |
8590 | 6079 |
|stxPath| |
6434 | 6080 |
|
6081 |
stxPath := OperatingSystem pathOfSTXExecutable. |
|
8590 | 6082 |
stxPath isNil ifTrue:[ |
6083 |
^ Filename currentDirectory |
|
6084 |
]. |
|
6085 |
^ stxPath asFilename directory. |
|
9677 | 6086 |
! |
6087 |
||
6088 |
tempDirectory |
|
6089 |
^ Filename tempDirectory. |
|
6090 |
||
6091 |
"Created: / 29-12-2010 / 11:03:00 / cg" |
|
5880 | 6092 |
! ! |
6093 |
||
11139 | 6094 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
6095 |
||
14262 | 6096 |
addDirToJavaSourcePath |
6097 |
"add the current path to java's sourcePath |
|
6098 |
(only available with ST/J System" |
|
6099 |
||
6100 |
Java addToSourcePath:self currentDirectory pathName |
|
6101 |
||
6102 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
6103 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
6104 |
! |
|
6105 |
||
11139 | 6106 |
copyFiles |
6107 |
self |
|
6108 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
6109 |
! |
|
6110 |
||
6111 |
cutFiles |
|
6112 |
self |
|
6113 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
6114 |
! |
|
6115 |
||
6116 |
deleteFiles |
|
6117 |
self |
|
6118 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
6119 |
! |
|
6120 |
||
6121 |
eraseFiles |
|
6122 |
self |
|
6123 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
6124 |
! |
|
6125 |
||
14262 | 6126 |
fileAddToJavaSourcePath |
6127 |
"add the current path to java's sourcePath |
|
6128 |
(only available with ST/J System" |
|
6129 |
||
17865 | 6130 |
Java notNil ifTrue:[ |
6131 |
self currentSelectedObjects do:[:each | |
|
6132 |
Java addToSourcePath:(each pathName) |
|
6133 |
]. |
|
14262 | 6134 |
]. |
6135 |
||
6136 |
"Created: / 9.11.1998 / 05:41:34 / cg" |
|
6137 |
"Modified: / 9.11.1998 / 05:56:00 / cg" |
|
6138 |
! |
|
6139 |
||
11139 | 6140 |
openSettingsDialog |
6141 |
|dialog| |
|
6142 |
||
6143 |
dialog := FileBrowserV2SettingsDialog new. |
|
6144 |
dialog settingsDialog:self. |
|
6145 |
dialog allButOpen. |
|
6146 |
dialog doReload. |
|
6147 |
dialog openWindow |
|
6148 |
! |
|
6149 |
||
6150 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
6151 |
|files dirs| |
|
6152 |
||
6153 |
files := self currentSelectedFiles. |
|
6154 |
files notEmpty ifTrue:[ |
|
6155 |
aBlock value:files. |
|
6156 |
] ifFalse:[ |
|
6157 |
dirs := self currentSelectedDirectories. |
|
6158 |
dirs notEmpty ifTrue:[ |
|
6159 |
aBlock value:dirs. |
|
6160 |
]. |
|
6161 |
]. |
|
6162 |
! ! |
|
6163 |
||
6164 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
|
6165 |
||
6166 |
openAboutThisApplication |
|
6167 |
"opens an about box for this application." |
|
6168 |
||
6169 |
Dialog aboutClass:self class. |
|
6170 |
! |
|
6171 |
||
6172 |
openHTMLDocument:relativeDocPath |
|
6173 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
6174 |
! ! |
|
6175 |
||
6176 |
!AbstractFileBrowser methodsFor:'menu actions-scm-cvs'! |
|
3892 | 6177 |
|
15905 | 6178 |
canCvsAddAndCommit |
6179 |
||
6180 |
|selectedFiles| |
|
6181 |
||
6182 |
selectedFiles := self currentSelectedObjects. |
|
6183 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
6184 |
! |
|
6185 |
||
6186 |
canRemoveCVSContainer |
|
6187 |
^ self currentSelectedFiles |
|
6188 |
contains:[:fileName| |
|
6189 |
|dirOfFile cvsDir| |
|
6190 |
||
19009 | 6191 |
dirOfFile := self class getDirectoryOf:fileName. |
15905 | 6192 |
cvsDir := dirOfFile construct:'CVS'. |
6193 |
cvsDir isDirectory |
|
6194 |
]. |
|
6195 |
! |
|
6196 |
||
12777 | 6197 |
commitFilesToCVS:files |
6198 |
|numFiles| |
|
6199 |
||
6200 |
(numFiles := files size) > 0 ifTrue:[ |
|
6201 |
self withActivityIndicationDo:[ |
|
6202 |
self cvsCommitFiles:files |
|
6203 |
] |
|
6204 |
] |
|
6205 |
! |
|
6206 |
||
3892 | 6207 |
cvsAddAndCommit |
4849 | 6208 |
self cvsAddAndCommitAsBinary:false |
6209 |
! |
|
6210 |
||
6211 |
cvsAddAndCommitAsBinary:asBinary |
|
8588 | 6212 |
|sel log logArg binArg cmd dir executionBlock nameString| |
3892 | 6213 |
|
6214 |
log := Dialog |
|
11139 | 6215 |
requestText:(resources string:'Enter initial log message:') |
4414 | 6216 |
lines:10 |
6217 |
columns:70 |
|
6218 |
initialAnswer:nil. |
|
8322
cf10f08b6164
care for cancel in #cvsAddAndCommitAsBinary:
Claus Gittinger <cg@exept.de>
parents:
8294
diff
changeset
|
6219 |
log isNil ifTrue:[^ self]. |
3892 | 6220 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6221 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6222 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6223 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6224 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6225 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6226 |
|
8588 | 6227 |
binArg := ''. |
6228 |
asBinary ifTrue:[ |
|
6229 |
binArg := '-kb '. |
|
6230 |
]. |
|
3982 | 6231 |
sel := self currentSelectedFiles. |
11139 | 6232 |
executionBlock := |
6233 |
[:stream | |
|
6234 |
log notNil ifTrue:[ |
|
17416 | 6235 |
sel notEmptyOrNil ifTrue:[ |
11139 | 6236 |
sel do:[:fn | |
6237 |
|nameArg| |
|
6238 |
||
6239 |
nameArg := '"',fn baseName,'"'. |
|
6240 |
||
19009 | 6241 |
dir := self class getDirectoryOf:fn. |
11139 | 6242 |
cmd := 'cvs add ',logArg,' ',binArg,nameArg. |
6243 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6244 |
||
6245 |
cmd := ('cvs commit -l ',logArg,' ',nameArg). |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6246 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
11139 | 6247 |
"/ mhmh - it seems that only old CVS implementations (at least turqoise) |
6248 |
"/ support and need the 'admin -kb' command. |
|
6249 |
"/ newer ones use the '-kb' option in the 'cvs add' command |
|
6250 |
asBinary ifTrue:[ |
|
6251 |
cmd := ('cvs admin -kb ' , nameArg). |
|
6252 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6253 |
||
6254 |
cmd := ('cvs upd ' , nameArg). |
|
6255 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6256 |
]. |
|
6257 |
] |
|
6258 |
] |
|
6259 |
] |
|
6260 |
]. |
|
4107 | 6261 |
nameString := 'Command> cvs add and commit'. |
3892 | 6262 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
11139 | 6263 |
|
17416 | 6264 |
"Modified: / 17-02-2017 / 08:25:16 / cg" |
3892 | 6265 |
! |
6266 |
||
4849 | 6267 |
cvsAddBinaryAndCommit |
6268 |
self cvsAddAndCommitAsBinary:true |
|
6269 |
! |
|
6270 |
||
18867 | 6271 |
cvsBrowseRepositoryVersions |
6272 |
"open a diff-textView showing all versions in the repository." |
|
6273 |
||
6274 |
|sel fn| |
|
6275 |
||
6276 |
sel := self currentSelectedObjects. |
|
6277 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6278 |
sel size == 1 ifFalse:[ ^ self ]. |
|
6279 |
fn := sel first. |
|
6280 |
||
6281 |
self withWaitCursorDo:[ |
|
6282 |
FileVersionDiffBrowser openOnAllVersionsOfFile:fn |
|
6283 |
] |
|
6284 |
||
6285 |
"Created: / 07-07-2019 / 19:45:23 / Claus Gittinger" |
|
6286 |
! |
|
6287 |
||
3892 | 6288 |
cvsCommit |
12777 | 6289 |
|selectedFiles| |
3892 | 6290 |
|
3982 | 6291 |
selectedFiles:= self currentSelectedFiles. |
12777 | 6292 |
self cvsCommitFiles:selectedFiles |
6293 |
! |
|
6294 |
||
6295 |
cvsCommitFiles:files |
|
6296 |
|nFiles log logTmp s logArg msg executionBlock nameString | |
|
6297 |
||
6298 |
nFiles := files size. |
|
6299 |
nFiles == 0 ifTrue:[^ self]. |
|
6300 |
||
6301 |
nFiles == 1 ifTrue:[ |
|
6302 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(files first baseName) |
|
3892 | 6303 |
] ifFalse:[ |
12777 | 6304 |
nFiles > 1 ifTrue:[ |
6305 |
msg := resources string:'Enter log message for %1 files to checkIn' with:nFiles printString |
|
4414 | 6306 |
] ifFalse:[ |
6627 | 6307 |
msg := resources string:'Enter log message for checkIn' |
4414 | 6308 |
] |
3892 | 6309 |
]. |
6310 |
||
6311 |
log := Dialog |
|
4414 | 6312 |
requestText:msg |
6313 |
lines:10 |
|
6314 |
columns:70 |
|
6315 |
initialAnswer:nil. |
|
3892 | 6316 |
|
4663 | 6317 |
log isNil ifTrue:[^ self]. |
12777 | 6318 |
log := log replChar:$" withString:'\"'. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6319 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6320 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
12777 | 6321 |
"/ save the log message into another tempFile ... |
13121 | 6322 |
s := FileStream newTemporary. |
6323 |
logTmp := s fileName. |
|
12777 | 6324 |
s nextPutAll:log. |
6325 |
s close. |
|
6326 |
||
6327 |
logArg := '-F "', logTmp pathName, '"'. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6328 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6329 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6330 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6331 |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6332 |
executionBlock := [:stream | |
12777 | 6333 |
[ |
6334 |
files do:[:fn | |
|
6335 |
| dir nameArg cmd | |
|
6336 |
||
6337 |
nameArg := '"',fn baseName,'"'. |
|
6338 |
dir := fn directory. |
|
6339 |
cmd := 'cvs commit ',logArg,' ' , nameArg. |
|
6340 |
stream showCR:fn pathName. |
|
6341 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
4663 | 6342 |
] |
12777 | 6343 |
] ensure:[ |
6344 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6345 |
]. |
|
4107 | 6346 |
]. |
6347 |
nameString := 'Command> cvs commit'. |
|
6348 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 6349 |
! |
6350 |
||
14527 | 6351 |
cvsCommitFolder |
6352 |
|dir log logTmp s logArg msg executionBlock nameString | |
|
6353 |
||
6354 |
(dir := self currentDirectory) isNil ifTrue:[ ^ self ]. |
|
6355 |
||
6356 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(dir baseName). |
|
6357 |
log := Dialog |
|
6358 |
requestText:msg |
|
6359 |
lines:10 |
|
6360 |
columns:70 |
|
6361 |
initialAnswer:nil. |
|
6362 |
||
6363 |
log isNil ifTrue:[^ self]. |
|
6364 |
log := log replChar:$" withString:'\"'. |
|
6365 |
||
6366 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6367 |
"/ save the log message into another tempFile ... |
|
6368 |
s := FileStream newTemporary. |
|
6369 |
logTmp := s fileName. |
|
6370 |
s nextPutAll:log. |
|
6371 |
s close. |
|
6372 |
||
6373 |
logArg := '-F "', logTmp pathName, '"'. |
|
6374 |
] ifFalse:[ |
|
6375 |
logArg := '-m ''' , log , ''''. |
|
6376 |
]. |
|
6377 |
||
6378 |
executionBlock := [:stream | |
|
6379 |
[ |
|
6380 |
|cmd| |
|
6381 |
||
6382 |
cmd := 'cvs commit ',logArg. |
|
6383 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6384 |
] ensure:[ |
|
6385 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6386 |
]. |
|
6387 |
]. |
|
6388 |
||
6389 |
nameString := 'Command> cvs commit'. |
|
6390 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6391 |
! |
|
6392 |
||
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6393 |
cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6394 |
|selectedFiles| |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6395 |
|
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6396 |
selectedFiles:= self currentSelectedFiles. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6397 |
selectedFiles do:[:each | |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6398 |
|out diffs| |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6399 |
|
15589 | 6400 |
out := CharacterWriteStream new:100. |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6401 |
OperatingSystem |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6402 |
executeCommand:'cvs diff -b ',each baseName |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6403 |
outputTo:out |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6404 |
inDirectory:each directoryName. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6405 |
diffs := out contents. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6406 |
TextView openWith:diffs. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6407 |
]. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6408 |
|
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6409 |
"Modified: / 23-01-2012 / 14:08:28 / cg" |
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6410 |
! |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6411 |
|
15211 | 6412 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
6413 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
6414 |
||
6415 |
|toRemove updateRunning executionBlock nameString| |
|
6416 |
||
6417 |
updateRunning := self backgroundProcesses value notEmpty. |
|
6418 |
self killAllRunningBackgroundProcesses. |
|
6419 |
toRemove := OrderedCollection new. |
|
6420 |
||
6421 |
executionBlock := |
|
6422 |
[:stream | |
|
6423 |
|cmd logArg prevDir prevFiles| |
|
6424 |
||
6425 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6426 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
|
6427 |
] ifFalse:[ |
|
6428 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
|
6429 |
]. |
|
6430 |
prevFiles := ''. |
|
6431 |
||
6432 |
filesToRemove do:[:fileName | |
|
6433 |
|dir file| |
|
6434 |
||
6435 |
dir := fileName directory. |
|
6436 |
(prevDir notNil and:[prevDir ~= dir]) ifTrue:[ |
|
6437 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6438 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6439 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6440 |
prevFiles := ''. |
|
6441 |
]. |
|
6442 |
||
17116 | 6443 |
OsError handle:[:ex| |
15211 | 6444 |
"was not able to remove it" |
6445 |
| lastError msg | |
|
6446 |
lastError := OperatingSystem lastErrorString. |
|
6447 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
6448 |
lastError isNil ifFalse:[ |
|
6449 |
msg := msg , '\\(' , lastError , ')' |
|
6450 |
]. |
|
6451 |
Dialog warn:msg withCRs |
|
6452 |
] do:[ |
|
6453 |
(fileName isSymbolicLink) ifFalse:[ |
|
6454 |
fileName remove. |
|
6455 |
file := fileName baseName. |
|
6456 |
cmd := ('cvs remove -f "',file,'"'). |
|
6457 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6458 |
"/ Transcript show:dir; space; showCR:cmd. |
|
6459 |
] |
|
6460 |
]. |
|
6461 |
prevDir := dir. |
|
6462 |
prevFiles := prevFiles,' ',file. |
|
6463 |
]. |
|
6464 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6465 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6466 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6467 |
]. |
|
6468 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
|
6469 |
filesToRemove size > 1 ifTrue:[ |
|
6470 |
nameString := nameString, ' ...'. |
|
6471 |
]. |
|
6472 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6473 |
! |
|
3892 | 6474 |
|
6475 |
cvsRemoveFileAndCVSContainer |
|
12493 | 6476 |
|files| |
6477 |
||
6478 |
files := self currentSelectedFiles copy. |
|
6479 |
self removeFilesAndCVSContainers:files |
|
3892 | 6480 |
! |
6481 |
||
9338 | 6482 |
cvsRevisionLog |
6483 |
| cmd sel executionBlock nameString| |
|
6484 |
||
6485 |
sel := self currentSelectedObjects. |
|
6486 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6487 |
||
6488 |
executionBlock := [:stream | |
|
6489 |
sel do:[:fn | |
|
6490 |
| dir nameArg | |
|
6491 |
||
6492 |
nameArg := '"',fn baseName,'"'. |
|
6493 |
dir := fn directory. |
|
6494 |
cmd := 'cvs log ' , nameArg. |
|
6495 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6496 |
] |
|
6497 |
]. |
|
6498 |
nameString := 'Command> cvs log'. |
|
6499 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6500 |
! |
|
6501 |
||
8562 | 6502 |
cvsTagSelection |
12856 | 6503 |
|tag tags cmd| |
6504 |
||
6505 |
tag := Dialog |
|
6506 |
request:(resources string:'Tag (possibly multiple, separated by ";"):') |
|
6507 |
initialAnswer:(CVSSourceCodeManager recentTag). |
|
6508 |
tag isEmptyOrNil ifTrue:[^ self ]. |
|
6509 |
||
6510 |
CVSSourceCodeManager recentTag:tag. |
|
8562 | 6511 |
|
6512 |
CVSSourceCodeManager notNil ifTrue:[ |
|
6513 |
cmd := CVSSourceCodeManager cvsExecutable. |
|
6514 |
] ifFalse:[ |
|
6515 |
cmd := 'cvs'. |
|
6516 |
]. |
|
6517 |
||
12856 | 6518 |
tags := tag asCollectionOfSubstringsSeparatedByAny:',;'. |
6519 |
tags do:[:eachTag | |
|
6520 |
self executeCommand:('%1 tag -F "%2" %3' |
|
6521 |
bindWith:cmd |
|
12858 | 6522 |
with:(eachTag withoutSeparators) |
12856 | 6523 |
with:(self makeFileNameArgumentString)) |
6524 |
]. |
|
8562 | 6525 |
! |
6526 |
||
3892 | 6527 |
cvsUpdateAll |
6528 |
| cmd | |
|
6529 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6530 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6531 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6532 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6533 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6534 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6535 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6536 |
self executeCommand:(cmd, ' upd -l'). |
3892 | 6537 |
! |
6538 |
||
6539 |
cvsUpdateAllRecursive |
|
6540 |
| cmd | |
|
6541 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6542 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6543 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6544 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6545 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6546 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6547 |
self executeCommand:(cmd, ' upd -d'). |
3892 | 6548 |
! |
6549 |
||
6550 |
cvsUpdateSelection |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6551 |
|stream cmd| |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6552 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6553 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6554 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6555 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6556 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6557 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6558 |
|
15589 | 6559 |
stream := CharacterWriteStream new. |
8563 | 6560 |
stream |
6561 |
nextPutAll:cmd; |
|
6562 |
nextPutAll:' upd '; |
|
6563 |
nextPutAll:(self makeFileNameArgumentString). |
|
6564 |
||
6565 |
self executeCommand:stream contents. |
|
6566 |
! |
|
6567 |
||
6568 |
makeFileNameArgumentString |
|
6569 |
|stream| |
|
6570 |
||
15589 | 6571 |
stream := CharacterWriteStream new. |
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6572 |
self currentSelectedFiles do:[: file | |
8563 | 6573 |
stream nextPut:$". |
4414 | 6574 |
stream nextPutAll:file baseName. |
8563 | 6575 |
stream nextPutAll:'" '. |
6576 |
]. |
|
6577 |
^ stream contents. |
|
12493 | 6578 |
! |
6579 |
||
6580 |
removeFilesAndCVSContainers:files |
|
6581 |
|numFiles question aswer| |
|
6582 |
||
6583 |
(numFiles := files size) > 0 ifTrue:[ |
|
6584 |
numFiles > 1 ifTrue:[ |
|
6585 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:numFiles |
|
6586 |
] ifFalse:[ |
|
6587 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(files first baseName allBold) |
|
6588 |
]. |
|
6589 |
||
6590 |
aswer := Dialog |
|
6591 |
confirm:question withCRs |
|
6592 |
yesLabel:(resources string:'Remove') |
|
6593 |
noLabel:(resources string:'Cancel'). |
|
6594 |
||
6595 |
aswer ifTrue:[ |
|
6596 |
self withActivityIndicationDo:[ |
|
6597 |
self cvsRemoveAndRemoveFromCVS:files |
|
6598 |
] |
|
6599 |
] |
|
6600 |
] |
|
3892 | 6601 |
! ! |
6602 |
||
14126 | 6603 |
|
11139 | 6604 |
!AbstractFileBrowser methodsFor:'menu actions-scm-mercurial'! |
6605 |
||
6606 |
mercurialAdd |
|
6607 |
|executionBlock sel maxCmdSize| |
|
6608 |
||
6609 |
maxCmdSize := 512. |
|
6610 |
||
6611 |
sel := self currentSelectedObjects. |
|
6612 |
sel isEmptyOrNil ifTrue:[ |
|
6613 |
^ self |
|
6614 |
]. |
|
6615 |
||
6616 |
executionBlock := |
|
6617 |
[:stream | |
|
6618 |
|prevDir cmd| |
|
6619 |
||
6620 |
prevDir := nil. |
|
6621 |
sel do:[:fn | |
|
6622 |
|nameArg dir| |
|
6623 |
||
6624 |
nameArg := '"',fn baseName,'"'. |
|
6625 |
dir := fn directory. |
|
6626 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6627 |
"/ flush |
|
6628 |
cmd notNil ifTrue:[ |
|
6629 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6630 |
cmd := nil. |
|
6631 |
] |
|
6632 |
]. |
|
6633 |
cmd isNil ifTrue:[ |
|
6634 |
cmd := 'hg add'. |
|
6635 |
]. |
|
6636 |
cmd := cmd,' ',nameArg. |
|
6637 |
prevDir := dir. |
|
6638 |
]. |
|
6639 |
cmd notNil ifTrue:[ |
|
6640 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6641 |
cmd := nil. |
|
6642 |
]. |
|
6643 |
stream nextPutLine:'Commit to finish the transaction'. |
|
6644 |
]. |
|
6645 |
||
6646 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg add'. |
|
6647 |
||
6648 |
"Created: / 15-01-2012 / 15:55:47 / cg" |
|
6649 |
! |
|
6650 |
||
6651 |
mercurialCommit |
|
6652 |
|dir executionBlock| |
|
6653 |
||
6654 |
"/ dir := self currentDirectory. |
|
6655 |
dir := self directoryContentsBrowser directory. |
|
6656 |
executionBlock := |
|
6657 |
[:stream | |
|
6658 |
(self getExecutionBlockForCommand:'hg commit' |
|
6659 |
inDirectory:dir) value:stream. |
|
6660 |
stream nextPutLine:'Push to sync other repositories'. |
|
6169 | 6661 |
]. |
11139 | 6662 |
|
6663 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg commit'. |
|
6664 |
||
6665 |
"Created: / 15-01-2012 / 16:21:27 / cg" |
|
6666 |
! |
|
6667 |
||
11144 | 6668 |
mercurialInit |
6669 |
|dir executionBlock| |
|
6670 |
||
6671 |
dir := self directoryContentsBrowser directory. |
|
6672 |
||
6673 |
(Dialog confirm:(resources |
|
6674 |
string:'Initialize new Mercurial Repository in %1?' |
|
6675 |
with:dir baseName)) ifFalse:[^ self]. |
|
6676 |
||
6677 |
executionBlock := |
|
6678 |
[:stream | |
|
6679 |
(self getExecutionBlockForCommand:('hg init') |
|
6680 |
inDirectory:dir) value:stream. |
|
6681 |
]. |
|
6682 |
||
6683 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg init'. |
|
6684 |
||
6685 |
"Created: / 17-01-2012 / 15:58:46 / cg" |
|
6686 |
! |
|
6687 |
||
11139 | 6688 |
mercurialPush |
6689 |
|destination dir executionBlock| |
|
6690 |
||
6691 |
destination := Dialog request:'Mercurial Repository' |
|
6692 |
initialAnswer:(LastMercurialRepository ? MercurialSourceCodeManager repositoryName). |
|
6693 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
6694 |
||
6695 |
LastMercurialRepository := destination. |
|
6696 |
||
6697 |
dir := self directoryContentsBrowser directory. |
|
6698 |
executionBlock := |
|
6699 |
[:stream | |
|
6700 |
(self getExecutionBlockForCommand:('hg push "%1"' bindWith:destination) |
|
6701 |
inDirectory:dir) value:stream. |
|
6702 |
]. |
|
6703 |
||
6704 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg push'. |
|
6705 |
||
6706 |
"Created: / 15-01-2012 / 16:29:41 / cg" |
|
6707 |
! |
|
6708 |
||
6709 |
mercurialStatus |
|
6710 |
|executionBlock sel maxCmdSize| |
|
6711 |
||
6712 |
maxCmdSize := 512. |
|
6713 |
||
6714 |
sel := self currentSelectedObjects. |
|
6715 |
sel isEmptyOrNil ifTrue:[ |
|
6716 |
^ self |
|
6717 |
]. |
|
6718 |
||
6719 |
executionBlock := |
|
6720 |
[:stream | |
|
6721 |
|prevDir cmd| |
|
6722 |
||
6723 |
prevDir := nil. |
|
6724 |
sel do:[:fn | |
|
6725 |
|nameArg dir| |
|
6726 |
||
6727 |
nameArg := '"',fn baseName,'"'. |
|
6728 |
dir := fn directory. |
|
6729 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6730 |
"/ flush |
|
6731 |
cmd notNil ifTrue:[ |
|
6732 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6733 |
cmd := nil. |
|
6734 |
] |
|
6735 |
]. |
|
6736 |
cmd isNil ifTrue:[ |
|
6737 |
cmd := 'hg status'. |
|
6738 |
]. |
|
6739 |
cmd := cmd,' ',nameArg. |
|
6740 |
prevDir := dir. |
|
6741 |
]. |
|
6742 |
cmd notNil ifTrue:[ |
|
6743 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6744 |
cmd := nil. |
|
6745 |
]. |
|
6746 |
]. |
|
6747 |
||
6748 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg status'. |
|
6749 |
||
6750 |
"Created: / 15-01-2012 / 19:43:08 / cg" |
|
3892 | 6751 |
! ! |
6752 |
||
4849 | 6753 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
3892 | 6754 |
|
8510 | 6755 |
allFilesInSelectedDirectoriesForWhich:aBlock |
17868 | 6756 |
^ self class allFilesInDirectories:(self currentSelectedDirectories) forWhich:aBlock |
8510 | 6757 |
! |
6758 |
||
18426 | 6759 |
changeSetFromGSTSource |
6760 |
GSTFileReader isNil ifTrue:[ Smalltalk loadPackage:'stx:libbasic2']. |
|
6761 |
||
6762 |
self withWaitCursorDo:[ |
|
6763 |
self currentSelectedFiles do:[:fn | |
|
6764 |
|changeSet| |
|
6765 |
||
18746 | 6766 |
(fn suffix sameAs:'st') ifTrue:[ |
18426 | 6767 |
changeSet := GSTFileReader new changeSetFromStream:fn readStream. |
6768 |
(Tools::ChangeSetBrowser2 |
|
6769 |
on: changeSet |
|
6770 |
label: fn baseName) |
|
6771 |
beTwoColumn; |
|
6772 |
targetNamespace:nil; |
|
6773 |
targetPackage:nil; |
|
6774 |
open |
|
6775 |
] |
|
6776 |
] |
|
6777 |
] |
|
6778 |
||
6779 |
"Created: / 23-09-2018 / 01:32:46 / Claus Gittinger" |
|
18746 | 6780 |
"Modified: / 01-05-2019 / 11:21:34 / Claus Gittinger" |
18426 | 6781 |
! |
6782 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6783 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6784 |
|conv| |
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 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6787 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6788 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6789 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6790 |
"/ 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
|
6791 |
"/ 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
|
6792 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6793 |
conv := OrderedCollection new. |
4722 | 6794 |
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
|
6795 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6796 |
outSuffix = 'png' ifTrue:[ |
4722 | 6797 |
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
|
6798 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6799 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6800 |
outSuffix = 'gif' ifTrue:[ |
4722 | 6801 |
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
|
6802 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6803 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6804 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 6805 |
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
|
6806 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6807 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6808 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 6809 |
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
|
6810 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6811 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6812 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6813 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6814 |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6815 |
convertImageFrom:fileName to:outFile onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6816 |
|writer image outSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6817 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6818 |
outSuffix := outFile suffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6819 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6820 |
((writer := MIMETypes imageReaderForSuffix:outSuffix) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6821 |
and:[ (image := Image fromFile:fileName) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6822 |
and:[ writer canRepresent:image ]]) ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6823 |
"/ can do it with Smalltalk tools |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6824 |
writer save:image onFile:outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6825 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6826 |
"/ use external tools (pbm-package, if available) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6827 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6828 |
convertImageUsingExternalFileToolsFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6829 |
toSuffix:outSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6830 |
onError:exceptionBlock. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6831 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6832 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6833 |
"Created: / 20-05-2010 / 11:12:36 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6834 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6835 |
|
4367 | 6836 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6837 |
self convertImageToSuffix:'gif' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6838 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6839 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6840 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6841 |
self convertImageToSuffix:'jpg' |
4531 | 6842 |
! |
6843 |
||
6844 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6845 |
self convertImageToSuffix:'png' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6846 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6847 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6848 |
convertImageToSuffix:outSuffix |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6849 |
|outFile filesToConvert| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6850 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6851 |
self withActivityIndicationDo:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6852 |
filesToConvert := self currentSelectedObjects copy. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6853 |
filesToConvert do:[:fileName | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6854 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6855 |
|
18453 | 6856 |
fileName isRegularFile ifTrue:[ |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6857 |
|skip| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6858 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6859 |
skip := false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6860 |
outFile := fileName withSuffix:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6861 |
outFile exists ifTrue:[ |
4722 | 6862 |
|answer| |
6863 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6864 |
answer := Dialog |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6865 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6866 |
default:false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6867 |
answer isNil ifTrue:[AbortSignal raise]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6868 |
answer ifFalse:[ skip := true ]. |
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 |
skip ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6871 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6872 |
convertImageFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6873 |
to:outFile |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6874 |
onError:[:errMsg | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6875 |
filesToConvert size == 1 ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6876 |
Dialog warn:errMsg |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6877 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6878 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6879 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6880 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6881 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6882 |
]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6883 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6884 |
self updateAndSelect:nil. |
4367 | 6885 |
] |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6886 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6887 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6888 |
self notify:nil. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6889 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6890 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6891 |
"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
|
6892 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6893 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6894 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6895 |
self convertImageToSuffix:'xpm' |
4367 | 6896 |
! |
6897 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6898 |
convertImageUsingExternalFileToolsFrom:fileName toSuffix:outSuffix onError:exceptionBlock |
13121 | 6899 |
|inFile outFile chainOfConversions conversionStream |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6900 |
eachConversionSuffixCommandPair eachConversionCommand eachConversionSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6901 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6902 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6903 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6904 |
chainOfConversions isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6905 |
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
|
6906 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6907 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6908 |
conversionStream := chainOfConversions readStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6909 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6910 |
inFile := fileName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6911 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6912 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6913 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6914 |
eachConversionCommand == #readToXPM ifTrue:[ |
13121 | 6915 |
|image tempStreamXPM| |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6916 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6917 |
image := Image fromFile:(inFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6918 |
image isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6919 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6920 |
^ false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6921 |
]. |
13121 | 6922 |
tempStreamXPM := FileStream newTemporaryWithSuffix:'xpm'. |
6923 |
XPMReader save:image onStream:tempStreamXPM. |
|
6924 |
tempStreamXPM close. |
|
6925 |
inFile := tempStreamXPM fileName. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6926 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6927 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6928 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6929 |
[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6930 |
|command errOutput errMsg| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6931 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6932 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6933 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6934 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6935 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6936 |
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
|
6937 |
|
13121 | 6938 |
outFile := (FileStream newTemporaryWithSuffix:eachConversionSuffix) close pathName. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6939 |
command := eachConversionCommand |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6940 |
bindWith:(inFile pathName) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6941 |
with:(outFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6942 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6943 |
errOutput := String writeStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6944 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6945 |
(OperatingSystem executeCommand:command errorTo:errOutput) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6946 |
errMsg := resources |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6947 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6948 |
with:inFile baseName allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6949 |
with:eachConversionSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6950 |
with:eachConversionCommand allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6951 |
with:errOutput contents. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6952 |
exceptionBlock value:errMsg. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6953 |
|
18024 | 6954 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
6955 |
outFile remove. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6956 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6957 |
]. |
18024 | 6958 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6959 |
inFile := outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6960 |
eachConversionSuffixCommandPair := conversionStream next |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6961 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6962 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6963 |
] ifCurtailed:[ |
18024 | 6964 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
6965 |
outFile remove. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6966 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6967 |
^ true. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6968 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6969 |
"Created: / 20-05-2010 / 11:05:50 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6970 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6971 |
|
3892 | 6972 |
createProjectAndOpenProjectBrowser |
6973 |
|nm f s directory| |
|
6974 |
||
6975 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 6976 |
directory := self currentDirectory. |
3892 | 6977 |
nm := directory baseName. |
6978 |
f := (directory construct:nm) withSuffix:'prj'. |
|
6979 |
f exists ifTrue:[ |
|
4414 | 6980 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
6981 |
^ self. |
|
3892 | 6982 |
]. |
6983 |
s := f writeStream. |
|
6984 |
s nextPutAll:' |
|
6985 |
name ''' , nm , ''' |
|
6986 |
type #classLibrary |
|
6987 |
package #''private:' , nm , ''' |
|
6988 |
prerequisites nil |
|
6989 |
||
6990 |
classes #( ) |
|
6991 |
'. |
|
6992 |
s close. |
|
6993 |
ProjectBrowser openOnFile:f. |
|
6994 |
! |
|
6995 |
||
5880 | 6996 |
doExecuteCommand |
6997 |
"execute an OperatingSystem-command" |
|
6998 |
||
6999 |
| action fileName| |
|
7000 |
||
7001 |
fileName := self firstSelectedFile. |
|
7002 |
action := [:command | |
|
7003 |
self addToCommandHistory:command for:fileName. |
|
7004 |
self executeCommand:command. |
|
7005 |
]. |
|
7006 |
self askForCommandFor:fileName thenDo:action |
|
7007 |
! |
|
7008 |
||
7009 |
doExecuteScript |
|
16941 | 7010 |
"execute a Smalltalk script" |
5880 | 7011 |
|
7012 |
|textHolder dialog template dummyClass dummyInstance| |
|
7013 |
||
7014 |
template := |
|
7015 |
'"/ Smalltalk script: |
|
7016 |
||
16084 | 7017 |
"/ the following variables are accessible: |
5880 | 7018 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
7019 |
"/ selectedFiles (= ...) |
|
7020 |
"/ |
|
7021 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
7022 |
"/ |
|
7023 |
"/ Useful operations are: |
|
7024 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
7025 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
7026 |
"/ directory directory |
|
7027 |
"/ |
|
7028 |
"/ example: move all files which match a aarticular pattern to |
|
7029 |
"/ a separate directory: |
|
7030 |
"/ |
|
7031 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
7032 |
"/ |
|
7033 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
7034 |
"/ |
|
7035 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
7036 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
7037 |
"/ idx := eachBaseNameString indexOf:$_. |
|
7038 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
7039 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
7040 |
"/ newDir := directory construct:prefix. |
|
7041 |
"/ newDir exists ifFalse:[ |
|
7042 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
7043 |
"/ newDir makeDirectory. |
|
7044 |
"/ ]. |
|
7045 |
"/ ]. |
|
7046 |
"/ newDir exists ifTrue:[ |
|
7047 |
"/ oldFile := directory construct:eachBaseNameString. |
|
7048 |
"/ newFile := newDir construct:rest. |
|
7049 |
"/ oldFile moveTo:newFile |
|
7050 |
"/ ] |
|
7051 |
"/ ] |
|
7052 |
"/ ] |
|
7053 |
'. |
|
7054 |
||
7055 |
LastScriptBlockString isNil ifTrue:[ |
|
7056 |
LastScriptBlockString := template. |
|
7057 |
]. |
|
7058 |
||
7059 |
textHolder := ValueHolder new. |
|
7060 |
dialog := Dialog |
|
7061 |
forRequestText:(resources string:'Enter script') |
|
7062 |
editViewClass:CodeView |
|
7063 |
lines:25 |
|
7064 |
columns:70 |
|
7065 |
initialAnswer:LastScriptBlockString |
|
7066 |
model:textHolder. |
|
7067 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
7068 |
dialog open. |
|
7069 |
dialog accepted ifFalse:[^ self]. |
|
7070 |
||
7071 |
LastScriptBlockString := textHolder value. |
|
7072 |
||
7073 |
Class classConventionViolationConfirmationQuerySignal |
|
7074 |
answer:true |
|
7075 |
do:[ |
|
7076 |
dummyClass := Object class |
|
7077 |
name:#Dummy |
|
7078 |
inEnvironment:nil |
|
7079 |
subclassOf:Object |
|
7080 |
instanceVariableNames:'directory selectedFiles' |
|
7081 |
variable:false |
|
7082 |
words:true |
|
7083 |
pointers:true |
|
7084 |
classVariableNames:'' |
|
7085 |
poolDictionaries:'' |
|
7086 |
category:#dummyCategory |
|
7087 |
comment:nil |
|
7088 |
changed:true. |
|
7089 |
]. |
|
7090 |
||
7091 |
dummyInstance := dummyClass basicNew. |
|
7092 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
7093 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
7094 |
||
7095 |
Compiler |
|
7096 |
evaluate:textHolder value |
|
7097 |
in:nil |
|
7098 |
receiver:dummyInstance |
|
7099 |
notifying:nil |
|
7100 |
logged:false |
|
7101 |
ifFail:[] |
|
7102 |
compile:true. |
|
7103 |
||
7104 |
"/ fileName := self firstSelectedFile. |
|
7105 |
"/ action := [:command | |
|
7106 |
"/ self addToCommandHistory:command for:fileName. |
|
7107 |
"/ self executeCommand:command. |
|
7108 |
"/ ]. |
|
7109 |
"/ self askForCommandFor:fileName thenDo:action |
|
7110 |
! |
|
7111 |
||
4230 | 7112 |
doMake |
7938 | 7113 |
|dir cmd| |
4230 | 7114 |
|
13856 | 7115 |
cmd := self makeCommandHolder value. |
7116 |
||
7117 |
"Make" |
|
7118 |
cmd = 'make' ifTrue:[ |
|
7119 |
dir := self theSingleSelectedDirectoryOrNil. |
|
7120 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
7121 |
dir notNil ifTrue:[ |
|
7122 |
(dir construct:'bmake.bat') exists ifTrue:[ |
|
7123 |
cmd := 'bmake.bat'. |
|
7124 |
] |
|
7938 | 7125 |
] |
13856 | 7126 |
]. |
7127 |
self executeCommand:cmd. |
|
7128 |
^self. |
|
7129 |
]. |
|
7130 |
||
7131 |
"Apache ant" |
|
7132 |
cmd = 'ant' ifTrue:[ |
|
7133 |
self executeCommand:cmd. |
|
7134 |
^self. |
|
7135 |
]. |
|
7136 |
||
7137 |
"Add more here..." |
|
7138 |
||
7139 |
"Modified (comment): / 13-04-2012 / 17:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4230 | 7140 |
! |
7141 |
||
8256 | 7142 |
doOpenCBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7143 |
"the CBrowser is an eXept-internal C-language IDE tool. |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7144 |
(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
|
7145 |
20 years ago ;-)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7146 |
|
8256 | 7147 |
|destDir| |
7148 |
||
18433 | 7149 |
((Smalltalk at:#'CBrowser') isNil or:[ (Smalltalk at:#'CBrowser::Browser') isNil ]) ifTrue:[ |
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7150 |
Smalltalk loadPackage:'exept:CC' |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7151 |
]. |
8256 | 7152 |
destDir := self currentDirectory. |
18433 | 7153 |
(Smalltalk at:#'CBrowser::Browser') openIn:destDir pathName |
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7154 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7155 |
"Modified: / 04-10-2011 / 13:41:31 / cg" |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7156 |
"Modified (comment): / 27-07-2012 / 20:41:40 / cg" |
18433 | 7157 |
"Modified: / 26-09-2018 / 12:37:34 / Claus Gittinger" |
8256 | 7158 |
! |
7159 |
||
7829 | 7160 |
doOpenExplorer |
18433 | 7161 |
"corresponding menu item is visible on a windows machine only" |
7162 |
||
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7163 |
self currentDirectory asFilename openExplorer |
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7164 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7165 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
18433 | 7166 |
"Modified (comment): / 26-09-2018 / 12:38:08 / Claus Gittinger" |
7829 | 7167 |
! |
7168 |
||
12473 | 7169 |
doOpenFinder |
18433 | 7170 |
"corresponding menu item is visible on a mac only" |
7171 |
||
12473 | 7172 |
self currentDirectory asFilename openFinder |
7173 |
||
7174 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
|
18433 | 7175 |
"Modified (comment): / 26-09-2018 / 12:38:00 / Claus Gittinger" |
12473 | 7176 |
! |
7177 |
||
18432 | 7178 |
doOpenGDBApplication |
7179 |
"the GDBApplication is a cg-private debugging tool" |
|
7180 |
||
7181 |
|destDir| |
|
7182 |
||
7183 |
(Smalltalk at:#'GDBApplication') isNil ifTrue:[ |
|
7184 |
Smalltalk loadPackage:'cg:tools' |
|
7185 |
]. |
|
7186 |
destDir := self currentDirectory. |
|
7187 |
(Smalltalk at:#'GDBApplication') openOn:destDir |
|
7188 |
||
7189 |
"Created: / 26-09-2018 / 12:09:32 / Claus Gittinger" |
|
7190 |
! |
|
7191 |
||
12811 | 7192 |
doOpenMonticelloBrowser |
18433 | 7193 |
(Smalltalk at:#'MCMczReader') isNil ifTrue:[ |
7194 |
Smalltalk loadPackage:'stx:goodies/monticello'. |
|
7195 |
(Smalltalk at:#'MCMczReader') isNil ifTrue:[ |
|
7196 |
Dialog warn:'Failed to load the monticello package'. |
|
7197 |
^ self. |
|
7198 |
]. |
|
7199 |
]. |
|
12874
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
7200 |
|
12811 | 7201 |
self withWaitCursorDo:[ |
7202 |
self currentSelectedFiles do:[:fn | |
|
7203 |
|version snapshot| |
|
7204 |
||
18746 | 7205 |
(fn suffix sameAs:'mcz') ifTrue:[ |
18433 | 7206 |
version := (Smalltalk at:#'MCMczReader') versionFromFile:fn. |
12811 | 7207 |
snapshot := version snapshot. |
7208 |
(Tools::ChangeSetBrowser2 |
|
7209 |
on: snapshot asChangeSet |
|
7210 |
label: version info name) |
|
7211 |
beTwoColumn; |
|
7212 |
targetNamespace:nil; |
|
7213 |
targetPackage:nil; |
|
7214 |
open |
|
7215 |
] |
|
7216 |
] |
|
7217 |
] |
|
18433 | 7218 |
|
18746 | 7219 |
"Modified: / 01-05-2019 / 11:23:23 / Claus Gittinger" |
12811 | 7220 |
! |
7221 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7222 |
doOpenSettings |
8168 | 7223 |
self openSettingsDialog |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7224 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7225 |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7226 |
doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7227 |
"open using win32-shell" |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7228 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7229 |
|fileName| |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7230 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7231 |
fileName := self firstSelectedFile. |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7232 |
fileName notNil ifTrue:[ |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7233 |
OperatingSystem |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7234 |
openApplicationForDocument:fileName pathName |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7235 |
operation:#open |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7236 |
] |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7237 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7238 |
"Modified: / 21-07-2012 / 12:26:10 / cg" |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7239 |
! |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7240 |
|
7104 | 7241 |
editMode:aSymbol |
7242 |
self |
|
7243 |
applicationNamed:#FileApplicationNoteBook |
|
7244 |
ifPresentDo:[:appl | |
|
7245 |
|subApp| |
|
7246 |
||
7247 |
subApp := appl selectedApplication. |
|
7248 |
subApp notNil ifTrue:[ |
|
7249 |
^ subApp perform:aSymbol |
|
7250 |
] |
|
7251 |
]. |
|
7252 |
||
7253 |
"Created: / 11-09-2006 / 12:42:08 / cg" |
|
7254 |
! |
|
7255 |
||
7256 |
editModeInsert |
|
7257 |
self editMode:#editModeInsert |
|
7258 |
||
7259 |
"Created: / 11-09-2006 / 12:40:36 / cg" |
|
7260 |
! |
|
7261 |
||
7262 |
editModeInsertAndSelect |
|
7263 |
self editMode:#editModeInsertAndSelect |
|
7264 |
||
7265 |
"Created: / 11-09-2006 / 12:40:45 / cg" |
|
7266 |
! |
|
7267 |
||
7268 |
editModeOverwrite |
|
7269 |
self editMode:#editModeOverwrite |
|
7270 |
||
7271 |
"Modified: / 11-09-2006 / 12:42:26 / cg" |
|
7272 |
! |
|
7273 |
||
15528 | 7274 |
fetchFileByURL |
7275 |
|url destinationFilename| |
|
7276 |
||
17818 | 7277 |
url := Dialog request:(resources string:'URL to Fetch:') initialAnswer:'http://host/path'. |
15528 | 7278 |
url isEmptyOrNil ifTrue:[^ self]. |
7279 |
url := url asURL. |
|
7280 |
||
17818 | 7281 |
destinationFilename := Dialog request:(resources string:'Download As:') initialAnswer:(UnixFilename named:url path) baseName. |
15528 | 7282 |
destinationFilename isEmptyOrNil ifTrue:[^ self]. |
7283 |
||
7284 |
destinationFilename := self currentDirectory asFilename / destinationFilename. |
|
7285 |
destinationFilename exists ifTrue:[ |
|
7286 |
|answer| |
|
7287 |
||
7288 |
answer := Dialog |
|
7289 |
confirm:(resources string:'Overwrite existing %1 ?' with:destinationFilename baseName allBold) |
|
7290 |
default:false. |
|
7291 |
answer ~~ true ifTrue:[^ self]. |
|
7292 |
]. |
|
7293 |
self withActivityIndicationDo:[ |
|
7294 |
self notify:(resources string:'Fetching %1' with:url). |
|
7295 |
HTTPInterface get:url destinationFile:destinationFilename. |
|
7296 |
self notify:nil. |
|
7297 |
] |
|
7298 |
||
17818 | 7299 |
"Modified: / 29-11-2017 / 12:26:13 / cg" |
15528 | 7300 |
! |
7301 |
||
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7302 |
fileContentsAsByteArray |
17769 | 7303 |
|file fileSize| |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7304 |
|
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7305 |
file := self firstSelectedFile. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7306 |
file isNil ifTrue:[^ self ]. |
17769 | 7307 |
|
7308 |
file := file asFilename. |
|
7309 |
||
7310 |
(fileSize := file fileSize) > (1024*1024) ifTrue:[ |
|
7311 |
fileSize > (128*1024*1024) ifTrue:[ |
|
11889 | 7312 |
Dialog warn:(resources string:'File is too big'). |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7313 |
^ self. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7314 |
]. |
17769 | 7315 |
(Dialog confirm:(resources |
7316 |
string:'File is big (%1) - proceed?' |
|
7317 |
with:(UnitConverter fileSizeStringFor:fileSize)) |
|
7318 |
) ifFalse:[^ self]. |
|
7319 |
]. |
|
7320 |
file binaryContentsOfEntireFile inspect |
|
7321 |
||
7322 |
"Modified: / 19-11-2017 / 14:58:43 / cg" |
|
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7323 |
! |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7324 |
|
3892 | 7325 |
fileFileIn |
7326 |
"fileIn the selected file(s)" |
|
7327 |
||
7328 |
self fileFileInLazy:false |
|
7329 |
! |
|
7330 |
||
7324 | 7331 |
fileFileIn:aFilename lazy:lazy |
7332 |
"fileIn a file" |
|
7333 |
||
7334 |
self withActivityIndicationDo:[ |
|
7335 |
self notify:('File in:', aFilename asFilename baseName). |
|
7336 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7337 |
self notify:nil. |
|
7338 |
] |
|
7339 |
||
7340 |
"Created: / 20-09-2006 / 14:28:35 / cg" |
|
7341 |
! |
|
7342 |
||
3892 | 7343 |
fileFileInLazy |
7344 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
7345 |
||
7346 |
self fileFileInLazy:true |
|
7347 |
! |
|
7348 |
||
7349 |
fileFileInLazy:lazy |
|
7350 |
"fileIn the selected file(s)" |
|
7351 |
||
7324 | 7352 |
self currentSelectedFiles do:[:fileName | |
7353 |
self fileIn:fileName lazy:lazy |
|
7354 |
]. |
|
7355 |
||
7356 |
"Modified: / 20-09-2006 / 14:29:24 / cg" |
|
3892 | 7357 |
! |
7358 |
||
12497 | 7359 |
fileFileInPackage |
7360 |
"assuming the current directory is a package directory, load it" |
|
7361 |
||
7362 |
|packageDir dir path top packageID| |
|
7363 |
||
7364 |
"/ find a reasonable package-id (walk up until we find stx) |
|
7365 |
path := ''. |
|
7366 |
dir := packageDir := self currentDirectory. |
|
7367 |
||
7368 |
top := (Smalltalk projectDirectoryForPackage:'stx') asFilename. |
|
7369 |
[ (dir / 'stx') = top ] whileFalse:[ |
|
7370 |
path := dir baseName , '/' , path. |
|
7371 |
dir := dir directory. |
|
7372 |
dir isNil ifTrue:[ |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7373 |
Dialog warn:'Could not find a path from "stx" to the current directory.'. |
12497 | 7374 |
"/ should ask the user for a packageID and proceed... |
7375 |
^ self. |
|
7376 |
]. |
|
7377 |
]. |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7378 |
packageID := path copyButLast:1. |
12497 | 7379 |
Smalltalk loadPackage:packageID fromDirectory:packageDir asAutoloaded:true |
7380 |
! |
|
7381 |
||
3892 | 7382 |
fileFileInToNameSpace |
7383 |
"fileIn the selected file(s)<into a nameSpace" |
|
7384 |
||
7385 |
|ns listOfKnownNameSpaces| |
|
7386 |
||
7387 |
listOfKnownNameSpaces := Set new. |
|
7388 |
NameSpace |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
7389 |
allNameSpaces |
4414 | 7390 |
do:[:eachNameSpace | |
7391 |
listOfKnownNameSpaces add:eachNameSpace name |
|
7392 |
]. |
|
3892 | 7393 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
7394 |
||
7395 |
ns := Dialog |
|
4414 | 7396 |
request:'During fileIn, new classes are created in nameSpace:' |
7397 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
7398 |
list:listOfKnownNameSpaces. |
|
3892 | 7399 |
ns isEmptyOrNil ifTrue:[^ self]. |
7400 |
||
7401 |
LastEnforcedNameSpace := ns. |
|
7402 |
ns := NameSpace name:ns. |
|
7403 |
||
7404 |
Class nameSpaceQuerySignal |
|
4414 | 7405 |
answer:ns |
7406 |
do:[ |
|
7407 |
self fileFileInLazy:false |
|
7408 |
] |
|
3892 | 7409 |
! |
7410 |
||
7411 |
fileFindAllDuplicates |
|
7412 |
"scan directory and all subdirs for duplicate files" |
|
7413 |
||
7414 |
|fileNames dir infoDir filesBySize |
|
18856 | 7415 |
result info dirPrefix stream textBox maxLength directories| |
3892 | 7416 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7417 |
self withActivityIndicationDo:[ |
4414 | 7418 |
result := Dictionary new. |
7419 |
directories := self currentSelectedDirectories. |
|
7420 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 7421 |
|
4414 | 7422 |
dir := directories first. |
3892 | 7423 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7424 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7425 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7426 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 7427 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
7428 |
with:ex pathName |
|
7429 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7430 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7431 |
]. |
4765 | 7432 |
fileNames := fileNames |
7433 |
collect:[:fn | dir construct:fn] |
|
18453 | 7434 |
thenSelect:[:fn | fn isRegularFile]. |
3892 | 7435 |
|
7436 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 7437 |
infoDir := Dictionary new. |
7438 |
fileNames do:[:fn | |
|
7439 |
infoDir at:fn put:(fn fileSize) |
|
7440 |
]. |
|
7441 |
||
14497 | 7442 |
"/ for each, get the file's size. |
4414 | 7443 |
"/ in a first pass, look for files of the same size and |
7444 |
"/ compare them ... |
|
3892 | 7445 |
|
7446 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 7447 |
filesBySize := Dictionary new. |
7448 |
infoDir keysAndValuesDo:[:fn :sz | |
|
7449 |
|entry| |
|
7450 |
||
7451 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7452 |
entry add:fn. |
|
7453 |
]. |
|
7454 |
||
7455 |
"/ any of same size ? |
|
3892 | 7456 |
|
7457 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 7458 |
filesBySize do:[:entry | |
7459 |
|files| |
|
7460 |
||
7461 |
entry size > 1 ifTrue:[ |
|
7462 |
files := entry asArray. |
|
7463 |
1 to:files size-1 do:[:idx1 | |
|
7464 |
idx1+1 to:files size do:[:idx2 | |
|
7465 |
|fn1 fn2| |
|
7466 |
||
7467 |
fn1 := files at:idx1. |
|
7468 |
fn2 := files at:idx2. |
|
3892 | 7469 |
|
7470 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 7471 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
7472 |
"/ compare the files |
|
7473 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7474 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 7475 |
result at:fn1 put:fn2. |
7476 |
] |
|
7477 |
] |
|
7478 |
] |
|
7479 |
] |
|
7480 |
] |
|
7481 |
]. |
|
3892 | 7482 |
|
7483 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 7484 |
dirPrefix := dir pathName. |
7485 |
result := result associations. |
|
7486 |
result := result collect:[:assoc | |
|
7487 |
|f1 f2| |
|
7488 |
||
7489 |
f1 := assoc key name. |
|
7490 |
f2 := assoc value name. |
|
7491 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
7492 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
7493 |
]. |
|
7494 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
7495 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
7496 |
]. |
|
7497 |
f1 < f2 ifTrue:[ |
|
7498 |
f2 -> f1 |
|
7499 |
] ifFalse:[ |
|
7500 |
f1 -> f2 |
|
7501 |
] |
|
7502 |
]. |
|
7503 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
7504 |
||
7505 |
info := OrderedCollection new. |
|
7506 |
result do:[:assoc | |
|
7507 |
info add:(assoc key , ' same as ' , assoc value) |
|
7508 |
]. |
|
7509 |
info isEmpty ifTrue:[ |
|
11889 | 7510 |
Dialog information:(resources string:'No duplicate files found.'). |
5543 | 7511 |
^ self. |
4414 | 7512 |
]. |
3892 | 7513 |
]. |
7514 |
||
15589 | 7515 |
stream := CharacterWriteStream new. |
11688 | 7516 |
stream nextPutAllLines:info. |
5542 | 7517 |
|
3892 | 7518 |
textBox := TextBox new. |
7519 |
textBox initialText:(stream contents). |
|
5542 | 7520 |
stream close. |
11889 | 7521 |
textBox title:(resources string:'File duplicates in directory: %1' with:dir asString). |
3892 | 7522 |
textBox readOnly:true. |
7523 |
textBox noCancel. |
|
11889 | 7524 |
textBox label:(resources string:'Duplicates in %1' with:dir asString). |
3892 | 7525 |
maxLength := 10. |
7526 |
info do:[: el | |
|
4414 | 7527 |
maxLength := maxLength max:(el size). |
3892 | 7528 |
]. |
7529 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 7530 |
textBox maxExtent:Screen current extent. |
7531 |
textBox openModeless. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7532 |
|
11688 | 7533 |
"Modified: / 27-07-2012 / 09:29:00 / cg" |
18856 | 7534 |
"Modified (format): / 28-06-2019 / 08:37:14 / Claus Gittinger" |
3892 | 7535 |
! |
7536 |
||
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7537 |
fileFindDuplicateFile |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7538 |
"scan directory for duplicates of the selected files" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7539 |
|
10306 | 7540 |
|files filesBySize samePerFile stream textBox mustHaveMatches| |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7541 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7542 |
files := self currentSelectedFiles. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7543 |
files isEmpty ifTrue:[^ self]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7544 |
|
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7545 |
self withWaitCursorDo:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7546 |
filesBySize := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7547 |
files do:[:fn | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7548 |
|sz entry| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7549 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7550 |
sz := fn asFilename fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7551 |
(filesBySize at:sz ifAbsentPut:[Set new]) add:fn. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7552 |
]. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7553 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7554 |
samePerFile := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7555 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7556 |
self currentSelectedDirectories do:[:eachDir | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7557 |
eachDir recursiveDirectoryContentsAsFilenamesDo:[:eachFile | |
18453 | 7558 |
eachFile isRegularFile ifTrue:[ |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7559 |
|sz possibleMatches| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7560 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7561 |
sz := eachFile fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7562 |
possibleMatches := filesBySize at:sz ifAbsent:nil. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7563 |
possibleMatches notNil ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7564 |
possibleMatches do:[:eachFileWithSameSize | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7565 |
eachFileWithSameSize ~= eachFile ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7566 |
(eachFileWithSameSize sameContentsAs:eachFile) ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7567 |
(samePerFile at:eachFileWithSameSize ifAbsentPut:[Set new]) add:eachFile |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7568 |
] |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7569 |
] |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7570 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7571 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7572 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7573 |
] |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7574 |
]. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7575 |
]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7576 |
|
15589 | 7577 |
stream := CharacterWriteStream with:'Duplicates:'. |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7578 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7579 |
do:[:origFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7580 |
|sameFiles| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7581 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7582 |
sameFiles := samePerFile at:origFile. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7583 |
stream nextPutLine:origFile baseName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7584 |
(sameFiles asOrderedCollection collect:[:each | each baseName]) sort do:[:eachSameName | |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7585 |
stream nextPutAll:' '; nextPutLine:eachSameName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7586 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7587 |
]. |
10306 | 7588 |
stream nextPutLine:'Files without duplicates:'. |
7589 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7590 |
do:[:origFile | |
|
7591 |
|sameFiles| |
|
7592 |
||
7593 |
sameFiles := samePerFile at:origFile. |
|
7594 |
sameFiles isEmpty ifTrue:[ |
|
7595 |
stream nextPutLine:origFile baseName. |
|
7596 |
]. |
|
7597 |
]. |
|
7598 |
||
7599 |
mustHaveMatches := Dialog request:'Must have for duplicates matching ?:' initialAnswer:(LastMustMatchPattern ? '[a-z][a-z][a-z]_[0-9][0-9][0-9].*'). |
|
7600 |
mustHaveMatches notEmptyOrNil ifTrue:[ |
|
7601 |
LastMustMatchPattern := mustHaveMatches. |
|
7602 |
||
7603 |
stream nextPutLine:'Files without duplicates in xxx_nnn.jpg:'. |
|
7604 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7605 |
do:[:origFile | |
|
7606 |
|sameFiles| |
|
7607 |
||
7608 |
sameFiles := samePerFile at:origFile. |
|
7609 |
sameFiles notEmpty ifTrue:[ |
|
7610 |
(sameFiles contains:[:file | mustHaveMatches match:file baseName]) ifFalse:[ |
|
7611 |
stream nextPutLine:origFile baseName. |
|
7612 |
] |
|
7613 |
]. |
|
7614 |
]. |
|
7615 |
]. |
|
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7616 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7617 |
textBox := TextBox new. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7618 |
textBox initialText:(stream contents). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7619 |
textBox title:'Files with same contents'. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7620 |
textBox readOnly:true. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7621 |
textBox noCancel. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7622 |
textBox extent:(350@400). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7623 |
textBox maxExtent:Screen current extent. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7624 |
textBox openModeless. "/ showAtPointer. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7625 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7626 |
"Created: / 11-07-2011 / 12:39:44 / cg" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7627 |
! |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7628 |
|
3892 | 7629 |
fileFindDuplicates |
7630 |
"scan directory for duplicate files" |
|
7631 |
||
17869 | 7632 |
|directories duplicates info |
7633 |
commonDir prefixSize stream titleStream textBox maxLength| |
|
8510 | 7634 |
|
7635 |
directories := self currentSelectedDirectories. |
|
17869 | 7636 |
duplicates := self class fileFindDuplicatesIn:directories. |
7637 |
duplicates isEmpty ifTrue:[ |
|
17868 | 7638 |
Dialog information:'No duplicate files found.'. |
7639 |
^ self. |
|
7640 |
]. |
|
7641 |
||
7642 |
info := OrderedCollection new. |
|
17869 | 7643 |
commonDir := self getBestDirectory. |
7644 |
prefixSize := commonDir asString size. |
|
7645 |
duplicates do:[:assoc | |
|
17871 | 7646 |
|dup orig| |
7647 |
||
7648 |
dup := assoc key. |
|
7649 |
orig := assoc value. |
|
17868 | 7650 |
prefixSize > 1 ifTrue:[ |
17871 | 7651 |
dup := dup pathNameRelativeFrom:commonDir. |
7652 |
orig := orig pathNameRelativeFrom:commonDir. |
|
17869 | 7653 |
"/ fn1 := ('..', (fn1 name copyFrom:(prefixSize + 1))). |
7654 |
"/ fn2 := ('..', (fn2 copyFrom:(prefixSize + 1))). |
|
17868 | 7655 |
]. |
17871 | 7656 |
(dup includes:Character space) ifTrue:[ |
7657 |
dup := '"' , dup , '"' |
|
7658 |
]. |
|
7659 |
(orig includes:Character space) ifTrue:[ |
|
7660 |
orig := '"' , orig , '"' |
|
7661 |
]. |
|
7662 |
info add:(dup , ' duplicate of ' , orig) |
|
17868 | 7663 |
]. |
7664 |
||
15589 | 7665 |
stream := CharacterWriteStream new. |
11688 | 7666 |
stream nextPutAllLines:info. |
7667 |
||
17869 | 7668 |
titleStream := CharacterWriteStream with:'File duplicates in director'. |
3892 | 7669 |
directories size == 1 ifTrue:[ |
12602 | 7670 |
titleStream nextPutAll:'y: '; nextPutAll: directories first asString. |
3892 | 7671 |
] ifFalse:[ |
4535 | 7672 |
titleStream nextPutLine:'ies: '. |
4355 | 7673 |
directories do:[:dir| |
17868 | 7674 |
prefixSize > 1 ifTrue:[ |
4355 | 7675 |
titleStream nextPutAll:'..'. |
17868 | 7676 |
titleStream nextPutLine:((dir asString) copyFrom:(prefixSize + 1)). |
4355 | 7677 |
] ifFalse:[ |
4535 | 7678 |
titleStream nextPutLine:(dir asString). |
4355 | 7679 |
]. |
7680 |
] |
|
3892 | 7681 |
]. |
5543 | 7682 |
|
3892 | 7683 |
textBox := TextBox new. |
7684 |
textBox initialText:(stream contents). |
|
7685 |
textBox title:(titleStream contents). |
|
7686 |
textBox readOnly:true. |
|
7687 |
textBox noCancel. |
|
14715 | 7688 |
stream := WriteStream on:''. |
7689 |
stream nextPutAll:'Duplicates in '. |
|
4170 | 7690 |
directories do:[ :aDirectory | |
4355 | 7691 |
stream nextPutAll:aDirectory baseName. |
7692 |
stream space. |
|
4050 | 7693 |
]. |
4170 | 7694 |
textBox label:stream contents. |
3892 | 7695 |
maxLength := 10. |
7696 |
info do:[: el | |
|
4355 | 7697 |
maxLength := maxLength max:(el size). |
3892 | 7698 |
]. |
5092 | 7699 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
7700 |
textBox maxExtent:Screen current extent. |
|
17869 | 7701 |
textBox addButton:(Button |
7702 |
label:(resources string:'Remove Duplicates') |
|
7703 |
action:[ |
|
7704 |
(Dialog confirm:(resources string:'Remove %1 duplicate files?' with:duplicates size)) ifTrue:[ |
|
7705 |
duplicates do:[:eachAssoc | |
|
17871 | 7706 |
eachAssoc key remove |
17869 | 7707 |
]. |
17871 | 7708 |
]. |
7709 |
textBox close. |
|
7710 |
self updateCurrentDirectoryWithReread. |
|
17869 | 7711 |
]). |
4355 | 7712 |
textBox openModeless. "/ showAtPointer. |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7713 |
|
11688 | 7714 |
"Modified: / 27-07-2012 / 09:29:14 / cg" |
3892 | 7715 |
! |
7716 |
||
7717 |
fileFindFile |
|
5961 | 7718 |
|filename| |
7719 |
||
7720 |
filename := self firstSelectedFileName. |
|
7721 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7722 |
filename := Filename homeDirectory. |
3892 | 7723 |
]. |
4101 | 7724 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 7725 |
! |
7726 |
||
8510 | 7727 |
fileFindSimilarImages |
7728 |
"scan directory for similar image files" |
|
7729 |
||
8512 | 7730 |
|result stream textBox directories imageFiles histogramsV histogramsH |
7731 |
similarV similarH similar alreadyPrinted| |
|
8510 | 7732 |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7733 |
self withWaitCursorDo:[ |
8510 | 7734 |
self withActivityIndicationDo:[ |
7735 |
result := Dictionary new. |
|
7736 |
||
7737 |
directories := self currentSelectedDirectories. |
|
7738 |
directories isEmpty ifTrue:[^ self]. |
|
7739 |
||
13714 | 7740 |
imageFiles := self allFilesInSelectedDirectoriesForWhich:[:f | f mimeTypeFromName isImageType]. |
8511 | 7741 |
"/ imageFiles := imageFiles select:[:f | f baseName startsWith:'foo']. |
7742 |
imageFiles sort:[:a :b | a pathName < b pathName]. |
|
7743 |
||
8510 | 7744 |
"/ for each, get the color histogram |
7745 |
histogramsV := Dictionary new. |
|
7746 |
histogramsH := Dictionary new. |
|
7747 |
imageFiles do:[:fn | |
|
7748 |
|hist image| |
|
7749 |
||
7750 |
image := Image fromFile:fn. |
|
7751 |
Transcript showCR:'generating histogram for ',fn baseName. |
|
7752 |
hist := ImageColorHistogram new forImage:image. |
|
7753 |
histogramsV at:fn put:(hist histogramVectorV). |
|
7754 |
histogramsH at:fn put:(hist histogramVectorH). |
|
7755 |
]. |
|
7756 |
||
7757 |
similarH := Dictionary new. |
|
7758 |
similarV := Dictionary new. |
|
7759 |
similar := Dictionary new. |
|
7760 |
||
8512 | 7761 |
(self firstSelectedFile notNil |
7762 |
ifTrue:[ Array with:self firstSelectedFile ] |
|
7763 |
ifFalse:[ imageFiles ]) |
|
7764 |
do:[:eachFile1 | |
|
8510 | 7765 |
|setOfSimilar distancesV distancesH| |
7766 |
||
7767 |
distancesV := OrderedCollection new. |
|
7768 |
distancesH := OrderedCollection new. |
|
7769 |
setOfSimilar := OrderedCollection new. |
|
7770 |
||
7771 |
imageFiles do:[:eachFile2 | |
|
7772 |
|v1 v2 dV dH| |
|
7773 |
||
7774 |
eachFile1 ~= eachFile2 ifTrue:[ |
|
7775 |
v1 := histogramsV at:eachFile1. |
|
7776 |
v2 := histogramsV at:eachFile2. |
|
7777 |
dV := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7778 |
distancesV add:(eachFile2 -> dV). |
|
7779 |
v1 := histogramsH at:eachFile1. |
|
7780 |
v2 := histogramsH at:eachFile2. |
|
7781 |
dH := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7782 |
distancesH add:(eachFile2 -> dH). |
|
7783 |
(dV < 10000 and:[dH < 10000]) ifTrue:[ |
|
8512 | 7784 |
setOfSimilar add:eachFile2->(dV + dH). |
8510 | 7785 |
]. |
7786 |
] |
|
7787 |
]. |
|
7788 |
distancesV sort:[:a1 :a2 | a1 value < a2 value]. |
|
7789 |
distancesH sort:[:a1 :a2 | a1 value < a2 value]. |
|
7790 |
similarV at:eachFile1 put:distancesV. |
|
7791 |
similarH at:eachFile1 put:distancesH. |
|
7792 |
setOfSimilar notEmpty ifTrue:[ similar at:eachFile1 put:setOfSimilar ]. |
|
7793 |
]. |
|
7794 |
||
7795 |
similar isEmpty ifTrue:[ |
|
7796 |
Dialog information:'No similarities found.'. |
|
7797 |
^ self. |
|
7798 |
]. |
|
7799 |
]. |
|
7800 |
||
15589 | 7801 |
stream := CharacterWriteStream new. |
8512 | 7802 |
alreadyPrinted := Set new. |
7803 |
||
7804 |
imageFiles do:[:eachFile | |
|
7805 |
|eachSet| |
|
7806 |
||
7807 |
(alreadyPrinted includes:eachFile) ifFalse:[ |
|
7808 |
eachSet := similar at:eachFile ifAbsent:nil. |
|
7809 |
eachSet notNil ifTrue:[ |
|
7810 |
stream nextPutLine:eachFile pathName. |
|
7811 |
eachSet do:[:info | |
|
7812 |
|fn2 dist| |
|
7813 |
||
7814 |
fn2 := info key. |
|
7815 |
dist := info value. |
|
7816 |
stream nextPutAll:' '. |
|
7817 |
stream nextPutAll:fn2 pathName. |
|
7818 |
stream nextPutLine:' (',dist printString,')'. |
|
7819 |
alreadyPrinted add:fn2. |
|
7820 |
]. |
|
7821 |
stream cr. |
|
7822 |
]. |
|
8510 | 7823 |
]. |
7824 |
]. |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7825 |
]. |
8510 | 7826 |
|
7827 |
textBox := TextBox new. |
|
7828 |
textBox initialText:(stream contents). |
|
7829 |
textBox title:'File similarities:'. |
|
7830 |
textBox readOnly:true. |
|
7831 |
textBox noCancel. |
|
7832 |
||
7833 |
textBox label:'File similarities'. |
|
7834 |
textBox extent:(400@((similar size max:40)* 10)). |
|
7835 |
textBox maxExtent:Screen current extent. |
|
7836 |
textBox openModeless. "/ showAtPointer. |
|
7837 |
||
7838 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
|
7839 |
! |
|
7840 |
||
4618 | 7841 |
fileHexDump |
17744 | 7842 |
|file item| |
4618 | 7843 |
|
7844 |
file := self firstSelectedFile. |
|
7845 |
file notNil ifTrue:[ |
|
7846 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 7847 |
self |
7848 |
applicationNamed:#FileApplicationNoteBook |
|
7849 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 7850 |
]. |
17744 | 7851 |
|
7852 |
"Modified (format): / 12-11-2017 / 11:19:56 / cg" |
|
4618 | 7853 |
! |
7854 |
||
7324 | 7855 |
fileIn:aFilename |
7856 |
"fileIn a file" |
|
7857 |
||
7858 |
self fileIn:aFilename lazy:false |
|
7859 |
||
7860 |
"Created: / 20-09-2006 / 14:30:06 / cg" |
|
7861 |
! |
|
7862 |
||
7863 |
fileIn:aFilename lazy:lazy |
|
7864 |
"fileIn a file" |
|
7865 |
||
7866 |
self withActivityIndicationDo:[ |
|
7867 |
self notify:('File in:', aFilename asFilename baseName). |
|
7868 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7869 |
self notify:nil. |
|
7870 |
] |
|
7871 |
||
7872 |
"Created: / 20-09-2006 / 14:29:21 / cg" |
|
7873 |
! |
|
7874 |
||
4930 | 7875 |
filterSelectedFiles:whichFilter |
7876 |
|selectedFiles numFiles msg filterBlock| |
|
7877 |
||
7560 | 7878 |
selectedFiles := self currentSelectedObjects. |
4930 | 7879 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
7880 |
||
7881 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
7882 |
numFiles > 1 ifTrue:[ |
|
7883 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
7884 |
]. |
|
7885 |
||
7886 |
(Dialog |
|
6352 | 7887 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 7888 |
initialAnswer:false |
7889 |
) ifFalse:[ |
|
7890 |
^ self |
|
7891 |
]. |
|
7892 |
||
7893 |
whichFilter == #rot13 ifTrue:[ |
|
7894 |
filterBlock := [:charIn | charIn rot13 ]. |
|
7895 |
]. |
|
7896 |
"/ add more here... |
|
7897 |
||
7898 |
filterBlock isNil ifTrue:[ |
|
7899 |
self information:'No such filter: ' , whichFilter. |
|
7900 |
^ self. |
|
7901 |
]. |
|
7902 |
||
7903 |
selectedFiles do:[:fileName | |
|
7904 |
|s| |
|
7905 |
||
7906 |
self notify:('Processing:', fileName baseName). |
|
18453 | 7907 |
fileName isRegularFile ifTrue:[ |
4930 | 7908 |
[ |
7909 |
|inFile outFile in out| |
|
7910 |
||
7911 |
inFile := fileName asFilename. |
|
7912 |
outFile := (fileName pathName , '.filter') asFilename. |
|
7913 |
||
7914 |
[ |
|
7915 |
|charIn charOut| |
|
7916 |
||
7917 |
in := inFile readStream. |
|
7918 |
out := outFile writeStream. |
|
7919 |
[in atEnd] whileFalse:[ |
|
7920 |
charIn := in next. |
|
7921 |
charOut := filterBlock value:charIn. |
|
7922 |
out nextPut:charOut. |
|
7923 |
]. |
|
13683 | 7924 |
out close. out:= nil. |
4930 | 7925 |
outFile renameTo:inFile. |
7926 |
] ensure:[ |
|
7927 |
out notNil ifTrue:[ out close ]. |
|
7928 |
in notNil ifTrue:[ in close ]. |
|
18024 | 7929 |
outFile remove. |
4930 | 7930 |
] |
7931 |
] on:FileStream openErrorSignal do:[:ex| |
|
7932 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
7933 |
]. |
|
7934 |
] |
|
7935 |
]. |
|
6190 | 7936 |
self notify:nil. |
7560 | 7937 |
|
7938 |
"Modified: / 04-12-2006 / 13:14:48 / cg" |
|
4930 | 7939 |
! |
7940 |
||
9784 | 7941 |
forEachParsedXmlFileDo:aBlock |
7942 |
"parse all selected XML files, for each dom-tree, evaluate aBlock" |
|
7943 |
||
7944 |
self withActivityIndicationDo:[ |
|
7945 |
| selectedFiles xmlDocument | |
|
7946 |
||
7947 |
selectedFiles:= self currentSelectedFiles. |
|
7948 |
selectedFiles do:[:fileName | |
|
7949 |
XML::XMLSignal handle:[:ex | |
|
14551 | 7950 |
Dialog |
7951 |
information:('Error while reading XML:\ %1' bindWith:ex description) withCRs |
|
7952 |
title:'XML Error'. |
|
9784 | 7953 |
^ self. |
7954 |
] do:[ |
|
7955 |
|s d magic encoder document| |
|
7956 |
||
7957 |
s := fileName asFilename readStream. |
|
14012 | 7958 |
[ |
7959 |
s binary. |
|
7960 |
magic := (s next:2). |
|
7961 |
magic = #[254 255] ifTrue:[ |
|
7962 |
"/ UTF16BE |
|
7963 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16be. |
|
7964 |
] ifFalse:[ |
|
7965 |
magic = #[255 254] ifTrue:[ |
|
7966 |
"/ UTF16LE |
|
7967 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16le. |
|
7968 |
]. |
|
7969 |
]. |
|
7970 |
] ensure:[ |
|
7971 |
s close. |
|
7972 |
]. |
|
9784 | 7973 |
document notNil ifTrue:[ |
7974 |
xmlDocument := XML::XMLParser |
|
7975 |
processDocumentString:document |
|
7976 |
beforeScanDo:[:parse| parse validate:false]. |
|
7977 |
] ifFalse:[ |
|
7978 |
xmlDocument := XML::XMLParser |
|
7979 |
processDocumentInFilename:fileName |
|
7980 |
beforeScanDo:[:parse| parse validate:false]. |
|
7981 |
] |
|
7982 |
]. |
|
7983 |
aBlock value:xmlDocument. |
|
7984 |
]. |
|
7985 |
] |
|
7986 |
||
7987 |
"Created: / 17-02-2011 / 13:58:21 / cg" |
|
7988 |
! |
|
7989 |
||
8832 | 7990 |
forEachSelectedFileIgnoringDirectories:ignoreDirs do:aBlock |
7991 |
|numItems path files| |
|
7992 |
||
18834 | 7993 |
files := ignoreDirs |
7994 |
ifTrue:[self currentSelectedFiles] |
|
7995 |
ifFalse:[self currentSelectedObjects]. |
|
8832 | 7996 |
|
7997 |
(numItems := files size) > 2 ifTrue:[ |
|
7998 |
(self |
|
7999 |
confirm:(resources string:'Open for each of the %1 items ?' |
|
8000 |
with:numItems)) ifFalse:[^ self]. |
|
8001 |
]. |
|
8002 |
||
8003 |
self withActivityIndicationDo:[ |
|
8004 |
files do:[:fileName | |
|
8005 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
8006 |
fileName isAbsolute ifTrue:[ |
|
17239 | 8007 |
path := fileName name. |
8832 | 8008 |
] ifFalse:[ |
8009 |
path := fileName pathName. |
|
8010 |
]. |
|
8011 |
aBlock value:path |
|
8012 |
] |
|
8013 |
]. |
|
8014 |
]. |
|
17239 | 8015 |
|
8016 |
"Modified: / 19-01-2017 / 16:57:03 / stefan" |
|
18834 | 8017 |
"Modified: / 23-06-2019 / 13:19:05 / Claus Gittinger" |
8832 | 8018 |
! |
8019 |
||
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8020 |
generateDetachedSignaturesForSelectedFiles |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8021 |
"generate detached signature (pkcs7) files from the contents of the selected files. |
16941 | 8022 |
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
|
8023 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8024 |
self withActivityIndicationDo:[ |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8025 |
self currentSelectedFiles do:[:fn | |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8026 |
|data hash signature signatureFile| |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8027 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8028 |
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
|
8029 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8030 |
data := fn contentsAsString. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8031 |
hash := SHA1Stream hashValueOf:data. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8032 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8033 |
signature := Expecco::KeyFileGenerator new signExpeccoCode:hash. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8034 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8035 |
signatureFile := fn addSuffix:'sig'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8036 |
signatureFile contents:signature. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8037 |
]. |
13677 | 8038 |
self updateCurrentDirectoryWithReread. |
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8039 |
self notify:nil. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8040 |
] |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8041 |
! |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8042 |
|
15211 | 8043 |
generatePatchInstallerForSelectedFiles |
8044 |
"generate an expecco patch, which installs the selected file(s). |
|
8045 |
Opens a dialog asking for the target directory and if the patch should be signed" |
|
8046 |
||
8047 |
|dialog targetDirHolder targetDir |
|
8048 |
generateSignedPatchHolder patchFileNameHolder patchFileName| |
|
8049 |
||
8050 |
targetDirHolder := '.' asValue. |
|
8051 |
generateSignedPatchHolder := true asValue. |
|
8052 |
patchFileNameHolder := '/tmp/00nn_patchFile.st' asValue. |
|
8053 |
||
8054 |
dialog := Dialog new. |
|
8055 |
dialog label:(resources string:'Patch Installer for File(s)'). |
|
8056 |
dialog addTextLabel:'Patchfile Name' adjust:#left. |
|
8057 |
dialog addInputFieldOn:patchFileNameHolder tabable:true. |
|
8058 |
dialog addTextLabel:'Target directory (relative to executable''s directory at execution time)' adjust:#left. |
|
8059 |
dialog addInputFieldOn:targetDirHolder tabable:true. |
|
8060 |
dialog addCheckBox:'Generate Signed Patch' on:generateSignedPatchHolder. |
|
8061 |
dialog addAbortAndOkButtons. |
|
8062 |
dialog open. |
|
8063 |
||
8064 |
dialog accepted ifFalse:[^ self]. |
|
8065 |
||
8066 |
targetDir := targetDirHolder value asFilename. |
|
8067 |
patchFileName := patchFileNameHolder value asFilename. |
|
8068 |
||
8069 |
self withActivityIndicationDo:[ |
|
8070 |
|outStream zipArchive pkcs7SignedData signatureFilename| |
|
8071 |
||
8072 |
self notify:'Generating self extracting st script: ', patchFileName name, '...'. |
|
8073 |
outStream := patchFileName writeStream. |
|
8074 |
outStream nextPutAll:' |
|
8075 |
|patchStream zipArchive| |
|
8076 |
patchStream := Expecco::Browser::CurrentPatchStreamQuery query. |
|
8077 |
patchStream isNil ifTrue:[ self error:''sorry, this patch can only be installed in expecco 2.6.2 and newer (missing CurrentPatchStreamQuery)'']. |
|
8078 |
zipArchive := ZipArchive readingFrom:patchStream. |
|
8079 |
zipArchive members do:[:each | zipArchive extract:each fileName]. |
|
8080 |
patchStream setToEnd. "/ to force fileIn to finish |
|
8081 |
!! |
|
8082 |
||
8083 |
!! !! |
|
8084 |
||
8085 |
'. |
|
8086 |
zipArchive := ZipArchive writingTo:outStream. "/ newFileNamed:(patchFileName). |
|
8087 |
||
8088 |
self currentSelectedFiles do:[:fn | |
|
8089 |
|inStream signatureFilename| |
|
8090 |
||
8091 |
inStream := fn asFilename readStream. |
|
8092 |
zipArchive addFile: (targetDir construct:fn asFilename baseName) name fromStream:inStream. |
|
8093 |
inStream close. |
|
8094 |
]. |
|
8095 |
||
16975 | 8096 |
zipArchive close. |
15211 | 8097 |
|
8098 |
generateSignedPatchHolder value ifTrue:[ |
|
8099 |
self notify:'Generating signed file from: ', patchFileName name, '...'. |
|
8100 |
||
8101 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:patchFileName contentsOfEntireFile. |
|
8102 |
signatureFilename := patchFileName withSuffix:'expeccoPatch'. |
|
8103 |
signatureFilename contents:pkcs7SignedData. |
|
8104 |
]. |
|
8105 |
self notify:nil. |
|
8106 |
] |
|
8107 |
! |
|
13783 | 8108 |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8109 |
generateSignaturesForSelectedFiles |
13783 | 8110 |
"generate signed pkcs7 files from the contents of the selected files. |
8111 |
These can be delivered as expeccoPatch files" |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8112 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8113 |
self withActivityIndicationDo:[ |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8114 |
self currentSelectedFiles do:[:fn | |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8115 |
|pkcs7SignedData signatureFilename| |
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8116 |
|
8646 | 8117 |
self notify:'Generating signed file from: ', (fn baseName), '...'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8118 |
|
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8119 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:fn contentsOfEntireFile. |
12094 | 8120 |
signatureFilename := fn withSuffix:'expeccoPatch'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8121 |
signatureFilename contents:pkcs7SignedData. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8122 |
]. |
13677 | 8123 |
self updateCurrentDirectoryWithReread. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8124 |
self notify:nil. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8125 |
] |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8126 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8127 |
|
9784 | 8128 |
inspectXmlFile |
8129 |
"Show an XML file - either in an XMLInspector or fall back to |
|
8130 |
a plain inspector on the XML tree" |
|
8131 |
||
8132 |
self forEachParsedXmlFileDo:[:xmlDocument | |
|
8133 |
XML::XMLInspector notNil ifTrue:[ |
|
8134 |
XML::XMLInspector openOn:xmlDocument. |
|
8135 |
] ifFalse:[ |
|
8136 |
"fall back..." |
|
8137 |
xmlDocument inspect. |
|
8138 |
] |
|
8139 |
]. |
|
8140 |
||
8141 |
"Modified: / 17-02-2011 / 13:58:16 / cg" |
|
8142 |
! |
|
8143 |
||
3892 | 8144 |
installAllAsAutoloaded |
8145 |
"install all classes found here as autoloaded classes" |
|
8146 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8147 |
self installAllAsAutoloadedRecursive:false |
3892 | 8148 |
! |
8149 |
||
6521 | 8150 |
installAllAsAutoloadedRecursive |
8151 |
"install all classes found here and in subdirectories as autoloaded classes" |
|
8152 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8153 |
self installAllAsAutoloadedRecursive:true |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8154 |
! |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8155 |
|
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8156 |
installAllAsAutoloadedRecursive:aBoolean |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8157 |
"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
|
8158 |
|
6521 | 8159 |
[ |
15507 | 8160 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
8161 |
|installAction| |
|
8162 |
||
8163 |
installAction := |
|
19031 | 8164 |
[:fn | |
8165 |
(fn hasSuffix:'st') ifTrue:[ |
|
15507 | 8166 |
self notify:('Install as autoloaded: ', fn baseName). |
8167 |
self installAsAutoloaded:fn. |
|
8168 |
] |
|
8169 |
]. |
|
8170 |
||
8171 |
self withActivityIndicationDo:[ |
|
8172 |
self currentSelectedDirectories do:[:dir| |
|
8173 |
aBoolean ifTrue:[ |
|
8174 |
dir recursiveDirectoryContentsAsFilenamesDo:installAction |
|
8175 |
] ifFalse:[ |
|
8176 |
dir directoryContentsAsFilenamesDo:installAction |
|
15152 | 8177 |
]. |
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8178 |
]. |
15507 | 8179 |
self notify:nil. |
8180 |
]. |
|
8181 |
] |
|
6521 | 8182 |
] fork. |
8183 |
! |
|
8184 |
||
3892 | 8185 |
installAsAutoloaded:aFilename |
8186 |
"install aFilename as autoloaded class" |
|
8187 |
||
13292 | 8188 |
Smalltalk installAutoloadedClassFromSourceFile:aFilename |
8189 |
||
8190 |
"Modified: / 01-08-2013 / 16:58:09 / cg" |
|
3892 | 8191 |
! |
8192 |
||
15211 | 8193 |
joinSelectedFiles |
8194 |
|selectedFiles numFiles msg outFileName outFile outStream| |
|
8195 |
||
8196 |
selectedFiles := self currentSelectedObjects. |
|
8197 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
8198 |
||
8199 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
8200 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
8201 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
|
8202 |
outFile := selectedFiles first directory construct:outFileName. |
|
8203 |
||
8204 |
outStream := outFile writeStream. |
|
8205 |
||
8206 |
selectedFiles do:[:fileName | |
|
8207 |
self notify:('Adding:', fileName baseName). |
|
17997 | 8208 |
fileName readingFileDo:[:inStream | |
8209 |
inStream copyToEndInto:outStream. |
|
8210 |
]. |
|
15211 | 8211 |
]. |
8212 |
outStream close. |
|
8213 |
self notify:nil. |
|
8214 |
||
8215 |
"Modified: / 04-12-2006 / 13:15:10 / cg" |
|
8216 |
! |
|
4558 | 8217 |
|
6292 | 8218 |
loadImageThenDo:aBlock |
3892 | 8219 |
|img path files| |
8220 |
||
3982 | 8221 |
files := self currentSelectedFiles. |
3892 | 8222 |
files isEmpty ifTrue:[ ^ self]. |
8223 |
files do:[:fileName | |
|
4414 | 8224 |
path := fileName. |
18453 | 8225 |
path isRegularFile ifTrue:[ |
4414 | 8226 |
img := Image fromFile:(path pathName). |
8227 |
img notNil ifTrue:[ |
|
6292 | 8228 |
aBlock value:img |
4414 | 8229 |
] ifFalse:[ |
15346 | 8230 |
Dialog warn:(resources string:'Unknown image format: "%1"' with:fileName asString) |
4414 | 8231 |
] |
8232 |
] |
|
3892 | 8233 |
]. |
8234 |
! |
|
8235 |
||
13089 | 8236 |
loadSignatureSupport |
8237 |
Expecco::KeyFileGenerator isNil ifTrue:[ |
|
14047 | 8238 |
Smalltalk loadPackage:'exept:expecco/license' |
13089 | 8239 |
]. |
8240 |
! |
|
8241 |
||
3892 | 8242 |
openASN1Browser |
8243 |
||
8244 |
self openTool:OSI::ASN1Browser |
|
8245 |
! |
|
8246 |
||
8247 |
openAppletViewer |
|
8248 |
|numItems files| |
|
8249 |
||
3982 | 8250 |
files := self currentSelectedFiles. |
3892 | 8251 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 8252 |
(self |
8253 |
confirm:(resources string:'open for each of the %1 items ?' |
|
8254 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 8255 |
]. |
8256 |
||
8257 |
Java startupJavaSystem. |
|
8258 |
"/ Java markAllClassesUninitialized. |
|
8259 |
"/ Java initAllStaticFields. |
|
8260 |
"/ Java initAllClasses. |
|
8261 |
||
8262 |
files do:[:fileName | |
|
4414 | 8263 |
|p path| |
8264 |
||
8265 |
path := fileName. |
|
18453 | 8266 |
path isRegularFile ifTrue:[ |
4414 | 8267 |
p := Java |
8268 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
8269 |
argumentString:path pathName. |
|
8270 |
p resume. |
|
8271 |
] |
|
3892 | 8272 |
]. |
8273 |
! |
|
8274 |
||
8275 |
openCBrowser |
|
6031 | 8276 |
|dir files| |
5880 | 8277 |
|
8278 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8279 |
dir isNil ifTrue:[ ^ self]. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8280 |
self withActivityIndicationDo:[ |
7560 | 8281 |
files := self currentSelectedObjects. |
6031 | 8282 |
files notEmptyOrNil ifTrue:[ |
8283 |
CBrowser::Browser openOn:files first. |
|
8284 |
] ifFalse:[ |
|
8285 |
CBrowser::Browser openIn:dir. |
|
8286 |
] |
|
3892 | 8287 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8288 |
|
7560 | 8289 |
"Modified: / 04-12-2006 / 13:15:19 / cg" |
3892 | 8290 |
! |
8291 |
||
4230 | 8292 |
openChangeSetBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8293 |
"open a changeSet browser on the selected file(s)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8294 |
|
4230 | 8295 |
self |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8296 |
openTool:(UserPreferences current changeSetBrowserClass) |
4230 | 8297 |
with:#openOnFile: |
18834 | 8298 |
ignoreDirectories:false |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8299 |
|
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8300 |
"Modified (comment): / 27-07-2012 / 20:42:55 / cg" |
18834 | 8301 |
"Modified: / 23-06-2019 / 13:17:07 / Claus Gittinger" |
4230 | 8302 |
! |
8303 |
||
3892 | 8304 |
openChangesBrowser |
8305 |
"open a change browser on the selected file(s)" |
|
8306 |
||
18774 | 8307 |
|files remaining| |
18775 | 8308 |
|
8309 |
files := self currentSelectedFiles. |
|
8310 |
remaining := files copy. |
|
8311 |
||
8312 |
"/ special for github-downloaded package&class folders (one method per file) |
|
8313 |
"/ these are named .package and .class |
|
18774 | 8314 |
GitHubSmalltalkPackageReader notNil ifTrue:[ |
8315 |
files do:[:fn | |
|
19031 | 8316 |
|suff| |
8317 |
||
18774 | 8318 |
fn isDirectory ifTrue:[ |
19031 | 8319 |
suff := fn suffix. |
8320 |
(suff = 'package') ifTrue:[ |
|
18248 | 8321 |
ChangeSetBrowser openOn:(GitHubSmalltalkPackageReader readPackageFrom:fn). |
18774 | 8322 |
remaining remove:fn. |
8323 |
] ifFalse:[ |
|
19031 | 8324 |
(suff = 'class') ifTrue:[ |
18774 | 8325 |
ChangeSetBrowser openOn:(GitHubSmalltalkClassReader readClassFrom:fn). |
8326 |
remaining remove:fn. |
|
8327 |
]. |
|
8328 |
]. |
|
18248 | 8329 |
]. |
18774 | 8330 |
]. |
8331 |
remaining isEmpty ifTrue:[^ self]. |
|
18246 | 8332 |
]. |
8333 |
||
18775 | 8334 |
"/ special for new github-downloaded source files |
8335 |
"/ these are named *.class.st, *.extension.st and *.trait.st |
|
8336 |
remaining copy do:[:fn | |
|
8337 |
#( '.class' '.extension' '.trait') contains:[:suff | |
|
8338 |
|changeSet| |
|
8339 |
||
8340 |
(fn withoutSuffix baseName endsWith:suff) ifTrue:[ |
|
8341 |
fn readingFileDo:[:in | |
|
8342 |
changeSet := ChangeSet fromGithubPharoSmalltalkStream:in. |
|
8343 |
]. |
|
8344 |
ChangeSetBrowser openOn:changeSet. |
|
8345 |
remaining remove:fn. |
|
8346 |
]. |
|
8347 |
]. |
|
8348 |
remaining isEmpty ifTrue:[^ self]. |
|
8349 |
]. |
|
8350 |
||
3892 | 8351 |
self openTool:(UserPreferences current changesBrowserClass) |
18246 | 8352 |
|
18775 | 8353 |
"Modified: / 26-05-2019 / 02:58:27 / Claus Gittinger" |
3892 | 8354 |
! |
8355 |
||
8356 |
openDiffView |
|
15215 | 8357 |
"open a diff-view on the two selected files" |
8358 |
||
8359 |
|name1 name2 files title |
|
8360 |
defaultName defaultDir| |
|
6460 | 8361 |
|
8362 |
files := self currentSelectedObjects. |
|
3892 | 8363 |
files isEmpty ifTrue:[ |
6460 | 8364 |
Dialog warn:(resources string:'You have to select a file first'). |
4414 | 8365 |
^ self. |
3892 | 8366 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8367 |
|
3892 | 8368 |
(files size == 2) ifTrue:[ |
4414 | 8369 |
name1 := files last. |
8370 |
name2 := files first. |
|
3892 | 8371 |
] ifFalse:[ |
4414 | 8372 |
LastFileDiffFile notNil ifTrue:[ |
11052 | 8373 |
LastFileDiffFile exists ifTrue:[ |
8374 |
name1 := LastFileDiffFile. |
|
8375 |
]. |
|
8376 |
"/ | directory | |
|
8377 |
"/ directory := self currentDirectory. |
|
8378 |
"/ directory notNil ifTrue:[ |
|
8379 |
"/ lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
8380 |
"/ (lastFile exists and:[lastFile isReadable]) ifTrue:[ |
|
8381 |
"/ name1 := lastFile. |
|
8382 |
"/ ] |
|
8383 |
"/ ] |
|
4414 | 8384 |
]. |
8385 |
name2 := files first. |
|
6460 | 8386 |
title := resources string:'Show differences between "%1" and:' with:name2 baseName. |
4414 | 8387 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
11052 | 8388 |
defaultDir := name1 notNil ifTrue:[name1 directory] ifFalse:[self currentDirectory]. |
4414 | 8389 |
name1 := DialogBox |
8390 |
requestFileName:title |
|
8391 |
default:defaultName |
|
6460 | 8392 |
ok:(resources string:'OK') |
8393 |
abort:(resources string:'Compare against File List') |
|
4414 | 8394 |
pattern:'*' |
11052 | 8395 |
fromDirectory:defaultDir. |
3892 | 8396 |
]. |
15215 | 8397 |
self openDiffViewOn:name1 and:name2 |
8398 |
||
8399 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
|
8400 |
! |
|
8401 |
||
8402 |
openDiffViewOn:fileArg1 and:fileArg2 |
|
8403 |
"open a diff-view on two files" |
|
8404 |
||
17769 | 8405 |
|file1 file2 file1Size file2Size text1 text2 d err nm l1 sameContents msg| |
15215 | 8406 |
|
8407 |
file1 := fileArg1. |
|
8408 |
file2 := fileArg2. |
|
3892 | 8409 |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8410 |
self withWaitCursorDo:[ |
15215 | 8411 |
(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
|
8412 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
14126 | 8413 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l string]]. |
15215 | 8414 |
file1 := nil. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8415 |
l1 := 'browser contents' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8416 |
] ifFalse:[ |
15215 | 8417 |
file1 := file1 asFilename. |
8418 |
LastFileDiffFile := file1. |
|
8419 |
file1 isReadable ifFalse:[ |
|
8420 |
nm := file1. |
|
8421 |
file1 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8422 |
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
|
8423 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8424 |
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
|
8425 |
]. |
4414 | 8426 |
]. |
15215 | 8427 |
l1 := file1 pathName |
4414 | 8428 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8429 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8430 |
err isNil ifTrue:[ |
15215 | 8431 |
file2 isReadable ifFalse:[ |
8432 |
nm := file2. |
|
8433 |
file2 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8434 |
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
|
8435 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8436 |
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
|
8437 |
]. |
4414 | 8438 |
]. |
8439 |
]. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8440 |
err notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8441 |
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
|
8442 |
^ self |
6176 | 8443 |
]. |
8444 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8445 |
self withActivityIndicationDo:[ |
17769 | 8446 |
file1Size := file1 isNil ifTrue:[0] ifFalse:[file1 fileSize]. |
8447 |
file2Size := file2 isNil ifTrue:[0] ifFalse:[file2 fileSize]. |
|
8448 |
||
8449 |
((file1Size > (1024*1024*32)) or:[ file2Size > (1024*1024*32) ]) ifTrue:[ |
|
8450 |
file1Size = file2Size ifTrue:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8451 |
ProgressIndicator |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8452 |
displayBusyIndicator:'Comparing...' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8453 |
at:(Screen default center) |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8454 |
during:[ |
15215 | 8455 |
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
|
8456 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8457 |
sameContents ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8458 |
self information:'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8459 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8460 |
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
|
8461 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8462 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8463 |
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
|
8464 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8465 |
^ self. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8466 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8467 |
|
15215 | 8468 |
file1 notNil ifTrue:[ |
8469 |
file1 isDirectory ifTrue:[ |
|
8470 |
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
|
8471 |
] ifFalse:[ |
15215 | 8472 |
text1 := file1 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8473 |
] |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8474 |
]. |
15215 | 8475 |
file2 isDirectory ifTrue:[ |
8476 |
text2 := file2 directoryContents asString. |
|
6460 | 8477 |
] ifFalse:[ |
15215 | 8478 |
text2 := file2 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8479 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8480 |
text1 = text2 ifTrue:[ |
15215 | 8481 |
(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
|
8482 |
msg := 'Same filename lists.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8483 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8484 |
msg := 'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8485 |
]. |
16911 | 8486 |
self information:msg |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8487 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8488 |
d := DiffTextView |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8489 |
openOn:text1 label:l1 |
15215 | 8490 |
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
|
8491 |
d topView label:(resources string:'File Differences'). |
6460 | 8492 |
] |
4414 | 8493 |
] |
3892 | 8494 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8495 |
|
17769 | 8496 |
"Modified: / 19-11-2017 / 15:00:47 / cg" |
3892 | 8497 |
! |
8498 |
||
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8499 |
openDirectoryDiffView |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8500 |
"open a directory diff-view" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8501 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8502 |
|name1 name2 files| |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8503 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8504 |
files := self currentSelectedObjects. |
11108 | 8505 |
files notEmpty ifTrue:[ |
8506 |
name1 := files first asFilename. |
|
18453 | 8507 |
name1 asFilename isRegularFile ifTrue:[ |
11108 | 8508 |
name1 := name1 directory |
8509 |
]. |
|
8510 |
]. |
|
8511 |
||
8512 |
(files size == 2) ifTrue:[ |
|
8513 |
name2 := files second. |
|
8514 |
] ifFalse:[ |
|
19152 | 8515 |
(files size ~~ 1) ifTrue:[ |
11108 | 8516 |
Dialog warn:(resources string:'Please select one or two directories.'). |
8517 |
^ self. |
|
8518 |
]. |
|
8519 |
name2 := Dialog |
|
8520 |
requestDirectoryName:(resources |
|
8521 |
string:'Recursive compare "%1" with folder:' |
|
8522 |
with:name1 asFilename baseName) |
|
8523 |
default:(LastFileDiffDirectory ? self currentDirectory). |
|
8524 |
name2 isEmptyOrNil ifTrue:[^ self]. |
|
8525 |
LastFileDiffDirectory := name2. |
|
8526 |
]. |
|
8527 |
name2 := name2 asFilename. |
|
8528 |
||
18453 | 8529 |
name2 asFilename isRegularFile ifTrue:[ |
11108 | 8530 |
name2 := name2 directory |
8531 |
]. |
|
8532 |
||
8533 |
self |
|
8534 |
applicationNamed:#FileApplicationNoteBook |
|
8535 |
ifPresentDo:[:appl | ^ appl openCompareDirectory:name1 with:name2]. |
|
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8536 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8537 |
"Created: / 20-05-2010 / 15:01:17 / cg" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8538 |
! |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8539 |
|
3892 | 8540 |
openEditor |
8541 |
self openTool:EditTextView |
|
8542 |
! |
|
8543 |
||
4957 | 8544 |
openGV |
8545 |
self openOSCommandWithFiles:'gv' |
|
8546 |
! |
|
8547 |
||
3892 | 8548 |
openHTMLReader |
8549 |
||
8550 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
8551 |
! |
|
8552 |
||
8553 |
openImageEditor |
|
6292 | 8554 |
[ |
8555 |
self loadImageThenDo:[:img | img edit] |
|
8556 |
] fork |
|
3892 | 8557 |
! |
8558 |
||
8559 |
openImageInspector |
|
6292 | 8560 |
[ |
8561 |
self loadImageThenDo:[:img | img inspect] |
|
8562 |
] fork |
|
3892 | 8563 |
! |
8564 |
||
8565 |
openImagePreview |
|
5778 | 8566 |
[ |
8567 |
self |
|
6292 | 8568 |
loadImageThenDo: |
5778 | 8569 |
[:img | |
8570 |
|i top viewer| |
|
8571 |
||
8572 |
top := StandardSystemView new. |
|
8573 |
||
8574 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8575 |
i := img. |
|
8576 |
top extent:200@200. |
|
8577 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
8578 |
top openAndWait. |
|
8579 |
||
8580 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
8581 |
i := i magnifiedPreservingRatioTo:200@200. |
|
8582 |
]. |
|
8583 |
viewer image:i. |
|
8584 |
]. |
|
3892 | 8585 |
] fork |
8586 |
! |
|
8587 |
||
8588 |
openMP3Player |
|
8589 |
|file| |
|
8590 |
||
3982 | 8591 |
file := self currentSelectedFiles. |
3892 | 8592 |
(file isEmpty) ifTrue:[ |
4414 | 8593 |
^ self. |
3892 | 8594 |
]. |
8595 |
file := file first. |
|
8596 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
8597 |
! |
|
8598 |
||
4957 | 8599 |
openOSCommandWithFiles:command |
8600 |
|files fileNames| |
|
8601 |
||
8602 |
files := self currentSelectedFiles. |
|
8603 |
(files isEmpty) ifTrue:[ |
|
8604 |
^ self. |
|
8605 |
]. |
|
8606 |
||
8607 |
fileNames := files collect:[:each | |
|
8608 |
'"' , each asFilename pathName , '"' |
|
8609 |
]. |
|
8610 |
||
8611 |
[ |
|
8612 |
OperatingSystem |
|
4959 | 8613 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
8614 |
inDirectory:(files first asFilename directory). |
|
4957 | 8615 |
] fork |
8616 |
! |
|
8617 |
||
4820 | 8618 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8619 |
|files fileNames cmd arg| |
4820 | 8620 |
|
8621 |
files := self currentSelectedFiles. |
|
8622 |
(files isEmpty) ifTrue:[ |
|
8623 |
^ self. |
|
8624 |
]. |
|
12972 | 8625 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'. |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8626 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8627 |
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
|
8628 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8629 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8630 |
|
4820 | 8631 |
fileNames := |
8632 |
files |
|
8633 |
collect: |
|
8634 |
[:each | |
|
8635 |
'"' , each asFilename pathName , '"' |
|
8636 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8637 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8638 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8639 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8640 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8641 |
]. |
4820 | 8642 |
|
4950 | 8643 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8644 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 8645 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8646 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8647 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 8648 |
! |
8649 |
||
8426 | 8650 |
openResourceFileEditor |
8651 |
||
8652 |
self |
|
8653 |
openTool: Tools::InternationalLanguageTranslationEditor |
|
8654 |
with: #openOnFile: |
|
8655 |
! |
|
8656 |
||
3892 | 8657 |
openSlideShow |
5880 | 8658 |
|dir| |
8659 |
||
8660 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8661 |
dir isNil ifTrue:[^ self]. |
|
8662 |
||
3892 | 8663 |
CodingExamples_GUI::SlideShow openIn:dir. |
8664 |
! |
|
8665 |
||
8666 |
openSnapshotImageBrowser |
|
4491 | 8667 |
"Sorry, for now, only the old browser can handle snapShotImages." |
8668 |
||
3892 | 8669 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
8670 |
! |
|
8671 |
||
8672 |
openTerminal |
|
19009 | 8673 |
"open a shell in vt100 terminal emulation in the current directory" |
8674 |
||
5880 | 8675 |
|dir| |
8676 |
||
8677 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 8678 |
|
5300 | 8679 |
TerminalApplication notNil ifTrue:[ |
8680 |
TerminalApplication openIn:dir |
|
8681 |
] ifFalse:[ |
|
8682 |
VT100TerminalView openShellIn:dir. |
|
8683 |
]. |
|
3892 | 8684 |
! |
8685 |
||
8686 |
openTool:aToolClass |
|
8687 |
"open a tool on the selected file(s)" |
|
8688 |
||
8689 |
^ self openTool:aToolClass ignoreDirectories:true |
|
8690 |
! |
|
8691 |
||
8692 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
8693 |
"open a tool on the selected file(s)" |
|
8694 |
||
8695 |
^ self |
|
4414 | 8696 |
openTool:aToolClass |
8697 |
with:#openOn: |
|
8698 |
ignoreDirectories:ignoreDirs |
|
3892 | 8699 |
! |
8700 |
||
8426 | 8701 |
openTool:aToolClass with:aSelector |
8702 |
"open a tool on the selected file(s)" |
|
8703 |
||
8704 |
^ self openTool:aToolClass with:aSelector ignoreDirectories:true |
|
8705 |
! |
|
8706 |
||
3892 | 8707 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
8708 |
"open a tool on the selected file(s)" |
|
8709 |
||
8832 | 8710 |
|tool| |
3892 | 8711 |
|
8712 |
aToolClass isNil ifTrue:[ |
|
4414 | 8713 |
Dialog warn:'Sorry, that tool seems to be not available'. |
8714 |
^ nil. |
|
3892 | 8715 |
]. |
8832 | 8716 |
self forEachSelectedFileIgnoringDirectories:ignoreDirs do:[:path | |
8717 |
tool := aToolClass perform:aSelector with:path. |
|
3892 | 8718 |
]. |
8719 |
^ tool |
|
8832 | 8720 |
! |
8721 |
||
18946 | 8722 |
openVideoPlayer |
8723 |
self openOSCommandWithFiles:'vlc' |
|
8724 |
||
8725 |
"Created: / 26-07-2019 / 11:09:32 / Stefan Vogel" |
|
8726 |
! |
|
8727 |
||
8832 | 8728 |
openWebBrowser |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8729 |
self |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8730 |
forEachSelectedFileIgnoringDirectories:true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8731 |
do:[:path | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8732 |
Error |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8733 |
handle:[:ex | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8734 |
Dialog warn:'Shell execution failed: ',ex description |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8735 |
] do:[ |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8736 |
OperatingSystem openApplicationForDocument:path operation:#open. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8737 |
^ self. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8738 |
] |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8739 |
]. |
3892 | 8740 |
! |
8741 |
||
6022 | 8742 |
openWorkspace |
8743 |
self |
|
8744 |
openTool:WorkspaceApplication |
|
8745 |
with:#openOnFile: |
|
8746 |
ignoreDirectories:true |
|
8747 |
! |
|
8748 |
||
4950 | 8749 |
openXV |
4957 | 8750 |
self openOSCommandWithFiles:'xv' |
4950 | 8751 |
! |
8752 |
||
3892 | 8753 |
openZipTool |
5880 | 8754 |
|zipTool| |
3892 | 8755 |
|
8756 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 8757 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 8758 |
]. |
8759 |
! |
|
8760 |
||
8761 |
readAbbrevFile |
|
8762 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
8763 |
||
5880 | 8764 |
|directories| |
3892 | 8765 |
|
3982 | 8766 |
directories := self currentSelectedDirectories. |
3892 | 8767 |
directories isEmpty ifTrue:[^ self]. |
8768 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8769 |
self withActivityIndicationDo:[ |
5880 | 8770 |
directories do:[:eachDir | |
8771 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
8772 |
] |
|
5828 | 8773 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8774 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8775 |
"Modified: / 25-07-2006 / 09:07:43 / cg" |
3892 | 8776 |
! |
8777 |
||
6460 | 8778 |
readAndShowResources |
8779 |
self withActivityIndicationDo:[ |
|
8780 |
| selectedFiles| |
|
8781 |
||
8782 |
selectedFiles:= self currentSelectedFiles. |
|
8783 |
selectedFiles do:[:fileName | |
|
8784 |
resources := ResourcePack fromFile:fileName. |
|
8785 |
resources inspect. |
|
8786 |
]. |
|
8787 |
] |
|
8788 |
! |
|
8789 |
||
17831 | 8790 |
removeBakAndSavFiles |
8791 |
"remove all .sav and .bak files (after confirmation)" |
|
8792 |
||
8793 |
|filesToRemove directories| |
|
8794 |
||
8795 |
directories := self currentSelectedDirectories. |
|
8796 |
directories isEmptyOrNil ifTrue:[ |
|
8797 |
directories := Array with:self currentDirectory |
|
8798 |
]. |
|
8799 |
||
8800 |
self withActivityIndicationDo:[ |
|
8801 |
filesToRemove := OrderedCollection new. |
|
8802 |
directories do:[:eachDirectoryToScan | |
|
8803 |
eachDirectoryToScan filesDo:[:fn | |
|
18998 | 8804 |
(#('sav' 'bak') includes:fn suffix asLowercase) ifTrue:[ |
17831 | 8805 |
filesToRemove add:fn. |
8806 |
] |
|
8807 |
] |
|
8808 |
]. |
|
8809 |
filesToRemove isEmpty ifTrue:[ |
|
8810 |
Dialog information:(resources string:'Nothing to remove'). |
|
8811 |
^ self. |
|
8812 |
]. |
|
8813 |
(Dialog confirm:(resources string:'Remove %1 file(s) ?' with:filesToRemove size)) ifFalse:[ |
|
8814 |
^ self |
|
8815 |
]. |
|
8816 |
filesToRemove do:[:each | |
|
8817 |
each remove |
|
8818 |
]. |
|
17871 | 8819 |
self updateCurrentDirectoryWithReread |
17831 | 8820 |
]. |
8821 |
! |
|
8822 |
||
3892 | 8823 |
singleFileFileIn:fileName lazy:lazy |
8824 |
"fileIn the selected file(s)" |
|
8825 |
||
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8826 |
|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
|
8827 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8828 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8829 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8830 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8831 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8832 |
[ |
4345 | 8833 |
(ObjectFileLoader notNil |
5491 | 8834 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 8835 |
AbortOperationRequest catch:[ |
8836 |
|p| |
|
8837 |
||
8838 |
"/ |
|
8839 |
"/ look if already loaded ... then unload first |
|
8840 |
"/ |
|
8841 |
p := fileName pathName. |
|
8842 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
8843 |
(Dialog confirm:(resources |
|
8844 |
string:'%1 is already loaded; load anyway ?' |
|
8845 |
with:p)) ifFalse:[ |
|
8846 |
^ self |
|
8847 |
]. |
|
8848 |
notifyString := 'unloading old ' , p , ' ...'. |
|
8849 |
Transcript showCR:notifyString. |
|
4523 | 8850 |
self notify:notifyString. |
4345 | 8851 |
ObjectFileLoader unloadObjectFile:p. |
8852 |
]. |
|
8853 |
||
8854 |
notifyString := 'loading ' , p , ' ...'. |
|
8855 |
Transcript showCR:notifyString. |
|
4523 | 8856 |
self notify:notifyString. |
12426 | 8857 |
(ObjectFileLoader loadObjectFile:p) isNil ifTrue:[ |
8858 |
notifyString := 'Error: could not load ' , p. |
|
8859 |
Transcript showCR:notifyString. |
|
8860 |
self notify:notifyString. |
|
8861 |
] ifFalse:[ |
|
8862 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
8863 |
]. |
|
4345 | 8864 |
] |
8865 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
8866 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
8867 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
8868 |
aStream := fileName readStreamOrNil. |
4345 | 8869 |
aStream notNil ifTrue:[ |
8870 |
aStream fileInBinary. |
|
8871 |
] |
|
8872 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8873 |
((fileName hasSuffix:'class') or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 8874 |
"/ loading a java class file |
8875 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 8876 |
JavaClassReader loadFile:fileName |
4345 | 8877 |
] |
8878 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
8879 |
"/ loading a sif (smalltalk interchange format) file |
|
8880 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
8881 |
SmalltalkInterchangeFileManager newForFileIn |
|
8882 |
fileName: fileName pathName; |
|
8883 |
fileIn. |
|
8884 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
|
8885 |
Parcel isNil ifTrue:[ |
|
8886 |
Dialog warn:'Parcel support not loaded.' |
|
8887 |
] ifFalse:[ |
|
8888 |
Parcel loadParcelFrom: fileName pathName |
|
8889 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8890 |
] ifFalse:[ (fileName hasSuffix:'jar') ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8891 |
JavaVM isNil ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8892 |
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
|
8893 |
^ self. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8894 |
] ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8895 |
JavaVM booted ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8896 |
(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
|
8897 |
JavaVM boot. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8898 |
]. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8899 |
JavaVM loadClassesIn: fileName. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8900 |
] |
4345 | 8901 |
] ifFalse:[ |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8902 |
"/ ask programming languages... |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8903 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
14360 | 8904 |
(lang isNil and:[(fileName hasSuffix:'js')]) ifTrue:[ |
14362 | 8905 |
Smalltalk loadPackage:'stx:libjavascript'. |
14360 | 8906 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
8907 |
]. |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8908 |
(lang notNil and:[lang ~= SmalltalkLanguage]) ifTrue:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8909 |
lang fileIn:fileName. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8910 |
] ifFalse:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8911 |
"/ loading a regular (chunk) or xml source file |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8912 |
Error handle:[:ex | |
15675 | 8913 |
self errorNotify:'Error during file in: ', ex description. |
15981 | 8914 |
ex resume. |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8915 |
] do:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8916 |
aStream := fileName readStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8917 |
[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8918 |
Class withoutUpdatingChangesDo:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8919 |
wasLazy := Compiler compileLazy:lazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8920 |
Smalltalk fileInStream:aStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8921 |
]. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8922 |
Class addInfoRecord:('fileIn ' , fileName asString) |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8923 |
] ensure:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8924 |
Compiler compileLazy:wasLazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8925 |
aStream close |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8926 |
] |
4345 | 8927 |
] |
8928 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8929 |
]]]] |
4345 | 8930 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8931 |
] 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
|
8932 |
|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
|
8933 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8934 |
isRedef := false. |
12684 | 8935 |
sig := ex creator. |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8936 |
(dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8937 |
action := #continue |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8938 |
] ifFalse:[ |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8939 |
(sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8940 |
ex reject |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8941 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8942 |
sig == Class methodRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8943 |
msg := 'trying to overwrite method:\\ ' , ex oldMethod whoString , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8944 |
, ex oldPackage , ''' with method from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8945 |
label := 'Method redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8946 |
redefKind := 'method'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8947 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8948 |
] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8949 |
msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8950 |
, ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8951 |
label := 'Class redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8952 |
redefKind := 'class'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8953 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8954 |
] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender| |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8955 |
label := msg := 'Breakpoint/Halt in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8956 |
sender := ex suspendedContext. |
19152 | 8957 |
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
|
8958 |
] ifFalse:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8959 |
label := 'Error in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8960 |
msg := 'error in fileIn: %1' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8961 |
]]]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8962 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8963 |
msg := msg bindWith:ex description. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8964 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8965 |
labels := #('Cancel' 'Skip' 'Debug' 'Compare Sources'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8966 |
values := #(abort skip debug compareSources). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8967 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8968 |
isRedef ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8969 |
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
|
8970 |
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
|
8971 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8972 |
labels := labels , #('Keep Package' ). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8973 |
values := values , #(keep). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8974 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8975 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8976 |
labels := labels , #( 'Continue' 'ContinueForAll'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8977 |
values := values , #( continue continueForAll). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8978 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8979 |
AbortAllOperationWantedQuery query ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8980 |
labels := #('Cancel All') , labels. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8981 |
values := #(cancelAll) , values. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8982 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8983 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8984 |
action := Dialog |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8985 |
choose:(msg withCRs) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8986 |
label:label |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8987 |
image:(WarningBox iconBitmap) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8988 |
labels:labels |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8989 |
values:values |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8990 |
default:#continue |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8991 |
onCancel:#abort. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8992 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8993 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8994 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8995 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8996 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8997 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8998 |
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
|
8999 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9000 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9001 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9002 |
(action == #compareSources) ifTrue:[ |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9003 |
DiffCodeView |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9004 |
openOn:(ex oldMethod source) label:'Old Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9005 |
and:(ex newMethod source) label:'New Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9006 |
title:ex description. |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9007 |
ex resignalAs:ex |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9008 |
]. |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
9009 |
(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
|
9010 |
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
|
9011 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9012 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9013 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9014 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9015 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9016 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9017 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9018 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9019 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9020 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9021 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9022 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9023 |
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
|
9024 |
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
|
9025 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9026 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9027 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9028 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9029 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9030 |
] |
7040 | 9031 |
|
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9032 |
"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
|
9033 |
"Modified: / 19-02-2014 / 12:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4531 | 9034 |
! |
9035 |
||
4558 | 9036 |
splitFile:infile intoPiecesOfSize:kiloBytes |
9037 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
9038 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
9039 |
||
9040 |
bufferSize := 32*1024. |
|
9041 |
||
9042 |
inStream := infile readStream. |
|
9043 |
||
9044 |
bytesPerSplit := kiloBytes * 1024. |
|
9045 |
||
9046 |
remaining := infile fileSize. |
|
9047 |
splitIndex := 1. |
|
9048 |
[remaining > 0] whileTrue:[ |
|
9049 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
9050 |
outStream := outFile asFilename writeStream. |
|
9051 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
9052 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
9053 |
buffer := ByteArray new:bufferSize. |
|
9054 |
n := inStream |
|
9055 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
9056 |
into:buffer |
|
9057 |
startingAt:1. |
|
9058 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
9059 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
9060 |
remaining := remaining - n. |
|
9061 |
]. |
|
9062 |
outStream close. |
|
9063 |
splitIndex := splitIndex + 1. |
|
9064 |
]. |
|
9065 |
inStream close. |
|
9066 |
! |
|
9067 |
||
15906 | 9068 |
splitFile:infile intoPiecesWithNumberOfLines:numberOfLines |
9069 |
|splitIndex line |
|
9070 |
inStream outFile outStream remainingLinesInThisOutfile| |
|
9071 |
||
9072 |
inStream := infile readStream. |
|
9073 |
||
9074 |
splitIndex := 1. |
|
9075 |
[inStream atEnd] whileFalse:[ |
|
9076 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
9077 |
outStream := outFile asFilename writeStream. |
|
9078 |
remainingLinesInThisOutfile := numberOfLines. |
|
9079 |
[(remainingLinesInThisOutfile > 0) and:[inStream atEnd not]] whileTrue:[ |
|
9080 |
line := inStream nextLine. |
|
15910 | 9081 |
outStream nextPutLine:line. |
15906 | 9082 |
remainingLinesInThisOutfile := remainingLinesInThisOutfile - 1. |
9083 |
]. |
|
9084 |
outStream close. |
|
9085 |
splitIndex := splitIndex + 1. |
|
9086 |
]. |
|
9087 |
inStream close. |
|
9088 |
! |
|
9089 |
||
4558 | 9090 |
splitSelectedFiles |
6264 | 9091 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 9092 |
|
12871 | 9093 |
selectedFiles := self currentSelectedFiles. |
4558 | 9094 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
9095 |
||
6265 | 9096 |
msg := (numFiles > 1) |
9097 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
9098 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 9099 |
|
6352 | 9100 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 9101 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
9102 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 9103 |
kiloBytes isNil ifTrue:[^ self]. |
9104 |
||
9105 |
selectedFiles do:[:fileName | |
|
18453 | 9106 |
fileName isRegularFile ifTrue:[ |
9107 |
self notify:('Splitting:', fileName baseName). |
|
4558 | 9108 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
9109 |
] |
|
9110 |
]. |
|
6190 | 9111 |
self notify:nil. |
6265 | 9112 |
|
7560 | 9113 |
"Modified: / 04-12-2006 / 13:15:26 / cg" |
4558 | 9114 |
! |
9115 |
||
15906 | 9116 |
splitSelectedFilesByLines |
9117 |
|selectedFiles numFiles msg numLinesString numLines| |
|
9118 |
||
9119 |
selectedFiles := self currentSelectedFiles. |
|
9120 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
9121 |
||
9122 |
msg := (numFiles > 1) |
|
9123 |
ifTrue:'Split each of the %1 files into pieces with number of lines:' |
|
9124 |
ifFalse:'Split %2 into pieces with number of lines:'. |
|
9125 |
||
9126 |
numLinesString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
9127 |
numLinesString isEmptyOrNil ifTrue:[^ self]. |
|
9128 |
||
9129 |
numLines := Integer readFrom:numLinesString onError:nil. |
|
9130 |
numLines isNil ifTrue:[^ self]. |
|
9131 |
||
9132 |
selectedFiles do:[:fileName | |
|
18453 | 9133 |
fileName isRegularFile ifTrue:[ |
9134 |
self notify:('Splitting:', fileName baseName). |
|
15906 | 9135 |
self splitFile:fileName intoPiecesWithNumberOfLines:numLines |
9136 |
] |
|
9137 |
]. |
|
9138 |
self notify:nil. |
|
9139 |
! |
|
9140 |
||
15211 | 9141 |
truncateSelectedFilesToZeroSize |
9142 |
|selectedFiles numFiles msg| |
|
9143 |
||
9144 |
selectedFiles := self currentSelectedObjects. |
|
9145 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
9146 |
||
9147 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
|
9148 |
numFiles > 1 ifTrue:[ |
|
9149 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
|
9150 |
]. |
|
9151 |
||
9152 |
(Dialog |
|
9153 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
|
9154 |
initialAnswer:false |
|
9155 |
) ifFalse:[ |
|
9156 |
^ self |
|
9157 |
]. |
|
9158 |
||
9159 |
selectedFiles do:[:fileName | |
|
9160 |
|s| |
|
9161 |
||
18453 | 9162 |
fileName isRegularFile ifTrue:[ |
9163 |
self notify:('Truncating:', fileName baseName). |
|
15211 | 9164 |
[ |
9165 |
s := fileName writeStream. |
|
9166 |
s close. |
|
9167 |
] on:FileStream openErrorSignal do:[:ex| |
|
9168 |
self warn:('Cannot truncate "%1".' bindWith:fileName baseName allBold). |
|
9169 |
]. |
|
9170 |
] |
|
9171 |
]. |
|
9172 |
self notify:nil. |
|
9173 |
||
9174 |
"Modified: / 04-12-2006 / 13:15:28 / cg" |
|
9175 |
! ! |
|
3892 | 9176 |
|
4849 | 9177 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 9178 |
|
9179 |
anySTFilesPresent |
|
9180 |
^ self anyFilesPresentWithSuffix:'st' |
|
9181 |
! |
|
9182 |
||
9183 |
canCreateNewProject |
|
9184 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
17865 | 9185 |
^ self currentSelectedFiles |
9186 |
contains:[:fileName| |
|
9187 |
| suffix| |
|
9188 |
suffix := fileName suffix asLowercase. |
|
9189 |
(suffix = 'prj' or:[suffix = 'st']) |
|
9190 |
] |
|
3892 | 9191 |
! |
9192 |
||
9193 |
canDoTerminal |
|
9194 |
||
9195 |
^ OperatingSystem isUNIXlike |
|
9196 |
or:[OperatingSystem isMSWINDOWSlike] |
|
9197 |
! |
|
9198 |
||
9199 |
canDoTerminalAndSystemIsDOS |
|
9200 |
||
9201 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
9202 |
! |
|
9203 |
||
9204 |
canDoTerminalAndSystemIsUnix |
|
9205 |
||
9206 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
9207 |
! |
|
9208 |
||
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9209 |
canGenerateSignatureFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
9210 |
"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
|
9211 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9212 |
Expecco::KeyFileGenerator isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9213 |
Expecco::KeyFile isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9214 |
|
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
9215 |
^ self currentSelectedFiles notEmptyOrNil |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9216 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9217 |
|
12811 | 9218 |
canOpenMonticelloBrowser |
9219 |
^ self currentSelectedFiles |
|
9220 |
contains:[:fileName| |
|
18746 | 9221 |
fileName suffix sameAs:'mcz' |
12811 | 9222 |
] |
18746 | 9223 |
|
9224 |
"Modified: / 01-05-2019 / 11:21:16 / Claus Gittinger" |
|
12811 | 9225 |
! |
9226 |
||
3892 | 9227 |
canReadAbbrevFile |
9228 |
||
5960 | 9229 |
|currentDirectory| |
3892 | 9230 |
|
9231 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 9232 |
currentDirectory := self currentDirectory. |
9233 |
^ currentDirectory notNil |
|
9234 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 9235 |
! |
9236 |
||
9237 |
canRemoveFromSourcePath |
|
9238 |
||
9239 |
^ false |
|
9240 |
! |
|
9241 |
||
13089 | 9242 |
cannotGenerateSignatureFiles |
9243 |
^ self canGenerateSignatureFiles not |
|
9244 |
! |
|
9245 |
||
3892 | 9246 |
hasASN1 |
9247 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 9248 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 9249 |
|
9250 |
! |
|
9251 |
||
9252 |
hasASN1AndSelection |
|
9253 |
^ [ self hasSelection value |
|
17416 | 9254 |
and:[self currentSelectedFiles notEmptyOrNil |
4414 | 9255 |
and:[OSI::ASN1Parser notNil |
9256 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
17416 | 9257 |
|
9258 |
"Modified: / 17-02-2017 / 08:25:09 / cg" |
|
3892 | 9259 |
! |
9260 |
||
9261 |
hasCBrowser |
|
9262 |
^ [ CBrowser::Browser notNil ] |
|
9263 |
! |
|
9264 |
||
9265 |
hasJava |
|
9266 |
||
14298 | 9267 |
^ [ JavaVM notNil |
9268 |
and:[JavaClassReader notNil |
|
9269 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 9270 |
! |
9271 |
||
9272 |
hasJavaAndSelection |
|
9273 |
||
12871 | 9274 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 9275 |
and:[JavaClassReader notNil |
9276 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 9277 |
! |
9278 |
||
9279 |
hasMP3Player |
|
9280 |
||
9281 |
^ [ MP3PlayerApplication notNil |
|
4414 | 9282 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 9283 |
! |
9284 |
||
9285 |
hasMP3PlayerAndSelection |
|
9286 |
||
12871 | 9287 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 9288 |
and:[ self hasMP3Player value]] |
3892 | 9289 |
! |
9290 |
||
8426 | 9291 |
hasResourceFileSelected |
12871 | 9292 |
^ (self currentSelectedFiles) |
9293 |
contains:[:fn | |
|
18746 | 9294 |
fn suffix sameAs:'rs' |
9295 |
]. |
|
9296 |
||
9297 |
"Modified: / 01-05-2019 / 11:23:30 / Claus Gittinger" |
|
8426 | 9298 |
! |
9299 |
||
3892 | 9300 |
hasSlideShow |
9301 |
||
9302 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
9303 |
! |
|
9304 |
||
9305 |
hasSnapshotSelection |
|
9306 |
||
9307 |
^ [ |
|
4414 | 9308 |
| files | |
8426 | 9309 |
|
4414 | 9310 |
files := self currentSelectedFiles. |
9311 |
((files size == 1) |
|
9312 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 9313 |
] |
9314 |
! |
|
9315 |
||
7869 | 9316 |
hasXml |
9206 | 9317 |
^ [ XML::XMLParser notNil ] |
7869 | 9318 |
! |
9319 |
||
9320 |
hasXmlFileSelected |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
9321 |
"/ 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
|
9322 |
"/ then handle the error when it ever fails during xml-parsing. |
7869 | 9323 |
|
8426 | 9324 |
^ [ |
9325 |
|sel fileName| |
|
7869 | 9326 |
|
9327 |
sel := self currentSelectedFiles. |
|
9328 |
sel size == 1 ifTrue:[ |
|
9329 |
fileName := sel first. |
|
9330 |
fileName notNil ifTrue:[ |
|
15936 | 9331 |
#('xml' 'xsd' 'vdx') includes:fileName suffix asLowercase |
7869 | 9332 |
] ifFalse:[ |
9333 |
false |
|
9334 |
] |
|
9335 |
] ifFalse:[ |
|
9336 |
false |
|
9337 |
] |
|
9338 |
] |
|
9339 |
! |
|
9340 |
||
3892 | 9341 |
hasZipFileSelected |
17982 | 9342 |
|sel fileName suff mime| |
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9343 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9344 |
sel := self currentSelectedFiles. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9345 |
sel size == 1 ifFalse:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9346 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9347 |
fileName := sel first. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9348 |
fileName isNil ifTrue:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9349 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9350 |
suff := fileName suffix asLowercase. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9351 |
(suff = 'zip' or:[suff = 'jar']) ifTrue:[^ true]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9352 |
|
17982 | 9353 |
mime := fileName mimeTypeOfContents. |
9354 |
"/ prepare for change (iana has obsoleted the x- types) |
|
9355 |
^ (mime = 'application/x-zip-compressed') or:[mime = 'application/zip'] |
|
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9356 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9357 |
"Modified: / 14-02-2011 / 17:17:03 / cg" |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9358 |
! |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9359 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9360 |
hasZipFileSelectedHolder |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9361 |
^ [ self hasZipFileSelected ] |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9362 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9363 |
"Created: / 14-02-2011 / 17:16:08 / cg" |
3892 | 9364 |
! |
9365 |
||
9366 |
javaSupportLoaded |
|
9367 |
||
9368 |
^ false |
|
9369 |
! ! |
|
9370 |
||
14126 | 9371 |
|
9372 |
||
3906 | 9373 |
!AbstractFileBrowser methodsFor:'presentation'! |
9374 |
||
9375 |
getModeString:modeBits |
|
9376 |
"convert file-mode bits into a more user-friendly string. |
|
9377 |
This is wrong here - should be moved into OperatingSystem." |
|
9378 |
||
9379 |
^ self getModeString:modeBits |
|
4414 | 9380 |
with:#( 'owner:' $r $w $x |
9381 |
' group:' $r $w $x |
|
9382 |
' others:' $r $w $x ) |
|
3906 | 9383 |
! |
9384 |
||
9385 |
getModeString:modeBits with:texts |
|
9386 |
"convert file-mode bits into a more user-friendly string. |
|
9387 |
This is wrong here - should be moved into OperatingSystem." |
|
9388 |
||
9389 |
|bits modeString| |
|
9390 |
||
9391 |
bits := modeBits bitAnd:8r777. |
|
9392 |
modeString := ''. |
|
9393 |
||
9394 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
9395 |
with: texts do:[:bitMask :access | |
|
4414 | 9396 |
|ch| |
9397 |
||
9398 |
bitMask isNil ifTrue:[ |
|
9399 |
modeString := modeString , access |
|
9400 |
] ifFalse:[ |
|
9401 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
9402 |
ch := $- |
|
9403 |
] ifFalse:[ |
|
9404 |
ch := access |
|
9405 |
]. |
|
9406 |
modeString := modeString copyWith:ch |
|
9407 |
] |
|
3906 | 9408 |
]. |
9409 |
^ modeString |
|
9410 |
! ! |
|
9411 |
||
5880 | 9412 |
!AbstractFileBrowser methodsFor:'private'! |
9413 |
||
9414 |
theSingleSelectedDirectoryOrHomeDir |
|
9415 |
|dir| |
|
9416 |
||
5888 | 9417 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 9418 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
9419 |
^ dir. |
|
9420 |
! |
|
9421 |
||
9422 |
theSingleSelectedDirectoryOrNil |
|
9423 |
|dirs| |
|
9424 |
||
9425 |
dirs := self currentSelectedDirectories. |
|
19152 | 9426 |
dirs size ~~ 1 ifTrue:[ ^ nil]. |
5880 | 9427 |
^ dirs anElement. |
14577 | 9428 |
! |
9429 |
||
9430 |
theSingleSelectedFileOrNil |
|
9431 |
|dirs| |
|
9432 |
||
9433 |
dirs := self currentSelectedFiles. |
|
19152 | 9434 |
dirs size ~~ 1 ifTrue:[ ^ nil]. |
14577 | 9435 |
^ dirs anElement. |
18751 | 9436 |
! |
9437 |
||
9438 |
theSingleSelectedItemOrNil |
|
9439 |
|items| |
|
9440 |
||
9441 |
items := self selectedItems. |
|
19152 | 9442 |
items size ~~ 1 ifTrue:[ ^ nil]. |
18751 | 9443 |
^ items anElement. |
9444 |
||
9445 |
"Created: / 02-05-2019 / 18:53:06 / Claus Gittinger" |
|
5880 | 9446 |
! ! |
9447 |
||
3892 | 9448 |
!AbstractFileBrowser methodsFor:'queries'! |
9449 |
||
8256 | 9450 |
cBrowserLoaded |
18432 | 9451 |
^ (Smalltalk at:#'CBrowser::Browser') notNil |
9452 |
||
9453 |
"Modified: / 26-09-2018 / 12:06:32 / Claus Gittinger" |
|
8256 | 9454 |
! |
9455 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9456 |
cBrowserMenuItemVisible |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9457 |
^ self cBrowserLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9458 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9459 |
"Created: / 04-10-2011 / 13:40:38 / cg" |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9460 |
! |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9461 |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9462 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9463 |
"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
|
9464 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9465 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9466 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9467 |
|
3906 | 9468 |
getFileInfoStringForFirstSelectedFile:longInfo |
9469 |
"get stat info on selected file - return a string which can be |
|
9470 |
shown in a box" |
|
9471 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9472 |
|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
|
9473 |
sizeString fileSize tAccess tModification buffer| |
3906 | 9474 |
|
7560 | 9475 |
selFiles := self currentSelectedObjects. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9476 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 9477 |
filename := selFiles first. |
9478 |
||
8364 | 9479 |
info := filename linkInfo. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9480 |
info isNil ifTrue:[ |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9481 |
^ 'Cannot get fileInfo'. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9482 |
^ nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9483 |
]. |
8364 | 9484 |
|
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
9485 |
buffer := Text writeStream. |
4765 | 9486 |
|
9487 |
buffer |
|
9488 |
nextPutAll:'filename: '; |
|
9489 |
nextPutLine:filename asString. |
|
9490 |
||
8364 | 9491 |
OperatingSystem isMSDOSlike ifTrue: [ |
9492 |
(info alternativeName notNil |
|
9493 |
and:[ info alternativeName ~= info fullName ]) ifTrue:[ |
|
9494 |
buffer nextPutAll:'shortname: '. |
|
9495 |
buffer nextPutLine:info alternativeName. |
|
9496 |
] |
|
9497 |
]. |
|
9498 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9499 |
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
|
9500 |
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
|
9501 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9502 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9503 |
]. |
4765 | 9504 |
buffer |
9505 |
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
|
9506 |
nextPutLine:(info path ? '???'). |
3906 | 9507 |
] 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
|
9508 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9509 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9510 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9511 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9512 |
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
|
9513 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9514 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9515 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9516 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9517 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9518 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9519 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9520 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9521 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9522 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9523 |
fileSize > 1024 ifTrue:[ |
8172 | 9524 |
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
|
9525 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9526 |
]. |
4765 | 9527 |
buffer nextPutLine:sizeString. |
3906 | 9528 |
|
9529 |
modeBits := info mode. |
|
9530 |
modeString := self getModeString:modeBits. |
|
4765 | 9531 |
|
9532 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 9533 |
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
|
9534 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 9535 |
]. |
4765 | 9536 |
buffer |
9537 |
cr; |
|
9538 |
nextPutAll:'owner: '; |
|
9539 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
9540 |
||
3906 | 9541 |
longInfo ifTrue:[ |
4765 | 9542 |
buffer |
9543 |
nextPutAll:'group: '; |
|
9544 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
9545 |
||
9546 |
tAccess := info accessTime. |
|
9547 |
buffer |
|
9548 |
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
|
9549 |
nextPutAll:tAccess asDate printString; |
4765 | 9550 |
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
|
9551 |
nextPutLine:tAccess asTime printString. |
4765 | 9552 |
|
9553 |
tModification := info modificationTime. |
|
9554 |
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
|
9555 |
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
|
9556 |
nextPutAll:tModification asDate printString; |
4765 | 9557 |
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
|
9558 |
nextPutLine:tModification asTime printString. |
3906 | 9559 |
]. |
4765 | 9560 |
^ buffer contents |
7560 | 9561 |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
9562 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
3906 | 9563 |
! |
9564 |
||
8510 | 9565 |
hasImageColorHistogram |
9566 |
^ ImageColorHistogram notNil |
|
9567 |
! |
|
9568 |
||
17686 | 9569 |
hasImageHistogram |
9570 |
^ ImageAlgorithms notNil |
|
9571 |
||
9572 |
"Created: / 10-09-2017 / 16:50:34 / cg" |
|
9573 |
! |
|
9574 |
||
10258 | 9575 |
hasSubversionSupport |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
9576 |
^ ConfigurableFeatures includesFeature: #SubversionSupport |
10258 | 9577 |
|
9578 |
"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
|
9579 |
"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
|
9580 |
"Modified: / 19-01-2012 / 10:43:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10258 | 9581 |
! |
9582 |
||
3892 | 9583 |
initialCommandFor:fileName into:aBox |
9584 |
"set a useful initial command for execute box." |
|
9585 |
||
18734 | 9586 |
self class |
9587 |
initialCommandFor:fileName |
|
9588 |
in:self "Filename" currentDirectory |
|
9589 |
intoBox:aBox |
|
9590 |
||
9591 |
"Modified: / 10-04-2019 / 05:55:21 / Claus Gittinger" |
|
3892 | 9592 |
! |
9593 |
||
9594 |
isAbstractFileBrowser |
|
9595 |
||
9596 |
^ true |
|
9597 |
! |
|
9598 |
||
18432 | 9599 |
stxgdbLoaded |
9600 |
^ (Smalltalk at:#GDBApplication) notNil |
|
9601 |
||
9602 |
"Created: / 26-09-2018 / 12:06:23 / Claus Gittinger" |
|
9603 |
! |
|
9604 |
||
9605 |
stxgdbMenuItemVisible |
|
9606 |
^ self stxgdbLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
|
9607 |
||
9608 |
"Created: / 26-09-2018 / 12:05:45 / Claus Gittinger" |
|
9609 |
! |
|
9610 |
||
3892 | 9611 |
systemIsDOS |
9612 |
^ OperatingSystem isMSDOSlike |
|
9613 |
! |
|
9614 |
||
12473 | 9615 |
systemIsOSX |
9616 |
^ OperatingSystem isOSXlike |
|
9617 |
! |
|
9618 |
||
3892 | 9619 |
systemIsUnix |
9620 |
^ OperatingSystem isUNIXlike |
|
14980 | 9621 |
! |
9622 |
||
9623 |
systemSupportsVolumes |
|
9624 |
^ OperatingSystem supportsVolumes |
|
3892 | 9625 |
! ! |
9626 |
||
9627 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
9628 |
||
9629 |
allItemsOfCurrentDirectory |
|
5009 | 9630 |
self |
4774 | 9631 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 9632 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
9633 |
||
9634 |
^ nil |
|
3892 | 9635 |
! |
9636 |
||
9637 |
anyFilesPresentWithSuffix:suffix |
|
6725 | 9638 |
self currentSelectedDirectories do:[:dir| |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9639 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
9640 |
(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
|
9641 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 9642 |
]. |
9643 |
^ false. |
|
9644 |
! |
|
9645 |
||
19009 | 9646 |
commonPrefixOfFiles:files |
19015 | 9647 |
|stringCol commonPrefix| |
19009 | 9648 |
|
9649 |
stringCol := files collect:#asString. |
|
19015 | 9650 |
stringCol do:[:el| |
9651 |
commonPrefix := commonPrefix isNil |
|
9652 |
ifTrue:[el] |
|
9653 |
ifFalse:[commonPrefix commonPrefixWith:el]. |
|
9654 |
]. |
|
9655 |
commonPrefix isNil ifTrue:[^ nil]. |
|
9656 |
^ commonPrefix asFilename |
|
7560 | 9657 |
|
9658 |
"Modified: / 04-12-2006 / 13:14:25 / cg" |
|
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9659 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9660 |
|
19009 | 9661 |
commonPrefixOfSelectedFiles |
9662 |
|selFiles| |
|
9663 |
||
9664 |
selFiles := self currentSelectedObjects. |
|
9665 |
selFiles isEmpty ifTrue:[^ nil]. |
|
9666 |
||
9667 |
^ self commonPrefixOfFiles:selFiles |
|
9668 |
! |
|
9669 |
||
12481 | 9670 |
compressTabsOnSave |
9671 |
"if true, compress leading spaces (multiples of 8) with a tab character |
|
9672 |
when saving. |
|
9673 |
Default is true" |
|
9674 |
||
9675 |
^ true |
|
9676 |
! |
|
9677 |
||
3892 | 9678 |
currentFilesAreInSameDirectory |
9679 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9680 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 9681 |
! |
9682 |
||
9683 |
currentFilesHasDirectories |
|
9684 |
||
6725 | 9685 |
^ self currentSelectedDirectories notEmpty. |
3892 | 9686 |
! |
9687 |
||
3982 | 9688 |
directoriesForFiles:aFileCol |
19009 | 9689 |
^ aFileCol collect:[:eachName| self class getDirectoryOf:eachName] as:Set. |
3982 | 9690 |
! |
9691 |
||
3892 | 9692 |
fileListIsEmpty |
5009 | 9693 |
self |
9694 |
applicationNamed:#DirectoryContentsBrowser |
|
9695 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
9696 |
||
9697 |
^ nil. |
|
3892 | 9698 |
! |
9699 |
||
9700 |
fileListIsNotEmpty |
|
9701 |
||
9702 |
^ self fileListIsEmpty not. |
|
9703 |
! |
|
9704 |
||
9705 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 9706 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 9707 |
|
9708 |
| file1 file2 | |
|
9709 |
||
6284 | 9710 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 9711 |
file1 := aFilename1 asFilename. |
9712 |
file2 := aFilename2 asFilename. |
|
6284 | 9713 |
|
3892 | 9714 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 9715 |
|
3892 | 9716 |
((file1 isDirectory) |
9717 |
and:[(file2 isDirectory) |
|
9718 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 9719 |
^ file1 baseName = file2 baseName |
3892 | 9720 |
]. |
3982 | 9721 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 9722 |
! |
9723 |
||
9724 |
getAllFilesAsStringCollection |
|
5009 | 9725 |
self |
9726 |
applicationNamed:#DirectoryContentsBrowser |
|
9727 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
9728 |
||
9729 |
^ nil |
|
3892 | 9730 |
! |
9731 |
||
9732 |
getBestDirectory |
|
17868 | 9733 |
"from a set of directories, return the common parent directory" |
9734 |
||
9735 |
^ self class getBestDirectoryFrom:(self currentSelectedDirectories) |
|
3892 | 9736 |
! |
9737 |
||
9738 |
getDirWithoutFileName:aFileName |
|
19009 | 9739 |
<resource: #obsolete> |
9740 |
^ self class getDirectoryOf:aFileName |
|
3892 | 9741 |
! |
9742 |
||
9743 |
getInfoItem |
|
9744 |
"get filename of a description-file (.dir.info, README etc.); |
|
16778 | 9745 |
This file is automatically shown when a directory is entered. |
3892 | 9746 |
You can add more names below if you like." |
9747 |
||
5880 | 9748 |
|dir| |
9749 |
||
9750 |
dir := self theSingleSelectedDirectoryOrNil. |
|
9751 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 9752 |
|
16778 | 9753 |
#( |
3892 | 9754 |
'.dir.info' |
9755 |
'README' |
|
9756 |
'ReadMe' |
|
9757 |
'Readme' |
|
9758 |
'readme' |
|
9759 |
'read.me' |
|
9760 |
'Read.me' |
|
9761 |
'READ.ME' |
|
9762 |
'README.TXT' |
|
15915 | 9763 |
'README.txt' |
3892 | 9764 |
'readme.txt' |
9765 |
'Readme.txt' |
|
9766 |
'Info.txt' |
|
9767 |
'info.txt' |
|
9768 |
'INFO.TXT' |
|
15915 | 9769 |
'INFO.txt' |
16778 | 9770 |
) do:[:f | |
5883 | 9771 |
|n| |
4414 | 9772 |
|
5880 | 9773 |
n := dir construct:f. |
18453 | 9774 |
(n isReadable and:[n isRegularFile]) ifTrue:[ |
4414 | 9775 |
^ DirectoryContentsBrowser itemClass fileName:n |
9776 |
] |
|
3892 | 9777 |
]. |
9778 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9779 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9780 |
|
12497 | 9781 |
hasPackageDirectorySelected |
9782 |
|dir| |
|
9783 |
||
9784 |
dir := self currentDirectory. |
|
9785 |
^ dir notNil |
|
9786 |
and:[ dir exists |
|
9787 |
and:[ (dir / 'abbrev.stc') exists ]] |
|
9788 |
! |
|
9789 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9790 |
parentDirectoriesOfCurrentFiles |
11743 | 9791 |
^ self currentSelectedObjects |
9792 |
collect:[:file | file directory] as:Set |
|
7560 | 9793 |
|
9794 |
"Modified: / 04-12-2006 / 13:15:21 / cg" |
|
6521 | 9795 |
! |
9796 |
||
9797 |
recursiveAnyFilesPresentWithSuffix:suffix |
|
6652 | 9798 |
^ true. "/ the code below is too slow for a menu enabling operation |
9799 |
||
9800 |
"/ |directories| |
|
9801 |
"/ |
|
9802 |
"/ directories := self currentDirectories value. |
|
9803 |
"/ directories do:[:dir| |
|
9804 |
"/ [ |
|
9805 |
"/ dir recursiveDirectoryContentsDo:[:f | |
|
9806 |
"/ (f asFilename suffix = suffix) ifTrue:[ ^ true] |
|
9807 |
"/ ] |
|
9808 |
"/ ] on:FileStream openErrorSignal do:[:ex|]. |
|
9809 |
"/ ]. |
|
9810 |
"/ ^ false. |
|
6586 | 9811 |
! |
9812 |
||
9813 |
recursiveAnySTFilesPresent |
|
9814 |
^ self recursiveAnyFilesPresentWithSuffix:'st' |
|
3982 | 9815 |
! ! |
9816 |
||
9817 |
!AbstractFileBrowser methodsFor:'selection'! |
|
9818 |
||
9819 |
currentSelectedDirectories |
|
6725 | 9820 |
^ self currentDirectoriesValue. |
3982 | 9821 |
! |
9822 |
||
9823 |
currentSelectedFiles |
|
17865 | 9824 |
^ self currentSelectedObjects reject:#isDirectory. |
7560 | 9825 |
|
9826 |
"Modified: / 04-12-2006 / 13:14:39 / cg" |
|
3982 | 9827 |
! |
9828 |
||
6460 | 9829 |
currentSelectedObjects |
9830 |
^ self currentFileNameHolder value |
|
9831 |
! |
|
9832 |
||
3982 | 9833 |
firstSelectedFile |
7560 | 9834 |
^ self currentSelectedObjects |
12102 | 9835 |
detect:[:file | (file ? '') asFilename isDirectory not] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9836 |
ifNone:[]. |
7560 | 9837 |
|
9838 |
"Modified: / 04-12-2006 / 13:14:50 / cg" |
|
4414 | 9839 |
! |
9840 |
||
9490 | 9841 |
hasOnlyDirectoriesSelected |
9842 |
^ self currentSelectedObjects conform:[:file | file isDirectory]. |
|
9843 |
||
9844 |
"Created: / 20-05-2010 / 10:45:03 / cg" |
|
9845 |
! |
|
9846 |
||
4414 | 9847 |
hasOnlyFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9848 |
|
7560 | 9849 |
^ self currentSelectedObjects conform:[:file | file isDirectory not]. |
9850 |
||
9851 |
"Modified: / 04-12-2006 / 13:15:01 / cg" |
|
4414 | 9852 |
! |
9853 |
||
9490 | 9854 |
hasTwoDirectoriesSelected |
9855 |
||
9856 |
^ self currentSelectedObjects size == 2 |
|
9857 |
and:[self hasOnlyDirectoriesSelected] |
|
9858 |
||
9859 |
"Created: / 20-05-2010 / 10:45:18 / cg" |
|
9860 |
! |
|
9861 |
||
4414 | 9862 |
hasTwoFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9863 |
|
7560 | 9864 |
^ self currentSelectedObjects size == 2 |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9865 |
and:[self hasOnlyFilesSelected] |
7560 | 9866 |
|
9867 |
"Modified: / 04-12-2006 / 13:15:04 / cg" |
|
14577 | 9868 |
! |
9869 |
||
18751 | 9870 |
selectFiles:aCollectionOfFiles |
9871 |
self subclassResponsibility |
|
9872 |
||
9873 |
"Created: / 02-05-2019 / 18:40:04 / Claus Gittinger" |
|
9874 |
! |
|
9875 |
||
14577 | 9876 |
selectNextFile |
9877 |
self |
|
9878 |
applicationNamed:#DirectoryContentsBrowser |
|
9879 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectNextFile ]]. |
|
9880 |
! |
|
9881 |
||
9882 |
selectPreviousFile |
|
9883 |
self |
|
9884 |
applicationNamed:#DirectoryContentsBrowser |
|
9885 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectPreviousFile ]]. |
|
18751 | 9886 |
! |
9887 |
||
9888 |
selectedItems |
|
9889 |
self subclassResponsibility |
|
9890 |
||
9891 |
"Created: / 02-05-2019 / 21:27:38 / Claus Gittinger" |
|
3892 | 9892 |
! ! |
9893 |
||
3964 | 9894 |
!AbstractFileBrowser methodsFor:'sorting'! |
9895 |
||
3989 | 9896 |
currentSortOrder |
17790 | 9897 |
^ self |
9898 |
aspectFor:#currentSortOrder |
|
9899 |
ifAbsent:[ |
|
9900 |
(Dictionary new |
|
9901 |
at:#column put:nil; |
|
9902 |
at:#reverse put:false; |
|
9903 |
at:#sortCaseless put:false; |
|
9904 |
yourself |
|
9905 |
) asValue |
|
9906 |
]. |
|
9907 |
||
9908 |
"Modified: / 25-11-2017 / 17:43:00 / cg" |
|
3989 | 9909 |
! |
9910 |
||
9911 |
sortBlockHolder |
|
9912 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 9913 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9914 |
selector:#fileName |
|
9915 |
sortCaseless:self sortCaseless value |
|
9916 |
sortReverse:false) asValue. |
|
3989 | 9917 |
]. |
9918 |
! |
|
9919 |
||
9920 |
sortBlockProperty |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9921 |
|v| |
4027 | 9922 |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9923 |
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
|
9924 |
v addDependent:self. |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9925 |
^ v. |
3989 | 9926 |
! |
9927 |
||
9928 |
sortCaseless |
|
4201 | 9929 |
" aspect for sort caseless " |
3989 | 9930 |
|
13000 | 9931 |
^ self |
9932 |
aspectFor:#sortCaseless |
|
9933 |
ifAbsent:[ (Filename isCaseSensitive not) asValue ] |
|
3989 | 9934 |
! |
9935 |
||
4074 | 9936 |
sortDirectoriesBeforeFiles |
9937 |
||
4201 | 9938 |
" aspect for sort directories always before files" |
4074 | 9939 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
9940 |
! |
|
9941 |
||
3989 | 9942 |
sortFileListsBy:instanceName |
9943 |
||
9944 |
self sortFileListsBy:instanceName withReverse:true |
|
9945 |
! |
|
9946 |
||
9947 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
9948 |
| aSymbol sortCaselessLocal currentSortOrder sorter isReverse| |
3964 | 9949 |
|
9950 |
aSymbol := instanceName asSymbol. |
|
4027 | 9951 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 9952 |
sortCaselessLocal := self sortCaseless value. |
4027 | 9953 |
currentSortOrder := self currentSortOrder value. |
17790 | 9954 |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9955 |
currentSortOrder isEmptyOrNil ifTrue:[ |
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9956 |
self currentSortOrder value:(currentSortOrder := Dictionary new). |
4343 | 9957 |
currentSortOrder at:#column put:aSymbol. |
9958 |
currentSortOrder at:#reverse put:false. |
|
9959 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 9960 |
] ifFalse:[ |
4343 | 9961 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
9962 |
"/ sort caseless changed |
|
9963 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
9964 |
] ifFalse:[ |
|
9965 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
9966 |
"/ same column like before - change sort order ifReverse is true |
|
9967 |
aBoolean ifTrue:[ |
|
9968 |
isReverse := currentSortOrder at:#reverse. |
|
9969 |
currentSortOrder at:#reverse put:(isReverse not). |
|
9970 |
]. |
|
9971 |
] ifFalse:[ |
|
9972 |
"/ another column - remark column |
|
9973 |
currentSortOrder at:#column put:aSymbol. |
|
9974 |
] |
|
9975 |
] |
|
3964 | 9976 |
]. |
4027 | 9977 |
self currentSortOrder changed. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9978 |
|
5383 | 9979 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9980 |
selector:instanceName |
|
9981 |
sortCaseless:sortCaselessLocal |
|
9982 |
sortReverse:(currentSortOrder at:#reverse). |
|
9983 |
self sortBlockHolder value:sorter. |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9984 |
|
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9985 |
"Modified: / 18-09-2007 / 09:42:47 / cg" |
17790 | 9986 |
"Modified (format): / 25-11-2017 / 17:43:31 / cg" |
3964 | 9987 |
! ! |
9988 |
||
3892 | 9989 |
!AbstractFileBrowser methodsFor:'startup & release'! |
9990 |
||
16720 | 9991 |
initializeAspects |
9992 |
aspects := IdentityDictionary new. |
|
9993 |
aspects at:#applications put:(IdentityDictionary new). |
|
9994 |
! |
|
9995 |
||
3892 | 9996 |
makeDependent |
4074 | 9997 |
self filterModel addDependent:self. |
4004 | 9998 |
self currentFileNameHolder addDependent:self. |
4074 | 9999 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 10000 |
self sortCaseless addDependent:self. |
4011 | 10001 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
10002 |
self rootHolder addDependent:self. |
3892 | 10003 |
! |
10004 |
||
10005 |
masterApplication:anApplication |
|
10006 |
||
10007 |
masterApplication isNil ifTrue:[ |
|
4414 | 10008 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
10009 |
aspects := anApplication aspects |
|
10010 |
] ifFalse:[ |
|
10011 |
aspects isNil ifTrue:[ |
|
16721 | 10012 |
self initializeAspects. |
4414 | 10013 |
] |
10014 |
]. |
|
10015 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10016 |
"/ self makeDependent. |
3892 | 10017 |
]. |
3952 | 10018 |
^ super masterApplication:anApplication. |
3892 | 10019 |
! |
10020 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10021 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10022 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10023 |
super postBuildWith:aBuilder. |
3892 | 10024 |
! ! |
10025 |
||
10026 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
10027 |
||
10028 |
files |
|
10029 |
"return the value of the instance variable 'files' (automatically generated)" |
|
10030 |
||
10031 |
^ files |
|
10032 |
! |
|
10033 |
||
10034 |
files:something |
|
10035 |
"set the value of the instance variable 'files' (automatically generated)" |
|
10036 |
||
10037 |
files := something. |
|
10038 |
! |
|
10039 |
||
10040 |
method |
|
10041 |
"return the value of the instance variable 'method' (automatically generated)" |
|
10042 |
||
10043 |
^ method |
|
10044 |
! |
|
10045 |
||
10046 |
method:something |
|
10047 |
"set the value of the instance variable 'method' (automatically generated)" |
|
10048 |
||
10049 |
method := something. |
|
10050 |
! ! |
|
10051 |
||
10052 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
10053 |
||
10054 |
locked |
|
10055 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
10056 |
||
10057 |
locked isNil ifTrue:[ |
|
4414 | 10058 |
locked := false. |
3892 | 10059 |
]. |
10060 |
^ locked |
|
10061 |
! ! |
|
10062 |
||
10063 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
10064 |
||
10065 |
doIfUnLocked:aBlock |
|
10066 |
||
10067 |
self locked ifFalse:[ |
|
4414 | 10068 |
aBlock value. |
3892 | 10069 |
]. |
10070 |
! |
|
10071 |
||
10072 |
doLocked:aBlock |
|
10073 |
||
10074 |
locked := true. |
|
4004 | 10075 |
aBlock ensure:[ |
4414 | 10076 |
locked := false. |
4004 | 10077 |
] |
3892 | 10078 |
! ! |
10079 |
||
3952 | 10080 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
10081 |
||
6369 | 10082 |
defaultHistorySize |
10083 |
^ 50 |
|
3892 | 10084 |
! ! |
10085 |
||
6371 | 10086 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 10087 |
|
10088 |
new |
|
6371 | 10089 |
^ (super new) initializeHistory. |
6369 | 10090 |
! ! |
10091 |
||
10092 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
10093 |
||
10094 |
historySize |
|
10095 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
10096 |
^ historySize |
|
10097 |
! |
|
10098 |
||
10099 |
historySize:aNumber |
|
10100 |
historySize := aNumber |
|
4032 | 10101 |
! ! |
10102 |
||
3892 | 10103 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
10104 |
||
3952 | 10105 |
addToHistory:aPath |
15803 | 10106 |
| item pathToAdd sep| |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10107 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10108 |
pathToAdd := aPath. |
15803 | 10109 |
(pathToAdd endsWith:(sep := Filename separator)) ifTrue:[ |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10110 |
pathToAdd asFilename isRootDirectory ifFalse:[ |
15803 | 10111 |
pathToAdd := pathToAdd copyButLast:(sep asString size). |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10112 |
] |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10113 |
]. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10114 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10115 |
item := self getItemFor:pathToAdd. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10116 |
self backForwardListAdd:pathToAdd. |
3952 | 10117 |
item isNil ifTrue:[ |
4347 | 10118 |
" not already in history" |
6369 | 10119 |
self size >= self historySize ifTrue:[ |
4347 | 10120 |
self removeLast. |
10121 |
]. |
|
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10122 |
item := DirectoryHistoryItem path:pathToAdd. |
3952 | 10123 |
] ifFalse:[ |
4347 | 10124 |
"already been there before; move the entry to |
10125 |
the beginning, so it will fall out later." |
|
10126 |
self remove:item. |
|
10381
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10127 |
]. |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10128 |
self addFirst:item |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10129 |
|
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10130 |
"Modified: / 24-07-2011 / 07:12:54 / cg" |
3952 | 10131 |
! |
10132 |
||
4347 | 10133 |
backForwardListAdd:aPath |
10134 |
|pathIndex| |
|
10135 |
||
10136 |
pathIndex := backForwardList indexOf:aPath. |
|
10137 |
pathIndex == 0 ifTrue:[ |
|
10138 |
" a new path comes in remove forward paths " |
|
10139 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
10140 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
10141 |
]. |
|
10142 |
] ifFalse:[ |
|
10143 |
backForwardList remove:aPath. |
|
10144 |
pathIndex <= backForwardIndex ifTrue:[ |
|
10145 |
backForwardIndex := backForwardIndex - 1. |
|
10146 |
] |
|
4022 | 10147 |
]. |
4347 | 10148 |
backForwardList add:aPath afterIndex:backForwardIndex. |
10149 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 10150 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 10151 |
backForwardList removeFirst. |
10152 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 10153 |
]. |
4347 | 10154 |
! |
10155 |
||
10156 |
goBackward |
|
4288 | 10157 |
"return the first path of the backward list; |
10158 |
remove it from the back list and add it ti the forward list." |
|
4022 | 10159 |
|
4347 | 10160 |
|retPath| |
10161 |
||
10162 |
self canBackward ifTrue:[ |
|
10163 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
10164 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 10165 |
]. |
4022 | 10166 |
^ retPath. |
10167 |
! |
|
10168 |
||
10169 |
goForward |
|
4288 | 10170 |
"return the first path of the forward list; |
10171 |
remove it from the list." |
|
4022 | 10172 |
|
4347 | 10173 |
|retPath| |
10174 |
||
10175 |
self canForward ifTrue:[ |
|
10176 |
retPath := backForwardList at:backForwardIndex + 1. |
|
10177 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 10178 |
]. |
4022 | 10179 |
^ retPath. |
10180 |
! |
|
10181 |
||
10182 |
resetForwardBackward |
|
10183 |
||
4347 | 10184 |
self initialize |
4022 | 10185 |
! |
10186 |
||
10187 |
setPosition:aPosition for:aPath |
|
10188 |
||
10189 |
self do:[:item| |
|
4414 | 10190 |
item path = aPath ifTrue:[ |
10191 |
item position:aPosition. |
|
10192 |
] |
|
4022 | 10193 |
]. |
3892 | 10194 |
! ! |
10195 |
||
4870 | 10196 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 10197 |
|
6371 | 10198 |
initializeHistory |
4032 | 10199 |
|
4347 | 10200 |
backForwardList := OrderedCollection new. |
10201 |
self reverseDo:[:el| |
|
10202 |
backForwardList add:el path. |
|
10203 |
]. |
|
10204 |
backForwardIndex := backForwardList size. |
|
4032 | 10205 |
! ! |
10206 |
||
3892 | 10207 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
10208 |
||
4288 | 10209 |
canBackward |
4347 | 10210 |
|
10211 |
^ backForwardIndex > 1 |
|
4288 | 10212 |
! |
10213 |
||
3892 | 10214 |
canForward |
4347 | 10215 |
|
10216 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
10217 |
! |
|
10218 |
||
10219 |
getBackCollection |
|
10220 |
||
10221 |
| backCol | |
|
10222 |
||
10223 |
backCol := OrderedCollection new. |
|
10224 |
self canBackward ifTrue:[ |
|
10225 |
| tmpCol | |
|
10226 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
10227 |
tmpCol reverseDo:[ :el| |
|
10228 |
backCol add:el. |
|
10229 |
] |
|
10230 |
]. |
|
10231 |
^ backCol |
|
3952 | 10232 |
! |
10233 |
||
10234 |
getForwardCollection |
|
10235 |
||
4347 | 10236 |
| forwCol | |
10237 |
||
10238 |
forwCol := OrderedCollection new. |
|
10239 |
self canForward ifTrue:[ |
|
10240 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
10241 |
]. |
|
10242 |
^ forwCol |
|
3952 | 10243 |
! |
10244 |
||
10245 |
getItemFor:aPath |
|
6627 | 10246 |
^ self detect:[:item| item path = aPath] ifNone:nil. |
10247 |
"/ self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
10248 |
"/ ^ nil. |
|
3952 | 10249 |
! |
10250 |
||
10251 |
getPositionFor:aPath |
|
10252 |
||
10253 |
|item| |
|
10254 |
||
10255 |
item := self getItemFor:aPath. |
|
10256 |
||
10257 |
item notNil ifTrue:[ |
|
4414 | 10258 |
^ item position. |
3952 | 10259 |
]. |
10260 |
^ nil |
|
10261 |
! |
|
10262 |
||
10263 |
includesPath:aPath |
|
6627 | 10264 |
^ self contains:[:item | item path = aPath]. |
10265 |
||
10266 |
"/ self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
10267 |
"/ ^ false. |
|
4347 | 10268 |
! |
10269 |
||
10270 |
nextBackwardItem |
|
10271 |
"return the first path of the backward list" |
|
10272 |
||
10273 |
|retPath| |
|
10274 |
||
10275 |
self canBackward ifTrue:[ |
|
10276 |
retPath := backForwardList at:backForwardIndex. |
|
10277 |
]. |
|
10278 |
^ retPath. |
|
10279 |
! |
|
10280 |
||
10281 |
nextForwardItem |
|
10282 |
"return the first path of the forward list" |
|
10283 |
||
10284 |
|retPath| |
|
10285 |
||
10286 |
self canForward ifTrue:[ |
|
10287 |
retPath := backForwardList at:backForwardIndex + 1. |
|
10288 |
]. |
|
10289 |
^ retPath. |
|
3952 | 10290 |
! ! |
10291 |
||
10292 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
10293 |
||
10294 |
path:aPath |
|
10295 |
||
10296 |
^ self new path:aPath |
|
10297 |
! ! |
|
10298 |
||
10299 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
10300 |
||
6433 | 10301 |
asFilename |
10302 |
^ path asFilename |
|
10303 |
! |
|
10304 |
||
3952 | 10305 |
path |
10306 |
"return the value of the instance variable 'path' (automatically generated)" |
|
10307 |
||
10308 |
^ path |
|
10309 |
! |
|
10310 |
||
10311 |
path:something |
|
10312 |
"set the value of the instance variable 'path' (automatically generated)" |
|
10313 |
||
10314 |
path := something. |
|
10315 |
! |
|
10316 |
||
10317 |
position |
|
10318 |
"return the value of the instance variable 'position' (automatically generated)" |
|
10319 |
||
10320 |
^ position |
|
10321 |
! |
|
10322 |
||
10323 |
position:something |
|
10324 |
"set the value of the instance variable 'position' (automatically generated)" |
|
10325 |
||
10326 |
position := something. |
|
10327 |
! |
|
10328 |
||
10329 |
printString |
|
10330 |
||
10331 |
^ self path asString |
|
3892 | 10332 |
! ! |
10333 |
||
10334 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
10335 |
||
10336 |
withValue:aValue isHolder:aBoolean |
|
10337 |
||
10338 |
| instance | |
|
10339 |
||
10340 |
instance := self basicNew. |
|
10341 |
instance value:aValue. |
|
10342 |
instance isHolder:aBoolean. |
|
10343 |
^ instance |
|
10344 |
! ! |
|
10345 |
||
10346 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
10347 |
||
10348 |
isHolder |
|
10349 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
10350 |
||
10351 |
^ isHolder |
|
10352 |
! |
|
10353 |
||
18931 | 10354 |
isHolder:aBoolean |
3892 | 10355 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
10356 |
||
18931 | 10357 |
isHolder := aBoolean. |
10358 |
||
10359 |
"Modified (format): / 19-07-2019 / 09:52:35 / Claus Gittinger" |
|
3892 | 10360 |
! |
10361 |
||
10362 |
value |
|
10363 |
"return the value of the instance variable 'value' (automatically generated)" |
|
10364 |
||
10365 |
^ value |
|
10366 |
! |
|
10367 |
||
10368 |
value:something |
|
10369 |
"set the value of the instance variable 'value' (automatically generated)" |
|
10370 |
||
10371 |
value := something. |
|
10372 |
! ! |
|
10373 |
||
10374 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
10375 |
||
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10376 |
version |
15803 | 10377 |
^ '$Header$' |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10378 |
! |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10379 |
|
8832 | 10380 |
version_CVS |
15803 | 10381 |
^ '$Header$' |
3892 | 10382 |
! ! |
12094 | 10383 |