author | Claus Gittinger <cg@exept.de> |
Mon, 20 Jan 2020 21:02:47 +0100 | |
changeset 19422 | c6ca1c3e0fd7 |
parent 19392 | ec66bf60a26d |
child 19431 | 67fede974175 |
permissions | -rw-r--r-- |
19392 | 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 |
|
19197 | 2903 |
contentsOfBytesAsDump:dataOrFileStream base:numberBase numberOfAddressDigits:addrDigits |
2904 |
addressStart:virtualStart characterEncoding:characterEncodingSymbol |
|
2905 |
||
17744 | 2906 |
"utility helper: generate a hexDump with addresses; |
2907 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
2908 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
2909 |
to support display of alien encoded binary data." |
|
2910 |
||
19197 | 2911 |
^ self |
2912 |
contentsOfBytesAsDump:dataOrFileStream base:numberBase numberOfAddressDigits:addrDigits |
|
2913 |
addressStart:virtualStart characterEncoding:characterEncodingSymbol |
|
2914 |
highlightRangeHolder:nil |
|
2915 |
! |
|
2916 |
||
19200 | 2917 |
contentsOfBytesAsDump:dataOrFileStream base:numberBaseArg numberOfAddressDigits:addrDigits |
19202 | 2918 |
addressStart:virtualStartArg characterEncoding:characterEncodingSymbol |
19197 | 2919 |
highlightRangeHolder:highlightRangeHolderOrNil |
2920 |
||
2921 |
"utility helper: generate a hex (or octal) dump with addresses; |
|
2922 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
2923 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
2924 |
to support display of alien encoded binary data. |
|
2925 |
highlightRangeHolderOrNil may hold on an interval (0-based) to mark a range of bytes. |
|
2926 |
Returns a virtual array of lines." |
|
2927 |
||
2928 |
|dataSize lines nHexLines replacementForUnprintable colsPerByte characterDecoder spaces |
|
2929 |
highlightFGColor highlightBGColor| |
|
2930 |
||
2931 |
highlightRangeHolderOrNil notNil ifTrue:[ |
|
2932 |
highlightFGColor := TextView defaultSelectionForegroundColor. |
|
2933 |
highlightBGColor := TextView defaultSelectionBackgroundColor. |
|
2934 |
]. |
|
17744 | 2935 |
|
2936 |
(characterEncodingSymbol isNil or:[characterEncodingSymbol == #'iso8859-1']) ifFalse:[ |
|
2937 |
characterDecoder := CharacterEncoder encoderToEncodeFrom:characterEncodingSymbol into:#unicode. |
|
2938 |
]. |
|
17252 | 2939 |
|
2940 |
"/ used to be: |
|
2941 |
"/ replacementForUnprintable := $. |
|
2942 |
replacementForUnprintable := Character value:16rB7. "/ a centered dot. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2943 |
|
18666 | 2944 |
dataSize := dataOrFileStream isStream |
2945 |
ifTrue:[ dataOrFileStream fileSize ] |
|
2946 |
ifFalse:[ dataOrFileStream size ]. |
|
2947 |
nHexLines := (dataSize + 15) // 16. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2948 |
|
19197 | 2949 |
"generate a virtual collection which evaluates and returns lines on-demand" |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2950 |
lines := VirtualArray new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2951 |
lines setSize:nHexLines + (nHexLines // 16). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2952 |
lines |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2953 |
generator:[:lineNr | |
17744 | 2954 |
|blockNr lineNrInBlock startOffset lineStream asciiLineStream byte line |
19202 | 2955 |
decodedChar charPrinted numberBase padChar virtualStart| |
2956 |
||
2957 |
virtualStart := virtualStartArg value. |
|
19200 | 2958 |
numberBase := numberBaseArg value. |
2959 |
padChar := numberBase == 10 ifTrue:[Character space] ifFalse:[$0]. |
|
2960 |
||
2961 |
"/ cols needed per byte in the hex dump |
|
2962 |
colsPerByte := ((255 printStringRadix:numberBase) size). |
|
2963 |
spaces := String new:colsPerByte. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2964 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2965 |
blockNr := (lineNr - 1) // 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2966 |
lineNrInBlock := (lineNr - 1) \\ 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2967 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2968 |
lineNrInBlock == 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2969 |
line := '' |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2970 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2971 |
startOffset := ((blockNr * 16) + lineNrInBlock) * 16. |
17744 | 2972 |
|
2973 |
"/ two streams; one for the hex bytes, one for the ascii-interpretation |
|
19197 | 2974 |
lineStream := Text writeStream. |
2975 |
asciiLineStream := Text writeStream. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2976 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2977 |
lineStream nextPutAll:((startOffset+virtualStart) hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2978 |
lineStream nextPutAll:': '. |
19197 | 2979 |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2980 |
1 to:16 do:[:i | |
19197 | 2981 |
|byteString asciiString| |
2982 |
||
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2983 |
i ~~ 1 ifTrue:[ lineStream space ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2984 |
|
18666 | 2985 |
(startOffset + i) > dataSize ifTrue:[ |
19197 | 2986 |
byteString := spaces. |
2987 |
asciiString := ' '. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2988 |
] ifFalse:[ |
18666 | 2989 |
dataOrFileStream isStream ifTrue:[ |
2990 |
dataOrFileStream position:(startOffset + i - 1). |
|
2991 |
byte := dataOrFileStream nextByte. |
|
2992 |
] ifFalse:[ |
|
2993 |
byte := dataOrFileStream at:startOffset + i. |
|
2994 |
]. |
|
19200 | 2995 |
byteString := (byte printStringRadix:numberBase size:colsPerByte fill:padChar). |
19197 | 2996 |
|
17744 | 2997 |
decodedChar := byte. |
2998 |
characterDecoder notNil ifTrue:[ |
|
2999 |
decodedChar := characterDecoder encode:byte. |
|
3000 |
]. |
|
3001 |
charPrinted := replacementForUnprintable. |
|
3002 |
decodedChar notNil ifTrue:[ |
|
3003 |
((decodedChar between:32 and:127) or:[(decodedChar between:(128+32) and:(128+127))]) ifTrue:[ |
|
3004 |
charPrinted := Character value:decodedChar. |
|
16188 | 3005 |
] ifFalse:[ |
17744 | 3006 |
(decodedChar between:0 and:31) ifTrue:[ |
3007 |
"/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400 |
|
3008 |
"/ are perfect here, but usually not available in the font |
|
3009 |
"/ and we have currently no way of knowing if they are... |
|
3010 |
"/ (could let the font draw into a bitmap and check if there is something...) |
|
19392 | 3011 |
"/ For now, write a dot.· |
17744 | 3012 |
"/ charPrinted := (Character value:(byte + 16r2400)) |
3013 |
]. |
|
16188 | 3014 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3015 |
]. |
19197 | 3016 |
asciiString := String with:charPrinted. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3017 |
]. |
19197 | 3018 |
"/ in highlightRange? |
3019 |
highlightRangeHolderOrNil notNil ifTrue:[ |
|
3020 |
highlightRangeHolderOrNil value notNil ifTrue:[ |
|
3021 |
(highlightRangeHolderOrNil value includes:(startOffset + i - 1)) ifTrue:[ |
|
3022 |
byteString := byteString withColor:highlightFGColor on:highlightBGColor. |
|
3023 |
asciiString := asciiString withColor:highlightFGColor on:highlightBGColor. |
|
3024 |
]. |
|
3025 |
]. |
|
3026 |
]. |
|
3027 |
lineStream nextPutAll:byteString. |
|
3028 |
asciiLineStream nextPutAll:asciiString. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3029 |
]. |
17744 | 3030 |
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
|
3031 |
, asciiLineStream contents. |
11262 | 3032 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3033 |
line |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3034 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3035 |
^ lines. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3036 |
|
17744 | 3037 |
"Created: / 12-11-2017 / 11:24:29 / cg" |
17750 | 3038 |
"Modified: / 12-11-2017 / 14:17:59 / cg" |
18666 | 3039 |
"Modified: / 12-03-2019 / 16:16:53 / Claus Gittinger" |
3040 |
! |
|
3041 |
||
3042 |
contentsOfBytesAsHexDump:dataOrFileStream numberOfAddressDigits:addrDigits addressStart:virtualStart |
|
17744 | 3043 |
"utility helper: generate a hexDump with addresses; the character columns at the right show |
3044 |
the iso8859-1 characters" |
|
17753 | 3045 |
|
3046 |
^ self |
|
18666 | 3047 |
contentsOfBytesAsDump:dataOrFileStream base:16 |
17744 | 3048 |
numberOfAddressDigits:addrDigits |
3049 |
addressStart:virtualStart |
|
17753 | 3050 |
characterEncoding:#'iso8859-1' |
11262 | 3051 |
|
3052 |
"Created: / 13-02-2012 / 15:01:46 / cg" |
|
17744 | 3053 |
"Modified: / 12-11-2017 / 12:07:12 / cg" |
17753 | 3054 |
"Modified: / 14-11-2017 / 17:48:19 / mawalch" |
18666 | 3055 |
"Modified (format): / 12-03-2019 / 16:38:26 / Claus Gittinger" |
3056 |
! |
|
3057 |
||
3058 |
contentsOfBytesAsHexDump:dataOrFileStream numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
|
17744 | 3059 |
"utility helper: generate a hexDump with addresses; |
3060 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
3061 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
3062 |
to support display of alien encoded binary data." |
|
3063 |
||
3064 |
^ self |
|
18666 | 3065 |
contentsOfBytesAsDump:dataOrFileStream base:16 |
17744 | 3066 |
numberOfAddressDigits:addrDigits |
3067 |
addressStart:virtualStart |
|
3068 |
characterEncoding:characterEncodingSymbol |
|
3069 |
||
3070 |
"Created: / 12-11-2017 / 11:21:44 / cg" |
|
18666 | 3071 |
"Modified (format): / 12-03-2019 / 16:38:31 / Claus Gittinger" |
17744 | 3072 |
! |
3073 |
||
3074 |
contentsOfFileAsDump:f base:numberBase withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3075 |
"opens the file, get its contents and generates a dump for it" |
|
3076 |
||
19197 | 3077 |
|resources fileName info stream data offs |
17768 | 3078 |
addrDigits lines answer sizeLimit showLastPart setNewLimit thisFileSizeString| |
4610 | 3079 |
|
3080 |
resources := self classResources. |
|
3081 |
||
3082 |
fileName := f baseName. |
|
3083 |
f isDirectory ifTrue:[ |
|
19197 | 3084 |
info := '"%1" is a directory.' |
3085 |
] ifFalse:[ |
|
3086 |
f exists ifFalse:[ |
|
3087 |
info := 'oops, "%1" is gone or unreadable.' |
|
19226 | 3088 |
] ifTrue:[ |
19197 | 3089 |
f isReadable ifFalse:[ |
3090 |
info := '"%1" is unreadable.' |
|
3091 |
] |
|
3092 |
] |
|
3093 |
]. |
|
3094 |
info notNil ifTrue:[ |
|
3095 |
Dialog warn:(resources string:info with:fileName). |
|
4610 | 3096 |
^ nil |
3097 |
]. |
|
19197 | 3098 |
|
17768 | 3099 |
f fileSize > (self maxFileSizeShownWithoutAsking) ifTrue:[ |
8472 | 3100 |
limitOrNil notNil ifTrue:[ |
3101 |
sizeLimit := limitOrNil. |
|
3102 |
showLastPart := showLastPartOrNil |
|
3103 |
] ifFalse:[ |
|
17768 | 3104 |
setNewLimit := false. |
3105 |
thisFileSizeString := (UnitConverter fileSizeStringFor:f fileSize). |
|
3106 |
||
3107 |
Dialog |
|
3108 |
withOptoutOption:[ setNewLimit := true ] |
|
3109 |
labelled:(resources string:'No longer ask for files smaller than %1' with:thisFileSizeString) |
|
3110 |
do:[ |
|
3111 |
answer := Dialog |
|
3112 |
confirmWithCancel:(resources |
|
3113 |
stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' |
|
3114 |
with:(fileName contractTo:40) allBold |
|
3115 |
with:thisFileSizeString) |
|
3116 |
labels:#('Cancel' 'Show All' 'Show First Part' ). |
|
3117 |
]. |
|
8472 | 3118 |
answer isNil ifTrue:[^ nil]. |
3119 |
answer ifTrue:[ |
|
17769 | 3120 |
sizeLimit := (4 * 1024 * 1024) "max:self maxFileSizeShownWithoutAsking". |
17768 | 3121 |
] ifFalse:[ |
3122 |
setNewLimit ifTrue:[ |
|
3123 |
self maxFileSizeShownWithoutAsking:(self maxFileSizeShownWithoutAsking max:f fileSize). |
|
3124 |
]. |
|
3125 |
]. |
|
8436 | 3126 |
]. |
4610 | 3127 |
]. |
3128 |
||
18666 | 3129 |
[ |
3130 |
stream := f readStream binary. |
|
3131 |
sizeLimit notNil ifTrue:[ |
|
3132 |
showLastPart == true ifTrue:[ |
|
3133 |
stream position:(f fileSize - sizeLimit). |
|
3134 |
]. |
|
3135 |
data := stream nextBytes:sizeLimit. |
|
3136 |
] ifFalse:[ |
|
3137 |
f fileSize > (1024*1024) ifTrue:[ |
|
3138 |
data := stream |
|
3139 |
] ifFalse:[ |
|
3140 |
data := stream contents. |
|
3141 |
]. |
|
3142 |
]. |
|
3143 |
] ensure:[ |
|
3144 |
(stream notNil and:[stream ~~ data]) ifTrue:[ |
|
3145 |
stream close. |
|
3146 |
]. |
|
3147 |
]. |
|
3148 |
||
4610 | 3149 |
offs := 0. |
3150 |
lines := StringCollection new. |
|
3151 |
||
3152 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
3153 |
||
11262 | 3154 |
^ self |
17744 | 3155 |
contentsOfBytesAsDump:data base:numberBase |
11262 | 3156 |
numberOfAddressDigits:addrDigits |
3157 |
addressStart:0 |
|
17744 | 3158 |
characterEncoding:characterEncoding |
3159 |
||
3160 |
"Created: / 12-11-2017 / 12:08:10 / cg" |
|
17769 | 3161 |
"Modified: / 19-11-2017 / 15:01:34 / cg" |
18666 | 3162 |
"Modified: / 12-03-2019 / 16:18:46 / Claus Gittinger" |
17744 | 3163 |
! |
3164 |
||
3165 |
contentsOfFileAsHexDump:f |
|
3166 |
"opens the file, get its contents and generates a dump for it" |
|
3167 |
||
3168 |
^ self |
|
3169 |
contentsOfFileAsHexDump:f |
|
3170 |
withLimit:nil |
|
3171 |
lastPart:nil |
|
3172 |
characterEncoding:#'iso8859-1' |
|
3173 |
||
3174 |
"Modified (comment): / 12-11-2017 / 12:09:30 / cg" |
|
3175 |
! |
|
3176 |
||
3177 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil |
|
3178 |
"opens the file, get its contents and generates a dump for it" |
|
3179 |
||
3180 |
^ self |
|
3181 |
contentsOfFileAsHexDump:f |
|
3182 |
withLimit:limitOrNil |
|
3183 |
lastPart:showLastPartOrNil |
|
3184 |
characterEncoding:#'iso-8859-1' |
|
3185 |
||
3186 |
"Modified (comment): / 12-11-2017 / 12:09:34 / cg" |
|
3187 |
! |
|
3188 |
||
3189 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3190 |
"opens the file, get its contents and generates a dump for it" |
|
3191 |
||
3192 |
^ self |
|
3193 |
contentsOfFileAsDump:f base:16 |
|
3194 |
withLimit:limitOrNil |
|
3195 |
lastPart:showLastPartOrNil |
|
3196 |
characterEncoding:characterEncoding |
|
3197 |
||
3198 |
"Created: / 12-11-2017 / 12:02:05 / cg" |
|
4610 | 3199 |
! ! |
3200 |
||
17868 | 3201 |
!AbstractFileBrowser class methodsFor:'utilities - files'! |
3202 |
||
3203 |
allFilesInDirectories:directories forWhich:aBlock |
|
3204 |
|allFiles| |
|
3205 |
||
3206 |
directories isEmpty ifTrue:[^ #()]. |
|
3207 |
||
3208 |
allFiles := OrderedCollection new. |
|
3209 |
directories do:[:dir| |
|
3210 |
[ |
|
3211 |
|fileNames| |
|
3212 |
||
3213 |
fileNames := dir directoryContents. |
|
3214 |
fileNames notNil ifTrue:[ |
|
3215 |
fileNames := fileNames |
|
3216 |
collect:[:fn | dir construct:fn] |
|
3217 |
thenSelect:[:fn | fn isDirectory not and:[aBlock value:fn]]. |
|
3218 |
allFiles addAll:fileNames. |
|
3219 |
] |
|
19392 | 3220 |
] on:OpenError do:[:ex| |
17868 | 3221 |
self warn:(self classResources stringWithCRs:'Cannot access: %1\(%2)' |
3222 |
with:ex pathName |
|
3223 |
with:ex description). |
|
3224 |
ex proceedWith:nil. |
|
3225 |
]. |
|
3226 |
]. |
|
3227 |
||
3228 |
^ allFiles |
|
3229 |
! |
|
3230 |
||
3231 |
fileFindDuplicatesIn:directories |
|
3232 |
"scan directories for duplicate files. |
|
17871 | 3233 |
return a dictionary mapping duplicate files to their original; |
3234 |
the oldest file found will be the value (original), the younger files (copies) will be the keys. |
|
17868 | 3235 |
Files without duplicate(s) will not have an entry in the dictionary." |
3236 |
||
3237 |
|infoDir filesBySize anySameSized |
|
3238 |
result allFiles| |
|
3239 |
||
3240 |
directories isEmpty ifTrue:[^ #()]. |
|
3241 |
||
3242 |
allFiles := self allFilesInDirectories:directories forWhich:[:f | true]. |
|
3243 |
allFiles isEmpty ifTrue:[^ #()]. |
|
3244 |
||
3245 |
"/ for each, get the file's info (size, modificationTime etc.). |
|
3246 |
infoDir := Dictionary new. |
|
3247 |
allFiles do:[:fn | |
|
3248 |
infoDir at:fn put:(fn info) |
|
3249 |
]. |
|
3250 |
||
3251 |
"/ in a first pass, collect groups by the same size |
|
3252 |
"/ remember those fileSizes for which multiple files exist |
|
3253 |
filesBySize := Dictionary new. |
|
3254 |
anySameSized := false. |
|
3255 |
infoDir keysAndValuesDo:[:fn :info | |
|
3256 |
|sz entry| |
|
3257 |
||
3258 |
sz := info fileSize. |
|
3259 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
3260 |
entry add:fn. |
|
3261 |
entry size > 1 ifTrue:[ anySameSized := true ]. |
|
3262 |
]. |
|
3263 |
||
3264 |
"/ any of same size ? |
|
3265 |
anySameSized ifFalse:[^ #() ]. |
|
3266 |
||
3267 |
result := Dictionary new. |
|
3268 |
||
3269 |
"/ now walk over the same-sized files and compare the contents. |
|
3270 |
filesBySize do:[:entry | |
|
3271 |
|files| |
|
3272 |
||
3273 |
entry size > 1 ifTrue:[ |
|
3274 |
files := entry asArray. |
|
3275 |
files |
|
3276 |
sort:[:a :b | |
|
3277 |
|tA tB| |
|
3278 |
tA := (infoDir at:a) modificationTime. |
|
3279 |
tB := (infoDir at:b) modificationTime. |
|
3280 |
tA < tB |
|
3281 |
]. |
|
3282 |
||
3283 |
1 to:files size-1 do:[:idx1 | |
|
3284 |
|fn1| |
|
3285 |
||
3286 |
fn1 := files at:idx1. |
|
3287 |
idx1+1 to:files size do:[:idx2 | |
|
3288 |
|fn2| |
|
3289 |
||
3290 |
fn2 := files at:idx2. |
|
3291 |
||
3292 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
3293 |
"/ compare the files |
|
3294 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3295 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
|
17871 | 3296 |
result at:fn2 put:fn1. |
17868 | 3297 |
] |
3298 |
] |
|
3299 |
] |
|
3300 |
] |
|
3301 |
] |
|
3302 |
]. |
|
3303 |
||
17869 | 3304 |
result := result associations copy. |
3305 |
"/ result := result collect:[:assoc | |
|
3306 |
"/ |f1 f2| |
|
3307 |
"/ |
|
3308 |
"/ f1 := assoc key asString. |
|
3309 |
"/ f2 := assoc value asString. |
|
3310 |
"/ f1 < f2 ifTrue:[ |
|
3311 |
"/ f2 -> f1 |
|
3312 |
"/ ] ifFalse:[ |
|
3313 |
"/ f1 -> f2 |
|
3314 |
"/ ] |
|
3315 |
"/ ]. |
|
17868 | 3316 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
3317 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
17869 | 3318 |
result sort:[:f1 :f2 | f1 key < f2 key]. |
17868 | 3319 |
^ result |
19009 | 3320 |
! |
3321 |
||
3322 |
getDirectoryOf:aFileName |
|
3323 |
|fn | |
|
3324 |
||
3325 |
aFileName isNil ifTrue:[ |
|
3326 |
^ aFileName. |
|
3327 |
]. |
|
3328 |
fn := aFileName asFilename. |
|
3329 |
||
3330 |
fn isDirectory ifFalse:[ |
|
3331 |
^ fn directory. |
|
3332 |
]. |
|
3333 |
^ fn. |
|
19230 | 3334 |
! |
3335 |
||
3336 |
getFileInfoStringForFile:filenameOrString long:longInfoBoolean |
|
3337 |
"get stat info on filename - |
|
3338 |
return a string which can be shown in a box" |
|
3339 |
||
3340 |
|filename fileOutput modeBits modeString s info |
|
3341 |
sizeString fileSize tAccess tModification buffer resources md5Hash sha1Hash| |
|
3342 |
||
3343 |
resources := self classResources. |
|
3344 |
||
3345 |
filename := filenameOrString asFilename. |
|
3346 |
||
3347 |
info := filename linkInfo. |
|
3348 |
info isNil ifTrue:[ |
|
3349 |
^ resources |
|
3350 |
string:'Cannot get info of ''%1''\(%2)' |
|
3351 |
with:filename |
|
3352 |
with:(OperatingSystem lastErrorString). |
|
3353 |
]. |
|
3354 |
||
3355 |
buffer := Text writeStream. |
|
3356 |
||
3357 |
buffer |
|
3358 |
nextPutAll:'Filename: '; |
|
3359 |
nextPutLine:filename asString. |
|
3360 |
||
3361 |
OperatingSystem isMSDOSlike ifTrue: [ |
|
3362 |
(info alternativeName notNil |
|
3363 |
and:[ info alternativeName ~= info fullName ]) ifTrue:[ |
|
3364 |
buffer nextPutAll:'Shortname: '. |
|
3365 |
buffer nextPutLine:info alternativeName. |
|
3366 |
] |
|
3367 |
]. |
|
3368 |
||
3369 |
buffer nextPutAll:'Type: '. |
|
3370 |
info isSymbolicLink ifTrue:[ |
|
3371 |
"get info of link target" |
|
3372 |
buffer nextPutLine:(resources string:'Symbolic link to: %1%2' |
|
3373 |
with:(info path) |
|
3374 |
with:(filename exists |
|
3375 |
ifFalse:[(resources string:' (broken)') withColor:Color red] |
|
3376 |
ifTrue:[''])). |
|
3377 |
info := filename info. |
|
3378 |
info isNil ifTrue:[^ buffer contents]. |
|
3379 |
] ifFalse:[ |
|
3380 |
(longInfoBoolean and:[info isRegular]) ifTrue:[ |
|
3381 |
fileOutput := filename fileType. |
|
3382 |
]. |
|
3383 |
||
3384 |
fileOutput isNil ifTrue:[ |
|
3385 |
s := info type asString |
|
3386 |
] ifFalse:[ |
|
3387 |
s := 'regular (' , fileOutput , ')' |
|
3388 |
]. |
|
3389 |
buffer nextPutLine:s. |
|
3390 |
]. |
|
3391 |
||
3392 |
fileSize := info fileSize. |
|
3393 |
sizeString := 'Size: ', fileSize printString. |
|
3394 |
fileSize > 1024 ifTrue:[ |
|
3395 |
sizeString := sizeString,' (',(UnitConverter fileSizeStringFor:fileSize),')'. |
|
3396 |
]. |
|
3397 |
buffer nextPutLine:sizeString. |
|
3398 |
||
3399 |
longInfoBoolean ifTrue:[ |
|
3400 |
info isRegular ifTrue:[ |
|
3401 |
md5Hash := MD5Stream hashValueOfFile:filename. |
|
3402 |
s := md5Hash hexPrintString. |
|
3403 |
buffer nextPutLine:(resources string:'MD5: %1' with:s). |
|
3404 |
||
3405 |
sha1Hash := SHA1Stream hashValueOfFile:filename. |
|
3406 |
s := sha1Hash hexPrintString. |
|
3407 |
buffer nextPutLine:(resources string:'SHA1: %1' with:s). |
|
3408 |
]. |
|
3409 |
]. |
|
3410 |
||
3411 |
modeBits := info mode. |
|
3412 |
modeString := AbstractFileBrowser getModeString:modeBits. |
|
3413 |
||
3414 |
buffer nextPutAll:'Access: '; nextPutAll:modeString. |
|
3415 |
longInfoBoolean ifTrue:[ |
|
3416 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
|
3417 |
]. |
|
3418 |
buffer |
|
3419 |
cr; |
|
3420 |
nextPutAll:'Owner: '; |
|
3421 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
3422 |
||
3423 |
longInfoBoolean ifTrue:[ |
|
3424 |
buffer |
|
3425 |
nextPutAll:'Group: '; |
|
3426 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
3427 |
||
3428 |
tAccess := info accessTime. |
|
3429 |
buffer |
|
3430 |
nextPutAll:'Last access: '; |
|
3431 |
nextPutAll:tAccess asDate printString; |
|
3432 |
space; |
|
3433 |
nextPutLine:tAccess asTime printString. |
|
3434 |
||
3435 |
tModification := info modificationTime. |
|
3436 |
buffer |
|
3437 |
nextPutAll:'Last modification: '; |
|
3438 |
nextPutAll:tModification asDate printString; |
|
3439 |
space; |
|
3440 |
nextPutLine:tModification asTime printString. |
|
3441 |
]. |
|
3442 |
^ buffer contents |
|
3443 |
||
3444 |
" |
|
3445 |
self getFileInfoStringForFile:'Make.proto' long:true |
|
3446 |
self getFileInfoStringForFile:'Make.proto' long:false |
|
3447 |
" |
|
3448 |
||
3449 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
|
3450 |
! |
|
3451 |
||
3452 |
getModeString:modeBits |
|
3453 |
"convert file-mode bits into a more user-friendly string. |
|
3454 |
This is wrong here - should be moved into OperatingSystem." |
|
3455 |
||
3456 |
^ self |
|
3457 |
getModeString:modeBits |
|
3458 |
with:#( 'Owner: ' $r $w $x |
|
3459 |
' Group: ' $r $w $x |
|
3460 |
' Others: ' $r $w $x ) |
|
3461 |
! |
|
3462 |
||
3463 |
getModeString:modeBits with:texts |
|
3464 |
"convert file-mode bits into a more user-friendly string. |
|
3465 |
This is wrong here - should be moved into OperatingSystem." |
|
3466 |
||
3467 |
|bits modeString| |
|
3468 |
||
3469 |
bits := modeBits bitAnd:8r777. |
|
3470 |
modeString := ''. |
|
3471 |
||
3472 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
3473 |
with: texts do:[:bitMask :access | |
|
3474 |
|ch| |
|
3475 |
||
3476 |
bitMask isNil ifTrue:[ |
|
3477 |
modeString := modeString , (self classResources string:access) |
|
3478 |
] ifFalse:[ |
|
3479 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
3480 |
ch := $- |
|
3481 |
] ifFalse:[ |
|
3482 |
ch := access |
|
3483 |
]. |
|
3484 |
modeString := modeString copyWith:ch |
|
3485 |
] |
|
3486 |
]. |
|
3487 |
^ modeString |
|
17868 | 3488 |
! ! |
3489 |
||
3892 | 3490 |
!AbstractFileBrowser methodsFor:'actions'! |
3491 |
||
3492 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 3493 |
"setup and launch a querybox to ask for a unix command. |
3892 | 3494 |
Then evaluate aBlock passing the command-string as argument." |
3495 |
||
16160 | 3496 |
|box osName commandString alwaysOpenLikeThisHolder openCmd suffix| |
3892 | 3497 |
|
3498 |
osName := OperatingSystem platformName. |
|
3499 |
||
3500 |
box := FilenameEnterBox |
|
4414 | 3501 |
title:(resources string:'Execute %1 command:' with:osName) |
3502 |
okText:(resources string:'Execute') |
|
4523 | 3503 |
action:[:cmd | commandString := cmd]. |
3892 | 3504 |
|
3505 |
fileName notNil ifTrue:[ |
|
4414 | 3506 |
self initialCommandFor:fileName into:box. |
3892 | 3507 |
]. |
16160 | 3508 |
alwaysOpenLikeThisHolder := false asValue. |
3509 |
box verticalPanel add:((CheckBox label:'Always use this command for this file type') model:alwaysOpenLikeThisHolder). |
|
19009 | 3510 |
box directory:(self class getDirectoryOf:fileName). |
16160 | 3511 |
box open. |
3512 |
||
3513 |
"/ box destroy. |
|
3514 |
alwaysOpenLikeThisHolder value ifTrue:[ |
|
3515 |
openCmd := commandString upTo:$". |
|
3516 |
suffix := fileName suffix. |
|
16306 | 3517 |
UserPreferences current |
3518 |
defaultFileOpenCommandFor:suffix put:(openCmd,' "%1"'); |
|
3519 |
beModified. |
|
3520 |
self breakPoint:#cg. |
|
16160 | 3521 |
]. |
3522 |
||
4523 | 3523 |
commandString notNil ifTrue:[ |
3524 |
aBlock value:commandString |
|
3525 |
]. |
|
3526 |
||
3892 | 3527 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
3528 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
3529 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
3530 |
! |
|
3531 |
||
3532 |
changeFileBrowserTitleTo:aString |
|
4774 | 3533 |
self |
3534 |
applicationNamed:#FileBrowserV2 |
|
5009 | 3535 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 3536 |
! |
3537 |
||
3538 |
copyFileList |
|
4774 | 3539 |
"copy the fileList to the clipBoard" |
3540 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3541 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3542 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3543 |
fileList := self |
4774 | 3544 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3545 |
ifPresentDo:[:app | app browserFileList]. |
3546 |
||
3547 |
fileList notNil ifTrue:[ |
|
3548 |
self copyFileListToClipBoard:fileList. |
|
3549 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3550 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3551 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3552 |
copyFileListToClipBoard:fileList |
4774 | 3553 |
"copy the itemList to the clipBoard" |
3554 |
||
3555 |
|stream| |
|
3556 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3557 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 3558 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3559 |
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
|
3560 |
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
|
3561 |
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
|
3562 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3563 |
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
|
3564 |
(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
|
3565 |
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
|
3566 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3567 |
]. |
3892 | 3568 |
]. |
6034 | 3569 |
self window setClipboardText:stream contents. |
3892 | 3570 |
! |
3571 |
||
3572 |
copySelectedFilenames |
|
4774 | 3573 |
"copy the selected fileNames to the clipBoard" |
3574 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3575 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3576 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3577 |
fileList := self |
4774 | 3578 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3579 |
ifPresentDo:[:appl | appl selectedFileNames]. |
3580 |
fileList notNil ifTrue:[ |
|
3581 |
self copyFileListToClipBoard:fileList. |
|
3582 |
]. |
|
3892 | 3583 |
! |
3584 |
||
10923 | 3585 |
doAddArchiver |
3586 |
|files| |
|
3587 |
||
3588 |
files := self currentSelectedFiles. |
|
3589 |
files size == 1 ifFalse:[ |
|
17818 | 3590 |
Dialog information:(resources string:'Select exactly one archive.'). |
10923 | 3591 |
^ self |
3592 |
]. |
|
3593 |
||
3594 |
self |
|
3595 |
applicationNamed:#FileApplicationNoteBook |
|
3596 |
ifPresentDo:[:appl | appl doAddArchiverOn:files first]. |
|
3597 |
||
3598 |
"Created: / 29-11-2011 / 19:01:31 / cg" |
|
17818 | 3599 |
"Modified: / 29-11-2017 / 12:25:47 / cg" |
10923 | 3600 |
! |
3601 |
||
3892 | 3602 |
doAddTerminal |
5960 | 3603 |
|dir| |
3604 |
||
3605 |
dir := self currentDirectory. |
|
3606 |
dir isNil ifTrue:[ |
|
4414 | 3607 |
dir := Filename homeDirectory |
3892 | 3608 |
]. |
4774 | 3609 |
|
5009 | 3610 |
self |
3611 |
applicationNamed:#FileApplicationNoteBook |
|
3612 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
18734 | 3613 |
|
3614 |
"Modified (format): / 10-04-2019 / 05:53:35 / Claus Gittinger" |
|
3892 | 3615 |
! |
3616 |
||
3617 |
doOpenSearchFile |
|
5961 | 3618 |
|item file| |
3619 |
||
3620 |
file := self firstSelectedFileName. |
|
3621 |
file isNil ifTrue:[ |
|
3622 |
file := Filename homeDirectory asAbsoluteFilename. |
|
3623 |
]. |
|
3624 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 3625 |
self openSearchFileOn:item. |
3626 |
! |
|
3627 |
||
3628 |
doShowFileContents |
|
5009 | 3629 |
self |
3630 |
applicationNamed:#DirectoryContentsBrowser |
|
3631 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
3632 |
||
3633 |
^ nil |
|
3892 | 3634 |
! |
3635 |
||
3636 |
doShowProperties |
|
3637 |
"show long stat (file)-info" |
|
3638 |
||
3639 |
self fileGetInfo:true |
|
3640 |
! |
|
3641 |
||
14577 | 3642 |
enterAction |
3643 |
self |
|
3644 |
applicationNamed:#DirectoryContentsBrowser |
|
3645 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl enterAction ]]. |
|
3646 |
! |
|
3647 |
||
5528 | 3648 |
fileEncodingDialog |
14497 | 3649 |
"open a dialog to allow change of the file's character encoding. |
5528 | 3650 |
Files are converted to internal encoding when read, and converted back |
3651 |
to this encoding when saved. |
|
3652 |
Notice: currently, not too many encodings are supported by the system." |
|
3653 |
||
3654 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
3655 |
||
3656 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
3657 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
3658 |
||
3659 |
bindings := IdentityDictionary new. |
|
3660 |
bindings at:#encodingList put:encodingDescr. |
|
3661 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 3662 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
3663 |
||
5528 | 3664 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
3665 |
ifTrue:[ |
|
3666 |
idx := (bindings at:#selectedEncoding) value. |
|
3667 |
selectedEncoding := encodings at:idx. |
|
3668 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 3669 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 3670 |
]. |
5737 | 3671 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 3672 |
]. |
3673 |
||
3674 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
3675 |
! |
|
3676 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3677 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3678 |
"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
|
3679 |
|
5959 | 3680 |
|currentFileNameHolder currentSel| |
3681 |
||
18823 | 3682 |
aFilename isNil ifTrue:[^ self]. |
3683 |
||
5959 | 3684 |
currentFileNameHolder := self currentFileNameHolder. |
3685 |
||
3686 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3687 |
(currentSel includes:aFilename) ifFalse:[ |
9677 | 3688 |
self withWaitCursorDo:[ |
3689 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
|
3690 |
] |
|
3691 |
]. |
|
3692 |
||
3693 |
"Modified: / 29-12-2010 / 11:04:29 / cg" |
|
18823 | 3694 |
"Modified: / 15-06-2019 / 08:38:21 / Claus Gittinger" |
3892 | 3695 |
! |
3696 |
||
11053 | 3697 |
lineEndConventionDialog |
3698 |
"open a dialog to allow change of the line end conventions |
|
3699 |
(when writing files)" |
|
3700 |
||
3701 |
|bindings| |
|
3702 |
||
3703 |
bindings := IdentityDictionary new. |
|
3704 |
bindings at:#lineEndConvention put:(self lineEndConvention asValue). |
|
3705 |
||
3706 |
(self openDialogInterface:#lineEndConventionDialogSpec withBindings:bindings) |
|
3707 |
ifTrue:[ |
|
15208 | 3708 |
self lineEndConventionHolder value:(bindings at:#lineEndConvention) value asSymbol |
11053 | 3709 |
]. |
3710 |
||
3711 |
"Created: / 06-01-2012 / 15:34:51 / cg" |
|
3712 |
! |
|
3713 |
||
4392 | 3714 |
newTextEditor |
5009 | 3715 |
self |
3716 |
applicationNamed:#FileApplicationNoteBook |
|
15936 | 3717 |
ifPresentDo:[:appl | |
3718 |
|editor files item| |
|
3719 |
||
3720 |
editor := appl newTextEditor. |
|
3721 |
(files := self currentSelectedFiles) size == 1 ifTrue:[ |
|
3722 |
item := DirectoryContentsBrowser itemClass fileName:files first. |
|
3723 |
editor item:item. |
|
3724 |
]. |
|
3725 |
^ editor |
|
3726 |
]. |
|
5009 | 3727 |
|
3728 |
^ nil. |
|
3729 |
! |
|
3730 |
||
3731 |
openApplByFileItem:anItem |
|
8490 | 3732 |
"/ q: is the following always wanted ? |
9267 | 3733 |
self window sensor shiftDown ifFalse:[ |
17715 | 3734 |
((anItem mimeType startsWith:'application/x-expecco-') |
3735 |
and:[(Smalltalk at:#ExpeccoStartup) notNil]) ifTrue:[ |
|
3736 |
(Smalltalk at:#ExpeccoStartup) main:{anItem fileName asString}. |
|
3737 |
^ self. |
|
3738 |
]. |
|
3739 |
||
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3740 |
"/ cg: no - batch and shell scripts are to be |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3741 |
"/ anItem fileName isExecutableProgram ifTrue:[ |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3742 |
"/ self executeCommand:anItem fileName pathName. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3743 |
"/ ^ self. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3744 |
"/ ]. |
9267 | 3745 |
|
8490 | 3746 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
3747 |
"/ Error handle:[:ex | |
|
3748 |
"/ ] do:[ |
|
3749 |
"/ OperatingSystem |
|
3750 |
"/ shellExecute:nil |
|
3751 |
"/ lpOperation:'open' |
|
3752 |
"/ lpFile:(anItem fileName pathName) |
|
3753 |
"/ lpParameters:nil |
|
3754 |
"/ lpDirectory:(self directory pathName) |
|
3755 |
"/ nShowCmd:#SW_SHOWNORMAL. |
|
3756 |
"/ ^ self. |
|
3757 |
"/ ] |
|
3758 |
"/ ] |
|
9267 | 3759 |
]. |
5306 | 3760 |
^ self |
5009 | 3761 |
applicationNamed:#FileApplicationNoteBook |
5306 | 3762 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3763 |
|
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3764 |
"Modified: / 06-09-2011 / 11:11:15 / cg" |
17715 | 3765 |
"Modified: / 18-10-2017 / 10:15:15 / stefan" |
3892 | 3766 |
! |
3767 |
||
4392 | 3768 |
openApplForFile:aFilename |
5306 | 3769 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 3770 |
! |
3771 |
||
3892 | 3772 |
openCommandResultApplication |
3773 |
||
5009 | 3774 |
self |
3775 |
applicationNamed:#FileApplicationNoteBook |
|
3776 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
3777 |
||
3778 |
^ nil |
|
3892 | 3779 |
! |
3780 |
||
5010 | 3781 |
openNewTextEditorOn:anItem |
5009 | 3782 |
self |
3783 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3784 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 3785 |
|
3786 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3787 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3788 |
|
5010 | 3789 |
openSearchFileOn:anItem |
5009 | 3790 |
self |
3791 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3792 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 3793 |
|
3794 |
^ nil. |
|
3892 | 3795 |
! |
3796 |
||
5162 | 3797 |
openTextEditorForFile:aFilename |
3798 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
3799 |
! |
|
3800 |
||
5010 | 3801 |
openTextEditorOn:anItem |
5009 | 3802 |
self |
3803 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3804 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 3805 |
|
3806 |
^ nil. |
|
3892 | 3807 |
! |
3808 |
||
5010 | 3809 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 3810 |
self |
3811 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3812 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 3813 |
|
3814 |
^ nil. |
|
4618 | 3815 |
! |
3816 |
||
5959 | 3817 |
setCurrentFileName:aFilename |
3818 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
3819 |
! |
|
3820 |
||
3821 |
setCurrentFileNames:aCollectionOfFilenames |
|
3822 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
3823 |
! |
|
3824 |
||
11053 | 3825 |
tabStopConversionDialog |
3826 |
"open a dialog to allow change of the tab stop conversion (when reading/writing files)" |
|
3827 |
||
3828 |
|bindings| |
|
3829 |
||
3830 |
bindings := IdentityDictionary new. |
|
3831 |
bindings at:#tabStops put:(self inputTabColumnConversion asValue). |
|
3832 |
||
3833 |
(self openDialogInterface:#tabStopConversionDialogSpec withBindings:bindings) |
|
3834 |
ifTrue:[ |
|
3835 |
self inputTabColumnConversionHolder value:(bindings at:#tabStops) value |
|
3836 |
]. |
|
3837 |
||
3838 |
"Created: / 06-01-2012 / 15:36:06 / cg" |
|
3839 |
! |
|
3840 |
||
3892 | 3841 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3842 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3843 |
aColOfFiles notNil ifTrue:[ |
5959 | 3844 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3845 |
]. |
3892 | 3846 |
! |
3847 |
||
3848 |
updateCurrentDirectory |
|
5739 | 3849 |
self updateCurrentDirectory:false |
3850 |
! |
|
3851 |
||
3852 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3853 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3854 |
|
5009 | 3855 |
self |
3856 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 3857 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 3858 |
self |
3859 |
applicationNamed:#DirectoryTreeBrowser |
|
3860 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 3861 |
! |
3862 |
||
5739 | 3863 |
updateCurrentDirectoryWithReread |
3864 |
self updateCurrentDirectory:true |
|
3865 |
! |
|
3866 |
||
4345 | 3867 |
withActivityIndicationDo:aBlock |
3868 |
self activityVisibilityChannel value:true. |
|
3869 |
[ |
|
19158 | 3870 |
self withWaitCursorDo:aBlock. |
4345 | 3871 |
] ensure:[ |
3872 |
self activityVisibilityChannel value:false. |
|
3873 |
] |
|
19158 | 3874 |
|
3875 |
"Modified (format): / 11-09-2019 / 16:43:07 / Stefan Vogel" |
|
3892 | 3876 |
! ! |
3877 |
||
3878 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
3879 |
||
3880 |
addBookmark |
|
3881 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
6725 | 3882 |
self addBookmarks:(self currentSelectedDirectories). |
5960 | 3883 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 3884 |
! |
3885 |
||
3886 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3887 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3888 |
self class addBookmark:path |
3892 | 3889 |
]. |
3890 |
! |
|
3891 |
||
8013 | 3892 |
editBookmarks |
17849 | 3893 |
self class editBookmarksWithDefault: self currentSelectedDirectories firstOrNil. |
3894 |
||
3895 |
"Modified: / 13-12-2017 / 23:24:39 / stefan" |
|
8013 | 3896 |
! |
3897 |
||
3892 | 3898 |
hasBookmarks |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3899 |
^ self class hasBookmarks |
3892 | 3900 |
! |
3901 |
||
3902 |
hasBookmarksToRemove |
|
3903 |
|bookmarks directories| |
|
3904 |
||
3982 | 3905 |
directories := self currentSelectedDirectories. |
3892 | 3906 |
bookmarks := self class directoryBookmarks. |
17416 | 3907 |
^ (bookmarks notEmptyOrNil and:[directories notEmpty]) |
3908 |
||
3909 |
"Modified: / 17-02-2017 / 08:25:22 / cg" |
|
3892 | 3910 |
! |
3911 |
||
3912 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3913 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3914 |
self class removeBookmark:dir |
3892 | 3915 |
]. |
4679 | 3916 |
! |
3917 |
||
3918 |
saveBookmarks |
|
3919 |
self class saveBookmarks |
|
3892 | 3920 |
! ! |
3921 |
||
3922 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
3923 |
||
3924 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 3925 |
|cmd suffix cmdHist historySize| |
3892 | 3926 |
|
3927 |
cmdHist := self class commandHistory. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
3928 |
(aCommandString notEmptyOrNil) ifTrue:[ |
4414 | 3929 |
cmdHist notNil ifTrue:[ |
3930 |
cmdHist addFirst:aCommandString. |
|
6369 | 3931 |
historySize := self class commandHistorySize. |
3932 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 3933 |
cmdHist removeLast |
3934 |
] |
|
3935 |
]. |
|
3936 |
aFilename notNil ifTrue:[ |
|
3937 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
3938 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
3939 |
DefaultCommandPerSuffix := Dictionary new. |
|
3940 |
]. |
|
3941 |
suffix := aFilename asFilename suffix. |
|
3942 |
suffix notNil ifTrue:[ |
|
3943 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
3944 |
] |
|
3945 |
] |
|
3892 | 3946 |
] |
3947 |
! |
|
3948 |
||
3949 |
doBack |
|
6286 | 3950 |
"go backward in the history" |
3892 | 3951 |
|
4022 | 3952 |
| fileName| |
3953 |
||
6369 | 3954 |
fileName := self directoryHistory goBackward. |
3892 | 3955 |
fileName notNil ifTrue:[ |
4347 | 3956 |
self gotoFile:(fileName asFilename). |
3892 | 3957 |
] |
3958 |
! |
|
3959 |
||
3960 |
doForward |
|
6286 | 3961 |
"go forward in the history" |
3892 | 3962 |
|
3964 | 3963 |
| fileName| |
3964 |
||
6369 | 3965 |
fileName := self directoryHistory goForward. |
3892 | 3966 |
fileName notNil ifTrue:[ |
4414 | 3967 |
self gotoFile:(fileName asFilename). |
4022 | 3968 |
] ifFalse:[ |
4414 | 3969 |
self enableForward value:false. |
18823 | 3970 |
]. |
3971 |
||
3972 |
"Modified (format): / 15-06-2019 / 08:38:41 / Claus Gittinger" |
|
3892 | 3973 |
! ! |
3974 |
||
3975 |
!AbstractFileBrowser methodsFor:'applications'! |
|
3976 |
||
5009 | 3977 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
3978 |
|appl| |
|
3979 |
||
3980 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
3981 |
appl notNil ifTrue:[ |
|
3982 |
^ aBlock value:appl |
|
3983 |
]. |
|
3984 |
^ nil. |
|
3985 |
! |
|
3986 |
||
4004 | 3987 |
directoryContentsBrowser |
3988 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 3989 |
! ! |
3990 |
||
3991 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
3992 |
||
3993 |
applications |
|
3994 |
^ aspects at:#applications |
|
3995 |
! |
|
3996 |
||
3997 |
backgroundProcesses |
|
3998 |
||
3999 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
4000 |
! |
|
4001 |
||
4230 | 4002 |
canMake |
15259 | 4003 |
^ self aspectFor:#canMake ifAbsent:[ ValueHolder with:false ]. |
4230 | 4004 |
! |
4005 |
||
18246 | 4006 |
canOpenChangeBrowser |
4007 |
^ self aspectFor:#canOpenChangeBrowser ifAbsent:[ false asValue ]. |
|
4008 |
||
4009 |
"Created: / 30-06-2018 / 18:29:53 / Claus Gittinger" |
|
4010 |
! |
|
4011 |
||
3892 | 4012 |
currentDirectories |
6725 | 4013 |
" returns a holder on a Collection of all currently selected directories |
4014 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3892 | 4015 |
" |
4016 |
||
4017 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
4018 |
! |
|
4019 |
||
6725 | 4020 |
currentDirectoriesValue |
4021 |
" returns a Collection of all currently selected directories |
|
4022 |
if only a file is selected, currentDirectories holds the directory of the file |
|
4023 |
" |
|
4024 |
||
4025 |
^ self currentDirectories value |
|
4026 |
! |
|
4027 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4028 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4029 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4030 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4031 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4032 |
|
6725 | 4033 |
directories := self currentSelectedDirectories. |
19152 | 4034 |
(directories size ~~ 1) ifTrue:[ |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4035 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4036 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4037 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4038 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
4039 |
|
13856 | 4040 |
currentDirectoryDisplayed |
4041 |
"Return a directory as Filename that is currently displayed in the browser" |
|
4042 |
||
4043 |
^self subclassResponsibility |
|
4044 |
||
4045 |
"Created: / 14-01-2013 / 11:57:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4046 |
! |
|
4047 |
||
3892 | 4048 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4049 |
"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
|
4050 |
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
|
4051 |
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
|
4052 |
|
6589 | 4053 |
^ self aspectFor:#currentFileNameHolder |
4054 |
ifAbsent:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4055 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4056 |
|
4692 | 4057 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4058 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4059 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4060 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4061 |
currentSel asValue |
6589 | 4062 |
] |
4063 |
notPresentDo:[:holder| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4064 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4065 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4066 |
newFilenames := Set new. |
6589 | 4067 |
filenames do:[:eachFilename| |
18805 | 4068 |
|existingFilename count| |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4069 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4070 |
existingFilename notNil ifTrue:[ |
18805 | 4071 |
count := 0. |
4072 |
[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
|
4073 |
existingFilename := existingFilename directory. |
18805 | 4074 |
count := count + 1. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
4075 |
]. |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
4076 |
existingFilename exists ifTrue:[ |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
4077 |
newFilenames add:existingFilename. |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
4078 |
]. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
4079 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4080 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4081 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4082 |
] |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
4083 |
|
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
4084 |
"Modified: / 27-11-2010 / 15:42:45 / cg" |
18805 | 4085 |
"Modified: / 05-06-2019 / 14:12:48 / Claus Gittinger" |
3892 | 4086 |
! |
4087 |
||
5528 | 4088 |
defaultFileEncoding |
4089 |
^ #'iso8859-1' "/ #'utf-8' |
|
4090 |
! |
|
4091 |
||
3892 | 4092 |
enableDirectoryUp |
4093 |
||
15259 | 4094 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[ValueHolder with:false] |
3892 | 4095 |
! |
4096 |
||
6456 | 4097 |
enableGotoDefaultDirectory |
15259 | 4098 |
^ self aspectFor:#enableGotoDefaultDirectory ifAbsent:[ ValueHolder with:true ]. |
4593 | 4099 |
! |
4100 |
||
8168 | 4101 |
enableGotoDesktop |
14308 | 4102 |
"/ backward compatibility |
4103 |
^ self enableGotoDesktopDirectory. |
|
8168 | 4104 |
! |
4105 |
||
9572 | 4106 |
enableGotoDesktopDirectory |
15259 | 4107 |
^ self aspectFor:#enableGotoDesktopDirectory ifAbsent:[ ValueHolder with:true ]. |
9572 | 4108 |
|
4109 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
4110 |
! |
|
4111 |
||
18511 | 4112 |
enableGotoDocumentsDirectory |
4113 |
^ self aspectFor:#enableGotoDocumentsDirectory ifAbsent:[ ValueHolder with:true ]. |
|
4114 |
||
4115 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
4116 |
! |
|
4117 |
||
18352 | 4118 |
enableGotoDownloadsDirectory |
4119 |
^ self aspectFor:#enableGotoDownloadsDirectory ifAbsent:[ ValueHolder with:true ]. |
|
4120 |
||
4121 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
4122 |
! |
|
4123 |
||
6434 | 4124 |
enableGotoSmalltalkDirectory |
6456 | 4125 |
^ self aspectFor:#enableGotoSmalltalkDirectory ifAbsent:[ true asValue ]. |
6434 | 4126 |
! |
4127 |
||
17187 | 4128 |
enableGotoSmalltalkWorkspaceDirectory |
4129 |
^ self aspectFor:#enableGotoSmalltalkWorkspaceDirectory ifAbsent:[ true asValue ]. |
|
4130 |
! |
|
4131 |
||
9677 | 4132 |
enableGotoTempDirectory |
4133 |
^ self aspectFor:#enableGotoTempDirectory ifAbsent:[ true asValue ]. |
|
4134 |
||
4135 |
"Created: / 29-12-2010 / 11:01:17 / cg" |
|
4136 |
! |
|
4137 |
||
3892 | 4138 |
enableHome |
4139 |
||
4140 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
4141 |
! |
|
4142 |
||
9596 | 4143 |
enableMakeCurrentDirectory |
4144 |
^ self aspectFor:#enableMakeCurrentDirectory ifAbsent:[ true asValue ]. |
|
4145 |
||
4146 |
"Created: / 26-10-2010 / 17:17:58 / cg" |
|
4147 |
! |
|
4148 |
||
3892 | 4149 |
enableViewNoteBookApplication |
4150 |
||
4151 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
4152 |
! |
|
4153 |
||
5528 | 4154 |
fileEncoding |
4155 |
^ self fileEncodingHolder value |
|
4156 |
! |
|
4157 |
||
4158 |
fileEncoding:newEncoding |
|
5533 | 4159 |
self fileEncodingHolder value:newEncoding. |
4160 |
||
4161 |
self |
|
4162 |
applicationNamed:#FileApplicationNoteBook |
|
4163 |
ifPresentDo:[:nb | |
|
4164 |
|appl| |
|
4165 |
||
4166 |
appl := nb selectedApplication. |
|
5535 | 4167 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 4168 |
appl fileEncoding:newEncoding |
4169 |
] |
|
4170 |
]. |
|
5528 | 4171 |
! |
4172 |
||
5737 | 4173 |
fileEncodingHolder |
4174 |
^ self |
|
4175 |
aspectFor:#fileEncodingHolder |
|
4176 |
ifAbsent:[ |
|
4177 |
self |
|
4178 |
applicationNamed:#FileApplicationNoteBook |
|
4179 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
4180 |
] |
|
4181 |
! |
|
4182 |
||
17485 | 4183 |
fileEntryFieldHolder |
4184 |
^ self subclassResponsibility. |
|
4185 |
||
4186 |
"Created: / 31-03-2017 / 11:36:49 / stefan" |
|
4187 |
! |
|
4188 |
||
5961 | 4189 |
firstSelectedFileName |
4190 |
|files| |
|
4191 |
||
7560 | 4192 |
files := self currentSelectedObjects. |
5961 | 4193 |
files notEmpty ifTrue:[ |
4194 |
^ files first |
|
4195 |
]. |
|
4196 |
^ nil |
|
7560 | 4197 |
|
4198 |
"Modified: / 04-12-2006 / 13:14:53 / cg" |
|
5961 | 4199 |
! |
4200 |
||
6456 | 4201 |
gotoDefaultDirectoryIsVisible |
9596 | 4202 |
^ true. |
4203 |
"/ ^ (Filename defaultDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
4204 |
||
4205 |
"Modified: / 26-10-2010 / 17:23:51 / cg" |
|
6456 | 4206 |
! |
4207 |
||
9572 | 4208 |
gotoDesktopDirectoryIsVisible |
4209 |
Filename desktopDirectory = Filename homeDirectory ifTrue:[^ false]. |
|
4210 |
||
4211 |
^ (Filename desktopDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
4212 |
||
4213 |
"Created: / 01-10-2010 / 16:26:27 / cg" |
|
4214 |
! |
|
4215 |
||
18834 | 4216 |
hasFileOrCypressPackageSelection |
4217 |
^ self aspectFor:#hasFileOrCypressPackageSelection ifAbsentPut:[ false asValue ]. |
|
4218 |
||
4219 |
"Created: / 23-06-2019 / 13:05:51 / Claus Gittinger" |
|
4220 |
! |
|
4221 |
||
4618 | 4222 |
hasFileSelection |
4223 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
4224 |
! |
|
4225 |
||
9490 | 4226 |
hasNotTwoDirectoriesSelectedHolder |
4227 |
^ self |
|
4228 |
aspectFor:#hasNotTwoDirectoriesSelectedHolder |
|
4229 |
ifAbsent:[ |
|
4230 |
BlockValue |
|
4231 |
with:[:m | self hasTwoDirectoriesSelected not] |
|
4232 |
argument:self currentFileNameHolder |
|
4233 |
]. |
|
4234 |
||
4235 |
"Created: / 20-05-2010 / 10:45:50 / cg" |
|
4236 |
! |
|
4237 |
||
5830 | 4238 |
hasNotTwoFilesSelectedHolder |
9490 | 4239 |
^ self |
4240 |
aspectFor:#hasNotTwoFilesSelectedHolder |
|
5830 | 4241 |
ifAbsent:[ |
4242 |
BlockValue |
|
4243 |
with:[:m | self hasTwoFilesSelected not] |
|
4244 |
argument:self currentFileNameHolder |
|
4245 |
]. |
|
9490 | 4246 |
|
4247 |
"Modified: / 20-05-2010 / 10:46:01 / cg" |
|
5830 | 4248 |
! |
4249 |
||
3892 | 4250 |
hasSelection |
17923 | 4251 |
"aspect holding true, if a file is selected" |
3892 | 4252 |
|
4253 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
4254 |
! |
|
4255 |
||
9490 | 4256 |
hasTwoDirectoriesSelectedHolder |
4257 |
^ self |
|
4258 |
aspectFor:#hasTwoDirectoriesSelectedHolder |
|
4259 |
ifAbsent:[ |
|
4260 |
BlockValue |
|
4261 |
with:[:m | self hasTwoDirectoriesSelected] |
|
4262 |
argument:self currentFileNameHolder |
|
4263 |
]. |
|
4264 |
||
4265 |
"Created: / 20-05-2010 / 10:45:41 / cg" |
|
4266 |
! |
|
4267 |
||
4414 | 4268 |
hasTwoFilesSelectedHolder |
9490 | 4269 |
^ self |
4270 |
aspectFor:#hasTwoFilesSelectedHolder |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4271 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4272 |
BlockValue |
5830 | 4273 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4274 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4275 |
]. |
9490 | 4276 |
|
4277 |
"Modified: / 20-05-2010 / 10:46:08 / cg" |
|
4414 | 4278 |
! |
4279 |
||
11053 | 4280 |
inputTabColumnConversion |
4281 |
^ self inputTabColumnConversionHolder value |
|
4282 |
||
4283 |
"Created: / 06-01-2012 / 15:25:56 / cg" |
|
4284 |
! |
|
4285 |
||
4286 |
inputTabColumnConversionHolder |
|
4287 |
^ self |
|
4288 |
aspectFor:#inputTabColumnConversionHolder |
|
4289 |
ifAbsent:[ |
|
4290 |
self |
|
4291 |
applicationNamed:#FileApplicationNoteBook |
|
4292 |
ifPresentDo:[:appl | appl inputTabColumnConversionHolder]. |
|
4293 |
] |
|
4294 |
||
4295 |
"Created: / 06-01-2012 / 15:26:16 / cg" |
|
4296 |
! |
|
4297 |
||
4298 |
lineEndConvention |
|
15208 | 4299 |
^ self lineEndConventionHolder value asSymbol |
11053 | 4300 |
|
4301 |
"Created: / 06-01-2012 / 13:05:14 / cg" |
|
4302 |
! |
|
4303 |
||
11591 | 4304 |
lineEndConvention: aSymbol |
18525 | 4305 |
self lineEndConventionHolder value:(aSymbol ifNotNil:[aSymbol asSymbol]) |
11591 | 4306 |
|
4307 |
"Created: / 11-07-2012 / 19:51:58 / cg" |
|
18525 | 4308 |
"Modified: / 13-11-2018 / 11:13:41 / Stefan Vogel" |
11591 | 4309 |
! |
4310 |
||
11053 | 4311 |
lineEndConventionHolder |
4312 |
^ self |
|
4313 |
aspectFor:#lineEndConventionHolder |
|
4314 |
ifAbsent:[ |
|
4315 |
self |
|
4316 |
applicationNamed:#FileApplicationNoteBook |
|
4317 |
ifPresentDo:[:appl | appl lineEndConventionHolder]. |
|
4318 |
] |
|
4319 |
||
4320 |
"Created: / 06-01-2012 / 13:02:51 / cg" |
|
4321 |
! |
|
4322 |
||
5737 | 4323 |
lockFileEncoding:aBoolean |
4324 |
self lockFileEncodingHolder value:aBoolean. |
|
4325 |
||
4326 |
self |
|
4327 |
applicationNamed:#FileApplicationNoteBook |
|
4328 |
ifPresentDo:[:nb | |
|
4329 |
|appl| |
|
4330 |
||
4331 |
appl := nb selectedApplication. |
|
4332 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
4333 |
appl lockFileEncoding:aBoolean |
|
4334 |
] |
|
4335 |
]. |
|
4336 |
! |
|
4337 |
||
4338 |
lockFileEncodingHolder |
|
4339 |
^ self |
|
4340 |
aspectFor:#lockFileEncodingHolder |
|
4341 |
ifAbsent:[ |
|
4342 |
self |
|
4343 |
applicationNamed:#FileApplicationNoteBook |
|
4344 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
4345 |
] |
|
4346 |
! |
|
4347 |
||
13856 | 4348 |
makeCommandHolder |
4349 |
^ self aspectFor:#makeCommandHolder ifAbsent:[ nil asValue ]. |
|
4350 |
||
4351 |
"Created: / 13-04-2012 / 17:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4352 |
! |
|
4353 |
||
4523 | 4354 |
notify:aString |
11108 | 4355 |
"aString is shown in the lower pane" |
4356 |
||
4523 | 4357 |
self notifyChannel value:aString |
11108 | 4358 |
|
4359 |
"Modified (comment): / 11-01-2012 / 21:46:55 / cg" |
|
4523 | 4360 |
! |
4361 |
||
3892 | 4362 |
notifyChannel |
4363 |
||
4364 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 4365 |
! |
4366 |
||
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4367 |
progressPercentageHolder |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4368 |
^ self aspectFor:#progressPercentageHolder ifAbsent:[ nil asValue ]. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4369 |
|
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4370 |
"Created: / 11-10-2010 / 12:54:46 / cg" |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4371 |
! |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4372 |
|
4071 | 4373 |
rootHolder |
4374 |
"holder, which keeps the rootHolder of the treeView |
|
4375 |
" |
|
4376 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4377 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4378 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4379 |
]. |
8192
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4380 |
! |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4381 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4382 |
rootHolder:aHolder |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4383 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4384 |
self aspectFor:#rootHolder put:aHolder |
3892 | 4385 |
! ! |
4386 |
||
4387 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
4388 |
||
4389 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 4390 |
"returns the model for an aspect; these are stored in a common dictionary" |
4391 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4392 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 4393 |
! |
4394 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4395 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 4396 |
"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
|
4397 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4398 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4399 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4400 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4401 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4402 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4403 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4404 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4405 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4406 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4407 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4408 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4409 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4410 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4411 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4412 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4413 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4414 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4415 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4416 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4417 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4418 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4419 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4420 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4421 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4422 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4423 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4424 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4425 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4426 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4427 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4428 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4429 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4430 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4431 |
|
18834 | 4432 |
aspectFor:something ifAbsentPut:aBlock |
4433 |
"returns the model for an aspect; these are stored in a common dictionary" |
|
4434 |
||
4435 |
^ self aspectFor:something ifAbsent:[|v| v := aBlock value. self aspectFor:something put:v. v] |
|
4436 |
||
4437 |
"Created: / 23-06-2019 / 13:05:37 / Claus Gittinger" |
|
4438 |
! |
|
4439 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4440 |
aspectFor:something put:aValueHolder |
6284 | 4441 |
"stores the model for an aspect; these are stored in a common dictionary" |
4442 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4443 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4444 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4445 |
|
3892 | 4446 |
aspects |
6284 | 4447 |
"returns the common aspect dictionary" |
4448 |
||
3892 | 4449 |
^ aspects |
4450 |
! |
|
4451 |
||
4452 |
runtimeAspectValueFor:something |
|
4453 |
"returns the default aspect item from the class variable RuntimeAspects |
|
4454 |
" |
|
4455 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
4456 |
! |
|
4457 |
||
4201 | 4458 |
saveAspectValues |
16306 | 4459 |
|prefs saveAspects aspectValue| |
4460 |
||
4461 |
prefs := UserPreferences current. |
|
4462 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4463 |
saveAspects := self class userPreferencesAspectList keys. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4464 |
saveAspects do:[ :aspectKey | |
4201 | 4465 |
aspectValue := (self perform:aspectKey) value. |
16306 | 4466 |
prefs |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4467 |
at: ('fileBrowser_',aspectKey asString) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4468 |
put: aspectValue. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4469 |
]. |
16306 | 4470 |
prefs beModified. |
4471 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4472 |
"Modified: / 04-09-2006 / 10:02:41 / cg" |
4201 | 4473 |
! |
4474 |
||
3892 | 4475 |
saveRuntimeAspectValues |
4476 |
|savedAspects dictionary value isHolder aspect| |
|
4477 |
||
5941 | 4478 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 4479 |
dictionary := Dictionary new. |
5941 | 4480 |
savedAspects do:[:aspectKey | |
4414 | 4481 |
aspect := self perform:aspectKey. |
4482 |
isHolder := aspect isValueModel. |
|
5941 | 4483 |
isHolder ifTrue:[ |
4484 |
value := aspect value |
|
4485 |
] ifFalse:[ |
|
4486 |
value := aspect |
|
4487 |
]. |
|
4488 |
dictionary at:aspectKey |
|
4489 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
4490 |
]. |
|
4491 |
RuntimeAspects := dictionary. |
|
3892 | 4492 |
! |
4493 |
||
4201 | 4494 |
userPreferencesAspectValueFor:something |
4495 |
"returns the default aspect from the Userpreferences |
|
3892 | 4496 |
" |
4201 | 4497 |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4498 |
(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
|
4499 |
^ UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4500 |
at:('fileBrowser_',something) asSymbol |
9579
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4501 |
ifAbsent:nil "(self class userPreferencesAspectList at:something)". |
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4502 |
|
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4503 |
"Modified: / 14-10-2010 / 19:16:38 / cg" |
3892 | 4504 |
! ! |
4505 |
||
4011 | 4506 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
4507 |
||
9015 | 4508 |
filter:aString |
4509 |
self filterModel value:aString |
|
4510 |
! |
|
4511 |
||
4018 | 4512 |
filterBackgroundColor |
4513 |
||
4514 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
4515 |
! |
|
4516 |
||
4011 | 4517 |
filterBlockHolder |
4518 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4519 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 4520 |
! |
4521 |
||
4522 |
filterListModel |
|
4523 |
||
4524 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
4525 |
! |
|
4526 |
||
4527 |
filterModel |
|
5941 | 4528 |
|m| |
4529 |
||
4530 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
4531 |
^ m |
|
4011 | 4532 |
! |
4533 |
||
8185
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4534 |
filterModel:aHolder |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4535 |
self aspectFor:#filterModel put:aHolder. |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4536 |
! |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4537 |
|
4018 | 4538 |
filterValueBox |
4539 |
||
4540 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
4541 |
! |
|
4542 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4543 |
makeFilterBlock |
14497 | 4544 |
"return a two-arg filterblock on the file's path- and base-name. This block should return true for files |
9102 | 4545 |
to be shown" |
4546 |
||
17481 | 4547 |
| filterString filterStrings filters notFilters showHidden filterBlock caseSensitive| |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4548 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4549 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4550 |
filterString = '' ifTrue:[filterString := '*']. |
17481 | 4551 |
caseSensitive := "ignoreCaseInPattern ?" Filename isCaseSensitive. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4552 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4553 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
12760 | 4554 |
filterStrings := filterStrings |
4555 |
select:[:eachFilter | eachFilter withoutSeparators notEmpty]. |
|
4556 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4557 |
filters := filterStrings |
12760 | 4558 |
reject:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
4559 |
thenCollect: |
|
4560 |
[:eachPattern | |
|
4561 |
|pattern| |
|
4562 |
||
4563 |
pattern := eachPattern withoutSeparators. |
|
15597 | 4564 |
pattern includesMatchCharacters ifFalse:[ |
4565 |
"JV@2012-03-05: Add implict star at the beginning and at the end of pattern, |
|
4566 |
that's how most of the other applications behave - do what most users expect" |
|
17772 | 4567 |
"/ pattern first == $* ifFalse:[pattern := '*' , pattern]. |
4568 |
"/ pattern last == $* ifFalse:[pattern := pattern , '*']. |
|
4569 |
[:name :baseName | baseName asLowercase includesString:pattern caseSensitive:caseSensitive] |
|
4570 |
] ifTrue:[ |
|
4571 |
pattern = '*' ifTrue:[ |
|
4572 |
[:name :baseName | true]. |
|
4573 |
] ifFalse:[ |
|
4574 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
|
4575 |
]. |
|
15597 | 4576 |
]. |
12760 | 4577 |
]. |
4578 |
||
4579 |
notFilters := filterStrings |
|
4580 |
select:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
|
4581 |
thenCollect: |
|
4582 |
[:eachPattern | |
|
9296 | 4583 |
|pattern| |
4584 |
||
4585 |
pattern := eachPattern withoutSeparators. |
|
12760 | 4586 |
pattern := (pattern copyFrom:2) withoutSeparators. |
17481 | 4587 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
9296 | 4588 |
]. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4589 |
|
12760 | 4590 |
|
4591 |
(filters size == 1 and:[notFilters isEmpty]) ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4592 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4593 |
] ifFalse:[ |
12760 | 4594 |
filters isEmpty ifTrue:[ |
4595 |
filterBlock := [:name :baseName | |
|
4596 |
(notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not |
|
4597 |
]. |
|
4598 |
] ifFalse:[ |
|
4599 |
notFilters isEmpty ifTrue:[ |
|
4600 |
filterBlock := [:name :baseName | |
|
4601 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4602 |
]. |
|
4603 |
] ifFalse:[ |
|
4604 |
filterBlock := [:name :baseName | |
|
4605 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4606 |
and:[ (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not ] |
|
4607 |
]. |
|
4608 |
] |
|
4609 |
] |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4610 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4611 |
|
4011 | 4612 |
showHidden := self showHiddenFiles value. |
4613 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4614 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4615 |
]. |
9296 | 4616 |
^ [:name :baseName | |
4617 |
name isHidden not and:[filterBlock value:name value:baseName]]. |
|
13856 | 4618 |
|
4619 |
"Modified: / 05-02-2012 / 01:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17481 | 4620 |
"Modified: / 27-03-2017 / 12:52:08 / stefan" |
17772 | 4621 |
"Modified: / 20-11-2017 / 22:02:04 / cg" |
4018 | 4622 |
! |
4623 |
||
4624 |
shownFiles |
|
4625 |
||
4626 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 4627 |
! ! |
4628 |
||
14126 | 4629 |
|
3892 | 4630 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
4631 |
||
4632 |
dirHistory |
|
6369 | 4633 |
"obsolete" |
4634 |
^ self directoryHistory |
|
4635 |
! |
|
4636 |
||
4637 |
directoryHistory |
|
3952 | 4638 |
^ self class directoryHistory |
3892 | 4639 |
! |
4640 |
||
4641 |
enableBack |
|
4642 |
||
15259 | 4643 |
^ self aspectFor:#enableBack ifAbsent:[ValueHolder with:false] |
3892 | 4644 |
! |
4645 |
||
4646 |
enableFileHistory |
|
4647 |
||
15259 | 4648 |
^ self aspectFor:#enableFileHistory ifAbsent:[ValueHolder with:false] |
3892 | 4649 |
! |
4650 |
||
4651 |
enableForward |
|
4652 |
||
15259 | 4653 |
^ self aspectFor:#enableForward ifAbsent:[ValueHolder with:false] |
3892 | 4654 |
! |
4655 |
||
4656 |
fileHistory |
|
9820
07b7d7929e3e
variable renamed in: #fileHistory
Stefan Vogel <sv@exept.de>
parents:
9793
diff
changeset
|
4657 |
^ self aspectFor:#fileHistory ifAbsent:[OrderedSet new] |
3892 | 4658 |
! ! |
4659 |
||
4660 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
4661 |
||
4345 | 4662 |
activityVisibilityChannel |
6284 | 4663 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 4664 |
|
15259 | 4665 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ ValueHolder with:false ]. |
4345 | 4666 |
! |
4667 |
||
15111 | 4668 |
alwaysUseSmalltalkTools |
4669 |
" aspect to prevent os tools to be opened on double click" |
|
4670 |
||
15259 | 4671 |
^ self aspectFor:#alwaysUseSmalltalkTools ifAbsent:[ ValueHolder with:true ]. |
15111 | 4672 |
! |
4673 |
||
6602 | 4674 |
changeSetBrowserItemVisible |
18834 | 4675 |
^ self hasFileOrCypressPackageSelection value |
4676 |
or:[Screen current ctrlDown]. |
|
4677 |
||
4678 |
"Modified: / 23-06-2019 / 13:13:53 / Claus Gittinger" |
|
6602 | 4679 |
! |
4680 |
||
11135 | 4681 |
cvsMenusAreShown |
18820 | 4682 |
^ self class cvsMenusAreShown |
4683 |
! |
|
4684 |
||
4685 |
gitMenusAreShown |
|
4686 |
^ self class gitMenusAreShown |
|
4687 |
||
4688 |
"Created: / 10-06-2019 / 15:56:16 / Claus Gittinger" |
|
11135 | 4689 |
! |
4690 |
||
13856 | 4691 |
hgMenusAreShown |
18820 | 4692 |
^ self class hgMenusAreShown |
13856 | 4693 |
! |
4694 |
||
11135 | 4695 |
mercurialMenusAreShown |
18820 | 4696 |
^ self class mercurialMenusAreShown |
11135 | 4697 |
! |
4698 |
||
4110 | 4699 |
openAlwaysInTextEditor |
18274 | 4700 |
"aspect for open every file in TextEditor don't use e.g. HtmlEditor for *.html'" |
4110 | 4701 |
|
15111 | 4702 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
18274 | 4703 |
|
4704 |
"Modified (comment): / 19-07-2018 / 15:28:00 / Stefan Vogel" |
|
4110 | 4705 |
! |
4706 |
||
3892 | 4707 |
openMultipleApplicationsForType |
4708 |
||
4201 | 4709 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
4710 |
open TextEditor " |
|
4711 |
||
3892 | 4712 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
4713 |
! |
|
4714 |
||
11137 | 4715 |
perforceMenusAreShown |
18820 | 4716 |
^ self class perforceMenusAreShown |
11137 | 4717 |
! |
4718 |
||
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
|
4719 |
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
|
4720 |
|
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
|
4721 |
^ 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
|
4722 |
|
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
|
4723 |
"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
|
4724 |
! |
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
|
4725 |
|
4201 | 4726 |
showDirectoryTree |
4727 |
||
4728 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 4729 |
! |
4730 |
||
4554 | 4731 |
showDiskUsageHolder |
4732 |
|holder| |
|
4733 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
4734 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 4735 |
holder addDependent:self. |
4554 | 4736 |
^ holder |
4737 |
! |
|
4738 |
||
3892 | 4739 |
showHiddenFiles |
4740 |
||
9582 | 4741 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
4742 |
||
4743 |
"Modified: / 15-10-2010 / 10:28:17 / cg" |
|
3892 | 4744 |
! |
4745 |
||
9108 | 4746 |
showHiddenFiles:aHolder |
4747 |
self aspectFor:#showHiddenFiles put:aHolder. |
|
4748 |
! |
|
4749 |
||
4750 |
shownFiles:aHolder |
|
4751 |
self aspectFor:#shownFiles put:aHolder. |
|
4752 |
! |
|
4753 |
||
11135 | 4754 |
svnMenusAreShown |
18820 | 4755 |
^ self class svnMenusAreShown |
11135 | 4756 |
! |
4757 |
||
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4758 |
tagsBrowserVisibleHolder |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4759 |
masterApplication notNil ifTrue:[ |
11162
faf8af233ac0
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
11156
diff
changeset
|
4760 |
^ masterApplication perform:#tagsBrowserVisibleHolder ifNotUnderstood:false |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4761 |
]. |
10762
311190be6490
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
10757
diff
changeset
|
4762 |
^ self aspectFor:#tagsBrowserVisibleHolder ifAbsent:[ FileApplicationNoteBook::TextEditor defaultTagsBrowserVisible asValue ]. |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4763 |
|
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4764 |
"Created: / 27-06-2011 / 16:02:59 / cg" |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4765 |
! |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4766 |
|
10757
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4767 |
useCodeView2InTools |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4768 |
^ self aspectFor:#useCodeView2InTools ifAbsent:[ UserPreferences current useCodeView2InTools asValue ]. |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4769 |
|
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4770 |
"Created: / 06-10-2011 / 11:45:58 / cg" |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4771 |
! |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4772 |
|
4648 | 4773 |
userContextAvailable |
4774 |
||
4775 |
" aspect for show group and user columns in contents view |
|
4776 |
windows provides no user context" |
|
4777 |
||
4778 |
^ OperatingSystem isMSWINDOWSlike not |
|
4779 |
! |
|
4780 |
||
3892 | 4781 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4782 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4783 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4784 |
^ self directoryContentsBrowser viewDescription |
3892 | 4785 |
! |
4786 |
||
4787 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4788 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 4789 |
" |
3892 | 4790 |
|
6121 | 4791 |
|directoryContentsBrowser| |
4792 |
||
4793 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
4794 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
4795 |
^ directoryContentsBrowser viewDetails |
|
3892 | 4796 |
! |
4797 |
||
4798 |
viewDirectoryDescription |
|
4799 |
||
4201 | 4800 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
4801 |
on change directory " |
|
4802 |
||
3892 | 4803 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
4804 |
! |
|
4805 |
||
4201 | 4806 |
viewDirsInContentsBrowser |
4807 |
||
4808 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
9319
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4809 |
|
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4810 |
" |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4811 |
UserPreferences current viewDirsInContentsBrowser |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4812 |
" |
4201 | 4813 |
! |
4814 |
||
5870 | 4815 |
viewFilesInContentsBrowser |
4816 |
||
4817 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
4818 |
! |
|
4819 |
||
3892 | 4820 |
viewFilesInDirectoryTree |
4821 |
||
4201 | 4822 |
" aspect for view files in tree view (not only directories) " |
4823 |
||
3892 | 4824 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
4825 |
! |
|
4826 |
||
4827 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4828 |
" aspect for show group information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4829 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4830 |
^ self directoryContentsBrowser viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4831 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4832 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4833 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4834 |
" aspect for show file-type icon in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4835 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4836 |
^ self directoryContentsBrowser viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4837 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4838 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4839 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4840 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4841 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4842 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 4843 |
! |
4844 |
||
4845 |
viewNoteBookApplicationHolder |
|
4846 |
||
4847 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
4848 |
! |
|
4849 |
||
4850 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4851 |
" aspect for show owner information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4852 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4853 |
^ self directoryContentsBrowser viewOwner |
3892 | 4854 |
! |
4855 |
||
4856 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4857 |
" aspect for show permission information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4858 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4859 |
^ self directoryContentsBrowser viewPermissions |
3892 | 4860 |
! |
4861 |
||
4862 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4863 |
" aspect for show image previev in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4864 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4865 |
^ self directoryContentsBrowser viewPreview |
3892 | 4866 |
! |
4867 |
||
4868 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4869 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4870 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4871 |
^ self directoryContentsBrowser viewSize |
3892 | 4872 |
! |
4873 |
||
4974 | 4874 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4875 |
" aspect for show size-in-bytes information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4876 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4877 |
^ self directoryContentsBrowser viewSizeInBytes |
4974 | 4878 |
! |
4879 |
||
5312 | 4880 |
viewSizeInKiloBytes |
4881 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
4882 |
||
4883 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
4884 |
! |
|
4885 |
||
3892 | 4886 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4887 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4888 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4889 |
^ self directoryContentsBrowser viewTime |
3892 | 4890 |
! |
4891 |
||
4892 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4893 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4894 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4895 |
^ self directoryContentsBrowser viewType |
3892 | 4896 |
! ! |
4897 |
||
4898 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
4899 |
||
4900 |
executeCommand:cmd |
|
4901 |
||
4902 |
self executeCommand:cmd inDirectory:nil |
|
4903 |
! |
|
4904 |
||
5880 | 4905 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 4906 |
| nameString executionBlock| |
4907 |
||
5880 | 4908 |
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
|
4909 |
nameString := 'Execute: ', cmd. |
3892 | 4910 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4911 |
! |
|
4912 |
||
4913 |
getExecutionBlockForCommand:cmd |
|
4914 |
||
4915 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
4916 |
! |
|
4917 |
||
5880 | 4918 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
4919 |
| dir| |
|
4920 |
||
4921 |
dir := directoryOrNil. |
|
4922 |
directoryOrNil isNil ifTrue:[ |
|
4923 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6671 | 4924 |
dir isNil ifTrue:[ |
12493 | 4925 |
Dialog warn:(resources string:'Please select a single directory.'). |
16732 | 4926 |
AbortOperationRequest raise. |
6671 | 4927 |
^ nil |
4928 |
]. |
|
3892 | 4929 |
]. |
4523 | 4930 |
|
4931 |
^ [:stream| |
|
4932 |
stream notNil ifTrue:[ |
|
4414 | 4933 |
OperatingSystem |
4934 |
executeCommand:cmd |
|
4935 |
inputFrom:nil |
|
4936 |
outputTo:stream |
|
4937 |
errorTo:stream |
|
4938 |
inDirectory:dir |
|
16732 | 4939 |
lineWise:true |
16825 | 4940 |
showWindow:false |
4414 | 4941 |
onError:[:status| false]. |
4942 |
] |
|
4523 | 4943 |
]. |
3892 | 4944 |
! |
4945 |
||
4946 |
killAllRunningBackgroundProcesses |
|
4947 |
||
4948 |
self backgroundProcesses do:[ : process | |
|
4523 | 4949 |
self notify:'kill ', process name. |
4414 | 4950 |
process terminate. |
3892 | 4951 |
]. |
4952 |
! |
|
4953 |
||
4954 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
4955 |
| stream process appl nameString| |
|
4956 |
||
4957 |
appl := self openCommandResultApplication. |
|
4958 |
stream := appl resultStream. |
|
4959 |
nameString := aString ? 'Execution Result'. |
|
4960 |
appl changeTabTo:nameString. |
|
4523 | 4961 |
|
16102 | 4962 |
process := |
4963 |
[ |
|
4964 |
[aBlock value:stream] |
|
4965 |
ensure:[ |
|
4966 |
self backgroundProcesses remove:process ifAbsent:[]. |
|
4967 |
appl process value:nil. |
|
4968 |
||
4969 |
"/ close automatically, if there was no output. |
|
4571 | 4970 |
"/ appl resultStream contents isEmpty ifTrue:[ |
4971 |
"/ appl doClose. |
|
4972 |
"/ ] |
|
16102 | 4973 |
stream nextPutLine:'Done.'. |
4974 |
self enqueueMessage:#updateCurrentDirectory. |
|
4975 |
] |
|
4976 |
] newProcess. |
|
3892 | 4977 |
process priority:(Processor userBackgroundPriority). |
4978 |
process name:nameString. |
|
4979 |
self backgroundProcesses add:process. |
|
4980 |
appl process value:process. |
|
4981 |
process resume. |
|
4982 |
! ! |
|
4983 |
||
4984 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
4985 |
||
4915 | 4986 |
currentFileNameHolderChanged |
4987 |
"/ self currentFileNameHolderChangedForCommon |
|
4988 |
! |
|
4989 |
||
4577 | 4990 |
currentFileNameHolderChangedForCommon |
18389 | 4991 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty dir| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4992 |
|
7560 | 4993 |
selection := self currentSelectedObjects. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4994 |
self class currentSelection:selection. |
4734 | 4995 |
|
13521 | 4996 |
selectionNotEmpty := selection notEmptyOrNil. |
5476 | 4997 |
self hasSelection value:selectionNotEmpty. |
4998 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
18840 | 4999 |
self hasFileOrCypressPackageSelection |
5000 |
value:(selection contains:[:sel | |
|
5001 |
sel isDirectory |
|
5002 |
and:[(sel hasSuffix:'package') or:[sel hasSuffix:'class']] |
|
5003 |
]). |
|
18246 | 5004 |
self canOpenChangeBrowser value:(selectionNotEmpty). |
4734 | 5005 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5006 |
newDirectories := self directoriesForFiles:selection. |
19009 | 5007 |
newDirectories := newDirectories select:[:fn | fn exists]. |
5008 |
||
6725 | 5009 |
oldDirectories := self currentSelectedDirectories. |
4011 | 5010 |
oldDirectories ~= newDirectories ifTrue:[ |
4347 | 5011 |
self currentDirectories value:newDirectories. |
5012 |
size := newDirectories size. |
|
4774 | 5013 |
rootInTreeView := self |
5014 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 5015 |
ifPresentDo:[:appl | appl rootHolder]. |
5016 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
5017 |
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
|
5018 |
|
4347 | 5019 |
newDirectories notEmpty ifTrue:[ |
6369 | 5020 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 5021 |
]. |
18389 | 5022 |
(dir := Filename homeDirectory) notNil ifTrue:[ |
5023 |
self enableHome value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
5024 |
]. |
|
14308 | 5025 |
"/ self enableGotoDesktop value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
18389 | 5026 |
(dir := Filename defaultDirectory) notNil ifTrue:[ |
5027 |
self enableGotoDefaultDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
5028 |
]. |
|
5029 |
(dir := self smalltalkDirectory) notNil ifTrue:[ |
|
5030 |
self enableGotoSmalltalkDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
5031 |
]. |
|
5032 |
(dir := Filename desktopDirectory) notNil ifTrue:[ |
|
5033 |
self enableGotoDesktopDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
5034 |
]. |
|
5035 |
(dir := Filename downloadsDirectory) notNil ifTrue:[ |
|
5036 |
self enableGotoDownloadsDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
5037 |
]. |
|
18511 | 5038 |
(dir := Filename documentsDirectory) notNil ifTrue:[ |
5039 |
self enableGotoDocumentsDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
5040 |
]. |
|
18389 | 5041 |
(dir := self tempDirectory) notNil ifTrue:[ |
5042 |
self enableGotoTempDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
5043 |
]. |
|
4011 | 5044 |
]. |
9599
6ffff091db22
changed: #currentFileNameHolderChangedForCommon
Claus Gittinger <cg@exept.de>
parents:
9596
diff
changeset
|
5045 |
self enableGotoDefaultDirectory value:(self currentDirectory isNil or:[self currentDirectory pathName ~= OperatingSystem getCurrentDirectory]). |
9596 | 5046 |
self enableMakeCurrentDirectory value:(newDirectories size == 1 |
5047 |
and:[ newDirectories first asFilename pathName ~= OperatingSystem getCurrentDirectory ]). |
|
4022 | 5048 |
self enableForward value:self canForward. |
4734 | 5049 |
self enableBack value:self canBackward. |
6095 | 5050 |
|
13856 | 5051 |
self updateCanMake. |
7560 | 5052 |
|
9677 | 5053 |
"Modified: / 29-12-2010 / 11:01:52 / cg" |
13856 | 5054 |
"Modified: / 17-12-2013 / 08:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18840 | 5055 |
"Modified: / 23-06-2019 / 21:42:40 / Claus Gittinger" |
4011 | 5056 |
! |
5057 |
||
5058 |
filterModelChanged |
|
5059 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
5060 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 5061 |
! |
5062 |
||
3892 | 5063 |
update:something with:aParameter from:changedObject |
5064 |
||
5065 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
5066 |
and the things that have to be done if it runs standalone " |
|
5067 |
||
5068 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 5069 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5070 |
^ self |
3892 | 5071 |
]. |
3989 | 5072 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5073 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5074 |
^ self |
3989 | 5075 |
]. |
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
5076 |
changedObject == self sortBlockProperty ifTrue:[ |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
5077 |
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
|
5078 |
^ self |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
5079 |
]. |
4011 | 5080 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5081 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5082 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5083 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5084 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5085 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5086 |
^ self |
4004 | 5087 |
]. |
4781 | 5088 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 5089 |
self notify:nil. |
4781 | 5090 |
^ self |
5091 |
]. |
|
3989 | 5092 |
|
3892 | 5093 |
super update:something with:aParameter from:changedObject |
5543 | 5094 |
! |
5095 |
||
6095 | 5096 |
updateCanMake |
5097 |
|dir can| |
|
5098 |
||
5099 |
can := false. |
|
5100 |
dir := self currentDirectory. |
|
5101 |
dir notNil ifTrue:[ |
|
13856 | 5102 |
"/ Check for make |
6095 | 5103 |
can := (dir asFilename construct:'Makefile') exists. |
13856 | 5104 |
can ifFalse:[ |
5105 |
can := (dir asFilename construct:'makefile') exists. |
|
5106 |
]. |
|
6095 | 5107 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
5108 |
can ifFalse:[ |
|
13856 | 5109 |
can := (self currentDirectory asFilename construct:'bc.mak') exists. |
6095 | 5110 |
] |
5111 |
]. |
|
13856 | 5112 |
can ifTrue:[ |
5113 |
self makeCommandHolder value: 'make'. |
|
5114 |
self canMake value: true. |
|
5115 |
^ self |
|
5116 |
]. |
|
5117 |
||
5118 |
"/Check for Apache ant |
|
5119 |
(OperatingSystem canExecuteCommand: 'ant') ifTrue:[ |
|
5120 |
can := (dir asFilename construct:'build.xml') exists. |
|
5121 |
can ifTrue:[ |
|
5122 |
self makeCommandHolder value: 'ant'. |
|
5123 |
self canMake value: true. |
|
5124 |
^ self |
|
5125 |
]. |
|
5126 |
]. |
|
5127 |
||
5128 |
"/Add more here... |
|
5129 |
||
6095 | 5130 |
]. |
5131 |
self canMake value:can. |
|
13856 | 5132 |
|
5133 |
"Modified: / 17-12-2013 / 08:13:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6095 | 5134 |
! |
5135 |
||
5543 | 5136 |
updateListAfterDelete:colOfFiles |
17871 | 5137 |
self updateCurrentDirectoryWithReread |
3892 | 5138 |
! ! |
5139 |
||
5140 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
5141 |
||
5142 |
canPaste |
|
5143 |
||
15259 | 5144 |
^ self aspectFor:#canPaste ifAbsent:[ ValueHolder with:false ]. |
3892 | 5145 |
! |
5146 |
||
5147 |
clipboard |
|
5148 |
||
5149 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
5150 |
! |
|
5151 |
||
5152 |
copyFilesToClipBoard:colOfFiles |
|
5153 |
self putInClipBoard:colOfFiles as:#copy. |
|
5154 |
! |
|
5155 |
||
5156 |
cutFilesToClipBoard:colOfFiles |
|
5157 |
"defete current selected files/directories |
|
5158 |
" |
|
5159 |
self putInClipBoard:colOfFiles as:#cut. |
|
5160 |
! |
|
5161 |
||
5162 |
emptyClipBoard |
|
5163 |
||
5164 |
self clipboard files:nil. |
|
5165 |
self canPaste value:false. |
|
5166 |
! |
|
5167 |
||
5168 |
putInClipBoard:colOfFiles as:aSymbol |
|
5169 |
| stream clp| |
|
5170 |
||
5171 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
5172 |
clp := self clipboard. |
|
5173 |
clp files:nil. |
|
5174 |
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
|
5175 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
5176 |
stream := String writeStream. |
3892 | 5177 |
stream nextPutAll:aSymbol asString. |
5178 |
stream nextPutAll:' <'. |
|
5179 |
stream nextPutAll:colOfFiles first asString. |
|
5180 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 5181 |
stream nextPutAll:' ...'. |
3892 | 5182 |
]. |
5183 |
stream nextPutAll:'> to clipboard'. |
|
5184 |
||
4523 | 5185 |
self notify:stream contents. |
3892 | 5186 |
clp files:colOfFiles. |
5187 |
self canPaste value:true. |
|
5188 |
! ! |
|
5189 |
||
5190 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
5191 |
||
5192 |
canDropFiles:dropedObjects for:filename |
|
6284 | 5193 |
|filenameDirString filenameDir| |
3892 | 5194 |
|
5195 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 5196 |
|
19009 | 5197 |
filenameDir := self class getDirectoryOf:filename. |
7491 | 5198 |
filenameDir isNil ifTrue:[^ false ]. |
13232 | 5199 |
filenameDir isWritableDirectory ifFalse:[^ false]. |
6284 | 5200 |
|
3892 | 5201 |
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
|
5202 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
5203 |
dropedObjects do:[:aDropObject | |
6284 | 5204 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
5205 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
5206 |
"/ |
|
5207 |
"/ dropFileName := aDropObject theObject. |
|
5208 |
"/ dropFileNameString := dropFileName asString. |
|
5209 |
"/ dropFileName isDirectory ifTrue:[ |
|
5210 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
5211 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
5212 |
"/ ^ false |
|
5213 |
"/ ] |
|
5214 |
"/ ] ifFalse:[ |
|
5215 |
"/ physicalPathName := dropFileName physicalPathName. |
|
5216 |
"/ (filenameDirString = dropFileName directory asString |
|
5217 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
5218 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
5219 |
"/ self notify:'Cannot drop a file into same directory'. |
|
5220 |
"/ ^ false |
|
5221 |
"/ ] |
|
5222 |
"/ ] |
|
5223 |
]. |
|
5224 |
self notify:nil. |
|
5225 |
^ true |
|
5226 |
! |
|
5227 |
||
5228 |
canDropObject:aDropObject into:aDirectory |
|
5229 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
5230 |
||
5231 |
dropFileName := aDropObject theObject. |
|
5232 |
dropFileNameString := dropFileName asString. |
|
5233 |
dropFileName isDirectory ifTrue:[ |
|
5234 |
filenameDirString := aDirectory asString. |
|
5235 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
5236 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
5237 |
^ false |
|
4414 | 5238 |
] |
6284 | 5239 |
] ifFalse:[ |
5240 |
physicalPathName := dropFileName physicalPathName. |
|
5241 |
(aDirectory = dropFileName directory |
|
5242 |
or:[ aDropObject isFileInArchive not |
|
5243 |
and:[physicalPathName notNil |
|
5244 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
5245 |
self notify:'Cannot drop a file into same directory'. |
|
5246 |
^ false |
|
5247 |
] |
|
5248 |
]. |
|
5249 |
^ true. |
|
3892 | 5250 |
! |
5251 |
||
7406 | 5252 |
canDropObjects:aCollectionOfDropObjects in:aWidget |
17865 | 5253 |
^ aCollectionOfDropObjects contains:#isFileObject |
7406 | 5254 |
|
5255 |
"Created: / 13-10-2006 / 15:52:49 / cg" |
|
5256 |
! |
|
5257 |
||
17202 | 5258 |
doStartDrag:arg1 in:arg2 |
5259 |
^ self class doStartDrag:arg1 in:arg2 |
|
6479 | 5260 |
! |
5261 |
||
7408 | 5262 |
dropObjects:aCollectionOfDropObjects in:aWidget at:position |
7990 | 5263 |
|fileEntryFieldHolder destDir dropObject fn d| |
5264 |
||
5265 |
fileEntryFieldHolder := self masterApplication notNil |
|
5266 |
ifTrue:[ self masterApplication fileEntryFieldHolder ] |
|
5267 |
ifFalse:[ self fileEntryFieldHolder ]. |
|
5268 |
||
5269 |
aWidget model == fileEntryFieldHolder ifTrue:[ |
|
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5270 |
dropObject := aCollectionOfDropObjects first. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5271 |
dropObject isFileObject ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5272 |
fn := dropObject theObject asFilename. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5273 |
dropObject isDirectory ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5274 |
d := fn. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5275 |
] ifFalse:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5276 |
d := fn directory. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5277 |
]. |
7990 | 5278 |
fileEntryFieldHolder value:d pathName. |
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5279 |
]. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5280 |
^ self. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5281 |
]. |
6479 | 5282 |
|
5283 |
destDir := self currentDirectory. |
|
5284 |
destDir isNil ifTrue:[^ self]. |
|
5285 |
||
8601 | 5286 |
self withWaitCursorDo:[ |
5287 |
aCollectionOfDropObjects do:[:dropObject | |
|
5288 |
|fn| |
|
5289 |
||
5290 |
dropObject isFileObject ifTrue:[ |
|
5291 |
fn := dropObject theObject asFilename. |
|
5292 |
dropObject isDirectory ifTrue:[ |
|
8808
cb6476c0cd3a
oops - drop of directories was broken
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
5293 |
fn recursiveCopyTo:destDir |
8601 | 5294 |
] ifFalse:[ |
8950
48c69259d82d
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
8887
diff
changeset
|
5295 |
fn copyTo:(destDir / fn baseName ) |
8601 | 5296 |
] |
6479 | 5297 |
] |
8601 | 5298 |
]. |
5299 |
]. |
|
9268
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5300 |
self directoryContentsBrowser notNil ifTrue:[ |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5301 |
self directoryContentsBrowser |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5302 |
directoryContentsChangeFlag:true; |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5303 |
wakeUp |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5304 |
]. |
7408 | 5305 |
|
5306 |
"Created: / 13-10-2006 / 18:26:41 / cg" |
|
3892 | 5307 |
! ! |
5308 |
||
5309 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
5310 |
||
5311 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 5312 |
"copy to" |
5313 |
||
7635 | 5314 |
^ self copyFile:aSourceFile to:aDestFile repairCorruptedFiles:false |
5315 |
||
5316 |
"Modified: / 07-02-2007 / 18:46:44 / cg" |
|
5317 |
! |
|
5318 |
||
5319 |
copyFile:aSourceFile to:aDestFile repairCorruptedFiles:repairCorruptedFiles |
|
5320 |
"copy to" |
|
5321 |
||
5322 |
|copyOperation msg| |
|
5323 |
||
5324 |
repairCorruptedFiles ifTrue:[ |
|
5325 |
copyOperation := FileOperation copyCorruptedFile:aSourceFile to:aDestFile |
|
5326 |
] ifFalse:[ |
|
5327 |
copyOperation := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
|
5328 |
]. |
|
5329 |
copyOperation result ifTrue:[ |
|
6190 | 5330 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 5331 |
] ifFalse:[ |
7635 | 5332 |
msg := copyOperation errorString. |
6190 | 5333 |
]. |
5334 |
self notify:msg. |
|
7635 | 5335 |
^ copyOperation result |
5336 |
||
5337 |
"Created: / 07-02-2007 / 18:46:34 / cg" |
|
3892 | 5338 |
! |
5339 |
||
5340 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
6374 | 5341 |
|copy result| |
3892 | 5342 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5343 |
self withActivityIndicationDo:[ |
5961 | 5344 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
6374 | 5345 |
copy result ifTrue:[ |
5346 |
result := Dictionary withKeys:(copy collectionOfCopiedFiles) andValues:(copy collectionOfNewFiles). |
|
5347 |
] ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5348 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5349 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5350 |
self updateCurrentDirectory. |
3892 | 5351 |
]. |
6374 | 5352 |
^ result |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5353 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5354 |
"Modified: / 25-07-2006 / 09:07:04 / cg" |
3892 | 5355 |
! |
5356 |
||
15569 | 5357 |
copyFromToRepairingCorruptedFiles |
5358 |
"ask for source and destination and copy the entered file. |
|
5359 |
Especially useful for raw devices to copy corrupted disks/files |
|
5360 |
" |
|
5361 |
||
5362 |
|source destination| |
|
5363 |
||
5364 |
source := Dialog |
|
5365 |
requestDirectoryName:(resources string:'Copy from:') |
|
5366 |
default:(LastMoveDestination ? self currentDirectory) |
|
5367 |
ok:(resources string:'Continue') |
|
5368 |
abort:nil. |
|
5369 |
||
5370 |
source isEmptyOrNil ifTrue:[^ self]. |
|
5371 |
source := source asFilename. |
|
5372 |
||
5373 |
destination := Dialog |
|
5374 |
requestDirectoryName:(resources string:'Copy "%1" to:' with:source) |
|
5375 |
default:(LastMoveDestination ? self currentDirectory) |
|
5376 |
ok:(resources string:'Copy') |
|
5377 |
abort:nil. |
|
5378 |
||
5379 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
5380 |
destination := destination asFilename. |
|
5381 |
||
5382 |
self copyFile:source to:destination repairCorruptedFiles:true. |
|
5383 |
! |
|
5384 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5385 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
12850 | 5386 |
|size msg answer file| |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5387 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5388 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5389 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5390 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5391 |
"/ 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
|
5392 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5393 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5394 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5395 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5396 |
"/ 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
|
5397 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5398 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5399 |
"/ 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
|
5400 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5401 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5402 |
"/ 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
|
5403 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5404 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5405 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5406 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5407 |
stringWithCRs:'Copy or move\\%1:\ %2\to:\ %3 ?' |
17762 | 5408 |
with:(resources string: |
5409 |
(file type == #regular |
|
5410 |
ifTrue:'file' |
|
5411 |
ifFalse:[ |
|
5412 |
file isDirectory |
|
5413 |
ifTrue:'directory' |
|
5414 |
ifFalse:'object'])) |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5415 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5416 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5417 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5418 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5419 |
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
|
5420 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5421 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 5422 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5423 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5424 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5425 |
request:msg |
8127 | 5426 |
label:(resources string:'Copy or Move') |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
5427 |
image:(WarningBox iconBitmap) |
8127 | 5428 |
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
|
5429 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5430 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5431 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5432 |
^ answer. |
17762 | 5433 |
|
5434 |
"Modified: / 17-11-2017 / 13:16:42 / cg" |
|
3892 | 5435 |
! |
5436 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5437 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 5438 |
"copy or move aColOfSourceFiles to aDirectory. |
5439 |
Asks the used if a move or a copy is wanted. |
|
5440 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
5441 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5442 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5443 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5444 |
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
|
5445 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5446 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5447 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5448 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5449 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5450 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5451 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5452 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5453 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5454 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5455 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5456 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 5457 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5458 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5459 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5460 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5461 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5462 |
|
4745 | 5463 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5464 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5465 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5466 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5467 |
^ true. |
3892 | 5468 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5469 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5470 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5471 |
^ true. |
3892 | 5472 |
]. |
4745 | 5473 |
^ false. |
3892 | 5474 |
! |
5475 |
||
6107 | 5476 |
copySelectionTo |
5477 |
"copy the selected file(s) to another directory" |
|
5478 |
||
13704 | 5479 |
self copySelectionToRepairingCorruptedFiles:false. |
5480 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5481 |
|
5482 |
"Modified: / 07-02-2007 / 18:42:48 / cg" |
|
5483 |
! |
|
5484 |
||
5485 |
copySelectionToRepairingCorruptedFiles |
|
5486 |
"copy the selected file(s) to another directory" |
|
5487 |
||
13704 | 5488 |
self copySelectionToRepairingCorruptedFiles:true. |
5489 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5490 |
|
5491 |
"Created: / 07-02-2007 / 18:42:59 / cg" |
|
5492 |
! |
|
5493 |
||
5494 |
copySelectionToRepairingCorruptedFiles:repairingCorruptedFiles |
|
5495 |
"copy the selected file(s) to another directory" |
|
5496 |
||
6299 | 5497 |
|selectedFiles msg destination directory| |
5498 |
||
7560 | 5499 |
selectedFiles := self currentSelectedObjects copy. |
6299 | 5500 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
5501 |
||
5502 |
msg := (selectedFiles size > 1) |
|
14588 | 5503 |
ifTrue:[ 'Copy Selected Items to Directory:' ] |
5504 |
ifFalse:[ 'Copy "%1" to Directory:' ]. |
|
6299 | 5505 |
|
5506 |
destination := Dialog |
|
14588 | 5507 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first baseName) |
7635 | 5508 |
default:(LastMoveDestination ? self currentDirectory) |
5509 |
ok:(resources string:'Copy') |
|
5510 |
abort:nil. |
|
5511 |
||
6299 | 5512 |
destination isEmptyOrNil ifTrue:[^ self]. |
5513 |
destination := destination asFilename. |
|
5514 |
||
5515 |
destination isDirectory ifFalse:[ |
|
5516 |
selectedFiles size == 1 ifTrue:[ |
|
5517 |
directory := destination directory. |
|
5518 |
directory isDirectory ifTrue:[ |
|
5519 |
LastMoveDestination := directory. |
|
7635 | 5520 |
self copyFile:selectedFiles first to:destination repairCorruptedFiles:repairingCorruptedFiles. |
6299 | 5521 |
^ self. |
5522 |
] |
|
5523 |
] |
|
5524 |
]. |
|
5525 |
||
5526 |
LastMoveDestination := destination. |
|
7635 | 5527 |
repairingCorruptedFiles ifTrue:[ |
5528 |
selectedFiles do:[:eachFile | |
|
5529 |
self copyFile:eachFile to:destination repairCorruptedFiles:repairingCorruptedFiles. |
|
5530 |
]. |
|
5531 |
^ self. |
|
5532 |
] ifFalse:[ |
|
5533 |
self copyFiles:selectedFiles to:destination |
|
5534 |
] |
|
5535 |
||
5536 |
"Created: / 07-02-2007 / 18:42:35 / cg" |
|
6107 | 5537 |
! |
5538 |
||
3892 | 5539 |
deleteFile:aFile |
6373 | 5540 |
"delete the selected files/directories" |
3892 | 5541 |
|
5542 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
5543 |
! |
|
5544 |
||
5545 |
deleteFiles:colOfFiles |
|
6373 | 5546 |
"delete some files/directories" |
5547 |
||
5081 | 5548 |
^ self deleteFiles:colOfFiles confirm:true. |
5549 |
! |
|
5550 |
||
5551 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 5552 |
"delete some files/directories" |
5553 |
||
5673 | 5554 |
|delete result| |
3892 | 5555 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5556 |
self withActivityIndicationDo:[ |
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5557 |
ProgressNotification handle:[:info | |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5558 |
self progressPercentageHolder value:info progressValue. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5559 |
info proceed |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5560 |
] do:[ |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5561 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5562 |
result := delete result. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5563 |
]. |
5673 | 5564 |
result notNil ifTrue:[ |
5565 |
result ifFalse:[ |
|
5566 |
self notify:delete errorString. |
|
5753 | 5567 |
] ifTrue:[ |
5568 |
self updateListAfterDelete:colOfFiles. |
|
5569 |
] |
|
4394 | 5570 |
]. |
5673 | 5571 |
]. |
5572 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5573 |
|
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5574 |
"Modified: / 11-10-2010 / 13:08:24 / cg" |
3892 | 5575 |
! |
5576 |
||
6169 | 5577 |
eraseFiles:colOfFiles |
6373 | 5578 |
"erase (clear and delete) some files/directories" |
5579 |
||
6169 | 5580 |
^ self eraseFiles:colOfFiles confirm:true. |
5581 |
! |
|
5582 |
||
5583 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 5584 |
"erase (clear and delete) some files/directories" |
5585 |
||
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5586 |
|deleteOperation result fileSize| |
6169 | 5587 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5588 |
self withActivityIndicationDo:[ |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5589 |
fileSize := colOfFiles first asFilename fileSize. |
8294 | 5590 |
deleteOperation := FileOperation eraseFiles:colOfFiles confirm:confirm. |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5591 |
(colOfFiles size == 1 and:[ fileSize < (10*1024*1024) ]) |
8294 | 5592 |
ifTrue:[ |
5593 |
result := deleteOperation result. |
|
5594 |
] ifFalse:[ |
|
5595 |
ProgressIndicator |
|
5596 |
displayProgressNotifications:'Erasing' |
|
5597 |
abortable:true |
|
5598 |
at:nil |
|
5599 |
during:[ |
|
5600 |
result := deleteOperation result. |
|
5601 |
]. |
|
5602 |
]. |
|
5603 |
||
6169 | 5604 |
result notNil ifTrue:[ |
5605 |
result ifFalse:[ |
|
8294 | 5606 |
self notify:deleteOperation errorString. |
6169 | 5607 |
] ifTrue:[ |
5608 |
self updateListAfterDelete:colOfFiles. |
|
5609 |
] |
|
5610 |
]. |
|
5611 |
]. |
|
5612 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5613 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5614 |
"Modified: / 25-07-2006 / 09:07:16 / cg" |
6169 | 5615 |
! |
5616 |
||
3892 | 5617 |
moveFile:aSourceFile to:aDestFile |
6373 | 5618 |
"move a file/directory" |
3892 | 5619 |
|
5620 |
|move| |
|
5621 |
||
5961 | 5622 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 5623 |
move result ifTrue:[ |
15346 | 5624 |
self notify:(resources string: 'move "%1" to "%2"' with:aSourceFile asString with:aDestFile asString). |
3892 | 5625 |
] ifFalse:[ |
4523 | 5626 |
self notify:move errorString. |
3892 | 5627 |
]. |
17871 | 5628 |
self updateCurrentDirectoryWithReread. |
3892 | 5629 |
^ move result |
5630 |
! |
|
5631 |
||
5632 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 5633 |
"move some files to aDirectory" |
5634 |
||
3892 | 5635 |
|move| |
5636 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5637 |
self withActivityIndicationDo:[ |
5961 | 5638 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5639 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5640 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5641 |
]. |
17871 | 5642 |
self updateCurrentDirectoryWithReread. |
3892 | 5643 |
]. |
6373 | 5644 |
^ move collectionOfMovedFiles |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5645 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5646 |
"Modified: / 25-07-2006 / 09:07:32 / cg" |
3892 | 5647 |
! |
5648 |
||
6107 | 5649 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5650 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5651 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5652 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5653 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5654 |
destinationDirectory := Dialog |
14588 | 5655 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items to Directory:') |
5789 | 5656 |
default:(LastMoveDestination ? self currentDirectory) |
6952 | 5657 |
ok:(resources string:'Move') |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5658 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5659 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5660 |
|
5789 | 5661 |
LastMoveDestination := destinationDirectory. |
13704 | 5662 |
self moveFiles:(self currentSelectedObjects copy) to:destinationDirectory asFilename. |
5663 |
self updateCurrentDirectoryWithReread. |
|
5664 |
||
7560 | 5665 |
|
5666 |
"Modified: / 04-12-2006 / 13:15:12 / cg" |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5667 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5668 |
|
3892 | 5669 |
newDirectory |
5670 |
"ask for and create a new directory" |
|
5671 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5672 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5673 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5674 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5675 |
directory isNil ifTrue:[ |
18175 | 5676 |
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
|
5677 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5678 |
]. |
4521 | 5679 |
|
5680 |
"/ 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
|
5681 |
selectedFiles := self currentSelectedFiles. |
4521 | 5682 |
selectedFiles size == 1 ifTrue:[ |
5683 |
singleSelectedFile := selectedFiles first. |
|
5684 |
||
5685 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
13714 | 5686 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5687 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
5688 |
||
5689 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
13714 | 5690 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5691 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
5692 |
]. |
|
5693 |
]. |
|
5694 |
]. |
|
5695 |
||
5961 | 5696 |
|
4521 | 5697 |
defaultAnswer notNil ifTrue:[ |
5961 | 5698 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 5699 |
] ifFalse:[ |
5961 | 5700 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 5701 |
]. |
5702 |
createOp result ifFalse:[ ^ self]. |
|
5703 |
newFile := createOp createdFile. |
|
3892 | 5704 |
newFile notNil ifTrue:[ |
17871 | 5705 |
self updateCurrentDirectoryWithReread. |
3892 | 5706 |
] |
17818 | 5707 |
|
5708 |
"Modified: / 29-11-2017 / 12:26:41 / cg" |
|
18175 | 5709 |
"Modified: / 01-06-2018 / 12:49:43 / Claus Gittinger" |
3892 | 5710 |
! |
5711 |
||
5712 |
newFile |
|
5713 |
"ask for and create a new file" |
|
5714 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5715 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5716 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5717 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5718 |
directory isNil ifTrue:[ |
18175 | 5719 |
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
|
5720 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5721 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5722 |
|
3982 | 5723 |
curFile := self firstSelectedFile. |
3892 | 5724 |
curFile notNil ifTrue:[ |
4414 | 5725 |
file := curFile. |
3892 | 5726 |
] ifFalse:[ |
4414 | 5727 |
file := directory. |
3892 | 5728 |
]. |
5961 | 5729 |
create := FileOperation createFileIn:file. |
3892 | 5730 |
create result ifFalse:[ ^ self]. |
5731 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
17818 | 5732 |
|
5733 |
"Modified: / 29-11-2017 / 12:26:51 / cg" |
|
18175 | 5734 |
"Modified: / 01-06-2018 / 12:49:50 / Claus Gittinger" |
3892 | 5735 |
! |
5736 |
||
5737 |
newHardLink |
|
5738 |
"ask for and create a hard link (unix only)" |
|
5739 |
||
6151 | 5740 |
self newLink:#hard. |
5741 |
! |
|
5742 |
||
5743 |
newLink:typeOfLink |
|
3892 | 5744 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
5745 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5746 |
| sel dir create createdFile| |
3892 | 5747 |
|
7560 | 5748 |
sel := self currentSelectedObjects. |
19152 | 5749 |
(sel size ~~ 1) ifTrue:[ |
18175 | 5750 |
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
|
5751 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5752 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5753 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5754 |
|
6151 | 5755 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 5756 |
create result ifFalse:[ ^ self]. |
5757 |
createdFile := create createdFile. |
|
5758 |
createdFile notNil ifTrue:[ |
|
6151 | 5759 |
typeOfLink == #soft ifTrue:[ |
17871 | 5760 |
self updateCurrentDirectoryWithReread. |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5761 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5762 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5763 |
] |
3892 | 5764 |
]. |
7560 | 5765 |
|
17818 | 5766 |
"Modified: / 29-11-2017 / 12:26:58 / cg" |
18175 | 5767 |
"Modified: / 01-06-2018 / 12:49:32 / Claus Gittinger" |
3892 | 5768 |
! |
5769 |
||
5770 |
newSoftLink |
|
5771 |
"ask for and create a soft link (unix only)" |
|
5772 |
||
6151 | 5773 |
self newLink:#soft. |
3892 | 5774 |
! |
5775 |
||
5776 |
pasteFiles |
|
6373 | 5777 |
"paste from clipBoard" |
5778 |
||
5779 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 5780 |
|
5781 |
files := self clipboard files. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
5782 |
files isEmptyOrNil ifTrue:[ ^ self ]. |
6373 | 5783 |
|
5784 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
5785 |
||
3892 | 5786 |
buffer := self clipboard copy. |
3982 | 5787 |
directories := self currentSelectedDirectories. |
5880 | 5788 |
directories size ~~ 1 ifTrue:[ |
4414 | 5789 |
|box dirStringCol| |
5880 | 5790 |
|
4414 | 5791 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
5792 |
box := ListSelectionBox new. |
|
6373 | 5793 |
box title:'Paste into which directory ?'. |
4414 | 5794 |
box list:dirStringCol. |
5795 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5796 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5797 |
box destroy. |
3892 | 5798 |
] ifFalse:[ |
5880 | 5799 |
destination := directories anElement. |
3892 | 5800 |
]. |
6373 | 5801 |
|
5802 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 5803 |
buffer files copy do:[:aFile| |
5804 |
aFile directory = destination ifTrue:[ |
|
5805 |
buffer files remove:aFile. |
|
5806 |
]. |
|
5807 |
]. |
|
5808 |
]. |
|
5809 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6374 | 5810 |
copiedFiles notEmptyOrNil ifTrue:[ |
5811 |
thisIsAFileMoveOperation ifTrue:[ |
|
5812 |
self deleteFiles:(copiedFiles keys) confirm:false. |
|
5813 |
]. |
|
5814 |
||
5815 |
"/ select those pasted files. |
|
5816 |
self updateCurrentDirectory:true. |
|
5817 |
self currentFileNameHolder value:copiedFiles values. |
|
5818 |
] |
|
3892 | 5819 |
! |
5820 |
||
5821 |
renameFile:aFile |
|
5822 |
"rename the selected file(s)" |
|
5823 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5824 |
^ self renameFiles:(Array with:aFile). |
3892 | 5825 |
! |
5826 |
||
4230 | 5827 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 5828 |
"rename filename to newFileString" |
5829 |
||
5830 |
|rename| |
|
5831 |
||
5961 | 5832 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 5833 |
rename result ifTrue:[ |
4230 | 5834 |
aBoolean ifTrue:[ |
5835 |
self updateAndSelect:(rename renamedFiles). |
|
5836 |
]. |
|
3892 | 5837 |
] ifFalse:[ |
4523 | 5838 |
self notify:rename errorString. |
3892 | 5839 |
]. |
5840 |
^ rename result |
|
5841 |
! |
|
5842 |
||
5843 |
renameFiles:aColOfFiles |
|
6373 | 5844 |
"rename some file(s)" |
3892 | 5845 |
|
5846 |
|rename| |
|
5847 |
||
5961 | 5848 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 5849 |
rename result ifFalse:[ |
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5850 |
self notify:rename errorString. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5851 |
^ nil. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5852 |
]. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5853 |
^ rename |
3892 | 5854 |
! |
5855 |
||
5856 |
renameSelection |
|
5857 |
"rename the selected file(s)" |
|
5858 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5859 |
|renamed| |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5860 |
|
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5861 |
renamed := self renameFiles:(self currentSelectedObjects copy). |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5862 |
renamed notNil ifTrue:[ |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5863 |
self updateAndSelect:renamed renamedFiles. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5864 |
]. |
7560 | 5865 |
|
5866 |
"Modified: / 04-12-2006 / 13:15:24 / cg" |
|
3892 | 5867 |
! ! |
5868 |
||
4080 | 5869 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 5870 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5871 |
bookmarksMenu |
3952 | 5872 |
<resource: #programMenu> |
5873 |
||
14941 | 5874 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec. |
5875 |
! |
|
5876 |
||
5877 |
bookmarksMenuForBaseSpec:aBaseMenuSpec |
|
5878 |
<resource: #programMenu> |
|
5879 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5880 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5881 |
|
14941 | 5882 |
menu := aBaseMenuSpec decodeAsLiteralArray. |
7763 | 5883 |
|
5884 |
"/ add the bookmark items ... |
|
5885 |
bookmarks := self class directoryBookmarks. |
|
5886 |
bookmarks notEmptyOrNil ifTrue:[ |
|
14604 | 5887 |
menu addSeparator. |
7763 | 5888 |
bookmarks do:[:dirName | |
12963 | 5889 |
menu addItem:(MenuItem |
5890 |
label:dirName asString |
|
5891 |
itemValue:[ |
|
5892 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
|
5893 |
self setCurrentFileName:dirName. |
|
5894 |
]. |
|
5895 |
]). |
|
7763 | 5896 |
]. |
5897 |
]. |
|
4080 | 5898 |
menu findGuiResourcesIn:self. |
7763 | 5899 |
^ menu |
5900 |
||
11135 | 5901 |
"Modified: / 14-01-2012 / 21:14:03 / cg" |
7763 | 5902 |
! |
5903 |
||
5904 |
canBackward |
|
5905 |
^ self directoryHistory canBackward. |
|
5906 |
||
5907 |
"Modified: / 27-03-2007 / 10:54:55 / cg" |
|
5908 |
! |
|
5909 |
||
5910 |
canForward |
|
5911 |
^ self directoryHistory canForward. |
|
5912 |
||
5913 |
"Modified: / 27-03-2007 / 10:54:57 / cg" |
|
5914 |
! |
|
5915 |
||
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5916 |
gotoBookmarksMenu |
7763 | 5917 |
<resource: #programMenu> |
5918 |
||
14941 | 5919 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec2. |
6099 | 5920 |
! |
5921 |
||
3892 | 5922 |
menuDirHistory:backOrForward |
7763 | 5923 |
"initialize the history menu" |
5924 |
||
3892 | 5925 |
<resource: #programMenu > |
5926 |
||
7763 | 5927 |
|hist menu pathList currentSel currentPath| |
5928 |
||
5929 |
hist := self directoryHistory. |
|
5930 |
hist isEmpty ifTrue:[^ nil]. |
|
5931 |
||
3892 | 5932 |
backOrForward == #back ifTrue:[ |
6725 | 5933 |
currentSel := self currentSelectedDirectories. |
4347 | 5934 |
currentSel size == 1 ifTrue:[ |
5935 |
currentPath := currentSel first asString. |
|
5936 |
] ifFalse:[ |
|
5937 |
currentPath := nil. |
|
5938 |
]. |
|
7763 | 5939 |
pathList := hist getBackCollection. |
3892 | 5940 |
] ifFalse:[ |
7763 | 5941 |
pathList := hist getForwardCollection. |
3892 | 5942 |
]. |
4022 | 5943 |
pathList isEmpty ifTrue:[ ^ nil]. |
7763 | 5944 |
|
6370 | 5945 |
pathList size > 30 ifTrue:[ |
5946 |
pathList := pathList copyTo:30 |
|
5947 |
]. |
|
7763 | 5948 |
|
5949 |
menu := Menu new. |
|
5950 |
||
3964 | 5951 |
pathList do:[:aPath| |
14593 | 5952 |
menu addItem:(MenuItem |
5953 |
label:aPath |
|
5954 |
itemValue:[ self setCurrentFileName:(aPath asFilename) ] |
|
5955 |
translateLabel:false). |
|
3952 | 5956 |
]. |
7763 | 5957 |
menu findGuiResourcesIn:self. |
3892 | 5958 |
^ menu |
7763 | 5959 |
|
11783 | 5960 |
"Modified: / 09-09-2012 / 13:07:22 / cg" |
3892 | 5961 |
! |
5962 |
||
5963 |
menuDirHistoryBack |
|
5964 |
"initialize the directory menu |
|
5965 |
" |
|
5966 |
<resource: #programMenu > |
|
5967 |
||
5968 |
^ self menuDirHistory:#back. |
|
5969 |
! |
|
5970 |
||
5971 |
menuDirHistoryForward |
|
5972 |
"initialize the directory menu |
|
5973 |
" |
|
5974 |
<resource: #programMenu > |
|
5975 |
||
5976 |
^ self menuDirHistory:#forward. |
|
3906 | 5977 |
! |
5978 |
||
5979 |
menuFileHistory |
|
5980 |
"initialize the file history menu |
|
5981 |
" |
|
5982 |
<resource: #programMenu > |
|
5983 |
||
7763 | 5984 |
|menu hist text removeItem| |
3906 | 5985 |
|
5986 |
hist := self fileHistory. |
|
5987 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5988 |
|
7763 | 5989 |
menu := Menu new. |
5990 |
||
5991 |
hist copy do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5992 |
aFileItem fileName exists ifTrue:[ |
12963 | 5993 |
menu addItem:(MenuItem |
5994 |
label: aFileItem fileName asString |
|
14593 | 5995 |
itemValue: |
5996 |
[ |
|
5997 |
self setCurrentFileName:(aFileItem fileName). |
|
5998 |
self openApplByFileItem:aFileItem |
|
5999 |
] |
|
6000 |
translateLabel:false). |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
6001 |
] ifFalse:[ |
7763 | 6002 |
"/ remove all not existing history entries |
6003 |
hist remove:aFileItem. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
6004 |
] |
3906 | 6005 |
]. |
7763 | 6006 |
menu addSeparator. |
6007 |
||
4080 | 6008 |
removeItem := MenuItem new. |
6009 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
6010 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
6011 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 6012 |
removeItem label:text. |
11783 | 6013 |
removeItem |
6014 |
itemValue:[ |
|
6015 |
self fileHistory removeAll. |
|
6016 |
self enableFileHistory value:false. |
|
6017 |
]. |
|
3906 | 6018 |
menu addItem:removeItem. |
7763 | 6019 |
menu findGuiResourcesIn:self. |
3906 | 6020 |
^ menu |
7763 | 6021 |
|
11783 | 6022 |
"Modified (format): / 09-09-2012 / 13:07:36 / cg" |
3952 | 6023 |
! |
6024 |
||
4080 | 6025 |
sortMenu |
6026 |
<resource: #programMenu > |
|
6027 |
||
6028 |
|menu| |
|
6029 |
||
7763 | 6030 |
menu := Menu decodeFromLiteralArray:self class sortMenu. |
4080 | 6031 |
menu findGuiResourcesIn:self. |
6032 |
^ menu |
|
7763 | 6033 |
|
6034 |
"Modified: / 27-03-2007 / 10:47:42 / cg" |
|
4080 | 6035 |
! |
6036 |
||
6037 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6038 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6039 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6040 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6041 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6042 |
|
19001 | 6043 |
"/ attn: the menuSpec format has changed. |
6044 |
"/ for reference, the following code supports both old and new formats. |
|
6045 |
specHere := self class viewDetailsMenuSpec. |
|
6046 |
((specHere at:2) isArray and:[(specHere at:2) first isSymbol]) ifTrue:[ |
|
6047 |
"/ new format |
|
6048 |
itemsHere := specHere copyFrom:2. |
|
6049 |
spec := { (specHere first) } , itemsContentsBrowser , itemsHere |
|
6050 |
] ifFalse:[ |
|
6051 |
itemsHere := specHere at:2. |
|
6052 |
||
6053 |
spec := specHere copy. |
|
6054 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
|
6055 |
]. |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6056 |
^ spec |
4080 | 6057 |
! |
6058 |
||
6059 |
viewInContentsBrowserMenu |
|
5009 | 6060 |
self |
6061 |
applicationNamed:#DirectoryContentsBrowser |
|
6062 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
6063 |
||
6064 |
^ nil. |
|
4080 | 6065 |
! |
6066 |
||
3952 | 6067 |
visitedDirectoriesMenu |
6068 |
<resource: #programMenu > |
|
6069 |
||
6070 |
|menu histCopy text removeItem| |
|
6071 |
||
7763 | 6072 |
histCopy := self directoryHistory. |
6073 |
histCopy isEmpty ifTrue:[^ nil]. |
|
6074 |
||
3952 | 6075 |
menu := Menu new. |
7763 | 6076 |
|
6077 |
histCopy do:[:aFile| |
|
12963 | 6078 |
menu addItem:(MenuItem |
6079 |
label:aFile asString |
|
6080 |
itemValue:[ |
|
6081 |
self setCurrentFileName:(aFile path asFilename). |
|
6082 |
]). |
|
7763 | 6083 |
]. |
6084 |
menu addSeparator. |
|
6085 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
6086 |
"/ 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
|
6087 |
text := (resources string:'Clear History'). |
3952 | 6088 |
removeItem := MenuItem new. |
4040 | 6089 |
removeItem translateLabel:true. |
3952 | 6090 |
removeItem label:text. |
11783 | 6091 |
removeItem |
6092 |
itemValue:[ |
|
6093 |
self directoryHistory removeAll. |
|
6094 |
self enableForward value:self canForward. |
|
6095 |
self enableBack value:self canBackward. |
|
6096 |
]. |
|
7763 | 6097 |
|
3952 | 6098 |
menu addItem:removeItem. |
7763 | 6099 |
menu findGuiResourcesIn:self. |
3952 | 6100 |
^ menu |
7763 | 6101 |
|
11783 | 6102 |
"Modified: / 09-09-2012 / 13:07:45 / cg" |
3892 | 6103 |
! ! |
6104 |
||
5880 | 6105 |
!AbstractFileBrowser methodsFor:'menu actions'! |
6106 |
||
6107 |
doCompareTwoFiles |
|
6108 |
self openDiffView. |
|
6109 |
! |
|
6110 |
||
6111 |
doGoDirectoryUp |
|
18511 | 6112 |
"navigate up to the parent folder" |
6113 |
||
5960 | 6114 |
| upDir directory rootInTreeView| |
5880 | 6115 |
|
6116 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
6117 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 6118 |
directory := self currentDirectory. |
6119 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 6120 |
] ifFalse:[ |
6121 |
rootInTreeView := self |
|
6122 |
applicationNamed:#DirectoryTreeBrowser |
|
6123 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 6124 |
directory := rootInTreeView value asFilename. |
6125 |
]. |
|
6126 |
upDir := directory directory. |
|
5959 | 6127 |
self setCurrentFileName:upDir. |
5880 | 6128 |
! |
6129 |
||
6130 |
doGotoDefaultDirectory |
|
18511 | 6131 |
"navigate to the default folder (is the current directory)" |
6132 |
||
5880 | 6133 |
self gotoFile:(Filename defaultDirectory). |
6134 |
! |
|
6135 |
||
8091 | 6136 |
doGotoDesktopDirectory |
18511 | 6137 |
"navigate to the desktop folder" |
6138 |
||
18823 | 6139 |
|dir| |
6140 |
||
6141 |
(dir := Filename desktopDirectory) isNil ifTrue:[ |
|
6142 |
Dialog warn:'No desktop folder defined'. |
|
6143 |
^ self. |
|
6144 |
]. |
|
6145 |
self gotoFile:dir. |
|
6146 |
||
6147 |
"Modified: / 15-06-2019 / 08:40:25 / Claus Gittinger" |
|
8091 | 6148 |
! |
6149 |
||
18036 | 6150 |
doGotoDocumentsDirectory |
18511 | 6151 |
"navigate to the documents folder" |
6152 |
||
18823 | 6153 |
|dir| |
6154 |
||
6155 |
(dir := Filename documentsDirectory) isNil ifTrue:[ |
|
6156 |
Dialog warn:'No documents folder defined'. |
|
6157 |
^ self. |
|
6158 |
]. |
|
6159 |
self gotoFile:dir. |
|
6160 |
||
6161 |
"Modified: / 15-06-2019 / 08:40:40 / Claus Gittinger" |
|
18036 | 6162 |
! |
6163 |
||
6164 |
doGotoDownloadsDirectory |
|
18511 | 6165 |
"navigate to the downloads folder" |
6166 |
||
18823 | 6167 |
|dir| |
6168 |
||
6169 |
(dir := Filename downloadsDirectory) isNil ifTrue:[ |
|
6170 |
Dialog warn:'No downloads folder defined'. |
|
6171 |
^ self. |
|
6172 |
]. |
|
6173 |
self gotoFile:dir. |
|
6174 |
||
6175 |
"Modified: / 15-06-2019 / 08:40:53 / Claus Gittinger" |
|
18036 | 6176 |
! |
6177 |
||
5880 | 6178 |
doGotoHomeDirectory |
18511 | 6179 |
"navigate to the home folder" |
6180 |
||
18823 | 6181 |
|dir| |
6182 |
||
6183 |
(dir := Filename homeDirectory) isNil ifTrue:[ |
|
6184 |
Dialog warn:'No home folder defined'. |
|
6185 |
^ self. |
|
6186 |
]. |
|
6187 |
self gotoFile:dir. |
|
6188 |
||
6189 |
"Modified: / 15-06-2019 / 08:41:08 / Claus Gittinger" |
|
5880 | 6190 |
! |
6191 |
||
6434 | 6192 |
doGotoSmalltalkDirectory |
18511 | 6193 |
"navigate to the smalltalk bin folder (where the stx executable is)" |
6194 |
||
18823 | 6195 |
|dir| |
6196 |
||
6197 |
(dir := self smalltalkDirectory) isNil ifTrue:[ |
|
6198 |
Dialog warn:'No smalltalk folder defined'. |
|
6199 |
^ self. |
|
6200 |
]. |
|
6201 |
self gotoFile:dir. |
|
6202 |
||
6203 |
"Modified: / 15-06-2019 / 08:41:26 / Claus Gittinger" |
|
6434 | 6204 |
! |
6205 |
||
17187 | 6206 |
doGotoSmalltalkWorkspaceDirectory |
18511 | 6207 |
"navigate to the user's smalltalk workspace folder" |
6208 |
||
18823 | 6209 |
|dir| |
6210 |
||
6211 |
(dir := UserPreferences current workspaceDirectory) isNil ifTrue:[ |
|
6212 |
Dialog warn:'No smalltalk workspace folder defined'. |
|
6213 |
^ self. |
|
6214 |
]. |
|
6215 |
self gotoFile:dir. |
|
6216 |
||
6217 |
"Modified: / 15-06-2019 / 08:42:03 / Claus Gittinger" |
|
17187 | 6218 |
! |
6219 |
||
9677 | 6220 |
doGotoTempDirectory |
18823 | 6221 |
|dir| |
6222 |
||
6223 |
(dir := self tempDirectory) isNil ifTrue:[ |
|
6224 |
Dialog warn:'No temp folder defined'. |
|
6225 |
^ self. |
|
6226 |
]. |
|
6227 |
self gotoFile:dir. |
|
9677 | 6228 |
|
6229 |
"Created: / 29-12-2010 / 11:03:17 / cg" |
|
18823 | 6230 |
"Modified: / 15-06-2019 / 08:41:59 / Claus Gittinger" |
9677 | 6231 |
! |
6232 |
||
9596 | 6233 |
doMakeCurrentDirectory |
17582 | 6234 |
<resource: #obsolete> |
6235 |
||
6236 |
"/ no longer |
|
6237 |
^ self |
|
6238 |
"/ OperatingSystem setCurrentDirectory:(self currentDirectory pathName). |
|
6239 |
"/ self currentFileNameHolderChangedForCommon. |
|
9596 | 6240 |
|
6241 |
"Created: / 26-10-2010 / 17:21:19 / cg" |
|
17582 | 6242 |
"Modified (format): / 17-07-2017 / 10:09:39 / cg" |
9596 | 6243 |
! |
6244 |
||
5880 | 6245 |
fileGetInfo:longInfo |
6246 |
"get info on selected file - show it in a box" |
|
6247 |
||
6248 |
|string box updater| |
|
6249 |
||
6250 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
6251 |
string notNil ifTrue:[ |
|
6252 |
box := InfoBox title:string. |
|
6253 |
updater := [ |
|
6254 |
[true] whileTrue:[ |
|
6255 |
Delay waitForSeconds:2. |
|
6256 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
6257 |
string isNil ifTrue:[ ^ self]. |
|
6258 |
box title:string |
|
6259 |
] |
|
6260 |
] fork. |
|
6261 |
box show. |
|
6262 |
updater terminate. |
|
6263 |
box destroy |
|
6264 |
] |
|
6434 | 6265 |
! |
6266 |
||
17686 | 6267 |
showDeltaBetweenTwoImageFiles |
6268 |
|i1 i2 delta| |
|
6269 |
||
6270 |
i1 := Image fromFile:(self selectedFileNames first). |
|
6271 |
i2 := Image fromFile:(self selectedFileNames second). |
|
6272 |
delta := ImageAlgorithms new differenceImageBetween:i1 and:i2. |
|
6273 |
ImageView openOn:delta. |
|
6274 |
||
6275 |
"Created: / 10-09-2017 / 16:59:08 / cg" |
|
6276 |
! |
|
6277 |
||
6434 | 6278 |
smalltalkDirectory |
8590 | 6279 |
|stxPath| |
6434 | 6280 |
|
6281 |
stxPath := OperatingSystem pathOfSTXExecutable. |
|
8590 | 6282 |
stxPath isNil ifTrue:[ |
6283 |
^ Filename currentDirectory |
|
6284 |
]. |
|
6285 |
^ stxPath asFilename directory. |
|
9677 | 6286 |
! |
6287 |
||
6288 |
tempDirectory |
|
6289 |
^ Filename tempDirectory. |
|
6290 |
||
6291 |
"Created: / 29-12-2010 / 11:03:00 / cg" |
|
5880 | 6292 |
! ! |
6293 |
||
11139 | 6294 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
6295 |
||
14262 | 6296 |
addDirToJavaSourcePath |
6297 |
"add the current path to java's sourcePath |
|
6298 |
(only available with ST/J System" |
|
6299 |
||
6300 |
Java addToSourcePath:self currentDirectory pathName |
|
6301 |
||
6302 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
6303 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
6304 |
! |
|
6305 |
||
11139 | 6306 |
copyFiles |
6307 |
self |
|
6308 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
6309 |
! |
|
6310 |
||
6311 |
cutFiles |
|
6312 |
self |
|
6313 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
6314 |
! |
|
6315 |
||
6316 |
deleteFiles |
|
6317 |
self |
|
6318 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
6319 |
! |
|
6320 |
||
6321 |
eraseFiles |
|
6322 |
self |
|
6323 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
6324 |
! |
|
6325 |
||
14262 | 6326 |
fileAddToJavaSourcePath |
6327 |
"add the current path to java's sourcePath |
|
6328 |
(only available with ST/J System" |
|
6329 |
||
17865 | 6330 |
Java notNil ifTrue:[ |
6331 |
self currentSelectedObjects do:[:each | |
|
6332 |
Java addToSourcePath:(each pathName) |
|
6333 |
]. |
|
14262 | 6334 |
]. |
6335 |
||
6336 |
"Created: / 9.11.1998 / 05:41:34 / cg" |
|
6337 |
"Modified: / 9.11.1998 / 05:56:00 / cg" |
|
6338 |
! |
|
6339 |
||
11139 | 6340 |
openSettingsDialog |
6341 |
|dialog| |
|
6342 |
||
6343 |
dialog := FileBrowserV2SettingsDialog new. |
|
6344 |
dialog settingsDialog:self. |
|
6345 |
dialog allButOpen. |
|
6346 |
dialog doReload. |
|
6347 |
dialog openWindow |
|
6348 |
! |
|
6349 |
||
6350 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
6351 |
|files dirs| |
|
6352 |
||
6353 |
files := self currentSelectedFiles. |
|
6354 |
files notEmpty ifTrue:[ |
|
6355 |
aBlock value:files. |
|
6356 |
] ifFalse:[ |
|
6357 |
dirs := self currentSelectedDirectories. |
|
6358 |
dirs notEmpty ifTrue:[ |
|
6359 |
aBlock value:dirs. |
|
6360 |
]. |
|
6361 |
]. |
|
6362 |
! ! |
|
6363 |
||
6364 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
|
6365 |
||
6366 |
openAboutThisApplication |
|
6367 |
"opens an about box for this application." |
|
6368 |
||
6369 |
Dialog aboutClass:self class. |
|
6370 |
! |
|
6371 |
||
19220 | 6372 |
openDocumentation |
19252 | 6373 |
"open an HTML browser on the launcher section in the 'tools/TOP' document. |
6374 |
Called when <F1> is pressed" |
|
6375 |
||
19220 | 6376 |
self openHTMLDocument:'tools/fbrowserV2/TOP.html' |
6377 |
! |
|
6378 |
||
11139 | 6379 |
openHTMLDocument:relativeDocPath |
6380 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
6381 |
! ! |
|
6382 |
||
6383 |
!AbstractFileBrowser methodsFor:'menu actions-scm-cvs'! |
|
3892 | 6384 |
|
15905 | 6385 |
canCvsAddAndCommit |
6386 |
||
6387 |
|selectedFiles| |
|
6388 |
||
6389 |
selectedFiles := self currentSelectedObjects. |
|
6390 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
6391 |
! |
|
6392 |
||
6393 |
canRemoveCVSContainer |
|
6394 |
^ self currentSelectedFiles |
|
6395 |
contains:[:fileName| |
|
6396 |
|dirOfFile cvsDir| |
|
6397 |
||
19009 | 6398 |
dirOfFile := self class getDirectoryOf:fileName. |
15905 | 6399 |
cvsDir := dirOfFile construct:'CVS'. |
6400 |
cvsDir isDirectory |
|
6401 |
]. |
|
6402 |
! |
|
6403 |
||
12777 | 6404 |
commitFilesToCVS:files |
6405 |
|numFiles| |
|
6406 |
||
6407 |
(numFiles := files size) > 0 ifTrue:[ |
|
6408 |
self withActivityIndicationDo:[ |
|
6409 |
self cvsCommitFiles:files |
|
6410 |
] |
|
6411 |
] |
|
6412 |
! |
|
6413 |
||
3892 | 6414 |
cvsAddAndCommit |
4849 | 6415 |
self cvsAddAndCommitAsBinary:false |
6416 |
! |
|
6417 |
||
6418 |
cvsAddAndCommitAsBinary:asBinary |
|
8588 | 6419 |
|sel log logArg binArg cmd dir executionBlock nameString| |
3892 | 6420 |
|
6421 |
log := Dialog |
|
11139 | 6422 |
requestText:(resources string:'Enter initial log message:') |
4414 | 6423 |
lines:10 |
6424 |
columns:70 |
|
6425 |
initialAnswer:nil. |
|
8322
cf10f08b6164
care for cancel in #cvsAddAndCommitAsBinary:
Claus Gittinger <cg@exept.de>
parents:
8294
diff
changeset
|
6426 |
log isNil ifTrue:[^ self]. |
3892 | 6427 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6428 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6429 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6430 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6431 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6432 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6433 |
|
8588 | 6434 |
binArg := ''. |
6435 |
asBinary ifTrue:[ |
|
6436 |
binArg := '-kb '. |
|
6437 |
]. |
|
3982 | 6438 |
sel := self currentSelectedFiles. |
11139 | 6439 |
executionBlock := |
6440 |
[:stream | |
|
6441 |
log notNil ifTrue:[ |
|
17416 | 6442 |
sel notEmptyOrNil ifTrue:[ |
11139 | 6443 |
sel do:[:fn | |
6444 |
|nameArg| |
|
6445 |
||
6446 |
nameArg := '"',fn baseName,'"'. |
|
6447 |
||
19009 | 6448 |
dir := self class getDirectoryOf:fn. |
11139 | 6449 |
cmd := 'cvs add ',logArg,' ',binArg,nameArg. |
6450 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6451 |
||
6452 |
cmd := ('cvs commit -l ',logArg,' ',nameArg). |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6453 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
11139 | 6454 |
"/ mhmh - it seems that only old CVS implementations (at least turqoise) |
6455 |
"/ support and need the 'admin -kb' command. |
|
6456 |
"/ newer ones use the '-kb' option in the 'cvs add' command |
|
6457 |
asBinary ifTrue:[ |
|
6458 |
cmd := ('cvs admin -kb ' , nameArg). |
|
6459 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6460 |
||
6461 |
cmd := ('cvs upd ' , nameArg). |
|
6462 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6463 |
]. |
|
6464 |
] |
|
6465 |
] |
|
6466 |
] |
|
6467 |
]. |
|
4107 | 6468 |
nameString := 'Command> cvs add and commit'. |
3892 | 6469 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
11139 | 6470 |
|
17416 | 6471 |
"Modified: / 17-02-2017 / 08:25:16 / cg" |
3892 | 6472 |
! |
6473 |
||
4849 | 6474 |
cvsAddBinaryAndCommit |
6475 |
self cvsAddAndCommitAsBinary:true |
|
6476 |
! |
|
6477 |
||
18867 | 6478 |
cvsBrowseRepositoryVersions |
6479 |
"open a diff-textView showing all versions in the repository." |
|
6480 |
||
6481 |
|sel fn| |
|
6482 |
||
6483 |
sel := self currentSelectedObjects. |
|
6484 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6485 |
sel size == 1 ifFalse:[ ^ self ]. |
|
6486 |
fn := sel first. |
|
6487 |
||
6488 |
self withWaitCursorDo:[ |
|
6489 |
FileVersionDiffBrowser openOnAllVersionsOfFile:fn |
|
6490 |
] |
|
6491 |
||
6492 |
"Created: / 07-07-2019 / 19:45:23 / Claus Gittinger" |
|
6493 |
! |
|
6494 |
||
3892 | 6495 |
cvsCommit |
12777 | 6496 |
|selectedFiles| |
3892 | 6497 |
|
3982 | 6498 |
selectedFiles:= self currentSelectedFiles. |
12777 | 6499 |
self cvsCommitFiles:selectedFiles |
6500 |
! |
|
6501 |
||
6502 |
cvsCommitFiles:files |
|
6503 |
|nFiles log logTmp s logArg msg executionBlock nameString | |
|
6504 |
||
6505 |
nFiles := files size. |
|
6506 |
nFiles == 0 ifTrue:[^ self]. |
|
6507 |
||
6508 |
nFiles == 1 ifTrue:[ |
|
6509 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(files first baseName) |
|
3892 | 6510 |
] ifFalse:[ |
12777 | 6511 |
nFiles > 1 ifTrue:[ |
6512 |
msg := resources string:'Enter log message for %1 files to checkIn' with:nFiles printString |
|
4414 | 6513 |
] ifFalse:[ |
6627 | 6514 |
msg := resources string:'Enter log message for checkIn' |
4414 | 6515 |
] |
3892 | 6516 |
]. |
6517 |
||
6518 |
log := Dialog |
|
4414 | 6519 |
requestText:msg |
6520 |
lines:10 |
|
6521 |
columns:70 |
|
6522 |
initialAnswer:nil. |
|
3892 | 6523 |
|
4663 | 6524 |
log isNil ifTrue:[^ self]. |
12777 | 6525 |
log := log replChar:$" withString:'\"'. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6526 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6527 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
12777 | 6528 |
"/ save the log message into another tempFile ... |
13121 | 6529 |
s := FileStream newTemporary. |
6530 |
logTmp := s fileName. |
|
12777 | 6531 |
s nextPutAll:log. |
6532 |
s close. |
|
6533 |
||
6534 |
logArg := '-F "', logTmp pathName, '"'. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6535 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6536 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6537 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6538 |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6539 |
executionBlock := [:stream | |
12777 | 6540 |
[ |
6541 |
files do:[:fn | |
|
6542 |
| dir nameArg cmd | |
|
6543 |
||
6544 |
nameArg := '"',fn baseName,'"'. |
|
6545 |
dir := fn directory. |
|
6546 |
cmd := 'cvs commit ',logArg,' ' , nameArg. |
|
6547 |
stream showCR:fn pathName. |
|
6548 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
4663 | 6549 |
] |
12777 | 6550 |
] ensure:[ |
6551 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6552 |
]. |
|
4107 | 6553 |
]. |
6554 |
nameString := 'Command> cvs commit'. |
|
6555 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 6556 |
! |
6557 |
||
14527 | 6558 |
cvsCommitFolder |
6559 |
|dir log logTmp s logArg msg executionBlock nameString | |
|
6560 |
||
6561 |
(dir := self currentDirectory) isNil ifTrue:[ ^ self ]. |
|
6562 |
||
6563 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(dir baseName). |
|
6564 |
log := Dialog |
|
6565 |
requestText:msg |
|
6566 |
lines:10 |
|
6567 |
columns:70 |
|
6568 |
initialAnswer:nil. |
|
6569 |
||
6570 |
log isNil ifTrue:[^ self]. |
|
6571 |
log := log replChar:$" withString:'\"'. |
|
6572 |
||
6573 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6574 |
"/ save the log message into another tempFile ... |
|
6575 |
s := FileStream newTemporary. |
|
6576 |
logTmp := s fileName. |
|
6577 |
s nextPutAll:log. |
|
6578 |
s close. |
|
6579 |
||
6580 |
logArg := '-F "', logTmp pathName, '"'. |
|
6581 |
] ifFalse:[ |
|
6582 |
logArg := '-m ''' , log , ''''. |
|
6583 |
]. |
|
6584 |
||
6585 |
executionBlock := [:stream | |
|
6586 |
[ |
|
6587 |
|cmd| |
|
6588 |
||
6589 |
cmd := 'cvs commit ',logArg. |
|
6590 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6591 |
] ensure:[ |
|
6592 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6593 |
]. |
|
6594 |
]. |
|
6595 |
||
6596 |
nameString := 'Command> cvs commit'. |
|
6597 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6598 |
! |
|
6599 |
||
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6600 |
cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6601 |
|selectedFiles| |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6602 |
|
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6603 |
selectedFiles:= self currentSelectedFiles. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6604 |
selectedFiles do:[:each | |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6605 |
|out diffs| |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6606 |
|
15589 | 6607 |
out := CharacterWriteStream new:100. |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6608 |
OperatingSystem |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6609 |
executeCommand:'cvs diff -b ',each baseName |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6610 |
outputTo:out |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6611 |
inDirectory:each directoryName. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6612 |
diffs := out contents. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6613 |
TextView openWith:diffs. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6614 |
]. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6615 |
|
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6616 |
"Modified: / 23-01-2012 / 14:08:28 / cg" |
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6617 |
! |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6618 |
|
15211 | 6619 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
6620 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
6621 |
||
6622 |
|toRemove updateRunning executionBlock nameString| |
|
6623 |
||
6624 |
updateRunning := self backgroundProcesses value notEmpty. |
|
6625 |
self killAllRunningBackgroundProcesses. |
|
6626 |
toRemove := OrderedCollection new. |
|
6627 |
||
6628 |
executionBlock := |
|
6629 |
[:stream | |
|
6630 |
|cmd logArg prevDir prevFiles| |
|
6631 |
||
6632 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6633 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
|
6634 |
] ifFalse:[ |
|
6635 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
|
6636 |
]. |
|
6637 |
prevFiles := ''. |
|
6638 |
||
6639 |
filesToRemove do:[:fileName | |
|
6640 |
|dir file| |
|
6641 |
||
6642 |
dir := fileName directory. |
|
6643 |
(prevDir notNil and:[prevDir ~= dir]) ifTrue:[ |
|
6644 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6645 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6646 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6647 |
prevFiles := ''. |
|
6648 |
]. |
|
6649 |
||
17116 | 6650 |
OsError handle:[:ex| |
15211 | 6651 |
"was not able to remove it" |
6652 |
| lastError msg | |
|
6653 |
lastError := OperatingSystem lastErrorString. |
|
6654 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
6655 |
lastError isNil ifFalse:[ |
|
6656 |
msg := msg , '\\(' , lastError , ')' |
|
6657 |
]. |
|
6658 |
Dialog warn:msg withCRs |
|
6659 |
] do:[ |
|
6660 |
(fileName isSymbolicLink) ifFalse:[ |
|
6661 |
fileName remove. |
|
6662 |
file := fileName baseName. |
|
6663 |
cmd := ('cvs remove -f "',file,'"'). |
|
6664 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6665 |
"/ Transcript show:dir; space; showCR:cmd. |
|
6666 |
] |
|
6667 |
]. |
|
6668 |
prevDir := dir. |
|
6669 |
prevFiles := prevFiles,' ',file. |
|
6670 |
]. |
|
6671 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6672 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6673 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6674 |
]. |
|
6675 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
|
6676 |
filesToRemove size > 1 ifTrue:[ |
|
6677 |
nameString := nameString, ' ...'. |
|
6678 |
]. |
|
6679 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6680 |
! |
|
3892 | 6681 |
|
6682 |
cvsRemoveFileAndCVSContainer |
|
12493 | 6683 |
|files| |
6684 |
||
6685 |
files := self currentSelectedFiles copy. |
|
6686 |
self removeFilesAndCVSContainers:files |
|
3892 | 6687 |
! |
6688 |
||
9338 | 6689 |
cvsRevisionLog |
6690 |
| cmd sel executionBlock nameString| |
|
6691 |
||
6692 |
sel := self currentSelectedObjects. |
|
6693 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6694 |
||
6695 |
executionBlock := [:stream | |
|
6696 |
sel do:[:fn | |
|
6697 |
| dir nameArg | |
|
6698 |
||
6699 |
nameArg := '"',fn baseName,'"'. |
|
6700 |
dir := fn directory. |
|
6701 |
cmd := 'cvs log ' , nameArg. |
|
6702 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6703 |
] |
|
6704 |
]. |
|
6705 |
nameString := 'Command> cvs log'. |
|
6706 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6707 |
! |
|
6708 |
||
8562 | 6709 |
cvsTagSelection |
12856 | 6710 |
|tag tags cmd| |
6711 |
||
6712 |
tag := Dialog |
|
6713 |
request:(resources string:'Tag (possibly multiple, separated by ";"):') |
|
6714 |
initialAnswer:(CVSSourceCodeManager recentTag). |
|
6715 |
tag isEmptyOrNil ifTrue:[^ self ]. |
|
6716 |
||
6717 |
CVSSourceCodeManager recentTag:tag. |
|
8562 | 6718 |
|
6719 |
CVSSourceCodeManager notNil ifTrue:[ |
|
6720 |
cmd := CVSSourceCodeManager cvsExecutable. |
|
6721 |
] ifFalse:[ |
|
6722 |
cmd := 'cvs'. |
|
6723 |
]. |
|
6724 |
||
12856 | 6725 |
tags := tag asCollectionOfSubstringsSeparatedByAny:',;'. |
6726 |
tags do:[:eachTag | |
|
6727 |
self executeCommand:('%1 tag -F "%2" %3' |
|
6728 |
bindWith:cmd |
|
12858 | 6729 |
with:(eachTag withoutSeparators) |
12856 | 6730 |
with:(self makeFileNameArgumentString)) |
6731 |
]. |
|
8562 | 6732 |
! |
6733 |
||
3892 | 6734 |
cvsUpdateAll |
6735 |
| cmd | |
|
6736 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6737 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6738 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6739 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6740 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6741 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6742 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6743 |
self executeCommand:(cmd, ' upd -l'). |
3892 | 6744 |
! |
6745 |
||
6746 |
cvsUpdateAllRecursive |
|
6747 |
| cmd | |
|
6748 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6749 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6750 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6751 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6752 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6753 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6754 |
self executeCommand:(cmd, ' upd -d'). |
3892 | 6755 |
! |
6756 |
||
6757 |
cvsUpdateSelection |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6758 |
|stream cmd| |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6759 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6760 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6761 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6762 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6763 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6764 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6765 |
|
15589 | 6766 |
stream := CharacterWriteStream new. |
8563 | 6767 |
stream |
6768 |
nextPutAll:cmd; |
|
6769 |
nextPutAll:' upd '; |
|
6770 |
nextPutAll:(self makeFileNameArgumentString). |
|
6771 |
||
6772 |
self executeCommand:stream contents. |
|
6773 |
! |
|
6774 |
||
6775 |
makeFileNameArgumentString |
|
6776 |
|stream| |
|
6777 |
||
15589 | 6778 |
stream := CharacterWriteStream new. |
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6779 |
self currentSelectedFiles do:[: file | |
8563 | 6780 |
stream nextPut:$". |
4414 | 6781 |
stream nextPutAll:file baseName. |
8563 | 6782 |
stream nextPutAll:'" '. |
6783 |
]. |
|
6784 |
^ stream contents. |
|
12493 | 6785 |
! |
6786 |
||
6787 |
removeFilesAndCVSContainers:files |
|
6788 |
|numFiles question aswer| |
|
6789 |
||
6790 |
(numFiles := files size) > 0 ifTrue:[ |
|
6791 |
numFiles > 1 ifTrue:[ |
|
6792 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:numFiles |
|
6793 |
] ifFalse:[ |
|
6794 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(files first baseName allBold) |
|
6795 |
]. |
|
6796 |
||
6797 |
aswer := Dialog |
|
6798 |
confirm:question withCRs |
|
6799 |
yesLabel:(resources string:'Remove') |
|
6800 |
noLabel:(resources string:'Cancel'). |
|
6801 |
||
6802 |
aswer ifTrue:[ |
|
6803 |
self withActivityIndicationDo:[ |
|
6804 |
self cvsRemoveAndRemoveFromCVS:files |
|
6805 |
] |
|
6806 |
] |
|
6807 |
] |
|
3892 | 6808 |
! ! |
6809 |
||
14126 | 6810 |
|
11139 | 6811 |
!AbstractFileBrowser methodsFor:'menu actions-scm-mercurial'! |
6812 |
||
6813 |
mercurialAdd |
|
6814 |
|executionBlock sel maxCmdSize| |
|
6815 |
||
6816 |
maxCmdSize := 512. |
|
6817 |
||
6818 |
sel := self currentSelectedObjects. |
|
6819 |
sel isEmptyOrNil ifTrue:[ |
|
6820 |
^ self |
|
6821 |
]. |
|
6822 |
||
6823 |
executionBlock := |
|
6824 |
[:stream | |
|
6825 |
|prevDir cmd| |
|
6826 |
||
6827 |
prevDir := nil. |
|
6828 |
sel do:[:fn | |
|
6829 |
|nameArg dir| |
|
6830 |
||
6831 |
nameArg := '"',fn baseName,'"'. |
|
6832 |
dir := fn directory. |
|
6833 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6834 |
"/ flush |
|
6835 |
cmd notNil ifTrue:[ |
|
6836 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6837 |
cmd := nil. |
|
6838 |
] |
|
6839 |
]. |
|
6840 |
cmd isNil ifTrue:[ |
|
6841 |
cmd := 'hg add'. |
|
6842 |
]. |
|
6843 |
cmd := cmd,' ',nameArg. |
|
6844 |
prevDir := dir. |
|
6845 |
]. |
|
6846 |
cmd notNil ifTrue:[ |
|
6847 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6848 |
cmd := nil. |
|
6849 |
]. |
|
6850 |
stream nextPutLine:'Commit to finish the transaction'. |
|
6851 |
]. |
|
6852 |
||
6853 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg add'. |
|
6854 |
||
6855 |
"Created: / 15-01-2012 / 15:55:47 / cg" |
|
6856 |
! |
|
6857 |
||
6858 |
mercurialCommit |
|
6859 |
|dir executionBlock| |
|
6860 |
||
6861 |
"/ dir := self currentDirectory. |
|
6862 |
dir := self directoryContentsBrowser directory. |
|
6863 |
executionBlock := |
|
6864 |
[:stream | |
|
6865 |
(self getExecutionBlockForCommand:'hg commit' |
|
6866 |
inDirectory:dir) value:stream. |
|
6867 |
stream nextPutLine:'Push to sync other repositories'. |
|
6169 | 6868 |
]. |
11139 | 6869 |
|
6870 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg commit'. |
|
6871 |
||
6872 |
"Created: / 15-01-2012 / 16:21:27 / cg" |
|
6873 |
! |
|
6874 |
||
11144 | 6875 |
mercurialInit |
6876 |
|dir executionBlock| |
|
6877 |
||
6878 |
dir := self directoryContentsBrowser directory. |
|
6879 |
||
6880 |
(Dialog confirm:(resources |
|
6881 |
string:'Initialize new Mercurial Repository in %1?' |
|
6882 |
with:dir baseName)) ifFalse:[^ self]. |
|
6883 |
||
6884 |
executionBlock := |
|
6885 |
[:stream | |
|
6886 |
(self getExecutionBlockForCommand:('hg init') |
|
6887 |
inDirectory:dir) value:stream. |
|
6888 |
]. |
|
6889 |
||
6890 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg init'. |
|
6891 |
||
6892 |
"Created: / 17-01-2012 / 15:58:46 / cg" |
|
6893 |
! |
|
6894 |
||
11139 | 6895 |
mercurialPush |
6896 |
|destination dir executionBlock| |
|
6897 |
||
6898 |
destination := Dialog request:'Mercurial Repository' |
|
6899 |
initialAnswer:(LastMercurialRepository ? MercurialSourceCodeManager repositoryName). |
|
6900 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
6901 |
||
6902 |
LastMercurialRepository := destination. |
|
6903 |
||
6904 |
dir := self directoryContentsBrowser directory. |
|
6905 |
executionBlock := |
|
6906 |
[:stream | |
|
6907 |
(self getExecutionBlockForCommand:('hg push "%1"' bindWith:destination) |
|
6908 |
inDirectory:dir) value:stream. |
|
6909 |
]. |
|
6910 |
||
6911 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg push'. |
|
6912 |
||
6913 |
"Created: / 15-01-2012 / 16:29:41 / cg" |
|
6914 |
! |
|
6915 |
||
6916 |
mercurialStatus |
|
6917 |
|executionBlock sel maxCmdSize| |
|
6918 |
||
6919 |
maxCmdSize := 512. |
|
6920 |
||
6921 |
sel := self currentSelectedObjects. |
|
6922 |
sel isEmptyOrNil ifTrue:[ |
|
6923 |
^ self |
|
6924 |
]. |
|
6925 |
||
6926 |
executionBlock := |
|
6927 |
[:stream | |
|
6928 |
|prevDir cmd| |
|
6929 |
||
6930 |
prevDir := nil. |
|
6931 |
sel do:[:fn | |
|
6932 |
|nameArg dir| |
|
6933 |
||
6934 |
nameArg := '"',fn baseName,'"'. |
|
6935 |
dir := fn directory. |
|
6936 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6937 |
"/ flush |
|
6938 |
cmd notNil ifTrue:[ |
|
6939 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6940 |
cmd := nil. |
|
6941 |
] |
|
6942 |
]. |
|
6943 |
cmd isNil ifTrue:[ |
|
6944 |
cmd := 'hg status'. |
|
6945 |
]. |
|
6946 |
cmd := cmd,' ',nameArg. |
|
6947 |
prevDir := dir. |
|
6948 |
]. |
|
6949 |
cmd notNil ifTrue:[ |
|
6950 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6951 |
cmd := nil. |
|
6952 |
]. |
|
6953 |
]. |
|
6954 |
||
6955 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg status'. |
|
6956 |
||
6957 |
"Created: / 15-01-2012 / 19:43:08 / cg" |
|
3892 | 6958 |
! ! |
6959 |
||
4849 | 6960 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
3892 | 6961 |
|
8510 | 6962 |
allFilesInSelectedDirectoriesForWhich:aBlock |
17868 | 6963 |
^ self class allFilesInDirectories:(self currentSelectedDirectories) forWhich:aBlock |
8510 | 6964 |
! |
6965 |
||
18426 | 6966 |
changeSetFromGSTSource |
6967 |
GSTFileReader isNil ifTrue:[ Smalltalk loadPackage:'stx:libbasic2']. |
|
6968 |
||
6969 |
self withWaitCursorDo:[ |
|
6970 |
self currentSelectedFiles do:[:fn | |
|
6971 |
|changeSet| |
|
6972 |
||
18746 | 6973 |
(fn suffix sameAs:'st') ifTrue:[ |
18426 | 6974 |
changeSet := GSTFileReader new changeSetFromStream:fn readStream. |
6975 |
(Tools::ChangeSetBrowser2 |
|
6976 |
on: changeSet |
|
6977 |
label: fn baseName) |
|
6978 |
beTwoColumn; |
|
6979 |
targetNamespace:nil; |
|
6980 |
targetPackage:nil; |
|
6981 |
open |
|
6982 |
] |
|
6983 |
] |
|
6984 |
] |
|
6985 |
||
6986 |
"Created: / 23-09-2018 / 01:32:46 / Claus Gittinger" |
|
18746 | 6987 |
"Modified: / 01-05-2019 / 11:21:34 / Claus Gittinger" |
18426 | 6988 |
! |
6989 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6990 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6991 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6992 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6993 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6994 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6995 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6996 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6997 |
"/ 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
|
6998 |
"/ 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
|
6999 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7000 |
conv := OrderedCollection new. |
4722 | 7001 |
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
|
7002 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7003 |
outSuffix = 'png' ifTrue:[ |
4722 | 7004 |
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
|
7005 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7006 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7007 |
outSuffix = 'gif' ifTrue:[ |
4722 | 7008 |
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
|
7009 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7010 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7011 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 7012 |
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
|
7013 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7014 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7015 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 7016 |
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
|
7017 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7018 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7019 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7020 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7021 |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7022 |
convertImageFrom:fileName to:outFile onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7023 |
|writer image outSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7024 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7025 |
outSuffix := outFile suffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7026 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7027 |
((writer := MIMETypes imageReaderForSuffix:outSuffix) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7028 |
and:[ (image := Image fromFile:fileName) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7029 |
and:[ writer canRepresent:image ]]) ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7030 |
"/ can do it with Smalltalk tools |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7031 |
writer save:image onFile:outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7032 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7033 |
"/ use external tools (pbm-package, if available) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7034 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7035 |
convertImageUsingExternalFileToolsFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7036 |
toSuffix:outSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7037 |
onError:exceptionBlock. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7038 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7039 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7040 |
"Created: / 20-05-2010 / 11:12:36 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7041 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7042 |
|
4367 | 7043 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7044 |
self convertImageToSuffix:'gif' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7045 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7046 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7047 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7048 |
self convertImageToSuffix:'jpg' |
4531 | 7049 |
! |
7050 |
||
7051 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7052 |
self convertImageToSuffix:'png' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7053 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7054 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7055 |
convertImageToSuffix:outSuffix |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7056 |
|outFile filesToConvert| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7057 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7058 |
self withActivityIndicationDo:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7059 |
filesToConvert := self currentSelectedObjects copy. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7060 |
filesToConvert do:[:fileName | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7061 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7062 |
|
18453 | 7063 |
fileName isRegularFile ifTrue:[ |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7064 |
|skip| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7065 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7066 |
skip := false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7067 |
outFile := fileName withSuffix:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7068 |
outFile exists ifTrue:[ |
4722 | 7069 |
|answer| |
7070 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7071 |
answer := Dialog |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7072 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7073 |
default:false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7074 |
answer isNil ifTrue:[AbortSignal raise]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7075 |
answer ifFalse:[ skip := true ]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7076 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7077 |
skip ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7078 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7079 |
convertImageFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7080 |
to:outFile |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7081 |
onError:[:errMsg | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7082 |
filesToConvert size == 1 ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7083 |
Dialog warn:errMsg |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7084 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7085 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7086 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7087 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7088 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7089 |
]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7090 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7091 |
self updateAndSelect:nil. |
4367 | 7092 |
] |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7093 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7094 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7095 |
self notify:nil. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7096 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7097 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7098 |
"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
|
7099 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7100 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7101 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7102 |
self convertImageToSuffix:'xpm' |
4367 | 7103 |
! |
7104 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7105 |
convertImageUsingExternalFileToolsFrom:fileName toSuffix:outSuffix onError:exceptionBlock |
13121 | 7106 |
|inFile outFile chainOfConversions conversionStream |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7107 |
eachConversionSuffixCommandPair eachConversionCommand eachConversionSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7108 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7109 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7110 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7111 |
chainOfConversions isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7112 |
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
|
7113 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7114 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7115 |
conversionStream := chainOfConversions readStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7116 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7117 |
inFile := fileName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7118 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7119 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7120 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7121 |
eachConversionCommand == #readToXPM ifTrue:[ |
13121 | 7122 |
|image tempStreamXPM| |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7123 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7124 |
image := Image fromFile:(inFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7125 |
image isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7126 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7127 |
^ false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7128 |
]. |
13121 | 7129 |
tempStreamXPM := FileStream newTemporaryWithSuffix:'xpm'. |
7130 |
XPMReader save:image onStream:tempStreamXPM. |
|
7131 |
tempStreamXPM close. |
|
7132 |
inFile := tempStreamXPM fileName. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7133 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7134 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7135 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7136 |
[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7137 |
|command errOutput errMsg| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7138 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7139 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7140 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7141 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7142 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7143 |
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
|
7144 |
|
13121 | 7145 |
outFile := (FileStream newTemporaryWithSuffix:eachConversionSuffix) close pathName. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7146 |
command := eachConversionCommand |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7147 |
bindWith:(inFile pathName) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7148 |
with:(outFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7149 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7150 |
errOutput := String writeStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7151 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7152 |
(OperatingSystem executeCommand:command errorTo:errOutput) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7153 |
errMsg := resources |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7154 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7155 |
with:inFile baseName allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7156 |
with:eachConversionSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7157 |
with:eachConversionCommand allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7158 |
with:errOutput contents. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7159 |
exceptionBlock value:errMsg. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7160 |
|
18024 | 7161 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
7162 |
outFile remove. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7163 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7164 |
]. |
18024 | 7165 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7166 |
inFile := outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7167 |
eachConversionSuffixCommandPair := conversionStream next |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7168 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7169 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7170 |
] ifCurtailed:[ |
18024 | 7171 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
7172 |
outFile remove. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7173 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7174 |
^ true. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7175 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7176 |
"Created: / 20-05-2010 / 11:05:50 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7177 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7178 |
|
3892 | 7179 |
createProjectAndOpenProjectBrowser |
7180 |
|nm f s directory| |
|
7181 |
||
7182 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 7183 |
directory := self currentDirectory. |
3892 | 7184 |
nm := directory baseName. |
7185 |
f := (directory construct:nm) withSuffix:'prj'. |
|
7186 |
f exists ifTrue:[ |
|
4414 | 7187 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
7188 |
^ self. |
|
3892 | 7189 |
]. |
7190 |
s := f writeStream. |
|
7191 |
s nextPutAll:' |
|
7192 |
name ''' , nm , ''' |
|
7193 |
type #classLibrary |
|
7194 |
package #''private:' , nm , ''' |
|
7195 |
prerequisites nil |
|
7196 |
||
7197 |
classes #( ) |
|
7198 |
'. |
|
7199 |
s close. |
|
7200 |
ProjectBrowser openOnFile:f. |
|
7201 |
! |
|
7202 |
||
5880 | 7203 |
doExecuteCommand |
7204 |
"execute an OperatingSystem-command" |
|
7205 |
||
7206 |
| action fileName| |
|
7207 |
||
7208 |
fileName := self firstSelectedFile. |
|
7209 |
action := [:command | |
|
7210 |
self addToCommandHistory:command for:fileName. |
|
7211 |
self executeCommand:command. |
|
7212 |
]. |
|
7213 |
self askForCommandFor:fileName thenDo:action |
|
7214 |
! |
|
7215 |
||
7216 |
doExecuteScript |
|
16941 | 7217 |
"execute a Smalltalk script" |
5880 | 7218 |
|
7219 |
|textHolder dialog template dummyClass dummyInstance| |
|
7220 |
||
7221 |
template := |
|
7222 |
'"/ Smalltalk script: |
|
7223 |
||
16084 | 7224 |
"/ the following variables are accessible: |
5880 | 7225 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
7226 |
"/ selectedFiles (= ...) |
|
7227 |
"/ |
|
7228 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
7229 |
"/ |
|
7230 |
"/ Useful operations are: |
|
7231 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
7232 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
7233 |
"/ directory directory |
|
7234 |
"/ |
|
7235 |
"/ example: move all files which match a aarticular pattern to |
|
7236 |
"/ a separate directory: |
|
7237 |
"/ |
|
7238 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
7239 |
"/ |
|
7240 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
7241 |
"/ |
|
7242 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
7243 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
7244 |
"/ idx := eachBaseNameString indexOf:$_. |
|
7245 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
7246 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
7247 |
"/ newDir := directory construct:prefix. |
|
7248 |
"/ newDir exists ifFalse:[ |
|
7249 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
7250 |
"/ newDir makeDirectory. |
|
7251 |
"/ ]. |
|
7252 |
"/ ]. |
|
7253 |
"/ newDir exists ifTrue:[ |
|
7254 |
"/ oldFile := directory construct:eachBaseNameString. |
|
7255 |
"/ newFile := newDir construct:rest. |
|
7256 |
"/ oldFile moveTo:newFile |
|
7257 |
"/ ] |
|
7258 |
"/ ] |
|
7259 |
"/ ] |
|
7260 |
'. |
|
7261 |
||
7262 |
LastScriptBlockString isNil ifTrue:[ |
|
7263 |
LastScriptBlockString := template. |
|
7264 |
]. |
|
7265 |
||
7266 |
textHolder := ValueHolder new. |
|
7267 |
dialog := Dialog |
|
7268 |
forRequestText:(resources string:'Enter script') |
|
7269 |
editViewClass:CodeView |
|
7270 |
lines:25 |
|
7271 |
columns:70 |
|
7272 |
initialAnswer:LastScriptBlockString |
|
7273 |
model:textHolder. |
|
7274 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
7275 |
dialog open. |
|
7276 |
dialog accepted ifFalse:[^ self]. |
|
7277 |
||
7278 |
LastScriptBlockString := textHolder value. |
|
7279 |
||
7280 |
Class classConventionViolationConfirmationQuerySignal |
|
7281 |
answer:true |
|
7282 |
do:[ |
|
7283 |
dummyClass := Object class |
|
7284 |
name:#Dummy |
|
7285 |
inEnvironment:nil |
|
7286 |
subclassOf:Object |
|
7287 |
instanceVariableNames:'directory selectedFiles' |
|
7288 |
variable:false |
|
7289 |
words:true |
|
7290 |
pointers:true |
|
7291 |
classVariableNames:'' |
|
7292 |
poolDictionaries:'' |
|
7293 |
category:#dummyCategory |
|
7294 |
comment:nil |
|
7295 |
changed:true. |
|
7296 |
]. |
|
7297 |
||
7298 |
dummyInstance := dummyClass basicNew. |
|
7299 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
7300 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
7301 |
||
7302 |
Compiler |
|
7303 |
evaluate:textHolder value |
|
7304 |
in:nil |
|
7305 |
receiver:dummyInstance |
|
7306 |
notifying:nil |
|
7307 |
logged:false |
|
7308 |
ifFail:[] |
|
7309 |
compile:true. |
|
7310 |
||
7311 |
"/ fileName := self firstSelectedFile. |
|
7312 |
"/ action := [:command | |
|
7313 |
"/ self addToCommandHistory:command for:fileName. |
|
7314 |
"/ self executeCommand:command. |
|
7315 |
"/ ]. |
|
7316 |
"/ self askForCommandFor:fileName thenDo:action |
|
7317 |
! |
|
7318 |
||
4230 | 7319 |
doMake |
7938 | 7320 |
|dir cmd| |
4230 | 7321 |
|
13856 | 7322 |
cmd := self makeCommandHolder value. |
7323 |
||
7324 |
"Make" |
|
7325 |
cmd = 'make' ifTrue:[ |
|
7326 |
dir := self theSingleSelectedDirectoryOrNil. |
|
7327 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
7328 |
dir notNil ifTrue:[ |
|
7329 |
(dir construct:'bmake.bat') exists ifTrue:[ |
|
7330 |
cmd := 'bmake.bat'. |
|
7331 |
] |
|
7938 | 7332 |
] |
13856 | 7333 |
]. |
7334 |
self executeCommand:cmd. |
|
7335 |
^self. |
|
7336 |
]. |
|
7337 |
||
7338 |
"Apache ant" |
|
7339 |
cmd = 'ant' ifTrue:[ |
|
7340 |
self executeCommand:cmd. |
|
7341 |
^self. |
|
7342 |
]. |
|
7343 |
||
7344 |
"Add more here..." |
|
7345 |
||
7346 |
"Modified (comment): / 13-04-2012 / 17:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4230 | 7347 |
! |
7348 |
||
8256 | 7349 |
doOpenCBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7350 |
"the CBrowser is an eXept-internal C-language IDE tool. |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7351 |
(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
|
7352 |
20 years ago ;-)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7353 |
|
8256 | 7354 |
|destDir| |
7355 |
||
18433 | 7356 |
((Smalltalk at:#'CBrowser') isNil or:[ (Smalltalk at:#'CBrowser::Browser') isNil ]) ifTrue:[ |
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7357 |
Smalltalk loadPackage:'exept:CC' |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7358 |
]. |
8256 | 7359 |
destDir := self currentDirectory. |
18433 | 7360 |
(Smalltalk at:#'CBrowser::Browser') openIn:destDir pathName |
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7361 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7362 |
"Modified: / 04-10-2011 / 13:41:31 / cg" |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7363 |
"Modified (comment): / 27-07-2012 / 20:41:40 / cg" |
18433 | 7364 |
"Modified: / 26-09-2018 / 12:37:34 / Claus Gittinger" |
8256 | 7365 |
! |
7366 |
||
7829 | 7367 |
doOpenExplorer |
18433 | 7368 |
"corresponding menu item is visible on a windows machine only" |
7369 |
||
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7370 |
self currentDirectory asFilename openExplorer |
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7371 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7372 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
18433 | 7373 |
"Modified (comment): / 26-09-2018 / 12:38:08 / Claus Gittinger" |
7829 | 7374 |
! |
7375 |
||
12473 | 7376 |
doOpenFinder |
18433 | 7377 |
"corresponding menu item is visible on a mac only" |
7378 |
||
12473 | 7379 |
self currentDirectory asFilename openFinder |
7380 |
||
7381 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
|
18433 | 7382 |
"Modified (comment): / 26-09-2018 / 12:38:00 / Claus Gittinger" |
12473 | 7383 |
! |
7384 |
||
18432 | 7385 |
doOpenGDBApplication |
7386 |
"the GDBApplication is a cg-private debugging tool" |
|
7387 |
||
7388 |
|destDir| |
|
7389 |
||
7390 |
(Smalltalk at:#'GDBApplication') isNil ifTrue:[ |
|
7391 |
Smalltalk loadPackage:'cg:tools' |
|
7392 |
]. |
|
7393 |
destDir := self currentDirectory. |
|
7394 |
(Smalltalk at:#'GDBApplication') openOn:destDir |
|
7395 |
||
7396 |
"Created: / 26-09-2018 / 12:09:32 / Claus Gittinger" |
|
7397 |
! |
|
7398 |
||
12811 | 7399 |
doOpenMonticelloBrowser |
18433 | 7400 |
(Smalltalk at:#'MCMczReader') isNil ifTrue:[ |
7401 |
Smalltalk loadPackage:'stx:goodies/monticello'. |
|
7402 |
(Smalltalk at:#'MCMczReader') isNil ifTrue:[ |
|
7403 |
Dialog warn:'Failed to load the monticello package'. |
|
7404 |
^ self. |
|
7405 |
]. |
|
7406 |
]. |
|
12874
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
7407 |
|
12811 | 7408 |
self withWaitCursorDo:[ |
7409 |
self currentSelectedFiles do:[:fn | |
|
7410 |
|version snapshot| |
|
7411 |
||
18746 | 7412 |
(fn suffix sameAs:'mcz') ifTrue:[ |
18433 | 7413 |
version := (Smalltalk at:#'MCMczReader') versionFromFile:fn. |
12811 | 7414 |
snapshot := version snapshot. |
7415 |
(Tools::ChangeSetBrowser2 |
|
7416 |
on: snapshot asChangeSet |
|
7417 |
label: version info name) |
|
7418 |
beTwoColumn; |
|
7419 |
targetNamespace:nil; |
|
7420 |
targetPackage:nil; |
|
7421 |
open |
|
7422 |
] |
|
7423 |
] |
|
7424 |
] |
|
18433 | 7425 |
|
18746 | 7426 |
"Modified: / 01-05-2019 / 11:23:23 / Claus Gittinger" |
12811 | 7427 |
! |
7428 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7429 |
doOpenSettings |
8168 | 7430 |
self openSettingsDialog |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7431 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7432 |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7433 |
doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7434 |
"open using win32-shell" |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7435 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7436 |
|fileName| |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7437 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7438 |
fileName := self firstSelectedFile. |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7439 |
fileName notNil ifTrue:[ |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7440 |
OperatingSystem |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7441 |
openApplicationForDocument:fileName pathName |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7442 |
operation:#open |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7443 |
] |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7444 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7445 |
"Modified: / 21-07-2012 / 12:26:10 / cg" |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7446 |
! |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7447 |
|
7104 | 7448 |
editMode:aSymbol |
7449 |
self |
|
7450 |
applicationNamed:#FileApplicationNoteBook |
|
7451 |
ifPresentDo:[:appl | |
|
7452 |
|subApp| |
|
7453 |
||
7454 |
subApp := appl selectedApplication. |
|
7455 |
subApp notNil ifTrue:[ |
|
7456 |
^ subApp perform:aSymbol |
|
7457 |
] |
|
7458 |
]. |
|
7459 |
||
7460 |
"Created: / 11-09-2006 / 12:42:08 / cg" |
|
7461 |
! |
|
7462 |
||
7463 |
editModeInsert |
|
7464 |
self editMode:#editModeInsert |
|
7465 |
||
7466 |
"Created: / 11-09-2006 / 12:40:36 / cg" |
|
7467 |
! |
|
7468 |
||
7469 |
editModeInsertAndSelect |
|
7470 |
self editMode:#editModeInsertAndSelect |
|
7471 |
||
7472 |
"Created: / 11-09-2006 / 12:40:45 / cg" |
|
7473 |
! |
|
7474 |
||
7475 |
editModeOverwrite |
|
7476 |
self editMode:#editModeOverwrite |
|
7477 |
||
7478 |
"Modified: / 11-09-2006 / 12:42:26 / cg" |
|
7479 |
! |
|
7480 |
||
15528 | 7481 |
fetchFileByURL |
7482 |
|url destinationFilename| |
|
7483 |
||
17818 | 7484 |
url := Dialog request:(resources string:'URL to Fetch:') initialAnswer:'http://host/path'. |
15528 | 7485 |
url isEmptyOrNil ifTrue:[^ self]. |
7486 |
url := url asURL. |
|
7487 |
||
17818 | 7488 |
destinationFilename := Dialog request:(resources string:'Download As:') initialAnswer:(UnixFilename named:url path) baseName. |
15528 | 7489 |
destinationFilename isEmptyOrNil ifTrue:[^ self]. |
7490 |
||
7491 |
destinationFilename := self currentDirectory asFilename / destinationFilename. |
|
7492 |
destinationFilename exists ifTrue:[ |
|
7493 |
|answer| |
|
7494 |
||
7495 |
answer := Dialog |
|
7496 |
confirm:(resources string:'Overwrite existing %1 ?' with:destinationFilename baseName allBold) |
|
7497 |
default:false. |
|
7498 |
answer ~~ true ifTrue:[^ self]. |
|
7499 |
]. |
|
7500 |
self withActivityIndicationDo:[ |
|
7501 |
self notify:(resources string:'Fetching %1' with:url). |
|
7502 |
HTTPInterface get:url destinationFile:destinationFilename. |
|
7503 |
self notify:nil. |
|
7504 |
] |
|
7505 |
||
17818 | 7506 |
"Modified: / 29-11-2017 / 12:26:13 / cg" |
15528 | 7507 |
! |
7508 |
||
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7509 |
fileContentsAsByteArray |
17769 | 7510 |
|file fileSize| |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7511 |
|
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7512 |
file := self firstSelectedFile. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7513 |
file isNil ifTrue:[^ self ]. |
17769 | 7514 |
|
7515 |
file := file asFilename. |
|
7516 |
||
7517 |
(fileSize := file fileSize) > (1024*1024) ifTrue:[ |
|
7518 |
fileSize > (128*1024*1024) ifTrue:[ |
|
11889 | 7519 |
Dialog warn:(resources string:'File is too big'). |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7520 |
^ self. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7521 |
]. |
17769 | 7522 |
(Dialog confirm:(resources |
7523 |
string:'File is big (%1) - proceed?' |
|
7524 |
with:(UnitConverter fileSizeStringFor:fileSize)) |
|
7525 |
) ifFalse:[^ self]. |
|
7526 |
]. |
|
7527 |
file binaryContentsOfEntireFile inspect |
|
7528 |
||
7529 |
"Modified: / 19-11-2017 / 14:58:43 / cg" |
|
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7530 |
! |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7531 |
|
3892 | 7532 |
fileFileIn |
7533 |
"fileIn the selected file(s)" |
|
7534 |
||
7535 |
self fileFileInLazy:false |
|
7536 |
! |
|
7537 |
||
7324 | 7538 |
fileFileIn:aFilename lazy:lazy |
7539 |
"fileIn a file" |
|
7540 |
||
7541 |
self withActivityIndicationDo:[ |
|
7542 |
self notify:('File in:', aFilename asFilename baseName). |
|
7543 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7544 |
self notify:nil. |
|
7545 |
] |
|
7546 |
||
7547 |
"Created: / 20-09-2006 / 14:28:35 / cg" |
|
7548 |
! |
|
7549 |
||
3892 | 7550 |
fileFileInLazy |
7551 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
7552 |
||
7553 |
self fileFileInLazy:true |
|
7554 |
! |
|
7555 |
||
7556 |
fileFileInLazy:lazy |
|
7557 |
"fileIn the selected file(s)" |
|
7558 |
||
7324 | 7559 |
self currentSelectedFiles do:[:fileName | |
7560 |
self fileIn:fileName lazy:lazy |
|
7561 |
]. |
|
7562 |
||
7563 |
"Modified: / 20-09-2006 / 14:29:24 / cg" |
|
3892 | 7564 |
! |
7565 |
||
12497 | 7566 |
fileFileInPackage |
7567 |
"assuming the current directory is a package directory, load it" |
|
7568 |
||
7569 |
|packageDir dir path top packageID| |
|
7570 |
||
7571 |
"/ find a reasonable package-id (walk up until we find stx) |
|
7572 |
path := ''. |
|
7573 |
dir := packageDir := self currentDirectory. |
|
7574 |
||
7575 |
top := (Smalltalk projectDirectoryForPackage:'stx') asFilename. |
|
7576 |
[ (dir / 'stx') = top ] whileFalse:[ |
|
7577 |
path := dir baseName , '/' , path. |
|
7578 |
dir := dir directory. |
|
19376 | 7579 |
(dir isNil or:[dir isRootDirectory]) ifTrue:[ |
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7580 |
Dialog warn:'Could not find a path from "stx" to the current directory.'. |
12497 | 7581 |
"/ should ask the user for a packageID and proceed... |
7582 |
^ self. |
|
7583 |
]. |
|
7584 |
]. |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7585 |
packageID := path copyButLast:1. |
12497 | 7586 |
Smalltalk loadPackage:packageID fromDirectory:packageDir asAutoloaded:true |
7587 |
! |
|
7588 |
||
3892 | 7589 |
fileFileInToNameSpace |
7590 |
"fileIn the selected file(s)<into a nameSpace" |
|
7591 |
||
7592 |
|ns listOfKnownNameSpaces| |
|
7593 |
||
7594 |
listOfKnownNameSpaces := Set new. |
|
7595 |
NameSpace |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
7596 |
allNameSpaces |
4414 | 7597 |
do:[:eachNameSpace | |
7598 |
listOfKnownNameSpaces add:eachNameSpace name |
|
7599 |
]. |
|
3892 | 7600 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
7601 |
||
7602 |
ns := Dialog |
|
4414 | 7603 |
request:'During fileIn, new classes are created in nameSpace:' |
7604 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
7605 |
list:listOfKnownNameSpaces. |
|
3892 | 7606 |
ns isEmptyOrNil ifTrue:[^ self]. |
7607 |
||
7608 |
LastEnforcedNameSpace := ns. |
|
7609 |
ns := NameSpace name:ns. |
|
7610 |
||
7611 |
Class nameSpaceQuerySignal |
|
4414 | 7612 |
answer:ns |
7613 |
do:[ |
|
7614 |
self fileFileInLazy:false |
|
7615 |
] |
|
3892 | 7616 |
! |
7617 |
||
7618 |
fileFindAllDuplicates |
|
7619 |
"scan directory and all subdirs for duplicate files" |
|
7620 |
||
7621 |
|fileNames dir infoDir filesBySize |
|
18856 | 7622 |
result info dirPrefix stream textBox maxLength directories| |
3892 | 7623 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7624 |
self withActivityIndicationDo:[ |
4414 | 7625 |
result := Dictionary new. |
7626 |
directories := self currentSelectedDirectories. |
|
7627 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 7628 |
|
4414 | 7629 |
dir := directories first. |
3892 | 7630 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7631 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7632 |
fileNames := dir recursiveDirectoryContents. |
19392 | 7633 |
] on:OpenError do:[:ex| |
6352 | 7634 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
7635 |
with:ex pathName |
|
7636 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7637 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7638 |
]. |
4765 | 7639 |
fileNames := fileNames |
7640 |
collect:[:fn | dir construct:fn] |
|
18453 | 7641 |
thenSelect:[:fn | fn isRegularFile]. |
3892 | 7642 |
|
7643 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 7644 |
infoDir := Dictionary new. |
7645 |
fileNames do:[:fn | |
|
7646 |
infoDir at:fn put:(fn fileSize) |
|
7647 |
]. |
|
7648 |
||
14497 | 7649 |
"/ for each, get the file's size. |
4414 | 7650 |
"/ in a first pass, look for files of the same size and |
7651 |
"/ compare them ... |
|
3892 | 7652 |
|
7653 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 7654 |
filesBySize := Dictionary new. |
7655 |
infoDir keysAndValuesDo:[:fn :sz | |
|
7656 |
|entry| |
|
7657 |
||
7658 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7659 |
entry add:fn. |
|
7660 |
]. |
|
7661 |
||
7662 |
"/ any of same size ? |
|
3892 | 7663 |
|
7664 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 7665 |
filesBySize do:[:entry | |
7666 |
|files| |
|
7667 |
||
7668 |
entry size > 1 ifTrue:[ |
|
7669 |
files := entry asArray. |
|
7670 |
1 to:files size-1 do:[:idx1 | |
|
7671 |
idx1+1 to:files size do:[:idx2 | |
|
7672 |
|fn1 fn2| |
|
7673 |
||
7674 |
fn1 := files at:idx1. |
|
7675 |
fn2 := files at:idx2. |
|
3892 | 7676 |
|
7677 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 7678 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
7679 |
"/ compare the files |
|
7680 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7681 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 7682 |
result at:fn1 put:fn2. |
7683 |
] |
|
7684 |
] |
|
7685 |
] |
|
7686 |
] |
|
7687 |
] |
|
7688 |
]. |
|
3892 | 7689 |
|
7690 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 7691 |
dirPrefix := dir pathName. |
7692 |
result := result associations. |
|
7693 |
result := result collect:[:assoc | |
|
7694 |
|f1 f2| |
|
7695 |
||
7696 |
f1 := assoc key name. |
|
7697 |
f2 := assoc value name. |
|
7698 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
7699 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
7700 |
]. |
|
7701 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
7702 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
7703 |
]. |
|
7704 |
f1 < f2 ifTrue:[ |
|
7705 |
f2 -> f1 |
|
7706 |
] ifFalse:[ |
|
7707 |
f1 -> f2 |
|
7708 |
] |
|
7709 |
]. |
|
7710 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
7711 |
||
7712 |
info := OrderedCollection new. |
|
7713 |
result do:[:assoc | |
|
7714 |
info add:(assoc key , ' same as ' , assoc value) |
|
7715 |
]. |
|
7716 |
info isEmpty ifTrue:[ |
|
11889 | 7717 |
Dialog information:(resources string:'No duplicate files found.'). |
5543 | 7718 |
^ self. |
4414 | 7719 |
]. |
3892 | 7720 |
]. |
7721 |
||
15589 | 7722 |
stream := CharacterWriteStream new. |
11688 | 7723 |
stream nextPutAllLines:info. |
5542 | 7724 |
|
3892 | 7725 |
textBox := TextBox new. |
7726 |
textBox initialText:(stream contents). |
|
5542 | 7727 |
stream close. |
11889 | 7728 |
textBox title:(resources string:'File duplicates in directory: %1' with:dir asString). |
3892 | 7729 |
textBox readOnly:true. |
7730 |
textBox noCancel. |
|
11889 | 7731 |
textBox label:(resources string:'Duplicates in %1' with:dir asString). |
3892 | 7732 |
maxLength := 10. |
7733 |
info do:[: el | |
|
4414 | 7734 |
maxLength := maxLength max:(el size). |
3892 | 7735 |
]. |
7736 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 7737 |
textBox maxExtent:Screen current extent. |
7738 |
textBox openModeless. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7739 |
|
11688 | 7740 |
"Modified: / 27-07-2012 / 09:29:00 / cg" |
18856 | 7741 |
"Modified (format): / 28-06-2019 / 08:37:14 / Claus Gittinger" |
3892 | 7742 |
! |
7743 |
||
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7744 |
fileFindDuplicateFile |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7745 |
"scan directory for duplicates of the selected files" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7746 |
|
10306 | 7747 |
|files filesBySize samePerFile stream textBox mustHaveMatches| |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7748 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7749 |
files := self currentSelectedFiles. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7750 |
files isEmpty ifTrue:[^ self]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7751 |
|
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7752 |
self withWaitCursorDo:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7753 |
filesBySize := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7754 |
files do:[:fn | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7755 |
|sz entry| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7756 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7757 |
sz := fn asFilename fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7758 |
(filesBySize at:sz ifAbsentPut:[Set new]) add:fn. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7759 |
]. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7760 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7761 |
samePerFile := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7762 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7763 |
self currentSelectedDirectories do:[:eachDir | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7764 |
eachDir recursiveDirectoryContentsAsFilenamesDo:[:eachFile | |
18453 | 7765 |
eachFile isRegularFile ifTrue:[ |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7766 |
|sz possibleMatches| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7767 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7768 |
sz := eachFile fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7769 |
possibleMatches := filesBySize at:sz ifAbsent:nil. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7770 |
possibleMatches notNil ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7771 |
possibleMatches do:[:eachFileWithSameSize | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7772 |
eachFileWithSameSize ~= eachFile ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7773 |
(eachFileWithSameSize sameContentsAs:eachFile) ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7774 |
(samePerFile at:eachFileWithSameSize ifAbsentPut:[Set new]) add:eachFile |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7775 |
] |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7776 |
] |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7777 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7778 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7779 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7780 |
] |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7781 |
]. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7782 |
]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7783 |
|
15589 | 7784 |
stream := CharacterWriteStream with:'Duplicates:'. |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7785 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7786 |
do:[:origFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7787 |
|sameFiles| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7788 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7789 |
sameFiles := samePerFile at:origFile. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7790 |
stream nextPutLine:origFile baseName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7791 |
(sameFiles asOrderedCollection collect:[:each | each baseName]) sort do:[:eachSameName | |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7792 |
stream nextPutAll:' '; nextPutLine:eachSameName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7793 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7794 |
]. |
10306 | 7795 |
stream nextPutLine:'Files without duplicates:'. |
7796 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7797 |
do:[:origFile | |
|
7798 |
|sameFiles| |
|
7799 |
||
7800 |
sameFiles := samePerFile at:origFile. |
|
7801 |
sameFiles isEmpty ifTrue:[ |
|
7802 |
stream nextPutLine:origFile baseName. |
|
7803 |
]. |
|
7804 |
]. |
|
7805 |
||
7806 |
mustHaveMatches := Dialog request:'Must have for duplicates matching ?:' initialAnswer:(LastMustMatchPattern ? '[a-z][a-z][a-z]_[0-9][0-9][0-9].*'). |
|
7807 |
mustHaveMatches notEmptyOrNil ifTrue:[ |
|
7808 |
LastMustMatchPattern := mustHaveMatches. |
|
7809 |
||
7810 |
stream nextPutLine:'Files without duplicates in xxx_nnn.jpg:'. |
|
7811 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7812 |
do:[:origFile | |
|
7813 |
|sameFiles| |
|
7814 |
||
7815 |
sameFiles := samePerFile at:origFile. |
|
7816 |
sameFiles notEmpty ifTrue:[ |
|
7817 |
(sameFiles contains:[:file | mustHaveMatches match:file baseName]) ifFalse:[ |
|
7818 |
stream nextPutLine:origFile baseName. |
|
7819 |
] |
|
7820 |
]. |
|
7821 |
]. |
|
7822 |
]. |
|
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7823 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7824 |
textBox := TextBox new. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7825 |
textBox initialText:(stream contents). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7826 |
textBox title:'Files with same contents'. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7827 |
textBox readOnly:true. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7828 |
textBox noCancel. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7829 |
textBox extent:(350@400). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7830 |
textBox maxExtent:Screen current extent. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7831 |
textBox openModeless. "/ showAtPointer. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7832 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7833 |
"Created: / 11-07-2011 / 12:39:44 / cg" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7834 |
! |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7835 |
|
3892 | 7836 |
fileFindDuplicates |
7837 |
"scan directory for duplicate files" |
|
7838 |
||
17869 | 7839 |
|directories duplicates info |
7840 |
commonDir prefixSize stream titleStream textBox maxLength| |
|
8510 | 7841 |
|
7842 |
directories := self currentSelectedDirectories. |
|
17869 | 7843 |
duplicates := self class fileFindDuplicatesIn:directories. |
7844 |
duplicates isEmpty ifTrue:[ |
|
17868 | 7845 |
Dialog information:'No duplicate files found.'. |
7846 |
^ self. |
|
7847 |
]. |
|
7848 |
||
7849 |
info := OrderedCollection new. |
|
17869 | 7850 |
commonDir := self getBestDirectory. |
7851 |
prefixSize := commonDir asString size. |
|
7852 |
duplicates do:[:assoc | |
|
17871 | 7853 |
|dup orig| |
7854 |
||
7855 |
dup := assoc key. |
|
7856 |
orig := assoc value. |
|
17868 | 7857 |
prefixSize > 1 ifTrue:[ |
17871 | 7858 |
dup := dup pathNameRelativeFrom:commonDir. |
7859 |
orig := orig pathNameRelativeFrom:commonDir. |
|
17869 | 7860 |
"/ fn1 := ('..', (fn1 name copyFrom:(prefixSize + 1))). |
7861 |
"/ fn2 := ('..', (fn2 copyFrom:(prefixSize + 1))). |
|
17868 | 7862 |
]. |
17871 | 7863 |
(dup includes:Character space) ifTrue:[ |
7864 |
dup := '"' , dup , '"' |
|
7865 |
]. |
|
7866 |
(orig includes:Character space) ifTrue:[ |
|
7867 |
orig := '"' , orig , '"' |
|
7868 |
]. |
|
7869 |
info add:(dup , ' duplicate of ' , orig) |
|
17868 | 7870 |
]. |
7871 |
||
15589 | 7872 |
stream := CharacterWriteStream new. |
11688 | 7873 |
stream nextPutAllLines:info. |
7874 |
||
17869 | 7875 |
titleStream := CharacterWriteStream with:'File duplicates in director'. |
3892 | 7876 |
directories size == 1 ifTrue:[ |
12602 | 7877 |
titleStream nextPutAll:'y: '; nextPutAll: directories first asString. |
3892 | 7878 |
] ifFalse:[ |
4535 | 7879 |
titleStream nextPutLine:'ies: '. |
4355 | 7880 |
directories do:[:dir| |
17868 | 7881 |
prefixSize > 1 ifTrue:[ |
4355 | 7882 |
titleStream nextPutAll:'..'. |
17868 | 7883 |
titleStream nextPutLine:((dir asString) copyFrom:(prefixSize + 1)). |
4355 | 7884 |
] ifFalse:[ |
4535 | 7885 |
titleStream nextPutLine:(dir asString). |
4355 | 7886 |
]. |
7887 |
] |
|
3892 | 7888 |
]. |
5543 | 7889 |
|
3892 | 7890 |
textBox := TextBox new. |
7891 |
textBox initialText:(stream contents). |
|
7892 |
textBox title:(titleStream contents). |
|
7893 |
textBox readOnly:true. |
|
7894 |
textBox noCancel. |
|
14715 | 7895 |
stream := WriteStream on:''. |
7896 |
stream nextPutAll:'Duplicates in '. |
|
4170 | 7897 |
directories do:[ :aDirectory | |
4355 | 7898 |
stream nextPutAll:aDirectory baseName. |
7899 |
stream space. |
|
4050 | 7900 |
]. |
4170 | 7901 |
textBox label:stream contents. |
3892 | 7902 |
maxLength := 10. |
7903 |
info do:[: el | |
|
4355 | 7904 |
maxLength := maxLength max:(el size). |
3892 | 7905 |
]. |
5092 | 7906 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
7907 |
textBox maxExtent:Screen current extent. |
|
17869 | 7908 |
textBox addButton:(Button |
7909 |
label:(resources string:'Remove Duplicates') |
|
7910 |
action:[ |
|
7911 |
(Dialog confirm:(resources string:'Remove %1 duplicate files?' with:duplicates size)) ifTrue:[ |
|
7912 |
duplicates do:[:eachAssoc | |
|
17871 | 7913 |
eachAssoc key remove |
17869 | 7914 |
]. |
17871 | 7915 |
]. |
7916 |
textBox close. |
|
7917 |
self updateCurrentDirectoryWithReread. |
|
17869 | 7918 |
]). |
4355 | 7919 |
textBox openModeless. "/ showAtPointer. |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7920 |
|
11688 | 7921 |
"Modified: / 27-07-2012 / 09:29:14 / cg" |
3892 | 7922 |
! |
7923 |
||
7924 |
fileFindFile |
|
5961 | 7925 |
|filename| |
7926 |
||
7927 |
filename := self firstSelectedFileName. |
|
7928 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7929 |
filename := Filename homeDirectory. |
3892 | 7930 |
]. |
4101 | 7931 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 7932 |
! |
7933 |
||
8510 | 7934 |
fileFindSimilarImages |
7935 |
"scan directory for similar image files" |
|
7936 |
||
8512 | 7937 |
|result stream textBox directories imageFiles histogramsV histogramsH |
7938 |
similarV similarH similar alreadyPrinted| |
|
8510 | 7939 |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7940 |
self withWaitCursorDo:[ |
8510 | 7941 |
self withActivityIndicationDo:[ |
7942 |
result := Dictionary new. |
|
7943 |
||
7944 |
directories := self currentSelectedDirectories. |
|
7945 |
directories isEmpty ifTrue:[^ self]. |
|
7946 |
||
13714 | 7947 |
imageFiles := self allFilesInSelectedDirectoriesForWhich:[:f | f mimeTypeFromName isImageType]. |
8511 | 7948 |
"/ imageFiles := imageFiles select:[:f | f baseName startsWith:'foo']. |
7949 |
imageFiles sort:[:a :b | a pathName < b pathName]. |
|
7950 |
||
8510 | 7951 |
"/ for each, get the color histogram |
7952 |
histogramsV := Dictionary new. |
|
7953 |
histogramsH := Dictionary new. |
|
7954 |
imageFiles do:[:fn | |
|
7955 |
|hist image| |
|
7956 |
||
7957 |
image := Image fromFile:fn. |
|
7958 |
Transcript showCR:'generating histogram for ',fn baseName. |
|
7959 |
hist := ImageColorHistogram new forImage:image. |
|
7960 |
histogramsV at:fn put:(hist histogramVectorV). |
|
7961 |
histogramsH at:fn put:(hist histogramVectorH). |
|
7962 |
]. |
|
7963 |
||
7964 |
similarH := Dictionary new. |
|
7965 |
similarV := Dictionary new. |
|
7966 |
similar := Dictionary new. |
|
7967 |
||
8512 | 7968 |
(self firstSelectedFile notNil |
7969 |
ifTrue:[ Array with:self firstSelectedFile ] |
|
7970 |
ifFalse:[ imageFiles ]) |
|
7971 |
do:[:eachFile1 | |
|
8510 | 7972 |
|setOfSimilar distancesV distancesH| |
7973 |
||
7974 |
distancesV := OrderedCollection new. |
|
7975 |
distancesH := OrderedCollection new. |
|
7976 |
setOfSimilar := OrderedCollection new. |
|
7977 |
||
7978 |
imageFiles do:[:eachFile2 | |
|
7979 |
|v1 v2 dV dH| |
|
7980 |
||
7981 |
eachFile1 ~= eachFile2 ifTrue:[ |
|
7982 |
v1 := histogramsV at:eachFile1. |
|
7983 |
v2 := histogramsV at:eachFile2. |
|
7984 |
dV := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7985 |
distancesV add:(eachFile2 -> dV). |
|
7986 |
v1 := histogramsH at:eachFile1. |
|
7987 |
v2 := histogramsH at:eachFile2. |
|
7988 |
dH := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7989 |
distancesH add:(eachFile2 -> dH). |
|
7990 |
(dV < 10000 and:[dH < 10000]) ifTrue:[ |
|
8512 | 7991 |
setOfSimilar add:eachFile2->(dV + dH). |
8510 | 7992 |
]. |
7993 |
] |
|
7994 |
]. |
|
7995 |
distancesV sort:[:a1 :a2 | a1 value < a2 value]. |
|
7996 |
distancesH sort:[:a1 :a2 | a1 value < a2 value]. |
|
7997 |
similarV at:eachFile1 put:distancesV. |
|
7998 |
similarH at:eachFile1 put:distancesH. |
|
7999 |
setOfSimilar notEmpty ifTrue:[ similar at:eachFile1 put:setOfSimilar ]. |
|
8000 |
]. |
|
8001 |
||
8002 |
similar isEmpty ifTrue:[ |
|
8003 |
Dialog information:'No similarities found.'. |
|
8004 |
^ self. |
|
8005 |
]. |
|
8006 |
]. |
|
8007 |
||
15589 | 8008 |
stream := CharacterWriteStream new. |
8512 | 8009 |
alreadyPrinted := Set new. |
8010 |
||
8011 |
imageFiles do:[:eachFile | |
|
8012 |
|eachSet| |
|
8013 |
||
8014 |
(alreadyPrinted includes:eachFile) ifFalse:[ |
|
8015 |
eachSet := similar at:eachFile ifAbsent:nil. |
|
8016 |
eachSet notNil ifTrue:[ |
|
8017 |
stream nextPutLine:eachFile pathName. |
|
8018 |
eachSet do:[:info | |
|
8019 |
|fn2 dist| |
|
8020 |
||
8021 |
fn2 := info key. |
|
8022 |
dist := info value. |
|
8023 |
stream nextPutAll:' '. |
|
8024 |
stream nextPutAll:fn2 pathName. |
|
8025 |
stream nextPutLine:' (',dist printString,')'. |
|
8026 |
alreadyPrinted add:fn2. |
|
8027 |
]. |
|
8028 |
stream cr. |
|
8029 |
]. |
|
8510 | 8030 |
]. |
8031 |
]. |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
8032 |
]. |
8510 | 8033 |
|
8034 |
textBox := TextBox new. |
|
8035 |
textBox initialText:(stream contents). |
|
8036 |
textBox title:'File similarities:'. |
|
8037 |
textBox readOnly:true. |
|
8038 |
textBox noCancel. |
|
8039 |
||
8040 |
textBox label:'File similarities'. |
|
8041 |
textBox extent:(400@((similar size max:40)* 10)). |
|
8042 |
textBox maxExtent:Screen current extent. |
|
8043 |
textBox openModeless. "/ showAtPointer. |
|
8044 |
||
8045 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
|
8046 |
! |
|
8047 |
||
4618 | 8048 |
fileHexDump |
17744 | 8049 |
|file item| |
4618 | 8050 |
|
8051 |
file := self firstSelectedFile. |
|
8052 |
file notNil ifTrue:[ |
|
8053 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 8054 |
self |
8055 |
applicationNamed:#FileApplicationNoteBook |
|
8056 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 8057 |
]. |
17744 | 8058 |
|
8059 |
"Modified (format): / 12-11-2017 / 11:19:56 / cg" |
|
4618 | 8060 |
! |
8061 |
||
7324 | 8062 |
fileIn:aFilename |
8063 |
"fileIn a file" |
|
8064 |
||
8065 |
self fileIn:aFilename lazy:false |
|
8066 |
||
8067 |
"Created: / 20-09-2006 / 14:30:06 / cg" |
|
8068 |
! |
|
8069 |
||
8070 |
fileIn:aFilename lazy:lazy |
|
8071 |
"fileIn a file" |
|
8072 |
||
8073 |
self withActivityIndicationDo:[ |
|
8074 |
self notify:('File in:', aFilename asFilename baseName). |
|
8075 |
self singleFileFileIn:aFilename lazy:lazy. |
|
8076 |
self notify:nil. |
|
8077 |
] |
|
8078 |
||
8079 |
"Created: / 20-09-2006 / 14:29:21 / cg" |
|
8080 |
! |
|
8081 |
||
4930 | 8082 |
filterSelectedFiles:whichFilter |
8083 |
|selectedFiles numFiles msg filterBlock| |
|
8084 |
||
7560 | 8085 |
selectedFiles := self currentSelectedObjects. |
4930 | 8086 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
8087 |
||
8088 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
8089 |
numFiles > 1 ifTrue:[ |
|
8090 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
8091 |
]. |
|
8092 |
||
8093 |
(Dialog |
|
6352 | 8094 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 8095 |
initialAnswer:false |
8096 |
) ifFalse:[ |
|
8097 |
^ self |
|
8098 |
]. |
|
8099 |
||
8100 |
whichFilter == #rot13 ifTrue:[ |
|
8101 |
filterBlock := [:charIn | charIn rot13 ]. |
|
8102 |
]. |
|
8103 |
"/ add more here... |
|
8104 |
||
8105 |
filterBlock isNil ifTrue:[ |
|
8106 |
self information:'No such filter: ' , whichFilter. |
|
8107 |
^ self. |
|
8108 |
]. |
|
8109 |
||
8110 |
selectedFiles do:[:fileName | |
|
8111 |
|s| |
|
8112 |
||
8113 |
self notify:('Processing:', fileName baseName). |
|
18453 | 8114 |
fileName isRegularFile ifTrue:[ |
4930 | 8115 |
[ |
8116 |
|inFile outFile in out| |
|
8117 |
||
8118 |
inFile := fileName asFilename. |
|
8119 |
outFile := (fileName pathName , '.filter') asFilename. |
|
8120 |
||
8121 |
[ |
|
8122 |
|charIn charOut| |
|
8123 |
||
8124 |
in := inFile readStream. |
|
8125 |
out := outFile writeStream. |
|
8126 |
[in atEnd] whileFalse:[ |
|
8127 |
charIn := in next. |
|
8128 |
charOut := filterBlock value:charIn. |
|
8129 |
out nextPut:charOut. |
|
8130 |
]. |
|
13683 | 8131 |
out close. out:= nil. |
4930 | 8132 |
outFile renameTo:inFile. |
8133 |
] ensure:[ |
|
8134 |
out notNil ifTrue:[ out close ]. |
|
8135 |
in notNil ifTrue:[ in close ]. |
|
18024 | 8136 |
outFile remove. |
4930 | 8137 |
] |
19392 | 8138 |
] on:OpenError do:[:ex| |
4930 | 8139 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
8140 |
]. |
|
8141 |
] |
|
8142 |
]. |
|
6190 | 8143 |
self notify:nil. |
7560 | 8144 |
|
8145 |
"Modified: / 04-12-2006 / 13:14:48 / cg" |
|
4930 | 8146 |
! |
8147 |
||
9784 | 8148 |
forEachParsedXmlFileDo:aBlock |
8149 |
"parse all selected XML files, for each dom-tree, evaluate aBlock" |
|
8150 |
||
8151 |
self withActivityIndicationDo:[ |
|
8152 |
| selectedFiles xmlDocument | |
|
8153 |
||
8154 |
selectedFiles:= self currentSelectedFiles. |
|
8155 |
selectedFiles do:[:fileName | |
|
8156 |
XML::XMLSignal handle:[:ex | |
|
14551 | 8157 |
Dialog |
8158 |
information:('Error while reading XML:\ %1' bindWith:ex description) withCRs |
|
8159 |
title:'XML Error'. |
|
9784 | 8160 |
^ self. |
8161 |
] do:[ |
|
19320 | 8162 |
xmlDocument := XML::XMLParser |
8163 |
processDocumentInFilename:fileName |
|
8164 |
beforeScanDo:[:parse| parse validate:false]. |
|
9784 | 8165 |
]. |
8166 |
aBlock value:xmlDocument. |
|
8167 |
]. |
|
8168 |
] |
|
8169 |
||
8170 |
"Created: / 17-02-2011 / 13:58:21 / cg" |
|
19320 | 8171 |
"Modified: / 29-11-2019 / 13:44:05 / Stefan Vogel" |
9784 | 8172 |
! |
8173 |
||
8832 | 8174 |
forEachSelectedFileIgnoringDirectories:ignoreDirs do:aBlock |
8175 |
|numItems path files| |
|
8176 |
||
18834 | 8177 |
files := ignoreDirs |
8178 |
ifTrue:[self currentSelectedFiles] |
|
8179 |
ifFalse:[self currentSelectedObjects]. |
|
8832 | 8180 |
|
8181 |
(numItems := files size) > 2 ifTrue:[ |
|
8182 |
(self |
|
8183 |
confirm:(resources string:'Open for each of the %1 items ?' |
|
8184 |
with:numItems)) ifFalse:[^ self]. |
|
8185 |
]. |
|
8186 |
||
8187 |
self withActivityIndicationDo:[ |
|
8188 |
files do:[:fileName | |
|
8189 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
8190 |
fileName isAbsolute ifTrue:[ |
|
17239 | 8191 |
path := fileName name. |
8832 | 8192 |
] ifFalse:[ |
8193 |
path := fileName pathName. |
|
8194 |
]. |
|
8195 |
aBlock value:path |
|
8196 |
] |
|
8197 |
]. |
|
8198 |
]. |
|
17239 | 8199 |
|
8200 |
"Modified: / 19-01-2017 / 16:57:03 / stefan" |
|
18834 | 8201 |
"Modified: / 23-06-2019 / 13:19:05 / Claus Gittinger" |
8832 | 8202 |
! |
8203 |
||
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8204 |
generateDetachedSignaturesForSelectedFiles |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8205 |
"generate detached signature (pkcs7) files from the contents of the selected files. |
16941 | 8206 |
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
|
8207 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8208 |
self withActivityIndicationDo:[ |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8209 |
self currentSelectedFiles do:[:fn | |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8210 |
|data hash signature signatureFile| |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8211 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8212 |
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
|
8213 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8214 |
data := fn contentsAsString. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8215 |
hash := SHA1Stream hashValueOf:data. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8216 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8217 |
signature := Expecco::KeyFileGenerator new signExpeccoCode:hash. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8218 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8219 |
signatureFile := fn addSuffix:'sig'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8220 |
signatureFile contents:signature. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8221 |
]. |
13677 | 8222 |
self updateCurrentDirectoryWithReread. |
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8223 |
self notify:nil. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8224 |
] |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8225 |
! |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8226 |
|
15211 | 8227 |
generatePatchInstallerForSelectedFiles |
8228 |
"generate an expecco patch, which installs the selected file(s). |
|
8229 |
Opens a dialog asking for the target directory and if the patch should be signed" |
|
8230 |
||
8231 |
|dialog targetDirHolder targetDir |
|
8232 |
generateSignedPatchHolder patchFileNameHolder patchFileName| |
|
8233 |
||
8234 |
targetDirHolder := '.' asValue. |
|
8235 |
generateSignedPatchHolder := true asValue. |
|
8236 |
patchFileNameHolder := '/tmp/00nn_patchFile.st' asValue. |
|
8237 |
||
8238 |
dialog := Dialog new. |
|
8239 |
dialog label:(resources string:'Patch Installer for File(s)'). |
|
8240 |
dialog addTextLabel:'Patchfile Name' adjust:#left. |
|
8241 |
dialog addInputFieldOn:patchFileNameHolder tabable:true. |
|
8242 |
dialog addTextLabel:'Target directory (relative to executable''s directory at execution time)' adjust:#left. |
|
8243 |
dialog addInputFieldOn:targetDirHolder tabable:true. |
|
8244 |
dialog addCheckBox:'Generate Signed Patch' on:generateSignedPatchHolder. |
|
8245 |
dialog addAbortAndOkButtons. |
|
8246 |
dialog open. |
|
8247 |
||
8248 |
dialog accepted ifFalse:[^ self]. |
|
8249 |
||
8250 |
targetDir := targetDirHolder value asFilename. |
|
8251 |
patchFileName := patchFileNameHolder value asFilename. |
|
8252 |
||
8253 |
self withActivityIndicationDo:[ |
|
8254 |
|outStream zipArchive pkcs7SignedData signatureFilename| |
|
8255 |
||
8256 |
self notify:'Generating self extracting st script: ', patchFileName name, '...'. |
|
8257 |
outStream := patchFileName writeStream. |
|
8258 |
outStream nextPutAll:' |
|
8259 |
|patchStream zipArchive| |
|
8260 |
patchStream := Expecco::Browser::CurrentPatchStreamQuery query. |
|
8261 |
patchStream isNil ifTrue:[ self error:''sorry, this patch can only be installed in expecco 2.6.2 and newer (missing CurrentPatchStreamQuery)'']. |
|
8262 |
zipArchive := ZipArchive readingFrom:patchStream. |
|
8263 |
zipArchive members do:[:each | zipArchive extract:each fileName]. |
|
8264 |
patchStream setToEnd. "/ to force fileIn to finish |
|
8265 |
!! |
|
8266 |
||
8267 |
!! !! |
|
8268 |
||
8269 |
'. |
|
8270 |
zipArchive := ZipArchive writingTo:outStream. "/ newFileNamed:(patchFileName). |
|
8271 |
||
8272 |
self currentSelectedFiles do:[:fn | |
|
8273 |
|inStream signatureFilename| |
|
8274 |
||
8275 |
inStream := fn asFilename readStream. |
|
19173 | 8276 |
[ |
8277 |
zipArchive addFile: (targetDir construct:fn asFilename baseName) name fromStream:inStream. |
|
8278 |
] ensure:[ |
|
8279 |
inStream close. |
|
8280 |
]. |
|
15211 | 8281 |
]. |
8282 |
||
16975 | 8283 |
zipArchive close. |
15211 | 8284 |
|
8285 |
generateSignedPatchHolder value ifTrue:[ |
|
8286 |
self notify:'Generating signed file from: ', patchFileName name, '...'. |
|
8287 |
||
8288 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:patchFileName contentsOfEntireFile. |
|
8289 |
signatureFilename := patchFileName withSuffix:'expeccoPatch'. |
|
8290 |
signatureFilename contents:pkcs7SignedData. |
|
8291 |
]. |
|
8292 |
self notify:nil. |
|
8293 |
] |
|
8294 |
! |
|
13783 | 8295 |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8296 |
generateSignaturesForSelectedFiles |
13783 | 8297 |
"generate signed pkcs7 files from the contents of the selected files. |
8298 |
These can be delivered as expeccoPatch files" |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8299 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8300 |
self withActivityIndicationDo:[ |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8301 |
self currentSelectedFiles do:[:fn | |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8302 |
|pkcs7SignedData signatureFilename| |
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8303 |
|
8646 | 8304 |
self notify:'Generating signed file from: ', (fn baseName), '...'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8305 |
|
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8306 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:fn contentsOfEntireFile. |
12094 | 8307 |
signatureFilename := fn withSuffix:'expeccoPatch'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8308 |
signatureFilename contents:pkcs7SignedData. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8309 |
]. |
13677 | 8310 |
self updateCurrentDirectoryWithReread. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8311 |
self notify:nil. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8312 |
] |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8313 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8314 |
|
9784 | 8315 |
inspectXmlFile |
8316 |
"Show an XML file - either in an XMLInspector or fall back to |
|
8317 |
a plain inspector on the XML tree" |
|
8318 |
||
8319 |
self forEachParsedXmlFileDo:[:xmlDocument | |
|
8320 |
XML::XMLInspector notNil ifTrue:[ |
|
8321 |
XML::XMLInspector openOn:xmlDocument. |
|
8322 |
] ifFalse:[ |
|
8323 |
"fall back..." |
|
8324 |
xmlDocument inspect. |
|
8325 |
] |
|
8326 |
]. |
|
8327 |
||
8328 |
"Modified: / 17-02-2011 / 13:58:16 / cg" |
|
8329 |
! |
|
8330 |
||
3892 | 8331 |
installAllAsAutoloaded |
8332 |
"install all classes found here as autoloaded classes" |
|
8333 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8334 |
self installAllAsAutoloadedRecursive:false |
3892 | 8335 |
! |
8336 |
||
6521 | 8337 |
installAllAsAutoloadedRecursive |
8338 |
"install all classes found here and in subdirectories as autoloaded classes" |
|
8339 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8340 |
self installAllAsAutoloadedRecursive:true |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8341 |
! |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8342 |
|
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8343 |
installAllAsAutoloadedRecursive:aBoolean |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8344 |
"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
|
8345 |
|
6521 | 8346 |
[ |
15507 | 8347 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
8348 |
|installAction| |
|
8349 |
||
8350 |
installAction := |
|
19031 | 8351 |
[:fn | |
8352 |
(fn hasSuffix:'st') ifTrue:[ |
|
15507 | 8353 |
self notify:('Install as autoloaded: ', fn baseName). |
8354 |
self installAsAutoloaded:fn. |
|
8355 |
] |
|
8356 |
]. |
|
8357 |
||
8358 |
self withActivityIndicationDo:[ |
|
8359 |
self currentSelectedDirectories do:[:dir| |
|
8360 |
aBoolean ifTrue:[ |
|
8361 |
dir recursiveDirectoryContentsAsFilenamesDo:installAction |
|
8362 |
] ifFalse:[ |
|
8363 |
dir directoryContentsAsFilenamesDo:installAction |
|
15152 | 8364 |
]. |
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8365 |
]. |
15507 | 8366 |
self notify:nil. |
8367 |
]. |
|
8368 |
] |
|
6521 | 8369 |
] fork. |
8370 |
! |
|
8371 |
||
3892 | 8372 |
installAsAutoloaded:aFilename |
8373 |
"install aFilename as autoloaded class" |
|
8374 |
||
13292 | 8375 |
Smalltalk installAutoloadedClassFromSourceFile:aFilename |
8376 |
||
8377 |
"Modified: / 01-08-2013 / 16:58:09 / cg" |
|
3892 | 8378 |
! |
8379 |
||
15211 | 8380 |
joinSelectedFiles |
8381 |
|selectedFiles numFiles msg outFileName outFile outStream| |
|
8382 |
||
8383 |
selectedFiles := self currentSelectedObjects. |
|
8384 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
8385 |
||
8386 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
8387 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
8388 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
|
8389 |
outFile := selectedFiles first directory construct:outFileName. |
|
8390 |
||
8391 |
outStream := outFile writeStream. |
|
8392 |
||
8393 |
selectedFiles do:[:fileName | |
|
8394 |
self notify:('Adding:', fileName baseName). |
|
17997 | 8395 |
fileName readingFileDo:[:inStream | |
8396 |
inStream copyToEndInto:outStream. |
|
8397 |
]. |
|
15211 | 8398 |
]. |
8399 |
outStream close. |
|
8400 |
self notify:nil. |
|
8401 |
||
8402 |
"Modified: / 04-12-2006 / 13:15:10 / cg" |
|
8403 |
! |
|
4558 | 8404 |
|
6292 | 8405 |
loadImageThenDo:aBlock |
3892 | 8406 |
|img path files| |
8407 |
||
3982 | 8408 |
files := self currentSelectedFiles. |
3892 | 8409 |
files isEmpty ifTrue:[ ^ self]. |
8410 |
files do:[:fileName | |
|
4414 | 8411 |
path := fileName. |
18453 | 8412 |
path isRegularFile ifTrue:[ |
4414 | 8413 |
img := Image fromFile:(path pathName). |
8414 |
img notNil ifTrue:[ |
|
6292 | 8415 |
aBlock value:img |
4414 | 8416 |
] ifFalse:[ |
15346 | 8417 |
Dialog warn:(resources string:'Unknown image format: "%1"' with:fileName asString) |
4414 | 8418 |
] |
8419 |
] |
|
3892 | 8420 |
]. |
8421 |
! |
|
8422 |
||
13089 | 8423 |
loadSignatureSupport |
8424 |
Expecco::KeyFileGenerator isNil ifTrue:[ |
|
14047 | 8425 |
Smalltalk loadPackage:'exept:expecco/license' |
13089 | 8426 |
]. |
8427 |
! |
|
8428 |
||
3892 | 8429 |
openASN1Browser |
8430 |
||
8431 |
self openTool:OSI::ASN1Browser |
|
8432 |
! |
|
8433 |
||
8434 |
openAppletViewer |
|
8435 |
|numItems files| |
|
8436 |
||
3982 | 8437 |
files := self currentSelectedFiles. |
3892 | 8438 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 8439 |
(self |
8440 |
confirm:(resources string:'open for each of the %1 items ?' |
|
8441 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 8442 |
]. |
8443 |
||
8444 |
Java startupJavaSystem. |
|
8445 |
"/ Java markAllClassesUninitialized. |
|
8446 |
"/ Java initAllStaticFields. |
|
8447 |
"/ Java initAllClasses. |
|
8448 |
||
8449 |
files do:[:fileName | |
|
4414 | 8450 |
|p path| |
8451 |
||
8452 |
path := fileName. |
|
18453 | 8453 |
path isRegularFile ifTrue:[ |
4414 | 8454 |
p := Java |
8455 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
8456 |
argumentString:path pathName. |
|
8457 |
p resume. |
|
8458 |
] |
|
3892 | 8459 |
]. |
8460 |
! |
|
8461 |
||
8462 |
openCBrowser |
|
6031 | 8463 |
|dir files| |
5880 | 8464 |
|
8465 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8466 |
dir isNil ifTrue:[ ^ self]. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8467 |
self withActivityIndicationDo:[ |
7560 | 8468 |
files := self currentSelectedObjects. |
6031 | 8469 |
files notEmptyOrNil ifTrue:[ |
8470 |
CBrowser::Browser openOn:files first. |
|
8471 |
] ifFalse:[ |
|
8472 |
CBrowser::Browser openIn:dir. |
|
8473 |
] |
|
3892 | 8474 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8475 |
|
7560 | 8476 |
"Modified: / 04-12-2006 / 13:15:19 / cg" |
3892 | 8477 |
! |
8478 |
||
4230 | 8479 |
openChangeSetBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8480 |
"open a changeSet browser on the selected file(s)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8481 |
|
4230 | 8482 |
self |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8483 |
openTool:(UserPreferences current changeSetBrowserClass) |
4230 | 8484 |
with:#openOnFile: |
18834 | 8485 |
ignoreDirectories:false |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8486 |
|
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8487 |
"Modified (comment): / 27-07-2012 / 20:42:55 / cg" |
18834 | 8488 |
"Modified: / 23-06-2019 / 13:17:07 / Claus Gittinger" |
4230 | 8489 |
! |
8490 |
||
3892 | 8491 |
openChangesBrowser |
8492 |
"open a change browser on the selected file(s)" |
|
8493 |
||
18774 | 8494 |
|files remaining| |
18775 | 8495 |
|
8496 |
files := self currentSelectedFiles. |
|
8497 |
remaining := files copy. |
|
8498 |
||
8499 |
"/ special for github-downloaded package&class folders (one method per file) |
|
8500 |
"/ these are named .package and .class |
|
18774 | 8501 |
GitHubSmalltalkPackageReader notNil ifTrue:[ |
8502 |
files do:[:fn | |
|
19031 | 8503 |
|suff| |
8504 |
||
18774 | 8505 |
fn isDirectory ifTrue:[ |
19031 | 8506 |
suff := fn suffix. |
8507 |
(suff = 'package') ifTrue:[ |
|
18248 | 8508 |
ChangeSetBrowser openOn:(GitHubSmalltalkPackageReader readPackageFrom:fn). |
18774 | 8509 |
remaining remove:fn. |
8510 |
] ifFalse:[ |
|
19031 | 8511 |
(suff = 'class') ifTrue:[ |
18774 | 8512 |
ChangeSetBrowser openOn:(GitHubSmalltalkClassReader readClassFrom:fn). |
8513 |
remaining remove:fn. |
|
8514 |
]. |
|
8515 |
]. |
|
18248 | 8516 |
]. |
18774 | 8517 |
]. |
8518 |
remaining isEmpty ifTrue:[^ self]. |
|
18246 | 8519 |
]. |
8520 |
||
18775 | 8521 |
"/ special for new github-downloaded source files |
8522 |
"/ these are named *.class.st, *.extension.st and *.trait.st |
|
8523 |
remaining copy do:[:fn | |
|
8524 |
#( '.class' '.extension' '.trait') contains:[:suff | |
|
8525 |
|changeSet| |
|
8526 |
||
8527 |
(fn withoutSuffix baseName endsWith:suff) ifTrue:[ |
|
8528 |
fn readingFileDo:[:in | |
|
8529 |
changeSet := ChangeSet fromGithubPharoSmalltalkStream:in. |
|
8530 |
]. |
|
8531 |
ChangeSetBrowser openOn:changeSet. |
|
8532 |
remaining remove:fn. |
|
8533 |
]. |
|
8534 |
]. |
|
8535 |
remaining isEmpty ifTrue:[^ self]. |
|
8536 |
]. |
|
8537 |
||
3892 | 8538 |
self openTool:(UserPreferences current changesBrowserClass) |
18246 | 8539 |
|
18775 | 8540 |
"Modified: / 26-05-2019 / 02:58:27 / Claus Gittinger" |
3892 | 8541 |
! |
8542 |
||
8543 |
openDiffView |
|
15215 | 8544 |
"open a diff-view on the two selected files" |
8545 |
||
8546 |
|name1 name2 files title |
|
8547 |
defaultName defaultDir| |
|
6460 | 8548 |
|
8549 |
files := self currentSelectedObjects. |
|
3892 | 8550 |
files isEmpty ifTrue:[ |
6460 | 8551 |
Dialog warn:(resources string:'You have to select a file first'). |
4414 | 8552 |
^ self. |
3892 | 8553 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8554 |
|
3892 | 8555 |
(files size == 2) ifTrue:[ |
4414 | 8556 |
name1 := files last. |
8557 |
name2 := files first. |
|
3892 | 8558 |
] ifFalse:[ |
4414 | 8559 |
LastFileDiffFile notNil ifTrue:[ |
11052 | 8560 |
LastFileDiffFile exists ifTrue:[ |
8561 |
name1 := LastFileDiffFile. |
|
8562 |
]. |
|
8563 |
"/ | directory | |
|
8564 |
"/ directory := self currentDirectory. |
|
8565 |
"/ directory notNil ifTrue:[ |
|
8566 |
"/ lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
8567 |
"/ (lastFile exists and:[lastFile isReadable]) ifTrue:[ |
|
8568 |
"/ name1 := lastFile. |
|
8569 |
"/ ] |
|
8570 |
"/ ] |
|
4414 | 8571 |
]. |
8572 |
name2 := files first. |
|
6460 | 8573 |
title := resources string:'Show differences between "%1" and:' with:name2 baseName. |
4414 | 8574 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
11052 | 8575 |
defaultDir := name1 notNil ifTrue:[name1 directory] ifFalse:[self currentDirectory]. |
4414 | 8576 |
name1 := DialogBox |
8577 |
requestFileName:title |
|
8578 |
default:defaultName |
|
6460 | 8579 |
ok:(resources string:'OK') |
8580 |
abort:(resources string:'Compare against File List') |
|
4414 | 8581 |
pattern:'*' |
11052 | 8582 |
fromDirectory:defaultDir. |
3892 | 8583 |
]. |
15215 | 8584 |
self openDiffViewOn:name1 and:name2 |
8585 |
||
8586 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
|
8587 |
! |
|
8588 |
||
8589 |
openDiffViewOn:fileArg1 and:fileArg2 |
|
8590 |
"open a diff-view on two files" |
|
8591 |
||
17769 | 8592 |
|file1 file2 file1Size file2Size text1 text2 d err nm l1 sameContents msg| |
15215 | 8593 |
|
8594 |
file1 := fileArg1. |
|
8595 |
file2 := fileArg2. |
|
3892 | 8596 |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8597 |
self withWaitCursorDo:[ |
15215 | 8598 |
(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
|
8599 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
14126 | 8600 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l string]]. |
15215 | 8601 |
file1 := nil. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8602 |
l1 := 'browser contents' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8603 |
] ifFalse:[ |
15215 | 8604 |
file1 := file1 asFilename. |
8605 |
LastFileDiffFile := file1. |
|
8606 |
file1 isReadable ifFalse:[ |
|
8607 |
nm := file1. |
|
8608 |
file1 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8609 |
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
|
8610 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8611 |
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
|
8612 |
]. |
4414 | 8613 |
]. |
15215 | 8614 |
l1 := file1 pathName |
4414 | 8615 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8616 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8617 |
err isNil ifTrue:[ |
15215 | 8618 |
file2 isReadable ifFalse:[ |
8619 |
nm := file2. |
|
8620 |
file2 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8621 |
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
|
8622 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8623 |
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
|
8624 |
]. |
4414 | 8625 |
]. |
8626 |
]. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8627 |
err notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8628 |
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
|
8629 |
^ self |
6176 | 8630 |
]. |
8631 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8632 |
self withActivityIndicationDo:[ |
17769 | 8633 |
file1Size := file1 isNil ifTrue:[0] ifFalse:[file1 fileSize]. |
8634 |
file2Size := file2 isNil ifTrue:[0] ifFalse:[file2 fileSize]. |
|
8635 |
||
8636 |
((file1Size > (1024*1024*32)) or:[ file2Size > (1024*1024*32) ]) ifTrue:[ |
|
8637 |
file1Size = file2Size ifTrue:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8638 |
ProgressIndicator |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8639 |
displayBusyIndicator:'Comparing...' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8640 |
at:(Screen default center) |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8641 |
during:[ |
15215 | 8642 |
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
|
8643 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8644 |
sameContents ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8645 |
self information:'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8646 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8647 |
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
|
8648 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8649 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8650 |
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
|
8651 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8652 |
^ self. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8653 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8654 |
|
15215 | 8655 |
file1 notNil ifTrue:[ |
8656 |
file1 isDirectory ifTrue:[ |
|
8657 |
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
|
8658 |
] ifFalse:[ |
15215 | 8659 |
text1 := file1 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8660 |
] |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8661 |
]. |
15215 | 8662 |
file2 isDirectory ifTrue:[ |
8663 |
text2 := file2 directoryContents asString. |
|
6460 | 8664 |
] ifFalse:[ |
15215 | 8665 |
text2 := file2 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8666 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8667 |
text1 = text2 ifTrue:[ |
15215 | 8668 |
(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
|
8669 |
msg := 'Same filename lists.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8670 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8671 |
msg := 'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8672 |
]. |
16911 | 8673 |
self information:msg |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8674 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8675 |
d := DiffTextView |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8676 |
openOn:text1 label:l1 |
15215 | 8677 |
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
|
8678 |
d topView label:(resources string:'File Differences'). |
6460 | 8679 |
] |
4414 | 8680 |
] |
3892 | 8681 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8682 |
|
17769 | 8683 |
"Modified: / 19-11-2017 / 15:00:47 / cg" |
3892 | 8684 |
! |
8685 |
||
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8686 |
openDirectoryDiffView |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8687 |
"open a directory diff-view" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8688 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8689 |
|name1 name2 files| |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8690 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8691 |
files := self currentSelectedObjects. |
11108 | 8692 |
files notEmpty ifTrue:[ |
8693 |
name1 := files first asFilename. |
|
18453 | 8694 |
name1 asFilename isRegularFile ifTrue:[ |
11108 | 8695 |
name1 := name1 directory |
8696 |
]. |
|
8697 |
]. |
|
8698 |
||
8699 |
(files size == 2) ifTrue:[ |
|
8700 |
name2 := files second. |
|
8701 |
] ifFalse:[ |
|
19152 | 8702 |
(files size ~~ 1) ifTrue:[ |
11108 | 8703 |
Dialog warn:(resources string:'Please select one or two directories.'). |
8704 |
^ self. |
|
8705 |
]. |
|
8706 |
name2 := Dialog |
|
8707 |
requestDirectoryName:(resources |
|
8708 |
string:'Recursive compare "%1" with folder:' |
|
8709 |
with:name1 asFilename baseName) |
|
8710 |
default:(LastFileDiffDirectory ? self currentDirectory). |
|
8711 |
name2 isEmptyOrNil ifTrue:[^ self]. |
|
8712 |
LastFileDiffDirectory := name2. |
|
8713 |
]. |
|
8714 |
name2 := name2 asFilename. |
|
8715 |
||
18453 | 8716 |
name2 asFilename isRegularFile ifTrue:[ |
11108 | 8717 |
name2 := name2 directory |
8718 |
]. |
|
8719 |
||
8720 |
self |
|
8721 |
applicationNamed:#FileApplicationNoteBook |
|
8722 |
ifPresentDo:[:appl | ^ appl openCompareDirectory:name1 with:name2]. |
|
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8723 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8724 |
"Created: / 20-05-2010 / 15:01:17 / cg" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8725 |
! |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8726 |
|
3892 | 8727 |
openEditor |
8728 |
self openTool:EditTextView |
|
8729 |
! |
|
8730 |
||
4957 | 8731 |
openGV |
8732 |
self openOSCommandWithFiles:'gv' |
|
8733 |
! |
|
8734 |
||
3892 | 8735 |
openHTMLReader |
8736 |
||
8737 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
8738 |
! |
|
8739 |
||
8740 |
openImageEditor |
|
6292 | 8741 |
[ |
8742 |
self loadImageThenDo:[:img | img edit] |
|
8743 |
] fork |
|
3892 | 8744 |
! |
8745 |
||
8746 |
openImageInspector |
|
6292 | 8747 |
[ |
8748 |
self loadImageThenDo:[:img | img inspect] |
|
8749 |
] fork |
|
3892 | 8750 |
! |
8751 |
||
8752 |
openImagePreview |
|
5778 | 8753 |
[ |
8754 |
self |
|
6292 | 8755 |
loadImageThenDo: |
5778 | 8756 |
[:img | |
8757 |
|i top viewer| |
|
8758 |
||
8759 |
top := StandardSystemView new. |
|
8760 |
||
8761 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8762 |
i := img. |
|
8763 |
top extent:200@200. |
|
8764 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
8765 |
top openAndWait. |
|
8766 |
||
8767 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
8768 |
i := i magnifiedPreservingRatioTo:200@200. |
|
8769 |
]. |
|
8770 |
viewer image:i. |
|
8771 |
]. |
|
3892 | 8772 |
] fork |
8773 |
! |
|
8774 |
||
8775 |
openMP3Player |
|
8776 |
|file| |
|
8777 |
||
3982 | 8778 |
file := self currentSelectedFiles. |
3892 | 8779 |
(file isEmpty) ifTrue:[ |
4414 | 8780 |
^ self. |
3892 | 8781 |
]. |
8782 |
file := file first. |
|
8783 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
8784 |
! |
|
8785 |
||
4957 | 8786 |
openOSCommandWithFiles:command |
8787 |
|files fileNames| |
|
8788 |
||
8789 |
files := self currentSelectedFiles. |
|
8790 |
(files isEmpty) ifTrue:[ |
|
8791 |
^ self. |
|
8792 |
]. |
|
8793 |
||
8794 |
fileNames := files collect:[:each | |
|
8795 |
'"' , each asFilename pathName , '"' |
|
8796 |
]. |
|
8797 |
||
8798 |
[ |
|
8799 |
OperatingSystem |
|
4959 | 8800 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
8801 |
inDirectory:(files first asFilename directory). |
|
4957 | 8802 |
] fork |
8803 |
! |
|
8804 |
||
4820 | 8805 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8806 |
|files fileNames cmd arg| |
4820 | 8807 |
|
8808 |
files := self currentSelectedFiles. |
|
8809 |
(files isEmpty) ifTrue:[ |
|
8810 |
^ self. |
|
8811 |
]. |
|
12972 | 8812 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'. |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8813 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8814 |
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
|
8815 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8816 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8817 |
|
4820 | 8818 |
fileNames := |
8819 |
files |
|
8820 |
collect: |
|
8821 |
[:each | |
|
8822 |
'"' , each asFilename pathName , '"' |
|
8823 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8824 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8825 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8826 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8827 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8828 |
]. |
4820 | 8829 |
|
4950 | 8830 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8831 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 8832 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8833 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8834 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 8835 |
! |
8836 |
||
8426 | 8837 |
openResourceFileEditor |
8838 |
||
8839 |
self |
|
8840 |
openTool: Tools::InternationalLanguageTranslationEditor |
|
8841 |
with: #openOnFile: |
|
8842 |
! |
|
8843 |
||
3892 | 8844 |
openSlideShow |
5880 | 8845 |
|dir| |
8846 |
||
8847 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8848 |
dir isNil ifTrue:[^ self]. |
|
8849 |
||
3892 | 8850 |
CodingExamples_GUI::SlideShow openIn:dir. |
8851 |
! |
|
8852 |
||
8853 |
openSnapshotImageBrowser |
|
4491 | 8854 |
"Sorry, for now, only the old browser can handle snapShotImages." |
8855 |
||
3892 | 8856 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
8857 |
! |
|
8858 |
||
8859 |
openTerminal |
|
19009 | 8860 |
"open a shell in vt100 terminal emulation in the current directory" |
8861 |
||
5880 | 8862 |
|dir| |
8863 |
||
8864 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 8865 |
|
5300 | 8866 |
TerminalApplication notNil ifTrue:[ |
8867 |
TerminalApplication openIn:dir |
|
8868 |
] ifFalse:[ |
|
8869 |
VT100TerminalView openShellIn:dir. |
|
8870 |
]. |
|
3892 | 8871 |
! |
8872 |
||
8873 |
openTool:aToolClass |
|
8874 |
"open a tool on the selected file(s)" |
|
8875 |
||
8876 |
^ self openTool:aToolClass ignoreDirectories:true |
|
8877 |
! |
|
8878 |
||
8879 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
8880 |
"open a tool on the selected file(s)" |
|
8881 |
||
8882 |
^ self |
|
4414 | 8883 |
openTool:aToolClass |
8884 |
with:#openOn: |
|
8885 |
ignoreDirectories:ignoreDirs |
|
3892 | 8886 |
! |
8887 |
||
8426 | 8888 |
openTool:aToolClass with:aSelector |
8889 |
"open a tool on the selected file(s)" |
|
8890 |
||
8891 |
^ self openTool:aToolClass with:aSelector ignoreDirectories:true |
|
8892 |
! |
|
8893 |
||
3892 | 8894 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
8895 |
"open a tool on the selected file(s)" |
|
8896 |
||
8832 | 8897 |
|tool| |
3892 | 8898 |
|
8899 |
aToolClass isNil ifTrue:[ |
|
4414 | 8900 |
Dialog warn:'Sorry, that tool seems to be not available'. |
8901 |
^ nil. |
|
3892 | 8902 |
]. |
8832 | 8903 |
self forEachSelectedFileIgnoringDirectories:ignoreDirs do:[:path | |
8904 |
tool := aToolClass perform:aSelector with:path. |
|
3892 | 8905 |
]. |
8906 |
^ tool |
|
8832 | 8907 |
! |
8908 |
||
18946 | 8909 |
openVideoPlayer |
8910 |
self openOSCommandWithFiles:'vlc' |
|
8911 |
||
8912 |
"Created: / 26-07-2019 / 11:09:32 / Stefan Vogel" |
|
8913 |
! |
|
8914 |
||
8832 | 8915 |
openWebBrowser |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8916 |
self |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8917 |
forEachSelectedFileIgnoringDirectories:true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8918 |
do:[:path | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8919 |
Error |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8920 |
handle:[:ex | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8921 |
Dialog warn:'Shell execution failed: ',ex description |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8922 |
] do:[ |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8923 |
OperatingSystem openApplicationForDocument:path operation:#open. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8924 |
^ self. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8925 |
] |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8926 |
]. |
3892 | 8927 |
! |
8928 |
||
6022 | 8929 |
openWorkspace |
8930 |
self |
|
8931 |
openTool:WorkspaceApplication |
|
8932 |
with:#openOnFile: |
|
8933 |
ignoreDirectories:true |
|
8934 |
! |
|
8935 |
||
4950 | 8936 |
openXV |
4957 | 8937 |
self openOSCommandWithFiles:'xv' |
4950 | 8938 |
! |
8939 |
||
3892 | 8940 |
openZipTool |
5880 | 8941 |
|zipTool| |
3892 | 8942 |
|
8943 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 8944 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 8945 |
]. |
8946 |
! |
|
8947 |
||
8948 |
readAbbrevFile |
|
8949 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
8950 |
||
5880 | 8951 |
|directories| |
3892 | 8952 |
|
3982 | 8953 |
directories := self currentSelectedDirectories. |
3892 | 8954 |
directories isEmpty ifTrue:[^ self]. |
8955 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8956 |
self withActivityIndicationDo:[ |
5880 | 8957 |
directories do:[:eachDir | |
8958 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
8959 |
] |
|
5828 | 8960 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8961 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8962 |
"Modified: / 25-07-2006 / 09:07:43 / cg" |
3892 | 8963 |
! |
8964 |
||
6460 | 8965 |
readAndShowResources |
8966 |
self withActivityIndicationDo:[ |
|
8967 |
| selectedFiles| |
|
8968 |
||
8969 |
selectedFiles:= self currentSelectedFiles. |
|
8970 |
selectedFiles do:[:fileName | |
|
8971 |
resources := ResourcePack fromFile:fileName. |
|
8972 |
resources inspect. |
|
8973 |
]. |
|
8974 |
] |
|
8975 |
! |
|
8976 |
||
17831 | 8977 |
removeBakAndSavFiles |
8978 |
"remove all .sav and .bak files (after confirmation)" |
|
8979 |
||
8980 |
|filesToRemove directories| |
|
8981 |
||
8982 |
directories := self currentSelectedDirectories. |
|
8983 |
directories isEmptyOrNil ifTrue:[ |
|
8984 |
directories := Array with:self currentDirectory |
|
8985 |
]. |
|
8986 |
||
8987 |
self withActivityIndicationDo:[ |
|
8988 |
filesToRemove := OrderedCollection new. |
|
8989 |
directories do:[:eachDirectoryToScan | |
|
8990 |
eachDirectoryToScan filesDo:[:fn | |
|
18998 | 8991 |
(#('sav' 'bak') includes:fn suffix asLowercase) ifTrue:[ |
17831 | 8992 |
filesToRemove add:fn. |
8993 |
] |
|
8994 |
] |
|
8995 |
]. |
|
8996 |
filesToRemove isEmpty ifTrue:[ |
|
8997 |
Dialog information:(resources string:'Nothing to remove'). |
|
8998 |
^ self. |
|
8999 |
]. |
|
9000 |
(Dialog confirm:(resources string:'Remove %1 file(s) ?' with:filesToRemove size)) ifFalse:[ |
|
9001 |
^ self |
|
9002 |
]. |
|
9003 |
filesToRemove do:[:each | |
|
9004 |
each remove |
|
9005 |
]. |
|
17871 | 9006 |
self updateCurrentDirectoryWithReread |
17831 | 9007 |
]. |
9008 |
! |
|
9009 |
||
3892 | 9010 |
singleFileFileIn:fileName lazy:lazy |
9011 |
"fileIn the selected file(s)" |
|
9012 |
||
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9013 |
|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
|
9014 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9015 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9016 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9017 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9018 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9019 |
[ |
4345 | 9020 |
(ObjectFileLoader notNil |
5491 | 9021 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 9022 |
AbortOperationRequest catch:[ |
9023 |
|p| |
|
9024 |
||
9025 |
"/ |
|
9026 |
"/ look if already loaded ... then unload first |
|
9027 |
"/ |
|
9028 |
p := fileName pathName. |
|
9029 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
9030 |
(Dialog confirm:(resources |
|
9031 |
string:'%1 is already loaded; load anyway ?' |
|
9032 |
with:p)) ifFalse:[ |
|
9033 |
^ self |
|
9034 |
]. |
|
9035 |
notifyString := 'unloading old ' , p , ' ...'. |
|
9036 |
Transcript showCR:notifyString. |
|
4523 | 9037 |
self notify:notifyString. |
4345 | 9038 |
ObjectFileLoader unloadObjectFile:p. |
9039 |
]. |
|
9040 |
||
9041 |
notifyString := 'loading ' , p , ' ...'. |
|
9042 |
Transcript showCR:notifyString. |
|
4523 | 9043 |
self notify:notifyString. |
12426 | 9044 |
(ObjectFileLoader loadObjectFile:p) isNil ifTrue:[ |
9045 |
notifyString := 'Error: could not load ' , p. |
|
9046 |
Transcript showCR:notifyString. |
|
9047 |
self notify:notifyString. |
|
9048 |
] ifFalse:[ |
|
9049 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
9050 |
]. |
|
4345 | 9051 |
] |
9052 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
9053 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
9054 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9055 |
aStream := fileName readStreamOrNil. |
4345 | 9056 |
aStream notNil ifTrue:[ |
9057 |
aStream fileInBinary. |
|
9058 |
] |
|
9059 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9060 |
((fileName hasSuffix:'class') or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 9061 |
"/ loading a java class file |
9062 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 9063 |
JavaClassReader loadFile:fileName |
4345 | 9064 |
] |
9065 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
9066 |
"/ loading a sif (smalltalk interchange format) file |
|
9067 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
9068 |
SmalltalkInterchangeFileManager newForFileIn |
|
9069 |
fileName: fileName pathName; |
|
9070 |
fileIn. |
|
9071 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
|
9072 |
Parcel isNil ifTrue:[ |
|
9073 |
Dialog warn:'Parcel support not loaded.' |
|
9074 |
] ifFalse:[ |
|
9075 |
Parcel loadParcelFrom: fileName pathName |
|
9076 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9077 |
] ifFalse:[ (fileName hasSuffix:'jar') ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9078 |
JavaVM isNil ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9079 |
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
|
9080 |
^ self. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9081 |
] ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9082 |
JavaVM booted ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9083 |
(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
|
9084 |
JavaVM boot. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9085 |
]. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9086 |
JavaVM loadClassesIn: fileName. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9087 |
] |
4345 | 9088 |
] ifFalse:[ |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9089 |
"/ ask programming languages... |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9090 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
14360 | 9091 |
(lang isNil and:[(fileName hasSuffix:'js')]) ifTrue:[ |
14362 | 9092 |
Smalltalk loadPackage:'stx:libjavascript'. |
14360 | 9093 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
9094 |
]. |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9095 |
(lang notNil and:[lang ~= SmalltalkLanguage]) ifTrue:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9096 |
lang fileIn:fileName. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9097 |
] ifFalse:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9098 |
"/ loading a regular (chunk) or xml source file |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9099 |
Error handle:[:ex | |
15675 | 9100 |
self errorNotify:'Error during file in: ', ex description. |
15981 | 9101 |
ex resume. |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9102 |
] do:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9103 |
aStream := fileName readStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9104 |
[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9105 |
Class withoutUpdatingChangesDo:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9106 |
wasLazy := Compiler compileLazy:lazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9107 |
Smalltalk fileInStream:aStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9108 |
]. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9109 |
Class addInfoRecord:('fileIn ' , fileName asString) |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9110 |
] ensure:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9111 |
Compiler compileLazy:wasLazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9112 |
aStream close |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9113 |
] |
4345 | 9114 |
] |
9115 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9116 |
]]]] |
4345 | 9117 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9118 |
] 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
|
9119 |
|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
|
9120 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9121 |
isRedef := false. |
12684 | 9122 |
sig := ex creator. |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9123 |
(dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9124 |
action := #continue |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9125 |
] ifFalse:[ |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9126 |
(sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9127 |
ex reject |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9128 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9129 |
sig == Class methodRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9130 |
msg := 'trying to overwrite method:\\ ' , ex oldMethod whoString , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9131 |
, ex oldPackage , ''' with method from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9132 |
label := 'Method redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9133 |
redefKind := 'method'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9134 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9135 |
] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9136 |
msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9137 |
, ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9138 |
label := 'Class redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9139 |
redefKind := 'class'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9140 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9141 |
] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender| |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9142 |
label := msg := 'Breakpoint/Halt in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9143 |
sender := ex suspendedContext. |
19392 | 9144 |
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
|
9145 |
] ifFalse:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9146 |
label := 'Error in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9147 |
msg := 'error in fileIn: %1' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9148 |
]]]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9149 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9150 |
msg := msg bindWith:ex description. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9151 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9152 |
labels := #('Cancel' 'Skip' 'Debug' 'Compare Sources'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9153 |
values := #(abort skip debug compareSources). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9154 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9155 |
isRedef ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9156 |
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
|
9157 |
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
|
9158 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9159 |
labels := labels , #('Keep Package' ). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9160 |
values := values , #(keep). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9161 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9162 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9163 |
labels := labels , #( 'Continue' 'ContinueForAll'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9164 |
values := values , #( continue continueForAll). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9165 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9166 |
AbortAllOperationWantedQuery query ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9167 |
labels := #('Cancel All') , labels. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9168 |
values := #(cancelAll) , values. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9169 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9170 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9171 |
action := Dialog |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9172 |
choose:(msg withCRs) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9173 |
label:label |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9174 |
image:(WarningBox iconBitmap) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9175 |
labels:labels |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9176 |
values:values |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9177 |
default:#continue |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9178 |
onCancel:#abort. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9179 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9180 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9181 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9182 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9183 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9184 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9185 |
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
|
9186 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9187 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9188 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9189 |
(action == #compareSources) ifTrue:[ |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9190 |
DiffCodeView |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9191 |
openOn:(ex oldMethod source) label:'Old Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9192 |
and:(ex newMethod source) label:'New Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9193 |
title:ex description. |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9194 |
ex resignalAs:ex |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9195 |
]. |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
9196 |
(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
|
9197 |
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
|
9198 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9199 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9200 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9201 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9202 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9203 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9204 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9205 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9206 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9207 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9208 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9209 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9210 |
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
|
9211 |
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
|
9212 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9213 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9214 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9215 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9216 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9217 |
] |
7040 | 9218 |
|
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9219 |
"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
|
9220 |
"Modified: / 19-02-2014 / 12:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4531 | 9221 |
! |
9222 |
||
4558 | 9223 |
splitFile:infile intoPiecesOfSize:kiloBytes |
9224 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
9225 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
9226 |
||
9227 |
bufferSize := 32*1024. |
|
9228 |
||
9229 |
inStream := infile readStream. |
|
9230 |
||
9231 |
bytesPerSplit := kiloBytes * 1024. |
|
9232 |
||
9233 |
remaining := infile fileSize. |
|
9234 |
splitIndex := 1. |
|
9235 |
[remaining > 0] whileTrue:[ |
|
9236 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
9237 |
outStream := outFile asFilename writeStream. |
|
9238 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
9239 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
9240 |
buffer := ByteArray new:bufferSize. |
|
9241 |
n := inStream |
|
9242 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
9243 |
into:buffer |
|
9244 |
startingAt:1. |
|
9245 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
9246 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
9247 |
remaining := remaining - n. |
|
9248 |
]. |
|
9249 |
outStream close. |
|
9250 |
splitIndex := splitIndex + 1. |
|
9251 |
]. |
|
9252 |
inStream close. |
|
9253 |
! |
|
9254 |
||
15906 | 9255 |
splitFile:infile intoPiecesWithNumberOfLines:numberOfLines |
9256 |
|splitIndex line |
|
9257 |
inStream outFile outStream remainingLinesInThisOutfile| |
|
9258 |
||
9259 |
inStream := infile readStream. |
|
9260 |
||
9261 |
splitIndex := 1. |
|
9262 |
[inStream atEnd] whileFalse:[ |
|
9263 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
9264 |
outStream := outFile asFilename writeStream. |
|
9265 |
remainingLinesInThisOutfile := numberOfLines. |
|
9266 |
[(remainingLinesInThisOutfile > 0) and:[inStream atEnd not]] whileTrue:[ |
|
9267 |
line := inStream nextLine. |
|
15910 | 9268 |
outStream nextPutLine:line. |
15906 | 9269 |
remainingLinesInThisOutfile := remainingLinesInThisOutfile - 1. |
9270 |
]. |
|
9271 |
outStream close. |
|
9272 |
splitIndex := splitIndex + 1. |
|
9273 |
]. |
|
9274 |
inStream close. |
|
9275 |
! |
|
9276 |
||
4558 | 9277 |
splitSelectedFiles |
6264 | 9278 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 9279 |
|
12871 | 9280 |
selectedFiles := self currentSelectedFiles. |
4558 | 9281 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
9282 |
||
6265 | 9283 |
msg := (numFiles > 1) |
9284 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
9285 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 9286 |
|
6352 | 9287 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 9288 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
9289 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 9290 |
kiloBytes isNil ifTrue:[^ self]. |
9291 |
||
9292 |
selectedFiles do:[:fileName | |
|
18453 | 9293 |
fileName isRegularFile ifTrue:[ |
9294 |
self notify:('Splitting:', fileName baseName). |
|
4558 | 9295 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
9296 |
] |
|
9297 |
]. |
|
6190 | 9298 |
self notify:nil. |
6265 | 9299 |
|
7560 | 9300 |
"Modified: / 04-12-2006 / 13:15:26 / cg" |
4558 | 9301 |
! |
9302 |
||
15906 | 9303 |
splitSelectedFilesByLines |
9304 |
|selectedFiles numFiles msg numLinesString numLines| |
|
9305 |
||
9306 |
selectedFiles := self currentSelectedFiles. |
|
9307 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
9308 |
||
9309 |
msg := (numFiles > 1) |
|
9310 |
ifTrue:'Split each of the %1 files into pieces with number of lines:' |
|
9311 |
ifFalse:'Split %2 into pieces with number of lines:'. |
|
9312 |
||
9313 |
numLinesString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
9314 |
numLinesString isEmptyOrNil ifTrue:[^ self]. |
|
9315 |
||
9316 |
numLines := Integer readFrom:numLinesString onError:nil. |
|
9317 |
numLines isNil ifTrue:[^ self]. |
|
9318 |
||
9319 |
selectedFiles do:[:fileName | |
|
18453 | 9320 |
fileName isRegularFile ifTrue:[ |
9321 |
self notify:('Splitting:', fileName baseName). |
|
15906 | 9322 |
self splitFile:fileName intoPiecesWithNumberOfLines:numLines |
9323 |
] |
|
9324 |
]. |
|
9325 |
self notify:nil. |
|
9326 |
! |
|
9327 |
||
15211 | 9328 |
truncateSelectedFilesToZeroSize |
9329 |
|selectedFiles numFiles msg| |
|
9330 |
||
9331 |
selectedFiles := self currentSelectedObjects. |
|
9332 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
9333 |
||
9334 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
|
9335 |
numFiles > 1 ifTrue:[ |
|
9336 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
|
9337 |
]. |
|
9338 |
||
9339 |
(Dialog |
|
9340 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
|
9341 |
initialAnswer:false |
|
9342 |
) ifFalse:[ |
|
9343 |
^ self |
|
9344 |
]. |
|
9345 |
||
9346 |
selectedFiles do:[:fileName | |
|
9347 |
|s| |
|
9348 |
||
18453 | 9349 |
fileName isRegularFile ifTrue:[ |
9350 |
self notify:('Truncating:', fileName baseName). |
|
15211 | 9351 |
[ |
9352 |
s := fileName writeStream. |
|
9353 |
s close. |
|
19392 | 9354 |
] on:OpenError do:[:ex| |
15211 | 9355 |
self warn:('Cannot truncate "%1".' bindWith:fileName baseName allBold). |
9356 |
]. |
|
9357 |
] |
|
9358 |
]. |
|
9359 |
self notify:nil. |
|
9360 |
||
9361 |
"Modified: / 04-12-2006 / 13:15:28 / cg" |
|
9362 |
! ! |
|
3892 | 9363 |
|
4849 | 9364 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 9365 |
|
9366 |
anySTFilesPresent |
|
9367 |
^ self anyFilesPresentWithSuffix:'st' |
|
9368 |
! |
|
9369 |
||
9370 |
canCreateNewProject |
|
9371 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
17865 | 9372 |
^ self currentSelectedFiles |
9373 |
contains:[:fileName| |
|
9374 |
| suffix| |
|
9375 |
suffix := fileName suffix asLowercase. |
|
9376 |
(suffix = 'prj' or:[suffix = 'st']) |
|
9377 |
] |
|
3892 | 9378 |
! |
9379 |
||
9380 |
canDoTerminal |
|
9381 |
||
9382 |
^ OperatingSystem isUNIXlike |
|
9383 |
or:[OperatingSystem isMSWINDOWSlike] |
|
9384 |
! |
|
9385 |
||
9386 |
canDoTerminalAndSystemIsDOS |
|
9387 |
||
9388 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
9389 |
! |
|
9390 |
||
9391 |
canDoTerminalAndSystemIsUnix |
|
9392 |
||
9393 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
9394 |
! |
|
9395 |
||
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9396 |
canGenerateSignatureFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
9397 |
"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
|
9398 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9399 |
Expecco::KeyFileGenerator isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9400 |
Expecco::KeyFile isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9401 |
|
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
9402 |
^ self currentSelectedFiles notEmptyOrNil |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9403 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9404 |
|
12811 | 9405 |
canOpenMonticelloBrowser |
9406 |
^ self currentSelectedFiles |
|
9407 |
contains:[:fileName| |
|
18746 | 9408 |
fileName suffix sameAs:'mcz' |
12811 | 9409 |
] |
18746 | 9410 |
|
9411 |
"Modified: / 01-05-2019 / 11:21:16 / Claus Gittinger" |
|
12811 | 9412 |
! |
9413 |
||
3892 | 9414 |
canReadAbbrevFile |
9415 |
||
5960 | 9416 |
|currentDirectory| |
3892 | 9417 |
|
9418 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 9419 |
currentDirectory := self currentDirectory. |
9420 |
^ currentDirectory notNil |
|
9421 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 9422 |
! |
9423 |
||
9424 |
canRemoveFromSourcePath |
|
9425 |
||
9426 |
^ false |
|
9427 |
! |
|
9428 |
||
13089 | 9429 |
cannotGenerateSignatureFiles |
9430 |
^ self canGenerateSignatureFiles not |
|
9431 |
! |
|
9432 |
||
3892 | 9433 |
hasASN1 |
9434 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 9435 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 9436 |
|
9437 |
! |
|
9438 |
||
9439 |
hasASN1AndSelection |
|
9440 |
^ [ self hasSelection value |
|
17416 | 9441 |
and:[self currentSelectedFiles notEmptyOrNil |
4414 | 9442 |
and:[OSI::ASN1Parser notNil |
9443 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
17416 | 9444 |
|
9445 |
"Modified: / 17-02-2017 / 08:25:09 / cg" |
|
3892 | 9446 |
! |
9447 |
||
9448 |
hasCBrowser |
|
9449 |
^ [ CBrowser::Browser notNil ] |
|
9450 |
! |
|
9451 |
||
9452 |
hasJava |
|
9453 |
||
14298 | 9454 |
^ [ JavaVM notNil |
9455 |
and:[JavaClassReader notNil |
|
9456 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 9457 |
! |
9458 |
||
9459 |
hasJavaAndSelection |
|
9460 |
||
12871 | 9461 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 9462 |
and:[JavaClassReader notNil |
9463 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 9464 |
! |
9465 |
||
9466 |
hasMP3Player |
|
9467 |
||
9468 |
^ [ MP3PlayerApplication notNil |
|
4414 | 9469 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 9470 |
! |
9471 |
||
9472 |
hasMP3PlayerAndSelection |
|
9473 |
||
12871 | 9474 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 9475 |
and:[ self hasMP3Player value]] |
3892 | 9476 |
! |
9477 |
||
8426 | 9478 |
hasResourceFileSelected |
12871 | 9479 |
^ (self currentSelectedFiles) |
9480 |
contains:[:fn | |
|
18746 | 9481 |
fn suffix sameAs:'rs' |
9482 |
]. |
|
9483 |
||
9484 |
"Modified: / 01-05-2019 / 11:23:30 / Claus Gittinger" |
|
8426 | 9485 |
! |
9486 |
||
3892 | 9487 |
hasSlideShow |
9488 |
||
9489 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
9490 |
! |
|
9491 |
||
9492 |
hasSnapshotSelection |
|
9493 |
||
9494 |
^ [ |
|
4414 | 9495 |
| files | |
8426 | 9496 |
|
4414 | 9497 |
files := self currentSelectedFiles. |
9498 |
((files size == 1) |
|
9499 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 9500 |
] |
9501 |
! |
|
9502 |
||
7869 | 9503 |
hasXml |
19320 | 9504 |
^ XML::XMLParser notNil |
9505 |
||
9506 |
"Modified: / 29-11-2019 / 13:44:29 / Stefan Vogel" |
|
7869 | 9507 |
! |
9508 |
||
9509 |
hasXmlFileSelected |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
9510 |
"/ 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
|
9511 |
"/ then handle the error when it ever fails during xml-parsing. |
7869 | 9512 |
|
8426 | 9513 |
^ [ |
9514 |
|sel fileName| |
|
7869 | 9515 |
|
9516 |
sel := self currentSelectedFiles. |
|
9517 |
sel size == 1 ifTrue:[ |
|
9518 |
fileName := sel first. |
|
9519 |
fileName notNil ifTrue:[ |
|
15936 | 9520 |
#('xml' 'xsd' 'vdx') includes:fileName suffix asLowercase |
7869 | 9521 |
] ifFalse:[ |
9522 |
false |
|
9523 |
] |
|
9524 |
] ifFalse:[ |
|
9525 |
false |
|
9526 |
] |
|
9527 |
] |
|
9528 |
! |
|
9529 |
||
3892 | 9530 |
hasZipFileSelected |
17982 | 9531 |
|sel fileName suff mime| |
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9532 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9533 |
sel := self currentSelectedFiles. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9534 |
sel size == 1 ifFalse:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9535 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9536 |
fileName := sel first. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9537 |
fileName isNil ifTrue:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9538 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9539 |
suff := fileName suffix asLowercase. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9540 |
(suff = 'zip' or:[suff = 'jar']) ifTrue:[^ true]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9541 |
|
17982 | 9542 |
mime := fileName mimeTypeOfContents. |
9543 |
"/ prepare for change (iana has obsoleted the x- types) |
|
9544 |
^ (mime = 'application/x-zip-compressed') or:[mime = 'application/zip'] |
|
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9545 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9546 |
"Modified: / 14-02-2011 / 17:17:03 / cg" |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9547 |
! |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9548 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9549 |
hasZipFileSelectedHolder |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9550 |
^ [ self hasZipFileSelected ] |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9551 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9552 |
"Created: / 14-02-2011 / 17:16:08 / cg" |
3892 | 9553 |
! |
9554 |
||
9555 |
javaSupportLoaded |
|
9556 |
||
9557 |
^ false |
|
9558 |
! ! |
|
9559 |
||
14126 | 9560 |
|
9561 |
||
5880 | 9562 |
!AbstractFileBrowser methodsFor:'private'! |
9563 |
||
9564 |
theSingleSelectedDirectoryOrHomeDir |
|
9565 |
|dir| |
|
9566 |
||
5888 | 9567 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 9568 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
9569 |
^ dir. |
|
9570 |
! |
|
9571 |
||
9572 |
theSingleSelectedDirectoryOrNil |
|
9573 |
|dirs| |
|
9574 |
||
9575 |
dirs := self currentSelectedDirectories. |
|
19152 | 9576 |
dirs size ~~ 1 ifTrue:[ ^ nil]. |
5880 | 9577 |
^ dirs anElement. |
14577 | 9578 |
! |
9579 |
||
9580 |
theSingleSelectedFileOrNil |
|
9581 |
|dirs| |
|
9582 |
||
9583 |
dirs := self currentSelectedFiles. |
|
19152 | 9584 |
dirs size ~~ 1 ifTrue:[ ^ nil]. |
14577 | 9585 |
^ dirs anElement. |
18751 | 9586 |
! |
9587 |
||
9588 |
theSingleSelectedItemOrNil |
|
9589 |
|items| |
|
9590 |
||
9591 |
items := self selectedItems. |
|
19152 | 9592 |
items size ~~ 1 ifTrue:[ ^ nil]. |
18751 | 9593 |
^ items anElement. |
9594 |
||
9595 |
"Created: / 02-05-2019 / 18:53:06 / Claus Gittinger" |
|
5880 | 9596 |
! ! |
9597 |
||
3892 | 9598 |
!AbstractFileBrowser methodsFor:'queries'! |
9599 |
||
8256 | 9600 |
cBrowserLoaded |
18432 | 9601 |
^ (Smalltalk at:#'CBrowser::Browser') notNil |
9602 |
||
9603 |
"Modified: / 26-09-2018 / 12:06:32 / Claus Gittinger" |
|
8256 | 9604 |
! |
9605 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9606 |
cBrowserMenuItemVisible |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9607 |
^ self cBrowserLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9608 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9609 |
"Created: / 04-10-2011 / 13:40:38 / cg" |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9610 |
! |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9611 |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9612 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9613 |
"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
|
9614 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9615 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9616 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9617 |
|
19230 | 9618 |
getFileInfoStringForFirstSelectedFile:longInfoBoolean |
3906 | 9619 |
"get stat info on selected file - return a string which can be |
9620 |
shown in a box" |
|
9621 |
||
19230 | 9622 |
|selFiles filename| |
3906 | 9623 |
|
7560 | 9624 |
selFiles := self currentSelectedObjects. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9625 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 9626 |
filename := selFiles first. |
9627 |
||
19230 | 9628 |
^ self class getFileInfoStringForFile:filename long:longInfoBoolean |
7560 | 9629 |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
9630 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
3906 | 9631 |
! |
9632 |
||
8510 | 9633 |
hasImageColorHistogram |
9634 |
^ ImageColorHistogram notNil |
|
9635 |
! |
|
9636 |
||
17686 | 9637 |
hasImageHistogram |
9638 |
^ ImageAlgorithms notNil |
|
9639 |
||
9640 |
"Created: / 10-09-2017 / 16:50:34 / cg" |
|
9641 |
! |
|
9642 |
||
10258 | 9643 |
hasSubversionSupport |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
9644 |
^ ConfigurableFeatures includesFeature: #SubversionSupport |
10258 | 9645 |
|
9646 |
"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
|
9647 |
"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
|
9648 |
"Modified: / 19-01-2012 / 10:43:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10258 | 9649 |
! |
9650 |
||
3892 | 9651 |
initialCommandFor:fileName into:aBox |
9652 |
"set a useful initial command for execute box." |
|
9653 |
||
18734 | 9654 |
self class |
9655 |
initialCommandFor:fileName |
|
9656 |
in:self "Filename" currentDirectory |
|
9657 |
intoBox:aBox |
|
9658 |
||
9659 |
"Modified: / 10-04-2019 / 05:55:21 / Claus Gittinger" |
|
3892 | 9660 |
! |
9661 |
||
9662 |
isAbstractFileBrowser |
|
9663 |
||
9664 |
^ true |
|
9665 |
! |
|
9666 |
||
18432 | 9667 |
stxgdbLoaded |
9668 |
^ (Smalltalk at:#GDBApplication) notNil |
|
9669 |
||
9670 |
"Created: / 26-09-2018 / 12:06:23 / Claus Gittinger" |
|
9671 |
! |
|
9672 |
||
9673 |
stxgdbMenuItemVisible |
|
9674 |
^ self stxgdbLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
|
9675 |
||
9676 |
"Created: / 26-09-2018 / 12:05:45 / Claus Gittinger" |
|
9677 |
! |
|
9678 |
||
3892 | 9679 |
systemIsDOS |
9680 |
^ OperatingSystem isMSDOSlike |
|
9681 |
! |
|
9682 |
||
12473 | 9683 |
systemIsOSX |
9684 |
^ OperatingSystem isOSXlike |
|
9685 |
! |
|
9686 |
||
3892 | 9687 |
systemIsUnix |
9688 |
^ OperatingSystem isUNIXlike |
|
14980 | 9689 |
! |
9690 |
||
9691 |
systemSupportsVolumes |
|
9692 |
^ OperatingSystem supportsVolumes |
|
3892 | 9693 |
! ! |
9694 |
||
9695 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
9696 |
||
9697 |
allItemsOfCurrentDirectory |
|
5009 | 9698 |
self |
4774 | 9699 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 9700 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
9701 |
||
9702 |
^ nil |
|
3892 | 9703 |
! |
9704 |
||
9705 |
anyFilesPresentWithSuffix:suffix |
|
6725 | 9706 |
self currentSelectedDirectories do:[:dir| |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9707 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
9708 |
(dir directoryContentsAsFilenamesDo:[:fn | (fn suffix = suffix) ifTrue:[ ^ true]]) |
19392 | 9709 |
] on:OpenError do:[:ex|]. |
3892 | 9710 |
]. |
9711 |
^ false. |
|
9712 |
! |
|
9713 |
||
19009 | 9714 |
commonPrefixOfFiles:files |
19015 | 9715 |
|stringCol commonPrefix| |
19009 | 9716 |
|
9717 |
stringCol := files collect:#asString. |
|
19015 | 9718 |
stringCol do:[:el| |
9719 |
commonPrefix := commonPrefix isNil |
|
9720 |
ifTrue:[el] |
|
9721 |
ifFalse:[commonPrefix commonPrefixWith:el]. |
|
9722 |
]. |
|
9723 |
commonPrefix isNil ifTrue:[^ nil]. |
|
9724 |
^ commonPrefix asFilename |
|
7560 | 9725 |
|
9726 |
"Modified: / 04-12-2006 / 13:14:25 / cg" |
|
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9727 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9728 |
|
19009 | 9729 |
commonPrefixOfSelectedFiles |
9730 |
|selFiles| |
|
9731 |
||
9732 |
selFiles := self currentSelectedObjects. |
|
9733 |
selFiles isEmpty ifTrue:[^ nil]. |
|
9734 |
||
9735 |
^ self commonPrefixOfFiles:selFiles |
|
9736 |
! |
|
9737 |
||
12481 | 9738 |
compressTabsOnSave |
9739 |
"if true, compress leading spaces (multiples of 8) with a tab character |
|
9740 |
when saving. |
|
9741 |
Default is true" |
|
9742 |
||
9743 |
^ true |
|
9744 |
! |
|
9745 |
||
3892 | 9746 |
currentFilesAreInSameDirectory |
9747 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9748 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 9749 |
! |
9750 |
||
9751 |
currentFilesHasDirectories |
|
9752 |
||
6725 | 9753 |
^ self currentSelectedDirectories notEmpty. |
3892 | 9754 |
! |
9755 |
||
3982 | 9756 |
directoriesForFiles:aFileCol |
19009 | 9757 |
^ aFileCol collect:[:eachName| self class getDirectoryOf:eachName] as:Set. |
3982 | 9758 |
! |
9759 |
||
3892 | 9760 |
fileListIsEmpty |
5009 | 9761 |
self |
9762 |
applicationNamed:#DirectoryContentsBrowser |
|
9763 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
9764 |
||
9765 |
^ nil. |
|
3892 | 9766 |
! |
9767 |
||
9768 |
fileListIsNotEmpty |
|
9769 |
||
9770 |
^ self fileListIsEmpty not. |
|
9771 |
! |
|
9772 |
||
9773 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 9774 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 9775 |
|
9776 |
| file1 file2 | |
|
9777 |
||
6284 | 9778 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 9779 |
file1 := aFilename1 asFilename. |
9780 |
file2 := aFilename2 asFilename. |
|
6284 | 9781 |
|
3892 | 9782 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 9783 |
|
3892 | 9784 |
((file1 isDirectory) |
9785 |
and:[(file2 isDirectory) |
|
9786 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 9787 |
^ file1 baseName = file2 baseName |
3892 | 9788 |
]. |
3982 | 9789 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 9790 |
! |
9791 |
||
9792 |
getAllFilesAsStringCollection |
|
5009 | 9793 |
self |
9794 |
applicationNamed:#DirectoryContentsBrowser |
|
9795 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
9796 |
||
9797 |
^ nil |
|
3892 | 9798 |
! |
9799 |
||
9800 |
getBestDirectory |
|
17868 | 9801 |
"from a set of directories, return the common parent directory" |
9802 |
||
9803 |
^ self class getBestDirectoryFrom:(self currentSelectedDirectories) |
|
3892 | 9804 |
! |
9805 |
||
9806 |
getDirWithoutFileName:aFileName |
|
19009 | 9807 |
<resource: #obsolete> |
9808 |
^ self class getDirectoryOf:aFileName |
|
3892 | 9809 |
! |
9810 |
||
9811 |
getInfoItem |
|
9812 |
"get filename of a description-file (.dir.info, README etc.); |
|
16778 | 9813 |
This file is automatically shown when a directory is entered. |
3892 | 9814 |
You can add more names below if you like." |
9815 |
||
5880 | 9816 |
|dir| |
9817 |
||
9818 |
dir := self theSingleSelectedDirectoryOrNil. |
|
9819 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 9820 |
|
16778 | 9821 |
#( |
3892 | 9822 |
'.dir.info' |
9823 |
'README' |
|
9824 |
'ReadMe' |
|
9825 |
'Readme' |
|
9826 |
'readme' |
|
9827 |
'read.me' |
|
9828 |
'Read.me' |
|
9829 |
'READ.ME' |
|
9830 |
'README.TXT' |
|
15915 | 9831 |
'README.txt' |
3892 | 9832 |
'readme.txt' |
9833 |
'Readme.txt' |
|
9834 |
'Info.txt' |
|
9835 |
'info.txt' |
|
9836 |
'INFO.TXT' |
|
15915 | 9837 |
'INFO.txt' |
16778 | 9838 |
) do:[:f | |
5883 | 9839 |
|n| |
4414 | 9840 |
|
5880 | 9841 |
n := dir construct:f. |
18453 | 9842 |
(n isReadable and:[n isRegularFile]) ifTrue:[ |
4414 | 9843 |
^ DirectoryContentsBrowser itemClass fileName:n |
9844 |
] |
|
3892 | 9845 |
]. |
9846 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9847 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9848 |
|
12497 | 9849 |
hasPackageDirectorySelected |
9850 |
|dir| |
|
9851 |
||
9852 |
dir := self currentDirectory. |
|
9853 |
^ dir notNil |
|
9854 |
and:[ dir exists |
|
9855 |
and:[ (dir / 'abbrev.stc') exists ]] |
|
9856 |
! |
|
9857 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9858 |
parentDirectoriesOfCurrentFiles |
11743 | 9859 |
^ self currentSelectedObjects |
9860 |
collect:[:file | file directory] as:Set |
|
7560 | 9861 |
|
9862 |
"Modified: / 04-12-2006 / 13:15:21 / cg" |
|
6521 | 9863 |
! |
9864 |
||
9865 |
recursiveAnyFilesPresentWithSuffix:suffix |
|
6652 | 9866 |
^ true. "/ the code below is too slow for a menu enabling operation |
9867 |
||
9868 |
"/ |directories| |
|
9869 |
"/ |
|
9870 |
"/ directories := self currentDirectories value. |
|
9871 |
"/ directories do:[:dir| |
|
9872 |
"/ [ |
|
9873 |
"/ dir recursiveDirectoryContentsDo:[:f | |
|
9874 |
"/ (f asFilename suffix = suffix) ifTrue:[ ^ true] |
|
9875 |
"/ ] |
|
9876 |
"/ ] on:FileStream openErrorSignal do:[:ex|]. |
|
9877 |
"/ ]. |
|
9878 |
"/ ^ false. |
|
6586 | 9879 |
! |
9880 |
||
9881 |
recursiveAnySTFilesPresent |
|
9882 |
^ self recursiveAnyFilesPresentWithSuffix:'st' |
|
3982 | 9883 |
! ! |
9884 |
||
9885 |
!AbstractFileBrowser methodsFor:'selection'! |
|
9886 |
||
9887 |
currentSelectedDirectories |
|
6725 | 9888 |
^ self currentDirectoriesValue. |
3982 | 9889 |
! |
9890 |
||
9891 |
currentSelectedFiles |
|
17865 | 9892 |
^ self currentSelectedObjects reject:#isDirectory. |
7560 | 9893 |
|
9894 |
"Modified: / 04-12-2006 / 13:14:39 / cg" |
|
3982 | 9895 |
! |
9896 |
||
6460 | 9897 |
currentSelectedObjects |
9898 |
^ self currentFileNameHolder value |
|
9899 |
! |
|
9900 |
||
3982 | 9901 |
firstSelectedFile |
7560 | 9902 |
^ self currentSelectedObjects |
12102 | 9903 |
detect:[:file | (file ? '') asFilename isDirectory not] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9904 |
ifNone:[]. |
7560 | 9905 |
|
9906 |
"Modified: / 04-12-2006 / 13:14:50 / cg" |
|
4414 | 9907 |
! |
9908 |
||
9490 | 9909 |
hasOnlyDirectoriesSelected |
9910 |
^ self currentSelectedObjects conform:[:file | file isDirectory]. |
|
9911 |
||
9912 |
"Created: / 20-05-2010 / 10:45:03 / cg" |
|
9913 |
! |
|
9914 |
||
4414 | 9915 |
hasOnlyFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9916 |
|
7560 | 9917 |
^ self currentSelectedObjects conform:[:file | file isDirectory not]. |
9918 |
||
9919 |
"Modified: / 04-12-2006 / 13:15:01 / cg" |
|
4414 | 9920 |
! |
9921 |
||
9490 | 9922 |
hasTwoDirectoriesSelected |
9923 |
||
9924 |
^ self currentSelectedObjects size == 2 |
|
9925 |
and:[self hasOnlyDirectoriesSelected] |
|
9926 |
||
9927 |
"Created: / 20-05-2010 / 10:45:18 / cg" |
|
9928 |
! |
|
9929 |
||
4414 | 9930 |
hasTwoFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9931 |
|
7560 | 9932 |
^ self currentSelectedObjects size == 2 |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9933 |
and:[self hasOnlyFilesSelected] |
7560 | 9934 |
|
9935 |
"Modified: / 04-12-2006 / 13:15:04 / cg" |
|
14577 | 9936 |
! |
9937 |
||
18751 | 9938 |
selectFiles:aCollectionOfFiles |
9939 |
self subclassResponsibility |
|
9940 |
||
9941 |
"Created: / 02-05-2019 / 18:40:04 / Claus Gittinger" |
|
9942 |
! |
|
9943 |
||
14577 | 9944 |
selectNextFile |
9945 |
self |
|
9946 |
applicationNamed:#DirectoryContentsBrowser |
|
9947 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectNextFile ]]. |
|
9948 |
! |
|
9949 |
||
9950 |
selectPreviousFile |
|
9951 |
self |
|
9952 |
applicationNamed:#DirectoryContentsBrowser |
|
9953 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectPreviousFile ]]. |
|
18751 | 9954 |
! |
9955 |
||
9956 |
selectedItems |
|
9957 |
self subclassResponsibility |
|
9958 |
||
9959 |
"Created: / 02-05-2019 / 21:27:38 / Claus Gittinger" |
|
3892 | 9960 |
! ! |
9961 |
||
3964 | 9962 |
!AbstractFileBrowser methodsFor:'sorting'! |
9963 |
||
3989 | 9964 |
currentSortOrder |
17790 | 9965 |
^ self |
9966 |
aspectFor:#currentSortOrder |
|
9967 |
ifAbsent:[ |
|
9968 |
(Dictionary new |
|
9969 |
at:#column put:nil; |
|
9970 |
at:#reverse put:false; |
|
9971 |
at:#sortCaseless put:false; |
|
9972 |
yourself |
|
9973 |
) asValue |
|
9974 |
]. |
|
9975 |
||
9976 |
"Modified: / 25-11-2017 / 17:43:00 / cg" |
|
3989 | 9977 |
! |
9978 |
||
9979 |
sortBlockHolder |
|
9980 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 9981 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9982 |
selector:#fileName |
|
9983 |
sortCaseless:self sortCaseless value |
|
9984 |
sortReverse:false) asValue. |
|
3989 | 9985 |
]. |
9986 |
! |
|
9987 |
||
9988 |
sortBlockProperty |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9989 |
|v| |
4027 | 9990 |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9991 |
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
|
9992 |
v addDependent:self. |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9993 |
^ v. |
3989 | 9994 |
! |
9995 |
||
9996 |
sortCaseless |
|
4201 | 9997 |
" aspect for sort caseless " |
3989 | 9998 |
|
13000 | 9999 |
^ self |
10000 |
aspectFor:#sortCaseless |
|
10001 |
ifAbsent:[ (Filename isCaseSensitive not) asValue ] |
|
3989 | 10002 |
! |
10003 |
||
4074 | 10004 |
sortDirectoriesBeforeFiles |
10005 |
||
4201 | 10006 |
" aspect for sort directories always before files" |
4074 | 10007 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
10008 |
! |
|
10009 |
||
3989 | 10010 |
sortFileListsBy:instanceName |
10011 |
||
10012 |
self sortFileListsBy:instanceName withReverse:true |
|
10013 |
! |
|
10014 |
||
10015 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
10016 |
| aSymbol sortCaselessLocal currentSortOrder sorter isReverse| |
3964 | 10017 |
|
10018 |
aSymbol := instanceName asSymbol. |
|
4027 | 10019 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 10020 |
sortCaselessLocal := self sortCaseless value. |
4027 | 10021 |
currentSortOrder := self currentSortOrder value. |
17790 | 10022 |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
10023 |
currentSortOrder isEmptyOrNil ifTrue:[ |
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
10024 |
self currentSortOrder value:(currentSortOrder := Dictionary new). |
4343 | 10025 |
currentSortOrder at:#column put:aSymbol. |
10026 |
currentSortOrder at:#reverse put:false. |
|
10027 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 10028 |
] ifFalse:[ |
4343 | 10029 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
10030 |
"/ sort caseless changed |
|
10031 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
10032 |
] ifFalse:[ |
|
10033 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
10034 |
"/ same column like before - change sort order ifReverse is true |
|
10035 |
aBoolean ifTrue:[ |
|
10036 |
isReverse := currentSortOrder at:#reverse. |
|
10037 |
currentSortOrder at:#reverse put:(isReverse not). |
|
10038 |
]. |
|
10039 |
] ifFalse:[ |
|
10040 |
"/ another column - remark column |
|
10041 |
currentSortOrder at:#column put:aSymbol. |
|
10042 |
] |
|
10043 |
] |
|
3964 | 10044 |
]. |
4027 | 10045 |
self currentSortOrder changed. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
10046 |
|
5383 | 10047 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
10048 |
selector:instanceName |
|
10049 |
sortCaseless:sortCaselessLocal |
|
10050 |
sortReverse:(currentSortOrder at:#reverse). |
|
10051 |
self sortBlockHolder value:sorter. |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
10052 |
|
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
10053 |
"Modified: / 18-09-2007 / 09:42:47 / cg" |
17790 | 10054 |
"Modified (format): / 25-11-2017 / 17:43:31 / cg" |
3964 | 10055 |
! ! |
10056 |
||
3892 | 10057 |
!AbstractFileBrowser methodsFor:'startup & release'! |
10058 |
||
16720 | 10059 |
initializeAspects |
10060 |
aspects := IdentityDictionary new. |
|
10061 |
aspects at:#applications put:(IdentityDictionary new). |
|
10062 |
! |
|
10063 |
||
3892 | 10064 |
makeDependent |
4074 | 10065 |
self filterModel addDependent:self. |
4004 | 10066 |
self currentFileNameHolder addDependent:self. |
4074 | 10067 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 10068 |
self sortCaseless addDependent:self. |
4011 | 10069 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
10070 |
self rootHolder addDependent:self. |
3892 | 10071 |
! |
10072 |
||
10073 |
masterApplication:anApplication |
|
10074 |
||
10075 |
masterApplication isNil ifTrue:[ |
|
4414 | 10076 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
10077 |
aspects := anApplication aspects |
|
10078 |
] ifFalse:[ |
|
10079 |
aspects isNil ifTrue:[ |
|
16721 | 10080 |
self initializeAspects. |
4414 | 10081 |
] |
10082 |
]. |
|
10083 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10084 |
"/ self makeDependent. |
3892 | 10085 |
]. |
3952 | 10086 |
^ super masterApplication:anApplication. |
3892 | 10087 |
! |
10088 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10089 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10090 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10091 |
super postBuildWith:aBuilder. |
3892 | 10092 |
! ! |
10093 |
||
10094 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
10095 |
||
10096 |
files |
|
10097 |
"return the value of the instance variable 'files' (automatically generated)" |
|
10098 |
||
10099 |
^ files |
|
10100 |
! |
|
10101 |
||
10102 |
files:something |
|
10103 |
"set the value of the instance variable 'files' (automatically generated)" |
|
10104 |
||
10105 |
files := something. |
|
10106 |
! |
|
10107 |
||
10108 |
method |
|
10109 |
"return the value of the instance variable 'method' (automatically generated)" |
|
10110 |
||
10111 |
^ method |
|
10112 |
! |
|
10113 |
||
10114 |
method:something |
|
10115 |
"set the value of the instance variable 'method' (automatically generated)" |
|
10116 |
||
10117 |
method := something. |
|
10118 |
! ! |
|
10119 |
||
10120 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
10121 |
||
10122 |
locked |
|
10123 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
10124 |
||
10125 |
locked isNil ifTrue:[ |
|
4414 | 10126 |
locked := false. |
3892 | 10127 |
]. |
10128 |
^ locked |
|
10129 |
! ! |
|
10130 |
||
10131 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
10132 |
||
10133 |
doIfUnLocked:aBlock |
|
10134 |
||
10135 |
self locked ifFalse:[ |
|
4414 | 10136 |
aBlock value. |
3892 | 10137 |
]. |
10138 |
! |
|
10139 |
||
10140 |
doLocked:aBlock |
|
10141 |
||
10142 |
locked := true. |
|
4004 | 10143 |
aBlock ensure:[ |
4414 | 10144 |
locked := false. |
4004 | 10145 |
] |
3892 | 10146 |
! ! |
10147 |
||
3952 | 10148 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
10149 |
||
6369 | 10150 |
defaultHistorySize |
10151 |
^ 50 |
|
3892 | 10152 |
! ! |
10153 |
||
6371 | 10154 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 10155 |
|
10156 |
new |
|
6371 | 10157 |
^ (super new) initializeHistory. |
6369 | 10158 |
! ! |
10159 |
||
10160 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
10161 |
||
10162 |
historySize |
|
10163 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
10164 |
^ historySize |
|
10165 |
! |
|
10166 |
||
10167 |
historySize:aNumber |
|
10168 |
historySize := aNumber |
|
4032 | 10169 |
! ! |
10170 |
||
3892 | 10171 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
10172 |
||
3952 | 10173 |
addToHistory:aPath |
15803 | 10174 |
| item pathToAdd sep| |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10175 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10176 |
pathToAdd := aPath. |
15803 | 10177 |
(pathToAdd endsWith:(sep := Filename separator)) ifTrue:[ |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10178 |
pathToAdd asFilename isRootDirectory ifFalse:[ |
15803 | 10179 |
pathToAdd := pathToAdd copyButLast:(sep asString size). |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10180 |
] |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10181 |
]. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10182 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10183 |
item := self getItemFor:pathToAdd. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10184 |
self backForwardListAdd:pathToAdd. |
3952 | 10185 |
item isNil ifTrue:[ |
4347 | 10186 |
" not already in history" |
6369 | 10187 |
self size >= self historySize ifTrue:[ |
4347 | 10188 |
self removeLast. |
10189 |
]. |
|
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10190 |
item := DirectoryHistoryItem path:pathToAdd. |
3952 | 10191 |
] ifFalse:[ |
4347 | 10192 |
"already been there before; move the entry to |
10193 |
the beginning, so it will fall out later." |
|
10194 |
self remove:item. |
|
10381
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10195 |
]. |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10196 |
self addFirst:item |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10197 |
|
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10198 |
"Modified: / 24-07-2011 / 07:12:54 / cg" |
3952 | 10199 |
! |
10200 |
||
4347 | 10201 |
backForwardListAdd:aPath |
10202 |
|pathIndex| |
|
10203 |
||
10204 |
pathIndex := backForwardList indexOf:aPath. |
|
10205 |
pathIndex == 0 ifTrue:[ |
|
10206 |
" a new path comes in remove forward paths " |
|
10207 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
10208 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
10209 |
]. |
|
10210 |
] ifFalse:[ |
|
10211 |
backForwardList remove:aPath. |
|
10212 |
pathIndex <= backForwardIndex ifTrue:[ |
|
10213 |
backForwardIndex := backForwardIndex - 1. |
|
10214 |
] |
|
4022 | 10215 |
]. |
4347 | 10216 |
backForwardList add:aPath afterIndex:backForwardIndex. |
10217 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 10218 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 10219 |
backForwardList removeFirst. |
10220 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 10221 |
]. |
4347 | 10222 |
! |
10223 |
||
10224 |
goBackward |
|
4288 | 10225 |
"return the first path of the backward list; |
10226 |
remove it from the back list and add it ti the forward list." |
|
4022 | 10227 |
|
4347 | 10228 |
|retPath| |
10229 |
||
10230 |
self canBackward ifTrue:[ |
|
10231 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
10232 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 10233 |
]. |
4022 | 10234 |
^ retPath. |
10235 |
! |
|
10236 |
||
10237 |
goForward |
|
4288 | 10238 |
"return the first path of the forward list; |
10239 |
remove it from the list." |
|
4022 | 10240 |
|
4347 | 10241 |
|retPath| |
10242 |
||
10243 |
self canForward ifTrue:[ |
|
10244 |
retPath := backForwardList at:backForwardIndex + 1. |
|
10245 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 10246 |
]. |
4022 | 10247 |
^ retPath. |
10248 |
! |
|
10249 |
||
10250 |
resetForwardBackward |
|
10251 |
||
4347 | 10252 |
self initialize |
4022 | 10253 |
! |
10254 |
||
10255 |
setPosition:aPosition for:aPath |
|
10256 |
||
10257 |
self do:[:item| |
|
4414 | 10258 |
item path = aPath ifTrue:[ |
10259 |
item position:aPosition. |
|
10260 |
] |
|
4022 | 10261 |
]. |
3892 | 10262 |
! ! |
10263 |
||
4870 | 10264 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 10265 |
|
6371 | 10266 |
initializeHistory |
4032 | 10267 |
|
4347 | 10268 |
backForwardList := OrderedCollection new. |
10269 |
self reverseDo:[:el| |
|
10270 |
backForwardList add:el path. |
|
10271 |
]. |
|
10272 |
backForwardIndex := backForwardList size. |
|
4032 | 10273 |
! ! |
10274 |
||
3892 | 10275 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
10276 |
||
4288 | 10277 |
canBackward |
4347 | 10278 |
|
10279 |
^ backForwardIndex > 1 |
|
4288 | 10280 |
! |
10281 |
||
3892 | 10282 |
canForward |
4347 | 10283 |
|
10284 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
10285 |
! |
|
10286 |
||
10287 |
getBackCollection |
|
10288 |
||
10289 |
| backCol | |
|
10290 |
||
10291 |
backCol := OrderedCollection new. |
|
10292 |
self canBackward ifTrue:[ |
|
10293 |
| tmpCol | |
|
10294 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
10295 |
tmpCol reverseDo:[ :el| |
|
10296 |
backCol add:el. |
|
10297 |
] |
|
10298 |
]. |
|
10299 |
^ backCol |
|
3952 | 10300 |
! |
10301 |
||
10302 |
getForwardCollection |
|
10303 |
||
4347 | 10304 |
| forwCol | |
10305 |
||
10306 |
forwCol := OrderedCollection new. |
|
10307 |
self canForward ifTrue:[ |
|
10308 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
10309 |
]. |
|
10310 |
^ forwCol |
|
3952 | 10311 |
! |
10312 |
||
10313 |
getItemFor:aPath |
|
6627 | 10314 |
^ self detect:[:item| item path = aPath] ifNone:nil. |
10315 |
"/ self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
10316 |
"/ ^ nil. |
|
3952 | 10317 |
! |
10318 |
||
10319 |
getPositionFor:aPath |
|
10320 |
||
10321 |
|item| |
|
10322 |
||
10323 |
item := self getItemFor:aPath. |
|
10324 |
||
10325 |
item notNil ifTrue:[ |
|
4414 | 10326 |
^ item position. |
3952 | 10327 |
]. |
10328 |
^ nil |
|
10329 |
! |
|
10330 |
||
10331 |
includesPath:aPath |
|
6627 | 10332 |
^ self contains:[:item | item path = aPath]. |
10333 |
||
10334 |
"/ self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
10335 |
"/ ^ false. |
|
4347 | 10336 |
! |
10337 |
||
10338 |
nextBackwardItem |
|
10339 |
"return the first path of the backward list" |
|
10340 |
||
10341 |
|retPath| |
|
10342 |
||
10343 |
self canBackward ifTrue:[ |
|
10344 |
retPath := backForwardList at:backForwardIndex. |
|
10345 |
]. |
|
10346 |
^ retPath. |
|
10347 |
! |
|
10348 |
||
10349 |
nextForwardItem |
|
10350 |
"return the first path of the forward list" |
|
10351 |
||
10352 |
|retPath| |
|
10353 |
||
10354 |
self canForward ifTrue:[ |
|
10355 |
retPath := backForwardList at:backForwardIndex + 1. |
|
10356 |
]. |
|
10357 |
^ retPath. |
|
3952 | 10358 |
! ! |
10359 |
||
10360 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
10361 |
||
10362 |
path:aPath |
|
10363 |
||
10364 |
^ self new path:aPath |
|
10365 |
! ! |
|
10366 |
||
10367 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
10368 |
||
6433 | 10369 |
asFilename |
10370 |
^ path asFilename |
|
10371 |
! |
|
10372 |
||
3952 | 10373 |
path |
10374 |
"return the value of the instance variable 'path' (automatically generated)" |
|
10375 |
||
10376 |
^ path |
|
10377 |
! |
|
10378 |
||
10379 |
path:something |
|
10380 |
"set the value of the instance variable 'path' (automatically generated)" |
|
10381 |
||
10382 |
path := something. |
|
10383 |
! |
|
10384 |
||
10385 |
position |
|
10386 |
"return the value of the instance variable 'position' (automatically generated)" |
|
10387 |
||
10388 |
^ position |
|
10389 |
! |
|
10390 |
||
10391 |
position:something |
|
10392 |
"set the value of the instance variable 'position' (automatically generated)" |
|
10393 |
||
10394 |
position := something. |
|
10395 |
! |
|
10396 |
||
10397 |
printString |
|
10398 |
||
10399 |
^ self path asString |
|
3892 | 10400 |
! ! |
10401 |
||
10402 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
10403 |
||
10404 |
withValue:aValue isHolder:aBoolean |
|
10405 |
||
10406 |
| instance | |
|
10407 |
||
10408 |
instance := self basicNew. |
|
10409 |
instance value:aValue. |
|
10410 |
instance isHolder:aBoolean. |
|
10411 |
^ instance |
|
10412 |
! ! |
|
10413 |
||
10414 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
10415 |
||
10416 |
isHolder |
|
10417 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
10418 |
||
10419 |
^ isHolder |
|
10420 |
! |
|
10421 |
||
18931 | 10422 |
isHolder:aBoolean |
3892 | 10423 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
10424 |
||
18931 | 10425 |
isHolder := aBoolean. |
10426 |
||
10427 |
"Modified (format): / 19-07-2019 / 09:52:35 / Claus Gittinger" |
|
3892 | 10428 |
! |
10429 |
||
10430 |
value |
|
10431 |
"return the value of the instance variable 'value' (automatically generated)" |
|
10432 |
||
10433 |
^ value |
|
10434 |
! |
|
10435 |
||
10436 |
value:something |
|
10437 |
"set the value of the instance variable 'value' (automatically generated)" |
|
10438 |
||
10439 |
value := something. |
|
10440 |
! ! |
|
10441 |
||
10442 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
10443 |
||
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10444 |
version |
15803 | 10445 |
^ '$Header$' |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10446 |
! |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10447 |
|
8832 | 10448 |
version_CVS |
15803 | 10449 |
^ '$Header$' |
3892 | 10450 |
! ! |
12094 | 10451 |