author | Claus Gittinger <cg@exept.de> |
Wed, 05 Jun 2019 14:16:59 +0200 | |
changeset 18805 | f6df57c6dbfb |
parent 18775 | 24687514152a |
child 18820 | 0dece51338cb |
permissions | -rw-r--r-- |
5140 | 1 |
" |
2 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
15211 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
14 |
"{ NameSpace: Smalltalk }" |
|
15 |
||
16 |
ApplicationModel subclass:#AbstractFileBrowser |
|
17 |
instanceVariableNames:'aspects' |
|
16720 | 18 |
classVariableNames:'CommandHistory CommandHistorySize DefaultCommandPerSuffix |
19 |
DefaultFilters DirectoryBookmarks LastEnforcedNameSpace |
|
20 |
LastFileDiffDirectory LastFileDiffFile LastFileSelection |
|
21 |
LastMercurialRepository LastMoveDestination LastMustMatchPattern |
|
18609 | 22 |
LastScriptBlockString MaxFileSizeShownWithoutAsking RootHolder |
23 |
RuntimeAspects VisitedDirectories' |
|
15211 | 24 |
poolDictionaries:'' |
25 |
category:'Interface-Tools-File' |
|
26 |
! |
|
3892 | 27 |
|
28 |
AbstractFileBrowser class instanceVariableNames:'DisabledCursorImage EnabledCursorImage' |
|
29 |
||
30 |
" |
|
31 |
The following class instance variables are inherited by this class: |
|
32 |
||
14126 | 33 |
ApplicationModel - ClassResources |
34 |
Model - |
|
35 |
Object - |
|
3892 | 36 |
" |
37 |
! |
|
38 |
||
39 |
Object subclass:#Clipboard |
|
14126 | 40 |
instanceVariableNames:'method files' |
41 |
classVariableNames:'' |
|
42 |
poolDictionaries:'' |
|
43 |
privateIn:AbstractFileBrowser |
|
3892 | 44 |
! |
45 |
||
46 |
Object subclass:#CodeExecutionLock |
|
14126 | 47 |
instanceVariableNames:'locked' |
48 |
classVariableNames:'' |
|
49 |
poolDictionaries:'' |
|
50 |
privateIn:AbstractFileBrowser |
|
3892 | 51 |
! |
52 |
||
4366 | 53 |
List subclass:#DirectoryHistory |
14126 | 54 |
instanceVariableNames:'forwardList backList lastWasForwardPath lastBackPath lastAddPath |
55 |
backForwardList backForwardIndex historySize' |
|
56 |
classVariableNames:'HistorySize' |
|
57 |
poolDictionaries:'' |
|
58 |
privateIn:AbstractFileBrowser |
|
3952 | 59 |
! |
60 |
||
61 |
Object subclass:#DirectoryHistoryItem |
|
14126 | 62 |
instanceVariableNames:'path position' |
63 |
classVariableNames:'' |
|
64 |
poolDictionaries:'' |
|
65 |
privateIn:AbstractFileBrowser::DirectoryHistory |
|
3892 | 66 |
! |
67 |
||
68 |
Object subclass:#SaveAspectItem |
|
14126 | 69 |
instanceVariableNames:'value isHolder' |
70 |
classVariableNames:'' |
|
71 |
poolDictionaries:'' |
|
72 |
privateIn:AbstractFileBrowser |
|
3892 | 73 |
! |
74 |
||
5140 | 75 |
!AbstractFileBrowser class methodsFor:'documentation'! |
76 |
||
77 |
copyright |
|
78 |
" |
|
79 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
80 |
All Rights Reserved |
|
81 |
||
82 |
This software is furnished under a license and may be used |
|
83 |
only in accordance with the terms of that license and with the |
|
84 |
inclusion of the above copyright notice. This software may not |
|
85 |
be provided or otherwise made available to, or used by, any |
|
86 |
other person. No title to or ownership of the software is |
|
87 |
hereby transferred. |
|
88 |
" |
|
5967 | 89 |
! |
90 |
||
91 |
documentation |
|
92 |
" |
|
93 |
[Author:] |
|
94 |
Christian Penk |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
95 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
96 |
Notice: this certainly needs a redesign - all those abstract-abstract classes which |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
97 |
define stuff which is only needed in some parts makes this hard to understand. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
98 |
Especially the fact, that AbstractFileBrowser defines things both as abstract superclass |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
99 |
and as a container is almost incomprehensable... |
17768 | 100 |
|
101 |
[class variables:] |
|
102 |
CommandHistory |
|
103 |
CommandHistorySize |
|
104 |
DefaultCommandPerSuffix |
|
105 |
DefaultFilters |
|
106 |
DirectoryBookmarks |
|
107 |
LastEnforcedNameSpace |
|
108 |
LastFileDiffDirectory |
|
109 |
LastFileDiffFile |
|
110 |
LastFileSelection |
|
111 |
LastMercurialRepository |
|
112 |
LastMoveDestination |
|
113 |
LastMustMatchPattern |
|
114 |
LastScriptBlockString |
|
115 |
RootHolder |
|
116 |
RuntimeAspects |
|
117 |
VisitedDirectories |
|
118 |
MaxFileSizeShownWithoutAsking ..... for big files, I will ask if only the first part is |
|
119 |
to be shown. This number (if non-nil) suppresses this |
|
120 |
question for files smaller. |
|
121 |
The initial default is 1Mb (1024*1024) |
|
5967 | 122 |
" |
5140 | 123 |
! ! |
3892 | 124 |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
125 |
!AbstractFileBrowser class methodsFor:'accessing'! |
3952 | 126 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
127 |
currentSelection |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
128 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
129 |
LastFileSelection isNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
130 |
LastFileSelection := #(). |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
131 |
]. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
132 |
^ LastFileSelection |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
133 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
134 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
135 |
currentSelection:aFilenameCol |
6589 | 136 |
aFilenameCol notEmptyOrNil ifTrue:[ |
12102 | 137 |
LastFileSelection := aFilenameCol collect:[:file | (file ? '') asFilename] |
6589 | 138 |
] |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
139 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
140 |
|
3952 | 141 |
directoryHistory |
142 |
||
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
143 |
VisitedDirectories isNil ifTrue:[ |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
144 |
VisitedDirectories := self directoryHistoryClass new. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
145 |
"/ VisitedDirectories inspect. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
146 |
]. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
147 |
^ VisitedDirectories |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
148 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
149 |
"Modified: / 21-11-2012 / 08:45:49 / cg" |
3952 | 150 |
! |
151 |
||
17768 | 152 |
maxFileSizeShownWithoutAsking |
153 |
"the max. filesize which is loaded without asking if only the first |
|
154 |
part should be shown" |
|
18770 | 155 |
|
156 |
MaxFileSizeShownWithoutAsking notNil ifTrue:[^ MaxFileSizeShownWithoutAsking]. |
|
157 |
ExternalAddress pointerSize == 8 ifTrue:[ |
|
158 |
^ (32*1024*1024) |
|
159 |
]. |
|
160 |
^ (4*1024*1024) |
|
17768 | 161 |
|
162 |
"Created: / 19-11-2017 / 14:48:19 / cg" |
|
18770 | 163 |
"Modified: / 22-05-2019 / 18:19:24 / Claus Gittinger" |
17768 | 164 |
! |
165 |
||
166 |
maxFileSizeShownWithoutAsking:anIntegerOrNilForDefault |
|
167 |
"the max. filesize which is loaded without asking if only the first |
|
17769 | 168 |
part should be shown. |
169 |
Nil resets to the default (currently 1Mb)" |
|
17768 | 170 |
|
171 |
MaxFileSizeShownWithoutAsking := anIntegerOrNilForDefault |
|
172 |
||
17769 | 173 |
" |
174 |
self maxFileSizeShownWithoutAsking:nil |
|
175 |
" |
|
176 |
||
17768 | 177 |
"Created: / 19-11-2017 / 14:48:45 / cg" |
178 |
! |
|
179 |
||
3952 | 180 |
resetClassVars |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
181 |
VisitedDirectories := nil. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
182 |
LastFileSelection := nil. |
5936 | 183 |
|
184 |
" |
|
185 |
AbstractFileBrowser resetClassVars |
|
186 |
" |
|
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
187 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
188 |
"Modified: / 21-11-2012 / 08:45:53 / cg" |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
189 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
190 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
191 |
rootHolder |
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 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
196 |
rootHolder:aRoot |
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 |
3952 | 199 |
! ! |
200 |
||
4915 | 201 |
!AbstractFileBrowser class methodsFor:'accessing-bookmarks'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
202 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
203 |
addBookmark:aDirectoryPath |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
204 |
"add aDirectoryPath to the list of our known bookmarks. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
205 |
Do not add duplicates." |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
206 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
207 |
|bookmarks| |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
208 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
209 |
bookmarks := self directoryBookmarks. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
210 |
(bookmarks includes:aDirectoryPath) ifFalse:[ |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
211 |
bookmarks add:aDirectoryPath asFilename. |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
212 |
]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
213 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
214 |
|
8013 | 215 |
bookmarksFrom:aFileNameOrString |
12390 | 216 |
|bookmarks s fileName line| |
8013 | 217 |
|
218 |
fileName := aFileNameOrString asFilename. |
|
219 |
[ |
|
220 |
s := fileName readStream. |
|
221 |
] on:OpenError do:[:ex| |
|
222 |
^ nil. |
|
223 |
]. |
|
224 |
||
225 |
bookmarks := OrderedCollection new. |
|
226 |
[s atEnd] whileFalse:[ |
|
12390 | 227 |
line := s nextLine. |
228 |
(line startsWith:';') ifFalse:[ |
|
229 |
bookmarks add:(Base64Coder decode:line) asString. |
|
230 |
] |
|
8013 | 231 |
]. |
232 |
s close. |
|
233 |
||
234 |
^ bookmarks |
|
235 |
! |
|
236 |
||
4679 | 237 |
defaultBookMarksFileDirectory |
12390 | 238 |
"the directory, where the default bookmarks are stored (as defaultBookMarksFilename)" |
239 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
240 |
^ Filename homeDirectory |
4679 | 241 |
! |
242 |
||
243 |
defaultBookMarksFilename |
|
12390 | 244 |
"the filename, in which the default bookmarks are stored (in defaultBookMarksDirectory)" |
245 |
||
4679 | 246 |
^ '.fileBrowserBookmarks' |
247 |
! |
|
248 |
||
249 |
directoryBookmarks |
|
250 |
DirectoryBookmarks isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
251 |
self loadBookmarksFrom:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename). |
4679 | 252 |
|
253 |
DirectoryBookmarks isEmptyOrNil ifTrue:[ |
|
17979 | 254 |
DirectoryBookmarks := |
255 |
OrderedCollection |
|
256 |
with:(Filename homeDirectory asAbsoluteFilename) |
|
257 |
with:(Filename currentDirectory asAbsoluteFilename). |
|
4679 | 258 |
] |
259 |
]. |
|
260 |
^ DirectoryBookmarks |
|
261 |
||
262 |
" |
|
5438
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
263 |
DirectoryBookmarks := nil. |
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
264 |
self directoryBookmarks. |
4679 | 265 |
" |
266 |
! |
|
267 |
||
8013 | 268 |
directoryBookmarks: collectionOfFilenames |
269 |
||
270 |
DirectoryBookmarks := collectionOfFilenames. |
|
271 |
self saveBookmarksInDefaultBookmarksFile. |
|
272 |
! |
|
273 |
||
274 |
editBookmarksWithDefault: aFilenameOrNil |
|
275 |
| oldBookmarks newBookmarks | |
|
276 |
||
277 |
oldBookmarks := self directoryBookmarks copy. |
|
278 |
newBookmarks := BookmarksEditDialog openWith: oldBookmarks defaultBookmark: aFilenameOrNil. |
|
279 |
newBookmarks isNil ifTrue:[^ self]. |
|
280 |
self directoryBookmarks: newBookmarks. |
|
9681
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
281 |
|
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
282 |
"Modified: / 13-01-2011 / 12:52:28 / cg" |
8013 | 283 |
! |
284 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
285 |
hasBookmarks |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
286 |
^ self directoryBookmarks notEmptyOrNil |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
287 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
288 |
|
4679 | 289 |
loadBookmarksFrom:aFileNameOrString |
8013 | 290 |
|bookmarks| |
291 |
||
292 |
bookmarks := self bookmarksFrom: aFileNameOrString. |
|
293 |
bookmarks isNil ifTrue:[^ self]. |
|
4679 | 294 |
|
295 |
DirectoryBookmarks := OrderedCollection new. |
|
296 |
bookmarks do:[:eachPath | |
|
297 |
self addBookmark:eachPath asFilename |
|
298 |
]. |
|
299 |
! |
|
300 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
301 |
removeBookmark:aDirectoryPath |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
302 |
|bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
303 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
304 |
bookmarks := self directoryBookmarks. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
305 |
bookmarks isEmptyOrNil ifTrue:[ ^ self]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
306 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
307 |
bookmarks remove:aDirectoryPath ifAbsent:[]. |
4679 | 308 |
! |
309 |
||
310 |
saveBookmarks |
|
311 |
|fn| |
|
312 |
||
313 |
fn := Dialog |
|
18747 | 314 |
requestFileNameForSave:(self resources string:'Save Bookmarks') |
4679 | 315 |
default:(self defaultBookMarksFilename) |
316 |
fromDirectory:(self defaultBookMarksFileDirectory). |
|
317 |
fn isEmptyOrNil ifTrue:[^ self]. |
|
318 |
||
319 |
self saveBookmarksIn:fn |
|
9607 | 320 |
|
321 |
"Modified: / 27-10-2010 / 11:27:09 / cg" |
|
18747 | 322 |
"Modified: / 01-05-2019 / 11:45:37 / Claus Gittinger" |
4679 | 323 |
! |
324 |
||
8013 | 325 |
saveBookmarks: bookmarks in:aFileNameOrString |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
326 |
"save the bokmarks in aFileNameOrString. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
327 |
Use Base64 coding" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
328 |
|
13683 | 329 |
|bookmarkStream fileName coder| |
4679 | 330 |
|
331 |
fileName := aFileNameOrString asFilename. |
|
332 |
fileName exists ifTrue:[ |
|
13683 | 333 |
fileName renameTo:(fileName addSuffix:'sav'). |
4679 | 334 |
]. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
335 |
bookmarkStream := fileName writeStream. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
336 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
337 |
"save each bookmark in one line" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
338 |
coder := (Base64Coder on:bookmarkStream) lineLimit:nil. |
4679 | 339 |
bookmarks do:[:eachPath | |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
340 |
eachPath asFilename pathName acceptVisitor:coder. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
341 |
coder flush. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
342 |
bookmarkStream cr. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
343 |
]. |
12391 | 344 |
bookmarkStream syncData; close. |
5960 | 345 |
! |
346 |
||
8013 | 347 |
saveBookmarksIn:aFileNameOrString |
348 |
"save the bokmarks in aFileNameOrString. |
|
349 |
Use Base64 coding" |
|
350 |
||
351 |
| bookmarks | |
|
352 |
||
353 |
bookmarks := self directoryBookmarks. |
|
354 |
self saveBookmarks: bookmarks in:aFileNameOrString |
|
355 |
! |
|
356 |
||
5960 | 357 |
saveBookmarksInDefaultBookmarksFile |
358 |
self saveBookmarksIn:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename) |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
359 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
360 |
|
4915 | 361 |
!AbstractFileBrowser class methodsFor:'accessing-classes'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
362 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
363 |
directoryHistoryClass |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
364 |
^ DirectoryHistory |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
365 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
366 |
"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
|
367 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
368 |
|
3892 | 369 |
!AbstractFileBrowser class methodsFor:'defaults'! |
370 |
||
371 |
commandHistory |
|
372 |
||
373 |
CommandHistory isNil ifTrue:[ |
|
4414 | 374 |
CommandHistory := OrderedCollection new. |
3892 | 375 |
]. |
376 |
^ CommandHistory |
|
377 |
! |
|
378 |
||
379 |
commandHistorySize |
|
4190 | 380 |
"max no of entries in the HistoryList " |
6369 | 381 |
|
3892 | 382 |
CommandHistorySize isNil ifTrue:[ |
6369 | 383 |
CommandHistorySize := 150 |
3892 | 384 |
]. |
385 |
^ CommandHistorySize |
|
386 |
! |
|
387 |
||
388 |
defaultFilterList |
|
389 |
||
390 |
DefaultFilters isNil ifTrue:[ |
|
4414 | 391 |
DefaultFilters := #( '*' |
392 |
'*.st' |
|
393 |
'*.[h,c]*' |
|
12760 | 394 |
'*.txt; *.htm*' |
395 |
'*.gif; *.xpm; *.jpg; *.png' |
|
396 |
'~*o; ~*.obj; ~*.dll;' |
|
4414 | 397 |
) |
3892 | 398 |
]. |
399 |
^ DefaultFilters. |
|
12760 | 400 |
|
401 |
" |
|
402 |
DefaultFilters := nil |
|
403 |
" |
|
3892 | 404 |
! |
405 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
406 |
initialCommandFor:fileName in:aDirectory intoBox:aBox |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
407 |
"set a useful initial command in an execute box." |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
408 |
|
4523 | 409 |
|mime cmd select path suffix baseName pathName| |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
410 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
411 |
path := aDirectory filenameFor:fileName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
412 |
baseName := path baseName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
413 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
414 |
|
16160 | 415 |
cmd := UserPreferences current defaultFileOpenCommandFor:suffix. |
416 |
cmd notNil ifTrue:[ |
|
417 |
aBox initialText:(cmd bindWith:fileName pathName). |
|
418 |
^ self |
|
419 |
]. |
|
420 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
421 |
mime := MIMETypes mimeTypeForSuffix:suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
422 |
"/ mime notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
423 |
"/ cmd := self initialCommandForMIME:mime file:path |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
424 |
"/ ]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
425 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
426 |
"/ 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
|
427 |
"/ XXX or from resources. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
428 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
429 |
(path type == #regular) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
430 |
path isExecutableProgram ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
431 |
aBox initialText:(path pathName , ' <arguments>'). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
432 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
433 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
434 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
435 |
select := true. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
436 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
437 |
"some heuristics - my personal preferences ... |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
438 |
(actually this should come from a configfile)" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
439 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
440 |
(baseName endsWith:'akefile') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
441 |
aBox initialText:'make target' selectFrom:6 to:11. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
442 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
443 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
444 |
|
18264 | 445 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:mime. |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
446 |
cmd notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
447 |
select := false |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
448 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
449 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
450 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
451 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
452 |
(suffix = 'C') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
453 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
454 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
455 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
456 |
suffix := suffix asLowercase. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
457 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
458 |
(suffix = 'taz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
459 |
aBox initialText:'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
460 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
461 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
462 |
(suffix = 'tar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
463 |
cmd := 'tar tvf %1'. |
18578 | 464 |
select := 'tar tvf' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
465 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
466 |
(suffix = 'zoo') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
467 |
cmd := 'zoo -list %1'. |
18578 | 468 |
select := 'zoo -list' size |
4496
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 |
(suffix = 'zip') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
471 |
cmd := 'unzip -l %1'. |
18578 | 472 |
select := 'unzip -l' size |
4496
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 |
(suffix = 'jar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
475 |
cmd := 'unzip -l %1'. |
18578 | 476 |
select := 'unzip -l' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
477 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
478 |
(suffix = 'z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
479 |
(baseName asLowercase endsWith:'tar.z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
480 |
cmd := 'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
481 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
482 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
483 |
cmd := 'uncompress %1' |
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 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
486 |
(suffix = 'gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
487 |
(baseName asLowercase endsWith:'tar.gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
488 |
cmd := ('gunzip < %1 | tar tvf -' ). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
489 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
490 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
491 |
cmd := 'gunzip %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
492 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
493 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
494 |
(suffix = 'html') ifTrue:[ |
18578 | 495 |
"/ cmd := 'netscape %1' |
496 |
cmd := 'firefox %1'. |
|
497 |
select := 'firefox' size |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
498 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
499 |
(suffix = 'htm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
500 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
501 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
502 |
(suffix = 'uue') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
503 |
cmd := 'uudecode %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
504 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
505 |
(suffix = 'c') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
506 |
cmd := 'cc -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
507 |
select := 5. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
508 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
509 |
(suffix = 'cc') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
510 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
511 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
512 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
513 |
(suffix = 'xbm') ifTrue:[ |
18578 | 514 |
cmd := 'bitmap %1'. |
515 |
select := 'bitmap' size |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
516 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
517 |
(suffix = 'ps') ifTrue:[ |
18578 | 518 |
cmd := 'ghostview %1'. |
519 |
select := 'ghostview' size |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
520 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
521 |
((suffix = '1') or:[suffix = 'man']) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
522 |
cmd := 'nroff -man %1'. |
18578 | 523 |
select := 'nroff -man' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
524 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
525 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
526 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
527 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
528 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
529 |
DefaultCommandPerSuffix isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
530 |
cmd := '<cmd>' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
531 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
532 |
cmd := DefaultCommandPerSuffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
533 |
at:suffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
534 |
ifAbsent:'<cmd>'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
535 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
536 |
cmd := cmd , ' %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 |
|
4523 | 539 |
pathName := path pathName. |
540 |
OperatingSystem isUNIXlike ifTrue:[ |
|
541 |
pathName includesSeparator ifTrue:[ |
|
542 |
pathName := '"' , pathName , '"' |
|
543 |
] |
|
544 |
]. |
|
545 |
||
546 |
cmd := cmd bindWith:pathName. |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
547 |
select == false ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
548 |
aBox initialText:cmd |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
549 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
550 |
select class == Interval ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
551 |
aBox initialText:cmd selectFrom:select start to:select stop |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
552 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
553 |
select isInteger ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
554 |
select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
555 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
556 |
aBox initialText:cmd selectFrom:1 to:select |
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 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
559 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
560 |
|
18264 | 561 |
"Modified: / 24-09-1997 / 16:34:52 / stefan" |
562 |
"Modified: / 09-04-1998 / 17:15:57 / cg" |
|
563 |
"Modified: / 09-07-2018 / 11:16:30 / Stefan Vogel" |
|
18578 | 564 |
"Modified: / 05-02-2019 / 10:23:20 / Claus Gittinger" |
3892 | 565 |
! |
566 |
||
5941 | 567 |
listOfRuntimeValuesToRemember |
568 |
" list of all aspects that will be remembered after closing a FileBrowserV2" |
|
569 |
||
570 |
^ #( |
|
571 |
"/ #filterModel |
|
572 |
#enableFileHistory |
|
573 |
#fileHistory |
|
574 |
#currentSortOrder |
|
575 |
#sortBlockProperty |
|
576 |
) |
|
3892 | 577 |
! |
578 |
||
579 |
resetAspects |
|
580 |
||
581 |
RuntimeAspects := nil. |
|
582 |
||
5941 | 583 |
" |
584 |
self resetAspects |
|
585 |
" |
|
3892 | 586 |
! |
587 |
||
588 |
runtimeAspects |
|
589 |
||
590 |
RuntimeAspects isNil ifTrue:[ |
|
4414 | 591 |
RuntimeAspects := Dictionary new. |
3892 | 592 |
]. |
593 |
^ RuntimeAspects |
|
594 |
! |
|
595 |
||
4201 | 596 |
userPreferencesAspectList |
597 |
" list of all aspects that will be saved with save settings |
|
598 |
that aspects will be image consistent if the settings are saved in Launcher |
|
11501 | 599 |
don't forget to add a access methods in UserPreferences if you add a aspect here |
4201 | 600 |
" |
601 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
602 |
^ Dictionary |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
603 |
withKeysAndValues:#( |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
604 |
viewDirsInContentsBrowser true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
605 |
showDirectoryTree true |
11501 | 606 |
showHiddenFiles true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
607 |
viewDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
608 |
viewDetails true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
609 |
viewDirectoryDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
610 |
viewFilesInDirectoryTree false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
611 |
viewGroup false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
612 |
viewOwner false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
613 |
viewPermissions false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
614 |
viewPreview false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
615 |
viewSize true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
616 |
viewSizeInKiloBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
617 |
viewSizeInBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
618 |
viewTime true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
619 |
viewType false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
620 |
openMultipleApplicationsForType false |
7788 | 621 |
filenameEntryFieldVisibleHolder true |
622 |
toolBarVisibleHolder true |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
623 |
sortDirectoriesBeforeFiles true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
624 |
openAlwaysInTextEditor false |
15111 | 625 |
alwaysUseSmalltalkTools true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
626 |
sortCaseless false |
13011 | 627 |
"/ 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
|
628 |
showDirectoriesOnTop false |
4201 | 629 |
) |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
630 |
|
11501 | 631 |
"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
|
632 |
"Modified: / 12-08-2014 / 13:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3892 | 633 |
! ! |
634 |
||
17202 | 635 |
!AbstractFileBrowser class methodsFor:'drag & drop'! |
636 |
||
637 |
doStartDrag:aDropSource in:aView |
|
638 |
"set the cursors before starting the drag & drop operation" |
|
639 |
||
640 |
|hdl| |
|
641 |
||
642 |
hdl := DragAndDropManager new. |
|
643 |
||
644 |
hdl disabledCursor:self disabledCursorIcon. |
|
645 |
hdl enabledCursor:self enabledCursorIcon. |
|
646 |
hdl alienCursor:nil. |
|
647 |
||
648 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft. |
|
649 |
||
650 |
"Modified: / 23-07-2007 / 23:00:38 / cg" |
|
651 |
! ! |
|
652 |
||
5398 | 653 |
!AbstractFileBrowser class methodsFor:'help specs'! |
654 |
||
17889 | 655 |
basicHelpSpec |
6099 | 656 |
<resource: #help> |
657 |
||
17889 | 658 |
^ super helpSpec addPairsFrom:#( |
6099 | 659 |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
660 |
#lockFileEncoding |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
661 |
'Do not guess the encoding from the file''s contents.' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
662 |
|
6100 | 663 |
#closeTabButton |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
664 |
'Close this tab' |
6100 | 665 |
|
6099 | 666 |
#addTerminal |
17182 | 667 |
'Add a shell terminal page' |
6099 | 668 |
|
669 |
#make |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
670 |
'Call the make command' |
6099 | 671 |
|
672 |
#searchFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
673 |
'Search a file' |
6099 | 674 |
|
675 |
#directoryUp |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
676 |
'Directory up' |
6099 | 677 |
|
678 |
#directoryBack |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
679 |
'Directory back' |
6099 | 680 |
|
681 |
#directoryForward |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
682 |
'Directory forward' |
6099 | 683 |
|
684 |
#directoryHistory |
|
685 |
'Directory' |
|
686 |
||
687 |
#copyFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
688 |
'Copy the selected file(s)' |
6099 | 689 |
|
690 |
#cutFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
691 |
'Cut the selected file(s)' |
6099 | 692 |
|
693 |
#editFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
694 |
'Edit the selected file' |
6099 | 695 |
|
696 |
#fileHome |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
697 |
'Goto home directory' |
6099 | 698 |
|
8093 | 699 |
#fileDesktop |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
700 |
'Goto desktop directory' |
8093 | 701 |
|
6099 | 702 |
#fileGotoDefault |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
703 |
'Goto default directory (ST/X start directory)' |
6099 | 704 |
|
6454 | 705 |
#fileGotoSmalltalkDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
706 |
'Goto Smalltalk directory (ST/X application)' |
6454 | 707 |
|
6456 | 708 |
#fileGotoDefaultDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
709 |
'Goto current directory' |
6456 | 710 |
|
6099 | 711 |
#pasteFile |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
712 |
'Paste file(s)' |
6099 | 713 |
|
714 |
#deleteFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
715 |
'Delete the selected file(s)' |
6099 | 716 |
|
717 |
#fileIn |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
718 |
'File in' |
6099 | 719 |
|
720 |
#fileHistory |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
721 |
'File history' |
6099 | 722 |
|
723 |
#fileGotoBookmark |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
724 |
'Goto bookmarked directory' |
6099 | 725 |
|
726 |
#hideToolBar |
|
13910 | 727 |
'Hide the toolbar (show again via "View"-menu)' |
6099 | 728 |
|
729 |
#hideFilenameEntryField |
|
13910 | 730 |
'Hide filename & filter fields (show again via "View"-menu)' |
731 |
||
732 |
#hideBookmarks |
|
733 |
'Hide the bookmarks (show again via "View"-menu)' |
|
6099 | 734 |
|
735 |
#openChangeBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
736 |
'Open a Changebrowser on file' |
6099 | 737 |
|
738 |
#showFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
739 |
'Show file details' |
6099 | 740 |
|
741 |
#hideFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
742 |
'Hide file details' |
6099 | 743 |
|
744 |
#toggleDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
745 |
'Show/hide file details' |
6099 | 746 |
|
747 |
#viewDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
748 |
'Show/hide file details' |
6099 | 749 |
|
750 |
#selectDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
751 |
'Select file details to be shown' |
6099 | 752 |
|
8088 | 753 |
#showDifferences |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
754 |
'Show differences between file and editor versions' |
8088 | 755 |
|
756 |
#toggleHexDisplay |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
757 |
'Toggle between hexadecimal and textual representation' |
8088 | 758 |
|
759 |
#findInBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
760 |
'Navigate the browser''s file list to the edited file' |
8088 | 761 |
|
762 |
#saveFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
763 |
'Save the editor''s contents into the file' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
764 |
|
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
765 |
#saveFileAs |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
766 |
'Save the editor''s contents into another file' |
8088 | 767 |
|
768 |
#reloadFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
769 |
'Reload from the file' |
8088 | 770 |
|
771 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
772 |
'Send to the printer' |
8088 | 773 |
|
6099 | 774 |
). |
775 |
||
8261 | 776 |
" |
17889 | 777 |
self helpSpec |
8261 | 778 |
" |
779 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
780 |
"Modified: / 06-10-2011 / 14:55:27 / cg" |
8261 | 781 |
! |
782 |
||
17889 | 783 |
helpSpec |
8261 | 784 |
<resource: #programHelp> |
785 |
||
786 |
|spec hist resources| |
|
787 |
||
17889 | 788 |
spec := self basicHelpSpec. |
8261 | 789 |
|
790 |
"/ add help items for the history |
|
6099 | 791 |
hist := self directoryHistory. |
792 |
hist notNil ifTrue:[ |
|
793 |
resources := self classResources. |
|
794 |
hist canForward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
795 |
spec at:#directoryForward put:[ resources string:'Forward to: %1' with:hist nextForwardItem ]. |
6099 | 796 |
]. |
797 |
hist canBackward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
798 |
spec at:#directoryBack put:[ resources string:'Back to: %1' with:hist nextBackwardItem ]. |
6099 | 799 |
]. |
800 |
]. |
|
801 |
^ spec. |
|
802 |
||
803 |
" |
|
17889 | 804 |
self helpSpec |
6099 | 805 |
" |
806 |
||
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
807 |
"Modified: / 03-11-2007 / 12:05:01 / cg" |
5398 | 808 |
! ! |
809 |
||
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
810 |
!AbstractFileBrowser class methodsFor:'image specs'! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
811 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
812 |
clearHistoryIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
813 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
814 |
|
17413 | 815 |
^ ToolbarIconLibrary deleteIcon |
816 |
"/ ^ Icon deleteIcon |
|
817 |
||
818 |
"Modified: / 15-02-2017 / 19:45:24 / cg" |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
819 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
820 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
821 |
copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
822 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
823 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
824 |
^ ToolbarIconLibrary copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
825 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
826 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
827 |
cutIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
828 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
829 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
830 |
^ ToolbarIconLibrary cut20x20Icon2 "cut28x28Icon" |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
831 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
832 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
833 |
deleteIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
834 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
835 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
836 |
^ ToolbarIconLibrary erase20x20Icon "/ delete28x28Icon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
837 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
838 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
839 |
directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
840 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
841 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
842 |
^ ToolbarIconLibrary directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
843 |
! |
3892 | 844 |
|
15211 | 845 |
disabledCursorIcon |
846 |
"This resource specification was automatically generated |
|
847 |
by the ImageEditor of ST/X." |
|
848 |
||
849 |
"Do not manually edit this!! If it is corrupted, |
|
850 |
the ImageEditor may not be able to read the specification." |
|
851 |
||
852 |
" |
|
17202 | 853 |
self disabledCursorIcon inspect |
854 |
ImageEditor openOnClass:self andSelector:#disabledCursorIcon |
|
15211 | 855 |
Icon flushCachedIcons |
856 |
" |
|
857 |
||
858 |
<resource: #image> |
|
859 |
||
860 |
^Icon |
|
861 |
constantNamed:#'AbstractFileBrowser class disabledCursorIcon' |
|
862 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
863 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@XF@@@H@P@@DOB@@BLLP@AA@"@@RHD @H1AD@BRHI@@$QBP@IBH$@BPQI@@"BLP@D QH@ADBB@@H0Q@@AC |
|
864 |
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:' |
|
865 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@_>@@@O?0@@G?>@@C<O0@A?@>@@_8G @O?A<@C38O@@<_C0@OC8<@C0_O@@>C?0@G _8@A<C>@@O0_@@A? |
|
866 |
? @@O?0@@A?8@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
867 |
! |
|
6337 | 868 |
|
15211 | 869 |
enabledCursorIcon |
870 |
"This resource specification was automatically generated |
|
871 |
by the ImageEditor of ST/X." |
|
872 |
||
873 |
"Do not manually edit this!! If it is corrupted, |
|
874 |
the ImageEditor may not be able to read the specification." |
|
875 |
||
876 |
" |
|
17202 | 877 |
self enabledCursorIcon inspect |
878 |
ImageEditor openOnClass:self andSelector:#enabledCursorIcon |
|
15211 | 879 |
Icon flushCachedIcons |
880 |
" |
|
881 |
||
882 |
<resource: #image> |
|
883 |
||
884 |
^Icon |
|
885 |
constantNamed:#'AbstractFileBrowser class enabledCursorIcon' |
|
886 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
887 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@@@@@?0_0@@@@@@C?A?@@@@@@@@AP@@@@T@@@@E@@@@A |
|
888 |
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:' |
|
889 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@?8?0@O>O<@C?#?@@@G@@@@A0@@@@\@@@@G@@@@A |
|
890 |
0@@@@\@@@@G@@@@A0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
891 |
! |
|
6337 | 892 |
|
3892 | 893 |
fileInIcon |
894 |
<resource: #programImage> |
|
895 |
||
6116 | 896 |
^ ToolbarIconLibrary fileInIcon |
3892 | 897 |
! |
898 |
||
6079 | 899 |
historyBackIcon |
900 |
<resource: #programImage> |
|
901 |
||
902 |
^ ToolbarIconLibrary historyBackIcon |
|
903 |
! |
|
904 |
||
905 |
historyForwardIcon |
|
906 |
<resource: #programImage> |
|
907 |
||
908 |
^ ToolbarIconLibrary historyForwardIcon |
|
909 |
! |
|
910 |
||
3892 | 911 |
homeIcon |
912 |
<resource: #programImage> |
|
913 |
||
6079 | 914 |
^ ToolbarIconLibrary homeIcon |
3892 | 915 |
! |
916 |
||
6074 | 917 |
homeIcon2 |
6079 | 918 |
<resource: #programImage> |
919 |
||
920 |
^ ToolbarIconLibrary homeIcon2 |
|
6074 | 921 |
! |
922 |
||
923 |
htmlReloadIcon |
|
924 |
<resource: #programImage> |
|
925 |
||
926 |
^ ToolbarIconLibrary reload22x22Icon |
|
927 |
! |
|
928 |
||
15211 | 929 |
leftDownIcon |
930 |
<resource: #image> |
|
931 |
"This resource specification was automatically generated |
|
932 |
by the ImageEditor of ST/X." |
|
933 |
"Do not manually edit this!! If it is corrupted, |
|
934 |
the ImageEditor may not be able to read the specification." |
|
935 |
" |
|
936 |
self leftDownIcon inspect |
|
937 |
ImageEditor openOnClass:self andSelector:#leftDownIcon" |
|
938 |
||
939 |
^ Icon constantNamed:#'AbstractFileBrowser class leftDownIcon' |
|
940 |
ifAbsentPut:[ |
|
941 |
(Depth2Image new) |
|
942 |
width:28; |
|
943 |
height:28; |
|
944 |
photometric:(#palette); |
|
945 |
bitsPerSample:(#( 2 )); |
|
946 |
samplesPerPixel:(1); |
|
947 |
bits:(ByteArray |
|
948 |
fromPackedString:' |
|
949 |
UUUUUUUUUUUPAUUUUUUUP@UUUUUUUPB!!UUUUUU@B*AUUUUU@B*(UUUUUPB** UUUUPB***AUUUTB***(EUUUB****%UUUR*****UUUUU@*%UUUUUUPJ)UUUU |
|
950 |
UUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*$@@@@AUPJ*****)UTB******UU@******%UPJ*****)UTAUUUU |
|
951 |
UUUU@@@@@@@AUUUUUUUUUP@a'); |
|
952 |
colorMapFromArray:#[ 255 255 255 0 0 0 40 40 100 255 0 0 ]; |
|
953 |
mask:((ImageMask new) |
|
954 |
width:28; |
|
955 |
height:28; |
|
956 |
bits:(ByteArray |
|
957 |
fromPackedString:' |
|
958 |
@@@@@@@@@@@@ @@@@\@@@@O @@@G<@@@C? @@A?<@@@?? @@_?<@@G?? @@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C??? @???8@O? |
|
959 |
?>@C??? @???8@O??>@@@@@@@@@@@@@a'); |
|
960 |
yourself); |
|
961 |
yourself |
|
962 |
] |
|
963 |
! |
|
964 |
||
965 |
menuHistoryList9x20Icon |
|
966 |
<resource: #image> |
|
967 |
"This resource specification was automatically generated |
|
968 |
by the ImageEditor of ST/X." |
|
969 |
"Do not manually edit this!! If it is corrupted, |
|
970 |
the ImageEditor may not be able to read the specification." |
|
971 |
" |
|
972 |
self menuHistoryList9x20Icon inspect |
|
973 |
ImageEditor openOnClass:self andSelector:#menuHistoryList9x20Icon |
|
974 |
Icon flushCachedIcons" |
|
975 |
||
976 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryList9x20Icon' |
|
977 |
ifAbsentPut:[ |
|
978 |
(Depth1Image new) |
|
979 |
width:9; |
|
980 |
height:20; |
|
981 |
photometric:(#palette); |
|
982 |
bitsPerSample:(#( 1 )); |
|
983 |
samplesPerPixel:(1); |
|
984 |
bits:(ByteArray |
|
985 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
986 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
987 |
mask:((ImageMask new) |
|
988 |
width:9; |
|
989 |
height:20; |
|
990 |
bits:(ByteArray |
|
991 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
992 |
yourself); |
|
993 |
yourself |
|
994 |
] |
|
995 |
! |
|
996 |
||
997 |
menuHistoryListIcon |
|
998 |
<resource: #image> |
|
999 |
"This resource specification was automatically generated |
|
1000 |
by the ImageEditor of ST/X." |
|
1001 |
"Do not manually edit this!! If it is corrupted, |
|
1002 |
the ImageEditor may not be able to read the specification." |
|
1003 |
" |
|
1004 |
self menuHistoryListIcon inspect |
|
1005 |
ImageEditor openOnClass:self andSelector:#menuHistoryListIcon" |
|
1006 |
||
1007 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryListIcon' |
|
1008 |
ifAbsentPut:[ |
|
1009 |
(Depth1Image new) |
|
1010 |
width:12; |
|
1011 |
height:12; |
|
1012 |
photometric:(#palette); |
|
1013 |
bitsPerSample:(#( 1 )); |
|
1014 |
samplesPerPixel:(1); |
|
1015 |
bits:(ByteArray fromPackedString:'??S?<O?0??C?<O?0??/?=_?0??C?<O?0'); |
|
1016 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
1017 |
mask:((ImageMask new) |
|
1018 |
width:12; |
|
1019 |
height:12; |
|
1020 |
bits:(ByteArray fromPackedString:'@@@O@@<@C0A?8C?@G8@O@@X@@@A?8@@@'); |
|
1021 |
yourself); |
|
1022 |
yourself |
|
1023 |
] |
|
1024 |
! |
|
3892 | 1025 |
|
6087 | 1026 |
newDirectoryIcon |
6074 | 1027 |
<resource: #programImage> |
1028 |
||
6087 | 1029 |
^ ToolbarIconLibrary newDirectoryIcon |
3923 | 1030 |
! |
1031 |
||
6091 | 1032 |
removeTabIcon |
1033 |
<resource: #programImage> |
|
1034 |
||
1035 |
^ ToolbarIconLibrary removeTabIcon |
|
1036 |
! |
|
1037 |
||
3892 | 1038 |
vt100Terminal |
1039 |
<resource: #programImage> |
|
1040 |
||
1041 |
^ ToolbarIconLibrary shell20x20Icon |
|
1042 |
! ! |
|
1043 |
||
5528 | 1044 |
!AbstractFileBrowser class methodsFor:'interface specs'! |
1045 |
||
15211 | 1046 |
encodingDialogSpec |
1047 |
"This resource specification was automatically generated |
|
1048 |
by the UIPainter of ST/X." |
|
1049 |
||
1050 |
"Do not manually edit this!! If it is corrupted, |
|
1051 |
the UIPainter may not be able to read the specification." |
|
1052 |
||
1053 |
" |
|
1054 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#encodingDialogSpec |
|
1055 |
AbstractFileBrowser new openInterface:#encodingDialogSpec |
|
1056 |
" |
|
1057 |
||
1058 |
<resource: #canvas> |
|
1059 |
||
1060 |
^ |
|
1061 |
#(FullSpec |
|
1062 |
name: encodingDialogSpec |
|
1063 |
window: |
|
1064 |
(WindowSpec |
|
1065 |
label: 'File Encoding' |
|
1066 |
name: 'File Encoding' |
|
1067 |
min: (Point 10 10) |
|
1068 |
bounds: (Rectangle 0 0 379 590) |
|
1069 |
) |
|
1070 |
component: |
|
1071 |
(SpecCollection |
|
1072 |
collection: ( |
|
1073 |
(LabelSpec |
|
1074 |
label: 'Select the External (File-) Encoding:' |
|
1075 |
name: 'Label1' |
|
1076 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1077 |
translateLabel: true |
|
1078 |
adjust: left |
|
1079 |
) |
|
1080 |
(DataSetSpec |
|
1081 |
name: 'Table1' |
|
1082 |
layout: (LayoutFrame 0 0 30 0 0 1 -60 1) |
|
1083 |
model: selectedEncoding |
|
1084 |
hasHorizontalScrollBar: true |
|
1085 |
hasVerticalScrollBar: true |
|
1086 |
dataList: encodingList |
|
1087 |
has3Dseparators: true |
|
1088 |
columns: |
|
1089 |
(Array |
|
1090 |
||
1091 |
(DataSetColumnSpec |
|
1092 |
label: 'Encoding' |
|
1093 |
labelButtonType: Button |
|
1094 |
height: heightOfFirstRow |
|
1095 |
model: at: |
|
1096 |
canSelect: false |
|
1097 |
isResizeable: false |
|
1098 |
showRowSeparator: false |
|
1099 |
showColSeparator: false |
|
1100 |
) |
|
1101 |
(DataSetColumnSpec |
|
1102 |
label: 'Description' |
|
1103 |
labelButtonType: Button |
|
1104 |
height: heightOfFirstRow |
|
1105 |
model: at: |
|
1106 |
canSelect: false |
|
1107 |
isResizeable: false |
|
1108 |
showRowSeparator: false |
|
1109 |
showColSeparator: false |
|
1110 |
) |
|
1111 |
) |
|
1112 |
doubleClickChannel: accept |
|
1113 |
) |
|
1114 |
(CheckBoxSpec |
|
1115 |
label: 'Lock Encoding' |
|
1116 |
name: 'LockEncodingCheckBox' |
|
1117 |
layout: (LayoutFrame 3 0 -60 1 217 0 -30 1) |
|
1118 |
activeHelpKey: lockFileEncoding |
|
1119 |
model: lockFileEncoding |
|
1120 |
translateLabel: true |
|
1121 |
) |
|
1122 |
(HorizontalPanelViewSpec |
|
1123 |
name: 'ButtonPanel' |
|
1124 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1125 |
horizontalLayout: fitSpace |
|
1126 |
verticalLayout: center |
|
1127 |
horizontalSpace: 3 |
|
1128 |
verticalSpace: 3 |
|
1129 |
reverseOrderIfOKAtLeft: true |
|
1130 |
component: |
|
1131 |
(SpecCollection |
|
1132 |
collection: ( |
|
1133 |
(ActionButtonSpec |
|
1134 |
label: 'Cancel' |
|
1135 |
name: 'Button2' |
|
1136 |
translateLabel: true |
|
1137 |
model: cancel |
|
1138 |
extent: (Point 183 22) |
|
1139 |
) |
|
1140 |
(ActionButtonSpec |
|
1141 |
label: 'OK' |
|
1142 |
name: 'Button1' |
|
1143 |
translateLabel: true |
|
1144 |
model: accept |
|
1145 |
isDefault: true |
|
1146 |
extent: (Point 184 22) |
|
1147 |
) |
|
1148 |
) |
|
1149 |
||
1150 |
) |
|
1151 |
) |
|
1152 |
) |
|
1153 |
||
1154 |
) |
|
1155 |
) |
|
1156 |
! |
|
1157 |
||
1158 |
lineEndConventionDialogSpec |
|
1159 |
"This resource specification was automatically generated |
|
1160 |
by the UIPainter of ST/X." |
|
1161 |
||
1162 |
"Do not manually edit this!! If it is corrupted, |
|
1163 |
the UIPainter may not be able to read the specification." |
|
1164 |
||
1165 |
" |
|
1166 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#lineEndConventionDialogSpec |
|
1167 |
AbstractFileBrowser new openInterface:#lineEndConventionDialogSpec |
|
1168 |
" |
|
1169 |
||
1170 |
<resource: #canvas> |
|
1171 |
||
1172 |
^ |
|
15212 | 1173 |
#(FullSpec |
1174 |
name: lineEndConventionDialogSpec |
|
1175 |
window: |
|
1176 |
(WindowSpec |
|
1177 |
label: 'Line-End Convention' |
|
1178 |
name: 'Line-End Convention' |
|
1179 |
min: (Point 10 10) |
|
1180 |
bounds: (Rectangle 0 0 379 239) |
|
1181 |
) |
|
1182 |
component: |
|
1183 |
(SpecCollection |
|
1184 |
collection: ( |
|
1185 |
(LabelSpec |
|
1186 |
label: 'Select the Line-End Convention (used when saving files):' |
|
1187 |
name: 'Label1' |
|
1188 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1189 |
translateLabel: true |
|
1190 |
adjust: left |
|
1191 |
) |
|
1192 |
(VerticalPanelViewSpec |
|
1193 |
name: 'VerticalPanel1' |
|
1194 |
layout: (LayoutFrame 20 0 40 0 0 1 -30 1) |
|
1195 |
horizontalLayout: fit |
|
1196 |
verticalLayout: topSpace |
|
1197 |
horizontalSpace: 3 |
|
1198 |
verticalSpace: 3 |
|
1199 |
component: |
|
1200 |
(SpecCollection |
|
1201 |
collection: ( |
|
1202 |
(RadioButtonSpec |
|
1203 |
label: 'NL (Unix)' |
|
1204 |
name: 'RadioButton1' |
|
1205 |
translateLabel: true |
|
1206 |
model: lineEndConvention |
|
1207 |
isTriggerOnDown: true |
|
1208 |
select: nl |
|
1209 |
extent: (Point 359 22) |
|
1210 |
) |
|
1211 |
(RadioButtonSpec |
|
1212 |
label: 'CR-NL (MSDOS)' |
|
1213 |
name: 'RadioButton4' |
|
1214 |
translateLabel: true |
|
1215 |
model: lineEndConvention |
|
1216 |
isTriggerOnDown: true |
|
1217 |
select: crlf |
|
1218 |
extent: (Point 359 22) |
|
1219 |
) |
|
1220 |
(RadioButtonSpec |
|
1221 |
label: 'CR (VMS and pre OSX mac)' |
|
1222 |
name: 'RadioButton5' |
|
1223 |
translateLabel: true |
|
1224 |
model: lineEndConvention |
|
1225 |
isTriggerOnDown: true |
|
1226 |
select: cr |
|
1227 |
extent: (Point 359 22) |
|
15211 | 1228 |
) |
15212 | 1229 |
(RadioButtonSpec |
1230 |
label: 'ETX (some modem protocols and mainframe files)' |
|
1231 |
name: 'RadioButton6' |
|
1232 |
translateLabel: true |
|
1233 |
model: lineEndConvention |
|
1234 |
isTriggerOnDown: true |
|
1235 |
select: etx |
|
1236 |
extent: (Point 359 22) |
|
1237 |
) |
|
1238 |
(RadioButtonSpec |
|
1239 |
label: 'EOT (some modem protocols and mainframe files)' |
|
1240 |
name: 'RadioButton7' |
|
1241 |
translateLabel: true |
|
1242 |
model: lineEndConvention |
|
1243 |
isTriggerOnDown: true |
|
1244 |
select: eot |
|
1245 |
extent: (Point 359 22) |
|
15211 | 1246 |
) |
15212 | 1247 |
) |
1248 |
||
1249 |
) |
|
15211 | 1250 |
) |
15212 | 1251 |
(HorizontalPanelViewSpec |
1252 |
name: 'ButtonPanel' |
|
1253 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1254 |
horizontalLayout: fitSpace |
|
1255 |
verticalLayout: center |
|
1256 |
horizontalSpace: 3 |
|
1257 |
verticalSpace: 3 |
|
1258 |
reverseOrderIfOKAtLeft: true |
|
1259 |
component: |
|
1260 |
(SpecCollection |
|
1261 |
collection: ( |
|
1262 |
(ActionButtonSpec |
|
1263 |
label: 'Cancel' |
|
1264 |
name: 'Button2' |
|
1265 |
translateLabel: true |
|
1266 |
model: cancel |
|
1267 |
extent: (Point 185 22) |
|
1268 |
) |
|
1269 |
(ActionButtonSpec |
|
1270 |
label: 'OK' |
|
1271 |
name: 'Button1' |
|
1272 |
translateLabel: true |
|
1273 |
model: accept |
|
1274 |
isDefault: true |
|
1275 |
extent: (Point 185 22) |
|
1276 |
) |
|
1277 |
) |
|
1278 |
||
1279 |
) |
|
1280 |
) |
|
1281 |
) |
|
1282 |
||
1283 |
) |
|
1284 |
) |
|
15211 | 1285 |
! |
1286 |
||
1287 |
tabStopConversionDialogSpec |
|
1288 |
"This resource specification was automatically generated |
|
1289 |
by the UIPainter of ST/X." |
|
1290 |
||
1291 |
"Do not manually edit this!! If it is corrupted, |
|
1292 |
the UIPainter may not be able to read the specification." |
|
1293 |
||
1294 |
" |
|
1295 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#tabStopConversionDialogSpec |
|
1296 |
AbstractFileBrowser new openInterface:#tabStopConversionDialogSpec |
|
1297 |
" |
|
1298 |
||
1299 |
<resource: #canvas> |
|
1300 |
||
1301 |
^ |
|
1302 |
#(FullSpec |
|
1303 |
name: 'tabStopConversionDialogSpec' |
|
1304 |
window: |
|
1305 |
(WindowSpec |
|
1306 |
label: 'Tab-Stop Conversion' |
|
1307 |
name: 'Tab-Stop Conversion' |
|
1308 |
min: (Point 10 10) |
|
1309 |
bounds: (Rectangle 0 0 379 239) |
|
1310 |
) |
|
1311 |
component: |
|
1312 |
(SpecCollection |
|
1313 |
collection: ( |
|
1314 |
(LabelSpec |
|
1315 |
label: 'Select the Tab-Stop Conversion (used when saving files):' |
|
1316 |
name: 'Label1' |
|
1317 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1318 |
translateLabel: true |
|
1319 |
adjust: left |
|
1320 |
) |
|
1321 |
(VerticalPanelViewSpec |
|
1322 |
name: 'VerticalPanel1' |
|
1323 |
layout: (LayoutFrame 0 0 30 0 0 1 -30 1) |
|
1324 |
horizontalLayout: center |
|
1325 |
verticalLayout: center |
|
1326 |
horizontalSpace: 3 |
|
1327 |
verticalSpace: 3 |
|
1328 |
component: |
|
1329 |
(SpecCollection |
|
1330 |
collection: ( |
|
1331 |
(RadioButtonSpec |
|
1332 |
label: '4' |
|
1333 |
name: 'RadioButton1' |
|
1334 |
translateLabel: true |
|
1335 |
model: tabStops |
|
1336 |
isTriggerOnDown: true |
|
1337 |
select: 4 |
|
1338 |
extent: (Point 136 22) |
|
1339 |
) |
|
1340 |
(RadioButtonSpec |
|
1341 |
label: '8' |
|
1342 |
name: 'RadioButton4' |
|
1343 |
translateLabel: true |
|
1344 |
model: tabStops |
|
1345 |
isTriggerOnDown: true |
|
1346 |
select: 8 |
|
1347 |
extent: (Point 136 22) |
|
1348 |
) |
|
1349 |
) |
|
1350 |
||
1351 |
) |
|
1352 |
) |
|
1353 |
(HorizontalPanelViewSpec |
|
1354 |
name: 'ButtonPanel' |
|
1355 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1356 |
horizontalLayout: fitSpace |
|
1357 |
verticalLayout: center |
|
1358 |
horizontalSpace: 3 |
|
1359 |
verticalSpace: 3 |
|
1360 |
reverseOrderIfOKAtLeft: true |
|
1361 |
component: |
|
1362 |
(SpecCollection |
|
1363 |
collection: ( |
|
1364 |
(ActionButtonSpec |
|
1365 |
label: 'Cancel' |
|
1366 |
name: 'Button2' |
|
1367 |
translateLabel: true |
|
1368 |
model: cancel |
|
1369 |
extent: (Point 185 22) |
|
1370 |
) |
|
1371 |
(ActionButtonSpec |
|
1372 |
label: 'OK' |
|
1373 |
name: 'Button1' |
|
1374 |
translateLabel: true |
|
1375 |
model: accept |
|
1376 |
isDefault: true |
|
1377 |
extent: (Point 185 22) |
|
1378 |
) |
|
1379 |
) |
|
1380 |
||
1381 |
) |
|
1382 |
) |
|
1383 |
) |
|
1384 |
||
1385 |
) |
|
1386 |
) |
|
1387 |
||
1388 |
"Modified: / 28-02-2012 / 11:12:38 / cg" |
|
1389 |
! ! |
|
5528 | 1390 |
|
3892 | 1391 |
!AbstractFileBrowser class methodsFor:'menu specs'! |
1392 |
||
15211 | 1393 |
baseBookmarksMenuSpec |
1394 |
"This resource specification was automatically generated |
|
1395 |
by the MenuEditor of ST/X." |
|
1396 |
||
1397 |
"Do not manually edit this!! If it is corrupted, |
|
1398 |
the MenuEditor may not be able to read the specification." |
|
1399 |
||
1400 |
" |
|
1401 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec |
|
1402 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec)) startUp |
|
1403 |
" |
|
1404 |
||
1405 |
<resource: #menu> |
|
1406 |
||
1407 |
^ |
|
1408 |
#(Menu |
|
1409 |
( |
|
1410 |
(MenuItem |
|
1411 |
enabled: currentFilesHasDirectories |
|
1412 |
label: 'Add Bookmark' |
|
1413 |
itemValue: addBookmark |
|
1414 |
translateLabel: true |
|
1415 |
) |
|
1416 |
(MenuItem |
|
1417 |
enabled: hasBookmarksToRemove |
|
1418 |
label: 'Remove Bookmark' |
|
1419 |
itemValue: removeBookmark |
|
1420 |
translateLabel: true |
|
1421 |
) |
|
1422 |
(MenuItem |
|
1423 |
label: 'Save Bookmarks In...' |
|
1424 |
itemValue: saveBookmarks |
|
1425 |
translateLabel: true |
|
1426 |
) |
|
1427 |
) |
|
1428 |
nil |
|
1429 |
nil |
|
1430 |
) |
|
1431 |
! |
|
1432 |
||
1433 |
baseBookmarksMenuSpec2 |
|
1434 |
"This resource specification was automatically generated |
|
1435 |
by the MenuEditor of ST/X." |
|
1436 |
||
1437 |
"Do not manually edit this!! If it is corrupted, |
|
1438 |
the MenuEditor may not be able to read the specification." |
|
1439 |
||
1440 |
" |
|
1441 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec2 |
|
1442 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec2)) startUp |
|
1443 |
" |
|
1444 |
||
1445 |
<resource: #menu> |
|
1446 |
||
1447 |
^ |
|
1448 |
#(Menu |
|
1449 |
( |
|
1450 |
(MenuItem |
|
1451 |
label: 'Edit Bookmarks' |
|
1452 |
itemValue: editBookmarks |
|
1453 |
translateLabel: true |
|
1454 |
) |
|
1455 |
(MenuItem |
|
1456 |
label: '-' |
|
1457 |
) |
|
1458 |
(MenuItem |
|
1459 |
enabled: currentFilesHasDirectories |
|
1460 |
label: 'Add Bookmark' |
|
1461 |
itemValue: addBookmark |
|
1462 |
translateLabel: true |
|
1463 |
) |
|
1464 |
) |
|
1465 |
nil |
|
1466 |
nil |
|
1467 |
) |
|
1468 |
! |
|
1469 |
||
1470 |
browserMenu |
|
1471 |
"This resource specification was automatically generated |
|
1472 |
by the MenuEditor of ST/X." |
|
1473 |
||
1474 |
"Do not manually edit this!! If it is corrupted, |
|
1475 |
the MenuEditor may not be able to read the specification." |
|
1476 |
||
1477 |
||
1478 |
" |
|
1479 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#browserMenu |
|
1480 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser browserMenu)) startUp |
|
1481 |
" |
|
1482 |
||
1483 |
<resource: #menu> |
|
1484 |
||
1485 |
^ |
|
1486 |
#(Menu |
|
1487 |
( |
|
1488 |
(MenuItem |
|
1489 |
label: 'Spawn Filebrowser' |
|
1490 |
itemValue: doSpawn |
|
1491 |
translateLabel: true |
|
1492 |
shortcutKey: Ctrln |
|
1493 |
) |
|
1494 |
(MenuItem |
|
1495 |
label: 'Windows Explorer' |
|
1496 |
itemValue: doOpenExplorer |
|
1497 |
translateLabel: true |
|
17946 | 1498 |
isVisible: systemIsDOS |
15211 | 1499 |
) |
1500 |
(MenuItem |
|
1501 |
label: 'Open Finder' |
|
1502 |
itemValue: doOpenFinder |
|
1503 |
translateLabel: true |
|
1504 |
isVisible: systemIsOSX |
|
1505 |
) |
|
1506 |
(MenuItem |
|
1507 |
label: 'C Browser' |
|
1508 |
itemValue: doOpenCBrowser |
|
1509 |
translateLabel: true |
|
1510 |
isVisible: cBrowserMenuItemVisible |
|
1511 |
) |
|
1512 |
(MenuItem |
|
18432 | 1513 |
label: 'STXGDB Debugger' |
1514 |
itemValue: doOpenGDBApplication |
|
1515 |
translateLabel: true |
|
1516 |
isVisible: stxgdbMenuItemVisible |
|
1517 |
) |
|
1518 |
(MenuItem |
|
15211 | 1519 |
label: '-' |
1520 |
) |
|
1521 |
(MenuItem |
|
1522 |
label: 'Add Text Editor Page' |
|
1523 |
itemValue: newTextEditor |
|
1524 |
translateLabel: true |
|
1525 |
shortcutKey: Ctrlt |
|
1526 |
) |
|
1527 |
(MenuItem |
|
1528 |
label: 'Add Shell Terminal Page' |
|
1529 |
itemValue: doAddTerminal |
|
1530 |
translateLabel: true |
|
1531 |
) |
|
1532 |
(MenuItem |
|
1533 |
label: 'Add Archiver Page' |
|
1534 |
itemValue: doAddArchiver |
|
1535 |
translateLabel: true |
|
1536 |
) |
|
1537 |
(MenuItem |
|
1538 |
label: 'Add Search Page' |
|
1539 |
itemValue: doOpenSearchFile |
|
1540 |
translateLabel: true |
|
1541 |
) |
|
1542 |
(MenuItem |
|
1543 |
label: '-' |
|
1544 |
isVisible: false |
|
1545 |
) |
|
1546 |
(MenuItem |
|
1547 |
label: 'Settings...' |
|
1548 |
itemValue: doOpenSettings |
|
1549 |
translateLabel: true |
|
1550 |
isVisible: false |
|
1551 |
) |
|
1552 |
(MenuItem |
|
1553 |
label: 'Encoding...' |
|
1554 |
itemValue: fileEncodingDialog |
|
1555 |
translateLabel: true |
|
1556 |
isVisible: false |
|
1557 |
) |
|
1558 |
(MenuItem |
|
1559 |
label: 'Line End Convention...' |
|
1560 |
itemValue: lineEndConventionDialog |
|
1561 |
translateLabel: true |
|
1562 |
isVisible: false |
|
1563 |
) |
|
1564 |
(MenuItem |
|
1565 |
label: 'Tab Stop Conversion...' |
|
1566 |
itemValue: tabStopConversionDialog |
|
1567 |
translateLabel: true |
|
1568 |
isVisible: false |
|
1569 |
) |
|
1570 |
(MenuItem |
|
1571 |
label: '-' |
|
1572 |
) |
|
1573 |
(MenuItem |
|
1574 |
label: 'Exit' |
|
1575 |
itemValue: closeRequest |
|
1576 |
translateLabel: true |
|
1577 |
) |
|
1578 |
) |
|
1579 |
nil |
|
1580 |
nil |
|
1581 |
) |
|
1582 |
||
17724 | 1583 |
"Modified: / 29-10-2017 / 11:13:49 / cg" |
18432 | 1584 |
"Modified: / 26-09-2018 / 12:07:26 / Claus Gittinger" |
15211 | 1585 |
! |
1586 |
||
1587 |
directoryMenu |
|
1588 |
"This resource specification was automatically generated |
|
1589 |
by the MenuEditor of ST/X." |
|
1590 |
||
1591 |
"Do not manually edit this!! If it is corrupted, |
|
1592 |
the MenuEditor may not be able to read the specification." |
|
1593 |
||
1594 |
||
1595 |
" |
|
1596 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#directoryMenu |
|
1597 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser directoryMenu)) startUp |
|
1598 |
" |
|
1599 |
||
1600 |
<resource: #menu> |
|
1601 |
||
1602 |
^ |
|
1603 |
#(Menu |
|
1604 |
( |
|
1605 |
(MenuItem |
|
1606 |
label: 'Bookmarks' |
|
1607 |
submenuChannel: bookmarksMenu |
|
1608 |
) |
|
1609 |
(MenuItem |
|
1610 |
label: 'Visited Directories' |
|
1611 |
submenuChannel: visitedDirectoriesMenu |
|
1612 |
) |
|
1613 |
(MenuItem |
|
1614 |
label: '-' |
|
1615 |
) |
|
1616 |
(MenuItem |
|
1617 |
label: 'Up' |
|
1618 |
itemValue: doGoDirectoryUp |
|
1619 |
) |
|
1620 |
(MenuItem |
|
1621 |
activeHelpKey: directoryBack |
|
1622 |
enabled: enableBack |
|
1623 |
label: 'Back' |
|
1624 |
itemValue: doBack |
|
1625 |
) |
|
1626 |
(MenuItem |
|
1627 |
activeHelpKey: directoryBack |
|
1628 |
enabled: enableForward |
|
1629 |
label: 'Forward' |
|
1630 |
itemValue: doForward |
|
1631 |
) |
|
1632 |
(MenuItem |
|
1633 |
label: '-' |
|
1634 |
) |
|
1635 |
(MenuItem |
|
1636 |
enabled: enableHome |
|
1637 |
label: 'Home Directory' |
|
1638 |
itemValue: doGotoHomeDirectory |
|
1639 |
) |
|
1640 |
(MenuItem |
|
1641 |
enabled: enableGotoDesktopDirectory |
|
1642 |
label: 'Desktop' |
|
1643 |
itemValue: doGotoDesktopDirectory |
|
1644 |
) |
|
1645 |
(MenuItem |
|
18511 | 1646 |
enabled: enableGotoDocumentsDirectory |
1647 |
label: 'Documents' |
|
1648 |
itemValue: doGotoDocumentsDirectory |
|
1649 |
) |
|
1650 |
(MenuItem |
|
18352 | 1651 |
enabled: enableGotoDownloadsDirectory |
1652 |
label: 'Downloads' |
|
1653 |
itemValue: doGotoDownloadsDirectory |
|
1654 |
) |
|
1655 |
(MenuItem |
|
15211 | 1656 |
enabled: enableGotoDefaultDirectory |
1657 |
label: 'Default (Current) Directory' |
|
1658 |
itemValue: doGotoDefaultDirectory |
|
1659 |
) |
|
1660 |
(MenuItem |
|
1661 |
enabled: enableGotoSmalltalkDirectory |
|
1662 |
label: 'Smalltalk (Application) Directory' |
|
1663 |
itemValue: doGotoSmalltalkDirectory |
|
1664 |
) |
|
1665 |
(MenuItem |
|
17187 | 1666 |
enabled: enableGotoSmalltalkWorkspaceDirectory |
1667 |
label: 'Smalltalk Workspace Directory' |
|
1668 |
itemValue: doGotoSmalltalkWorkspaceDirectory |
|
1669 |
) |
|
1670 |
(MenuItem |
|
15211 | 1671 |
enabled: enableGotoTempDirectory |
1672 |
label: 'Smalltalk Temp Directory' |
|
1673 |
itemValue: doGotoTempDirectory |
|
1674 |
) |
|
1675 |
(MenuItem |
|
1676 |
label: '-' |
|
17582 | 1677 |
isVisible: false |
15211 | 1678 |
) |
1679 |
(MenuItem |
|
1680 |
enabled: enableMakeCurrentDirectory |
|
1681 |
label: 'Make this the Default (Current) Directory' |
|
1682 |
itemValue: doMakeCurrentDirectory |
|
17582 | 1683 |
isVisible: false |
15211 | 1684 |
) |
1685 |
) |
|
1686 |
nil |
|
1687 |
nil |
|
1688 |
) |
|
17582 | 1689 |
|
1690 |
"Modified: / 17-07-2017 / 10:08:31 / cg" |
|
15211 | 1691 |
! |
1692 |
||
1693 |
editMenu |
|
1694 |
"This resource specification was automatically generated |
|
1695 |
by the MenuEditor of ST/X." |
|
1696 |
||
1697 |
"Do not manually edit this!! If it is corrupted, |
|
1698 |
the MenuEditor may not be able to read the specification." |
|
1699 |
||
1700 |
" |
|
1701 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#editMenu |
|
1702 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser editMenu)) startUp |
|
1703 |
" |
|
1704 |
||
1705 |
<resource: #menu> |
|
1706 |
||
1707 |
^ |
|
1708 |
#(Menu |
|
1709 |
( |
|
1710 |
(MenuItem |
|
1711 |
enabled: hasFileSelection |
|
1712 |
label: 'Copy Selected Filenames to Clipboard' |
|
1713 |
itemValue: copySelectedFilenames |
|
1714 |
translateLabel: true |
|
1715 |
) |
|
1716 |
(MenuItem |
|
1717 |
enabled: fileListIsNotEmpty |
|
1718 |
label: 'Copy all Filenames to Clipboard' |
|
1719 |
itemValue: copyFileList |
|
1720 |
translateLabel: true |
|
1721 |
) |
|
1722 |
) |
|
1723 |
nil |
|
1724 |
nil |
|
1725 |
) |
|
1726 |
! |
|
1727 |
||
1728 |
emptyMenuSpec |
|
1729 |
"This resource specification was automatically generated |
|
1730 |
by the MenuEditor of ST/X." |
|
1731 |
||
1732 |
"Do not manually edit this!! If it is corrupted, |
|
1733 |
the MenuEditor may not be able to read the specification." |
|
1734 |
||
1735 |
" |
|
1736 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#emptyMenuSpec |
|
1737 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser emptyMenuSpec)) startUp |
|
1738 |
" |
|
1739 |
||
1740 |
<resource: #menu> |
|
1741 |
||
1742 |
^ |
|
1743 |
#(#Menu |
|
1744 |
#( |
|
1745 |
) |
|
1746 |
nil |
|
1747 |
nil |
|
1748 |
) |
|
1749 |
! |
|
1750 |
||
1751 |
extraMenu |
|
1752 |
"This resource specification was automatically generated |
|
1753 |
by the MenuEditor of ST/X." |
|
1754 |
||
1755 |
"Do not manually edit this!! If it is corrupted, |
|
1756 |
the MenuEditor may not be able to read the specification." |
|
1757 |
||
1758 |
||
1759 |
" |
|
1760 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#extraMenu |
|
1761 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser extraMenu)) startUp |
|
1762 |
" |
|
1763 |
||
1764 |
<resource: #menu> |
|
1765 |
||
1766 |
^ |
|
1767 |
#(Menu |
|
1768 |
( |
|
1769 |
(MenuItem |
|
1770 |
label: 'Encoding...' |
|
1771 |
itemValue: fileEncodingDialog |
|
1772 |
translateLabel: true |
|
1773 |
) |
|
1774 |
(MenuItem |
|
1775 |
label: 'Line End Convention...' |
|
1776 |
itemValue: lineEndConventionDialog |
|
1777 |
translateLabel: true |
|
1778 |
) |
|
1779 |
(MenuItem |
|
1780 |
label: 'Tab Stop Conversion...' |
|
1781 |
itemValue: tabStopConversionDialog |
|
1782 |
translateLabel: true |
|
1783 |
) |
|
1784 |
(MenuItem |
|
1785 |
label: '-' |
|
1786 |
) |
|
1787 |
(MenuItem |
|
1788 |
label: 'Settings...' |
|
1789 |
itemValue: doOpenSettings |
|
1790 |
translateLabel: true |
|
1791 |
labelImage: (ResourceRetriever ToolbarIconLibrary settings16x16Icon 'Settings...') |
|
1792 |
) |
|
1793 |
) |
|
1794 |
nil |
|
1795 |
nil |
|
1796 |
) |
|
1797 |
! |
|
1798 |
||
1799 |
fileMenu |
|
1800 |
"This resource specification was automatically generated |
|
1801 |
by the MenuEditor of ST/X." |
|
1802 |
||
1803 |
"Do not manually edit this!! If it is corrupted, |
|
1804 |
the MenuEditor may not be able to read the specification." |
|
1805 |
||
1806 |
||
1807 |
" |
|
1808 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileMenu |
|
1809 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileMenu)) startUp |
|
1810 |
" |
|
1811 |
||
1812 |
<resource: #menu> |
|
1813 |
||
1814 |
^ |
|
1815 |
#(Menu |
|
1816 |
( |
|
1817 |
(MenuItem |
|
1818 |
enabled: enableFileHistory |
|
1819 |
label: 'File History' |
|
1820 |
submenuChannel: menuFileHistory |
|
1821 |
) |
|
1822 |
(MenuItem |
|
1823 |
label: '-' |
|
1824 |
) |
|
1825 |
(MenuItem |
|
1826 |
label: 'Open' |
|
1827 |
itemValue: doShowFileContents |
|
1828 |
) |
|
1829 |
(MenuItem |
|
1830 |
label: '-' |
|
1831 |
) |
|
1832 |
(MenuItem |
|
1833 |
enabled: hasFileSelection |
|
1834 |
label: 'FileIn' |
|
1835 |
itemValue: fileFileIn |
|
1836 |
) |
|
1837 |
(MenuItem |
|
1838 |
enabled: hasFileSelection |
|
1839 |
label: 'FileIn to Namespace...' |
|
1840 |
itemValue: fileFileInToNameSpace |
|
1841 |
) |
|
1842 |
(MenuItem |
|
1843 |
enabled: hasPackageDirectorySelected |
|
1844 |
label: 'Load Package from Here' |
|
1845 |
itemValue: fileFileInPackage |
|
1846 |
) |
|
1847 |
(MenuItem |
|
1848 |
label: '-' |
|
1849 |
) |
|
1850 |
(MenuItem |
|
1851 |
label: 'New' |
|
1852 |
submenuChannel: newMenu |
|
1853 |
keepLinkedMenu: true |
|
1854 |
) |
|
1855 |
(MenuItem |
|
1856 |
label: '-' |
|
1857 |
) |
|
1858 |
(MenuItem |
|
1859 |
enabled: hasSelection |
|
1860 |
label: 'Cut' |
|
1861 |
itemValue: cutFiles |
|
1862 |
) |
|
1863 |
(MenuItem |
|
1864 |
enabled: hasSelection |
|
1865 |
label: 'Copy' |
|
1866 |
itemValue: copyFiles |
|
1867 |
) |
|
1868 |
(MenuItem |
|
1869 |
enabled: canPaste |
|
1870 |
label: 'Paste' |
|
1871 |
itemValue: pasteFiles |
|
1872 |
) |
|
1873 |
(MenuItem |
|
1874 |
enabled: hasSelection |
|
1875 |
label: 'Delete' |
|
1876 |
itemValue: deleteFiles |
|
1877 |
) |
|
1878 |
(MenuItem |
|
1879 |
enabled: hasSelection |
|
1880 |
label: 'Erase' |
|
1881 |
itemValue: eraseFiles |
|
1882 |
) |
|
1883 |
(MenuItem |
|
1884 |
label: '-' |
|
1885 |
) |
|
1886 |
(MenuItem |
|
1887 |
enabled: hasSelection |
|
1888 |
label: 'Rename...' |
|
1889 |
itemValue: renameSelection |
|
1890 |
shortcutKey: Rename |
|
1891 |
) |
|
1892 |
(MenuItem |
|
1893 |
enabled: hasSelection |
|
1894 |
label: 'Move To...' |
|
1895 |
itemValue: moveSelectionTo |
|
1896 |
) |
|
1897 |
(MenuItem |
|
1898 |
enabled: hasSelection |
|
1899 |
label: 'Copy To...' |
|
1900 |
itemValue: copySelectionTo |
|
1901 |
) |
|
1902 |
(MenuItem |
|
1903 |
enabled: hasSelection |
|
1904 |
label: 'Properties...' |
|
1905 |
itemValue: doShowProperties |
|
1906 |
) |
|
1907 |
(MenuItem |
|
1908 |
label: '-' |
|
1909 |
isVisible: javaSupportLoaded |
|
1910 |
) |
|
1911 |
(MenuItem |
|
1912 |
enabled: canAddToClassPath |
|
1913 |
label: 'Add to Java Class Path' |
|
1914 |
isVisible: javaSupportLoaded |
|
1915 |
) |
|
1916 |
(MenuItem |
|
1917 |
enabled: canRemoveFromClassPath |
|
1918 |
label: 'Remove from Java Class Path' |
|
1919 |
isVisible: javaSupportLoaded |
|
1920 |
) |
|
1921 |
(MenuItem |
|
1922 |
enabled: canAddToSourcePath |
|
1923 |
label: 'Add to Java Source Path' |
|
1924 |
isVisible: javaSupportLoaded |
|
1925 |
) |
|
1926 |
(MenuItem |
|
1927 |
enabled: canRemoveFromSourcePath |
|
1928 |
label: 'Remove from Java Source Path' |
|
1929 |
isVisible: javaSupportLoaded |
|
1930 |
) |
|
1931 |
) |
|
1932 |
nil |
|
1933 |
nil |
|
1934 |
) |
|
1935 |
! |
|
1936 |
||
1937 |
fileOpMenu |
|
1938 |
"This resource specification was automatically generated |
|
1939 |
by the MenuEditor of ST/X." |
|
1940 |
||
1941 |
"Do not manually edit this!! If it is corrupted, |
|
1942 |
the MenuEditor may not be able to read the specification." |
|
1943 |
||
1944 |
||
1945 |
" |
|
1946 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileOpMenu |
|
1947 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileOpMenu)) startUp |
|
1948 |
" |
|
1949 |
||
1950 |
<resource: #menu> |
|
1951 |
||
1952 |
^ |
|
1953 |
#(Menu |
|
1954 |
( |
|
1955 |
(MenuItem |
|
1956 |
enabled: hasFileSelection |
|
15906 | 1957 |
label: 'Split (by size)...' |
15211 | 1958 |
itemValue: splitSelectedFiles |
1959 |
) |
|
1960 |
(MenuItem |
|
1961 |
enabled: hasFileSelection |
|
15906 | 1962 |
label: 'Split (by #lines)...' |
1963 |
itemValue: splitSelectedFilesByLines |
|
1964 |
) |
|
1965 |
(MenuItem |
|
1966 |
enabled: hasFileSelection |
|
15211 | 1967 |
label: 'Join...' |
1968 |
itemValue: joinSelectedFiles |
|
1969 |
) |
|
1970 |
(MenuItem |
|
1971 |
enabled: hasFileSelection |
|
1972 |
label: 'Copy Corrupted File To...' |
|
1973 |
itemValue: copySelectionToRepairingCorruptedFiles |
|
1974 |
) |
|
1975 |
(MenuItem |
|
15569 | 1976 |
label: 'Copy Corrupted File From -> To...' |
1977 |
itemValue: copyFromToRepairingCorruptedFiles |
|
1978 |
) |
|
1979 |
(MenuItem |
|
15211 | 1980 |
label: '-' |
1981 |
) |
|
1982 |
(MenuItem |
|
1983 |
enabled: hasFileSelection |
|
1984 |
label: 'Rot13...' |
|
1985 |
itemValue: filterSelectedFiles: |
|
1986 |
argument: rot13 |
|
1987 |
) |
|
1988 |
(MenuItem |
|
1989 |
label: '-' |
|
1990 |
) |
|
1991 |
(MenuItem |
|
1992 |
enabled: hasFileSelection |
|
1993 |
label: 'Truncate...' |
|
1994 |
itemValue: truncateSelectedFilesToZeroSize |
|
1995 |
) |
|
1996 |
(MenuItem |
|
1997 |
label: '-' |
|
1998 |
) |
|
1999 |
(MenuItem |
|
2000 |
label: 'Load Signature Support Package' |
|
2001 |
itemValue: loadSignatureSupport |
|
2002 |
isVisible: cannotGenerateSignatureFiles |
|
2003 |
) |
|
2004 |
(MenuItem |
|
2005 |
enabled: canGenerateSignatureFiles |
|
2006 |
label: 'Generate Signed Files' |
|
2007 |
itemValue: generateSignaturesForSelectedFiles |
|
2008 |
) |
|
2009 |
(MenuItem |
|
2010 |
enabled: canGenerateSignatureFiles |
|
2011 |
label: 'Generate Detached Signature Files (use for dll)' |
|
2012 |
itemValue: generateDetachedSignaturesForSelectedFiles |
|
2013 |
) |
|
2014 |
(MenuItem |
|
2015 |
enabled: canGenerateSignatureFiles |
|
2016 |
label: 'Generate Patch Installer for File(s)' |
|
2017 |
itemValue: generatePatchInstallerForSelectedFiles |
|
2018 |
) |
|
2019 |
(MenuItem |
|
2020 |
label: '-' |
|
2021 |
) |
|
2022 |
(MenuItem |
|
2023 |
enabled: hasFileSelection |
|
2024 |
label: 'File Differences' |
|
2025 |
itemValue: openDiffView |
|
2026 |
isVisible: hasTwoFilesSelectedHolder |
|
2027 |
) |
|
2028 |
(MenuItem |
|
2029 |
enabled: hasFileSelection |
|
2030 |
label: 'File Differences...' |
|
2031 |
itemValue: openDiffView |
|
2032 |
isVisible: hasNotTwoFilesSelectedHolder |
|
2033 |
) |
|
2034 |
(MenuItem |
|
2035 |
enabled: hasSelection |
|
2036 |
label: 'Directory Differences' |
|
2037 |
itemValue: openDirectoryDiffView |
|
2038 |
isVisible: hasTwoDirectoriesSelectedHolder |
|
2039 |
) |
|
2040 |
(MenuItem |
|
2041 |
enabled: hasSelection |
|
2042 |
label: 'Directory Differences...' |
|
2043 |
itemValue: openDirectoryDiffView |
|
2044 |
isVisible: hasNotTwoDirectoriesSelectedHolder |
|
2045 |
) |
|
17831 | 2046 |
(MenuItem |
2047 |
label: '-' |
|
2048 |
) |
|
2049 |
(MenuItem |
|
2050 |
label: 'Remove .bak and .sav Files...' |
|
2051 |
itemValue: removeBakAndSavFiles |
|
2052 |
) |
|
15211 | 2053 |
) |
2054 |
nil |
|
2055 |
nil |
|
2056 |
) |
|
2057 |
! |
|
2058 |
||
2059 |
newMenu |
|
2060 |
"This resource specification was automatically generated |
|
2061 |
by the MenuEditor of ST/X." |
|
2062 |
||
2063 |
"Do not manually edit this!! If it is corrupted, |
|
2064 |
the MenuEditor may not be able to read the specification." |
|
2065 |
||
2066 |
" |
|
2067 |
MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#newMenu |
|
2068 |
(Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser newMenu)) startUp |
|
2069 |
" |
|
2070 |
||
2071 |
<resource: #menu> |
|
2072 |
||
2073 |
^ |
|
2074 |
#(#Menu |
|
2075 |
#( |
|
2076 |
#(#MenuItem |
|
2077 |
#label: 'Directory...' |
|
2078 |
#translateLabel: true |
|
2079 |
#value: #newDirectory |
|
2080 |
) |
|
2081 |
#(#MenuItem |
|
2082 |
#label: 'File...' |
|
2083 |
#translateLabel: true |
|
2084 |
#value: #newFile |
|
2085 |
) |
|
2086 |
#(#MenuItem |
|
2087 |
#label: 'Hard Link...' |
|
2088 |
#translateLabel: true |
|
2089 |
#value: #newHardLink |
|
2090 |
) |
|
2091 |
#(#MenuItem |
|
2092 |
#label: 'Symbolic Link...' |
|
2093 |
#translateLabel: true |
|
2094 |
#value: #newSoftLink |
|
2095 |
) |
|
2096 |
) |
|
2097 |
nil |
|
2098 |
nil |
|
2099 |
) |
|
2100 |
! |
|
2101 |
||
2102 |
scmMenuSlice |
|
2103 |
"This resource specification was automatically generated |
|
2104 |
by the MenuEditor of ST/X." |
|
2105 |
||
2106 |
"Do not manually edit this!! If it is corrupted, |
|
2107 |
the MenuEditor may not be able to read the specification." |
|
2108 |
||
2109 |
||
2110 |
" |
|
2111 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#scmMenuSlice |
|
2112 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser scmMenuSlice)) startUp |
|
2113 |
" |
|
2114 |
||
2115 |
<resource: #menu> |
|
2116 |
||
2117 |
^ |
|
2118 |
#(Menu |
|
2119 |
( |
|
2120 |
(MenuItem |
|
2121 |
label: 'CVS' |
|
2122 |
isVisible: cvsMenusAreShown |
|
2123 |
submenuChannel: cvsMenu |
|
2124 |
) |
|
2125 |
(MenuItem |
|
2126 |
label: 'SVN' |
|
2127 |
isVisible: svnMenusAreShown |
|
2128 |
submenuChannel: svnMenu |
|
2129 |
) |
|
2130 |
(MenuItem |
|
2131 |
label: 'Mercurial' |
|
2132 |
isVisible: mercurialMenusAreShown |
|
2133 |
submenuChannel: mercurialMenu |
|
2134 |
) |
|
2135 |
(MenuItem |
|
2136 |
label: 'HG' |
|
2137 |
isVisible: hgMenusAreShown |
|
2138 |
submenuChannel: hgMenu |
|
2139 |
) |
|
2140 |
(MenuItem |
|
2141 |
label: 'Perforce' |
|
2142 |
isVisible: perforceMenusAreShown |
|
2143 |
submenuChannel: perforceMenu |
|
2144 |
) |
|
2145 |
) |
|
2146 |
nil |
|
2147 |
nil |
|
2148 |
) |
|
2149 |
! |
|
2150 |
||
2151 |
showMenuSpec |
|
2152 |
"This resource specification was automatically generated |
|
2153 |
by the MenuEditor of ST/X." |
|
2154 |
||
2155 |
"Do not manually edit this!! If it is corrupted, |
|
2156 |
the MenuEditor may not be able to read the specification." |
|
2157 |
||
2158 |
" |
|
2159 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpec |
|
2160 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpec)) startUp |
|
2161 |
" |
|
2162 |
||
2163 |
<resource: #menu> |
|
2164 |
||
2165 |
^ |
|
2166 |
#(Menu |
|
2167 |
( |
|
2168 |
(MenuItem |
|
2169 |
label: 'Hidden Files' |
|
2170 |
translateLabel: true |
|
2171 |
hideMenuOnActivated: false |
|
2172 |
indication: showHiddenFiles |
|
2173 |
) |
|
2174 |
(MenuItem |
|
2175 |
label: '-' |
|
2176 |
) |
|
2177 |
(MenuItem |
|
2178 |
label: 'Directory Tree' |
|
2179 |
translateLabel: true |
|
2180 |
hideMenuOnActivated: false |
|
2181 |
indication: showDirectoryTree |
|
2182 |
) |
|
2183 |
(MenuItem |
|
2184 |
label: 'Regular Files in TreeView (Left)' |
|
2185 |
translateLabel: true |
|
2186 |
hideMenuOnActivated: false |
|
2187 |
indication: viewFilesInDirectoryTree |
|
2188 |
) |
|
2189 |
(MenuItem |
|
2190 |
label: 'Directories in ContentsView (Right)' |
|
2191 |
translateLabel: true |
|
2192 |
hideMenuOnActivated: false |
|
2193 |
indication: viewDirsInContentsBrowser |
|
2194 |
) |
|
2195 |
(MenuItem |
|
2196 |
enabled: enableViewNoteBookApplication |
|
2197 |
label: 'File Applications' |
|
2198 |
translateLabel: true |
|
2199 |
hideMenuOnActivated: false |
|
2200 |
indication: viewNoteBookApplicationHolder |
|
2201 |
) |
|
2202 |
(MenuItem |
|
2203 |
label: '-' |
|
2204 |
) |
|
2205 |
(MenuItem |
|
2206 |
label: 'DiskUsage' |
|
2207 |
translateLabel: true |
|
2208 |
hideMenuOnActivated: false |
|
2209 |
indication: showDiskUsageHolder |
|
2210 |
) |
|
2211 |
) |
|
2212 |
nil |
|
2213 |
nil |
|
2214 |
) |
|
2215 |
! |
|
2216 |
||
2217 |
showMenuSpecForDialog |
|
2218 |
"This resource specification was automatically generated |
|
2219 |
by the MenuEditor of ST/X." |
|
2220 |
||
2221 |
"Do not manually edit this!! If it is corrupted, |
|
2222 |
the MenuEditor may not be able to read the specification." |
|
2223 |
||
2224 |
" |
|
2225 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpecForDialog |
|
2226 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpecForDialog)) startUp |
|
2227 |
" |
|
2228 |
||
2229 |
<resource: #menu> |
|
2230 |
||
2231 |
^ |
|
2232 |
#(Menu |
|
2233 |
( |
|
2234 |
(MenuItem |
|
2235 |
label: 'Hidden Files' |
|
2236 |
translateLabel: true |
|
2237 |
hideMenuOnActivated: false |
|
2238 |
indication: showHiddenFiles |
|
2239 |
) |
|
2240 |
) |
|
2241 |
nil |
|
2242 |
nil |
|
2243 |
) |
|
2244 |
! |
|
2245 |
||
2246 |
sortMenu |
|
2247 |
"This resource specification was automatically generated |
|
2248 |
by the MenuEditor of ST/X." |
|
2249 |
||
2250 |
"Do not manually edit this!! If it is corrupted, |
|
2251 |
the MenuEditor may not be able to read the specification." |
|
2252 |
||
2253 |
" |
|
2254 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#sortMenu |
|
2255 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser sortMenu)) startUp |
|
2256 |
" |
|
2257 |
||
2258 |
<resource: #menu> |
|
2259 |
||
2260 |
^ |
|
2261 |
#(#Menu |
|
2262 |
#( |
|
2263 |
#(#MenuItem |
|
2264 |
#label: 'By Filename' |
|
2265 |
#translateLabel: true |
|
2266 |
#hideMenuOnActivated: false |
|
2267 |
#choice: #sortBlockProperty |
|
2268 |
#choiceValue: #baseName |
|
2269 |
) |
|
2270 |
#(#MenuItem |
|
2271 |
#label: 'By Extension' |
|
2272 |
#translateLabel: true |
|
2273 |
#hideMenuOnActivated: false |
|
2274 |
#choice: #sortBlockProperty |
|
2275 |
#choiceValue: #suffix |
|
2276 |
) |
|
2277 |
#(#MenuItem |
|
2278 |
#label: 'By Permissions' |
|
2279 |
#translateLabel: true |
|
2280 |
#hideMenuOnActivated: false |
|
2281 |
#choice: #sortBlockProperty |
|
2282 |
#choiceValue: #permissions |
|
2283 |
) |
|
2284 |
#(#MenuItem |
|
2285 |
#label: 'By Owner' |
|
2286 |
#translateLabel: true |
|
2287 |
#isVisible: #viewOwner |
|
2288 |
#hideMenuOnActivated: false |
|
2289 |
#choice: #sortBlockProperty |
|
2290 |
#choiceValue: #owner |
|
2291 |
) |
|
2292 |
#(#MenuItem |
|
2293 |
#label: 'By Group' |
|
2294 |
#translateLabel: true |
|
2295 |
#isVisible: #viewOwner |
|
2296 |
#hideMenuOnActivated: false |
|
2297 |
#choice: #sortBlockProperty |
|
2298 |
#choiceValue: #group |
|
2299 |
) |
|
2300 |
#(#MenuItem |
|
2301 |
#label: 'By Size' |
|
2302 |
#translateLabel: true |
|
2303 |
#hideMenuOnActivated: false |
|
2304 |
#choice: #sortBlockProperty |
|
2305 |
#choiceValue: #fileSize |
|
2306 |
) |
|
2307 |
#(#MenuItem |
|
2308 |
#label: 'By Date && Time' |
|
2309 |
#translateLabel: true |
|
2310 |
#hideMenuOnActivated: false |
|
2311 |
#choice: #sortBlockProperty |
|
2312 |
#choiceValue: #modificationTime |
|
2313 |
) |
|
2314 |
#(#MenuItem |
|
2315 |
#label: '-' |
|
2316 |
) |
|
2317 |
#(#MenuItem |
|
2318 |
#label: 'Ignore Case in Sort' |
|
2319 |
#translateLabel: true |
|
2320 |
#hideMenuOnActivated: false |
|
2321 |
#indication: #sortCaseless |
|
2322 |
) |
|
2323 |
#(#MenuItem |
|
2324 |
#label: 'Directories before Files' |
|
2325 |
#translateLabel: true |
|
2326 |
#hideMenuOnActivated: false |
|
2327 |
#indication: #sortDirectoriesBeforeFiles |
|
2328 |
) |
|
2329 |
) |
|
2330 |
nil |
|
2331 |
nil |
|
2332 |
) |
|
2333 |
! |
|
2334 |
||
2335 |
toolsMenuSpec |
|
2336 |
"This resource specification was automatically generated |
|
2337 |
by the MenuEditor of ST/X." |
|
2338 |
||
2339 |
"Do not manually edit this!! If it is corrupted, |
|
2340 |
the MenuEditor may not be able to read the specification." |
|
2341 |
||
2342 |
||
2343 |
" |
|
2344 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec |
|
2345 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp |
|
2346 |
" |
|
2347 |
||
2348 |
<resource: #menu> |
|
2349 |
||
2350 |
^ |
|
2351 |
#(Menu |
|
2352 |
( |
|
2353 |
(MenuItem |
|
2354 |
label: 'Open (Win32-Shell)' |
|
2355 |
itemValue: doOpenWithShellCommand |
|
2356 |
isVisible: systemIsDOS |
|
2357 |
) |
|
2358 |
(MenuItem |
|
18013 | 2359 |
label: 'Open (OSX-Application)' |
2360 |
itemValue: doOpenWithShellCommand |
|
2361 |
isVisible: systemIsOSX |
|
2362 |
) |
|
2363 |
(MenuItem |
|
15211 | 2364 |
label: 'Execute UNIX Command...' |
2365 |
itemValue: doExecuteCommand |
|
2366 |
isVisible: systemIsUnix |
|
2367 |
) |
|
2368 |
(MenuItem |
|
2369 |
label: 'Execute DOS Command...' |
|
2370 |
itemValue: doExecuteCommand |
|
2371 |
isVisible: systemIsDOS |
|
2372 |
) |
|
2373 |
(MenuItem |
|
2374 |
label: 'Execute Script...' |
|
2375 |
itemValue: doExecuteScript |
|
2376 |
) |
|
2377 |
(MenuItem |
|
2378 |
enabled: canDoTerminal |
|
2379 |
label: 'Shell Terminal' |
|
2380 |
itemValue: openTerminal |
|
2381 |
isVisible: canDoTerminalAndSystemIsUnix |
|
2382 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'Shell Terminal') |
|
2383 |
) |
|
2384 |
(MenuItem |
|
2385 |
enabled: canDoTerminal |
|
2386 |
label: 'DOS Terminal' |
|
2387 |
itemValue: openTerminal |
|
2388 |
isVisible: canDoTerminalAndSystemIsDOS |
|
2389 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'DOS Terminal') |
|
2390 |
) |
|
2391 |
(MenuItem |
|
2392 |
label: '-' |
|
2393 |
) |
|
2394 |
(MenuItem |
|
2395 |
enabled: hasFileSelection |
|
2396 |
label: 'Changes Browser' |
|
2397 |
itemValue: openChangesBrowser |
|
18773 | 2398 |
labelImage: (ResourceRetriever ToolbarIconLibrary changesBrowser16x16Icon 'Changes Browser') |
15211 | 2399 |
) |
2400 |
(MenuItem |
|
2401 |
enabled: hasFileSelection |
|
2402 |
label: 'ChangeSet Browser' |
|
2403 |
itemValue: openChangeSetBrowser |
|
2404 |
isVisible: changeSetBrowserItemVisible |
|
2405 |
) |
|
2406 |
(MenuItem |
|
2407 |
enabled: hasFileSelection |
|
2408 |
label: 'Workspace' |
|
2409 |
itemValue: openWorkspace |
|
2410 |
) |
|
2411 |
(MenuItem |
|
2412 |
label: '-' |
|
2413 |
) |
|
2414 |
(MenuItem |
|
2415 |
enabled: canReadAbbrevFile |
|
2416 |
label: 'Install Autoloaded' |
|
2417 |
itemValue: readAbbrevFile |
|
2418 |
) |
|
2419 |
(MenuItem |
|
2420 |
enabled: anySTFilesPresent |
|
2421 |
label: 'Install all ST-Files as Autoloaded' |
|
2422 |
itemValue: installAllAsAutoloaded |
|
2423 |
) |
|
2424 |
(MenuItem |
|
2425 |
enabled: recursiveAnySTFilesPresent |
|
2426 |
label: 'Recursive Install all ST-Files as Autoloaded' |
|
2427 |
itemValue: installAllAsAutoloadedRecursive |
|
2428 |
) |
|
2429 |
(MenuItem |
|
2430 |
label: '-' |
|
2431 |
) |
|
2432 |
(MenuItem |
|
2433 |
enabled: hasJava |
|
2434 |
label: 'Add Directory to Java Source Path (stx:libjava)' |
|
2435 |
itemValue: addDirToJavaSourcePath |
|
2436 |
) |
|
2437 |
(MenuItem |
|
2438 |
enabled: hasJava |
|
2439 |
label: 'Add Selected Files to Java Source Path (stx:libjava)' |
|
2440 |
itemValue: fileAddToJavaSourcePath |
|
2441 |
) |
|
2442 |
(MenuItem |
|
2443 |
label: '-' |
|
2444 |
) |
|
2445 |
(MenuItem |
|
2446 |
label: 'File Operations' |
|
2447 |
submenuChannel: fileOpMenu |
|
2448 |
) |
|
2449 |
(MenuItem |
|
2450 |
label: 'File Utilities' |
|
2451 |
submenu: |
|
2452 |
(Menu |
|
2453 |
( |
|
2454 |
(MenuItem |
|
2455 |
enabled: hasFileSelection |
|
2456 |
label: 'Editor' |
|
2457 |
itemValue: openEditor |
|
2458 |
) |
|
2459 |
(MenuItem |
|
2460 |
enabled: hasFileSelection |
|
2461 |
label: 'HTML Reader' |
|
2462 |
itemValue: openHTMLReader |
|
2463 |
) |
|
2464 |
(MenuItem |
|
2465 |
enabled: hasFileSelection |
|
2466 |
label: 'Web Browser' |
|
2467 |
itemValue: openWebBrowser |
|
2468 |
) |
|
2469 |
(MenuItem |
|
2470 |
label: 'XML Inspector' |
|
2471 |
itemValue: inspectXmlFile |
|
2472 |
isVisible: hasXml |
|
2473 |
showBusyCursorWhilePerforming: true |
|
2474 |
) |
|
2475 |
(MenuItem |
|
2476 |
enabled: hasFileSelection |
|
2477 |
label: 'Acroread (PDF Viewer)' |
|
2478 |
itemValue: openPDFViewer |
|
2479 |
) |
|
2480 |
(MenuItem |
|
2481 |
enabled: hasASN1AndSelection |
|
2482 |
label: 'ASN1 Browser' |
|
2483 |
itemValue: openASN1Browser |
|
2484 |
isVisible: hasASN1 |
|
2485 |
) |
|
2486 |
(MenuItem |
|
2487 |
enabled: hasCBrowser |
|
2488 |
label: 'C Browser' |
|
2489 |
itemValue: openCBrowser |
|
2490 |
isVisible: hasCBrowser |
|
2491 |
) |
|
2492 |
(MenuItem |
|
2493 |
enabled: canOpenMonticelloBrowser |
|
2494 |
label: 'Monticello Browser' |
|
2495 |
itemValue: doOpenMonticelloBrowser |
|
2496 |
) |
|
2497 |
(MenuItem |
|
2498 |
enabled: hasJavaAndSelection |
|
2499 |
label: 'Applet Viewer' |
|
2500 |
itemValue: openAppletViewer |
|
2501 |
isVisible: hasJava |
|
2502 |
) |
|
2503 |
(MenuItem |
|
2504 |
enabled: hasMP3PlayerAndSelection |
|
2505 |
label: 'MP3 Player' |
|
2506 |
itemValue: openMP3Player |
|
2507 |
isVisible: hasMP3Player |
|
2508 |
) |
|
2509 |
(MenuItem |
|
2510 |
enabled: hasFileSelection |
|
2511 |
label: 'xv (Image Viewer)' |
|
2512 |
itemValue: openXV |
|
2513 |
isVisible: systemIsUnix |
|
2514 |
) |
|
2515 |
(MenuItem |
|
2516 |
enabled: currentFilesAreInSameDirectory |
|
2517 |
label: 'Slide Show' |
|
2518 |
itemValue: openSlideShow |
|
2519 |
isVisible: hasSlideShow |
|
2520 |
) |
|
2521 |
(MenuItem |
|
2522 |
enabled: hasFileSelection |
|
2523 |
label: 'gv (Postscript Viewer)' |
|
2524 |
itemValue: openGV |
|
2525 |
isVisible: systemIsUnix |
|
2526 |
) |
|
2527 |
(MenuItem |
|
2528 |
enabled: hasMP3PlayerAndSelection |
|
2529 |
label: 'MP3 Player' |
|
2530 |
itemValue: openMP3Player |
|
2531 |
isVisible: hasMP3Player |
|
2532 |
) |
|
2533 |
(MenuItem |
|
2534 |
enabled: hasFileSelection |
|
2535 |
label: 'Realplay (avi viewer)' |
|
2536 |
itemValue: openRP |
|
2537 |
isVisible: systemIsUnix |
|
2538 |
) |
|
2539 |
(MenuItem |
|
2540 |
label: '-' |
|
2541 |
) |
|
2542 |
(MenuItem |
|
2543 |
label: 'Smalltalk' |
|
2544 |
submenu: |
|
2545 |
(Menu |
|
2546 |
( |
|
2547 |
(MenuItem |
|
2548 |
enabled: hasSnapshotSelection |
|
2549 |
label: 'Snapshot Image Browser' |
|
2550 |
itemValue: openSnapshotImageBrowser |
|
2551 |
) |
|
2552 |
(MenuItem |
|
2553 |
enabled: canCreateNewProject |
|
2554 |
label: 'Create Smalltalk Project' |
|
2555 |
itemValue: createProjectAndOpenProjectBrowser |
|
2556 |
) |
|
2557 |
(MenuItem |
|
2558 |
label: '-' |
|
2559 |
) |
|
2560 |
(MenuItem |
|
2561 |
enabled: hasResourceFileSelected |
|
2562 |
label: 'Show Contents of Resourcefile' |
|
2563 |
itemValue: readAndShowResources |
|
2564 |
) |
|
2565 |
(MenuItem |
|
2566 |
enabled: hasResourceFileSelected |
|
2567 |
label: 'Resource File Editor' |
|
2568 |
itemValue: openResourceFileEditor |
|
2569 |
showBusyCursorWhilePerforming: true |
|
2570 |
) |
|
2571 |
(MenuItem |
|
2572 |
label: '-' |
|
2573 |
) |
|
2574 |
(MenuItem |
|
2575 |
enabled: hasFileSelection |
|
2576 |
label: 'Contents as ByteArray' |
|
2577 |
itemValue: fileContentsAsByteArray |
|
2578 |
) |
|
18426 | 2579 |
(MenuItem |
2580 |
label: '-' |
|
2581 |
) |
|
2582 |
(MenuItem |
|
2583 |
enabled: hasFileSelection |
|
2584 |
label: 'Changes from GNU Smalltalk Source' |
|
2585 |
itemValue: changeSetFromGSTSource |
|
2586 |
) |
|
15211 | 2587 |
) |
2588 |
nil |
|
2589 |
nil |
|
2590 |
) |
|
2591 |
) |
|
2592 |
(MenuItem |
|
2593 |
label: 'Image' |
|
2594 |
submenu: |
|
2595 |
(Menu |
|
2596 |
( |
|
2597 |
(MenuItem |
|
2598 |
enabled: hasFileSelection |
|
2599 |
label: 'Image Editor' |
|
2600 |
itemValue: openImageEditor |
|
2601 |
) |
|
2602 |
(MenuItem |
|
2603 |
enabled: hasFileSelection |
|
2604 |
label: 'Image Preview' |
|
2605 |
itemValue: openImagePreview |
|
2606 |
) |
|
2607 |
(MenuItem |
|
2608 |
enabled: hasFileSelection |
|
2609 |
label: 'Image Inspector' |
|
2610 |
itemValue: openImageInspector |
|
2611 |
) |
|
2612 |
(MenuItem |
|
2613 |
label: '-' |
|
2614 |
) |
|
2615 |
(MenuItem |
|
2616 |
enabled: hasFileSelection |
|
2617 |
label: 'Convert to GIF' |
|
2618 |
itemValue: convertImageToGIF |
|
2619 |
) |
|
2620 |
(MenuItem |
|
2621 |
enabled: hasFileSelection |
|
2622 |
label: 'Convert to PNG' |
|
2623 |
itemValue: convertImageToPNG |
|
2624 |
) |
|
2625 |
(MenuItem |
|
2626 |
enabled: hasFileSelection |
|
2627 |
label: 'Convert to XPM' |
|
2628 |
itemValue: convertImageToXPM |
|
2629 |
) |
|
2630 |
(MenuItem |
|
2631 |
enabled: hasFileSelection |
|
2632 |
label: 'Convert to JPG' |
|
2633 |
itemValue: convertImageToJPG |
|
2634 |
) |
|
2635 |
) |
|
2636 |
nil |
|
2637 |
nil |
|
2638 |
) |
|
2639 |
) |
|
2640 |
(MenuItem |
|
15528 | 2641 |
label: 'Web' |
2642 |
submenu: |
|
2643 |
(Menu |
|
2644 |
( |
|
2645 |
(MenuItem |
|
2646 |
label: 'Fetch File by URL...' |
|
2647 |
itemValue: fetchFileByURL |
|
2648 |
) |
|
2649 |
) |
|
2650 |
nil |
|
2651 |
nil |
|
2652 |
) |
|
2653 |
) |
|
2654 |
(MenuItem |
|
15211 | 2655 |
enabled: hasZipFileSelectedHolder |
2656 |
label: 'ZipFile Tool' |
|
2657 |
itemValue: openZipTool |
|
2658 |
) |
|
2659 |
(MenuItem |
|
2660 |
enabled: hasFileSelection |
|
2661 |
label: 'Hex Dump' |
|
2662 |
itemValue: fileHexDump |
|
2663 |
) |
|
2664 |
) |
|
2665 |
nil |
|
2666 |
nil |
|
2667 |
) |
|
2668 |
) |
|
2669 |
(MenuItem |
|
2670 |
label: 'Find' |
|
2671 |
submenu: |
|
2672 |
(Menu |
|
2673 |
( |
|
2674 |
(MenuItem |
|
2675 |
label: 'File...' |
|
2676 |
itemValue: fileFindFile |
|
2677 |
) |
|
2678 |
(MenuItem |
|
2679 |
enabled: hasFileSelection |
|
2680 |
label: 'Same Contents as Selected...' |
|
2681 |
itemValue: fileFindDuplicateFile |
|
2682 |
) |
|
2683 |
(MenuItem |
|
2684 |
label: 'Duplicate Files' |
|
2685 |
itemValue: fileFindDuplicates |
|
2686 |
) |
|
2687 |
(MenuItem |
|
2688 |
enabled: hasSelection |
|
2689 |
label: 'All Duplicate Files (Recursive)' |
|
2690 |
itemValue: fileFindAllDuplicates |
|
2691 |
) |
|
2692 |
(MenuItem |
|
17686 | 2693 |
label: 'Similar Image Files (by Colors)' |
15211 | 2694 |
itemValue: fileFindSimilarImages |
2695 |
isVisible: hasImageColorHistogram |
|
2696 |
) |
|
17686 | 2697 |
(MenuItem |
2698 |
label: 'Similar Image Files (by Form)' |
|
2699 |
itemValue: fileFindSimilarImagesByForm |
|
2700 |
isVisible: hasImageHistogram |
|
2701 |
) |
|
15211 | 2702 |
) |
2703 |
nil |
|
2704 |
nil |
|
2705 |
) |
|
2706 |
) |
|
2707 |
) |
|
2708 |
nil |
|
2709 |
nil |
|
2710 |
) |
|
2711 |
! |
|
2712 |
||
2713 |
viewDetailsMenuSpec |
|
2714 |
"This resource specification was automatically generated |
|
2715 |
by the MenuEditor of ST/X." |
|
2716 |
||
2717 |
"Do not manually edit this!! If it is corrupted, |
|
2718 |
the MenuEditor may not be able to read the specification." |
|
2719 |
||
2720 |
" |
|
2721 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#viewDetailsMenuSpec |
|
2722 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser viewDetailsMenuSpec)) startUp |
|
2723 |
" |
|
2724 |
||
2725 |
<resource: #menu> |
|
2726 |
||
2727 |
^ |
|
2728 |
#(#Menu |
|
2729 |
#( |
|
2730 |
#(#MenuItem |
|
2731 |
#label: '-' |
|
2732 |
) |
|
2733 |
#(#MenuItem |
|
2734 |
#label: 'Hidden Files' |
|
2735 |
#translateLabel: true |
|
2736 |
#indication: #showHiddenFiles |
|
2737 |
) |
|
2738 |
) |
|
2739 |
nil |
|
2740 |
nil |
|
2741 |
) |
|
2742 |
! ! |
|
3892 | 2743 |
|
11144 | 2744 |
!AbstractFileBrowser class methodsFor:'menu specs-scm'! |
2745 |
||
15211 | 2746 |
cvsMenu |
2747 |
"This resource specification was automatically generated |
|
2748 |
by the MenuEditor of ST/X." |
|
2749 |
||
2750 |
"Do not manually edit this!! If it is corrupted, |
|
2751 |
the MenuEditor may not be able to read the specification." |
|
2752 |
||
2753 |
||
2754 |
" |
|
2755 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#cvsMenu |
|
2756 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser cvsMenu)) startUp |
|
2757 |
" |
|
2758 |
||
2759 |
<resource: #menu> |
|
2760 |
||
2761 |
^ |
|
2762 |
#(Menu |
|
2763 |
( |
|
2764 |
(MenuItem |
|
2765 |
label: 'Commit (CVS)...' |
|
2766 |
itemValue: cvsCommit |
|
2767 |
translateLabel: true |
|
2768 |
) |
|
2769 |
(MenuItem |
|
2770 |
enabled: canCvsAddAndCommit |
|
2771 |
label: 'Add && Commit...' |
|
2772 |
itemValue: cvsAddAndCommit |
|
2773 |
translateLabel: true |
|
2774 |
) |
|
2775 |
(MenuItem |
|
2776 |
enabled: canCvsAddAndCommit |
|
2777 |
label: 'Add as Binary && Commit...' |
|
2778 |
itemValue: cvsAddBinaryAndCommit |
|
2779 |
translateLabel: true |
|
2780 |
) |
|
2781 |
(MenuItem |
|
2782 |
label: 'Commit Folder (CVS)...' |
|
2783 |
itemValue: cvsCommitFolder |
|
2784 |
translateLabel: true |
|
2785 |
) |
|
2786 |
(MenuItem |
|
2787 |
label: '-' |
|
2788 |
) |
|
2789 |
(MenuItem |
|
2790 |
enabled: hasSelection |
|
2791 |
label: 'Update selected Files/Directories' |
|
2792 |
itemValue: cvsUpdateSelection |
|
2793 |
translateLabel: true |
|
2794 |
) |
|
2795 |
(MenuItem |
|
2796 |
label: 'Update Directory Local' |
|
2797 |
itemValue: cvsUpdateAll |
|
2798 |
translateLabel: true |
|
2799 |
) |
|
2800 |
(MenuItem |
|
2801 |
label: 'Update Directory Recursive' |
|
2802 |
itemValue: cvsUpdateAllRecursive |
|
2803 |
translateLabel: true |
|
2804 |
) |
|
2805 |
(MenuItem |
|
2806 |
label: '-' |
|
2807 |
) |
|
2808 |
(MenuItem |
|
2809 |
enabled: hasSelection |
|
2810 |
label: 'Tag...' |
|
2811 |
itemValue: cvsTagSelection |
|
2812 |
translateLabel: true |
|
2813 |
) |
|
2814 |
(MenuItem |
|
2815 |
enabled: hasSelection |
|
2816 |
label: 'Revision Log' |
|
2817 |
itemValue: cvsRevisionLog |
|
2818 |
translateLabel: true |
|
2819 |
) |
|
2820 |
(MenuItem |
|
2821 |
enabled: hasSelection |
|
2822 |
label: 'Compare with newest in Repository' |
|
2823 |
itemValue: cvsCompareWithNewest |
|
2824 |
translateLabel: true |
|
2825 |
) |
|
2826 |
(MenuItem |
|
2827 |
label: '-' |
|
2828 |
) |
|
2829 |
(MenuItem |
|
2830 |
enabled: canRemoveCVSContainer |
|
2831 |
label: 'Remove File && CVS Container...' |
|
2832 |
itemValue: cvsRemoveFileAndCVSContainer |
|
2833 |
translateLabel: true |
|
2834 |
) |
|
2835 |
) |
|
2836 |
nil |
|
2837 |
nil |
|
2838 |
) |
|
2839 |
! |
|
2840 |
||
2841 |
mercurialMenu |
|
2842 |
"This resource specification was automatically generated |
|
2843 |
by the MenuEditor of ST/X." |
|
2844 |
||
2845 |
"Do not manually edit this!! If it is corrupted, |
|
2846 |
the MenuEditor may not be able to read the specification." |
|
2847 |
||
2848 |
||
2849 |
" |
|
2850 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#mercurialMenu |
|
2851 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser mercurialMenu)) startUp |
|
2852 |
" |
|
2853 |
||
2854 |
<resource: #menu> |
|
2855 |
||
2856 |
^ |
|
2857 |
#(Menu |
|
2858 |
( |
|
2859 |
(MenuItem |
|
2860 |
label: 'Add' |
|
2861 |
itemValue: mercurialAdd |
|
2862 |
translateLabel: true |
|
2863 |
) |
|
2864 |
(MenuItem |
|
2865 |
label: 'Commit Changes' |
|
2866 |
itemValue: mercurialCommit |
|
2867 |
translateLabel: true |
|
2868 |
) |
|
2869 |
(MenuItem |
|
2870 |
label: 'Push...' |
|
2871 |
itemValue: mercurialPush |
|
2872 |
translateLabel: true |
|
2873 |
) |
|
2874 |
(MenuItem |
|
2875 |
label: 'Status' |
|
2876 |
itemValue: mercurialStatus |
|
2877 |
translateLabel: true |
|
2878 |
) |
|
2879 |
(MenuItem |
|
2880 |
label: '-' |
|
2881 |
) |
|
2882 |
(MenuItem |
|
2883 |
label: 'Init' |
|
2884 |
itemValue: mercurialInit |
|
2885 |
translateLabel: true |
|
2886 |
) |
|
2887 |
) |
|
2888 |
nil |
|
2889 |
nil |
|
2890 |
) |
|
2891 |
||
2892 |
"Modified: / 17-01-2012 / 15:57:40 / cg" |
|
2893 |
! |
|
2894 |
||
2895 |
perforceMenu |
|
2896 |
"This resource specification was automatically generated |
|
2897 |
by the MenuEditor of ST/X." |
|
2898 |
||
2899 |
"Do not manually edit this!! If it is corrupted, |
|
2900 |
the MenuEditor may not be able to read the specification." |
|
2901 |
||
2902 |
||
2903 |
" |
|
2904 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#perforceMenu |
|
2905 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser perforceMenu)) startUp |
|
2906 |
" |
|
2907 |
||
2908 |
<resource: #menu> |
|
2909 |
||
2910 |
^ |
|
2911 |
#(Menu |
|
2912 |
( |
|
2913 |
(MenuItem |
|
2914 |
label: 'Commit' |
|
2915 |
itemValue: perforceCommit |
|
2916 |
translateLabel: true |
|
2917 |
) |
|
2918 |
) |
|
2919 |
nil |
|
2920 |
nil |
|
2921 |
) |
|
2922 |
||
2923 |
"Created: / 15-01-2012 / 13:12:30 / cg" |
|
2924 |
! ! |
|
11144 | 2925 |
|
3892 | 2926 |
!AbstractFileBrowser class methodsFor:'misc'! |
2927 |
||
2928 |
newLock |
|
2929 |
^ CodeExecutionLock new |
|
2930 |
! ! |
|
2931 |
||
17288 | 2932 |
!AbstractFileBrowser class methodsFor:'queries'! |
2933 |
||
2934 |
isAbstract |
|
2935 |
^ self == AbstractFileBrowser |
|
2936 |
! ! |
|
2937 |
||
17868 | 2938 |
!AbstractFileBrowser class methodsFor:'queries-file'! |
2939 |
||
2940 |
getBestDirectoryFrom:directories |
|
2941 |
"from a set of directories, return the common parent directory" |
|
2942 |
||
2943 |
|stringCol firstPre| |
|
2944 |
||
2945 |
directories isEmpty ifTrue:[^ nil]. |
|
2946 |
directories size == 1 ifTrue:[^ directories first]. |
|
2947 |
stringCol := (directories collect:[:file| file asString]) asOrderedCollection. |
|
2948 |
firstPre := stringCol at:1. |
|
2949 |
stringCol from:2 do:[:el| |
|
2950 |
firstPre := firstPre commonPrefixWith:el. |
|
2951 |
]. |
|
2952 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
2953 |
firstPre removeLast. |
|
2954 |
]. |
|
2955 |
^ firstPre asFilename |
|
2956 |
! ! |
|
2957 |
||
17746 | 2958 |
!AbstractFileBrowser class methodsFor:'utilities - dump'! |
4610 | 2959 |
|
18666 | 2960 |
contentsOfBytesAsDump:dataOrFileStream base:numberBase numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
17744 | 2961 |
"utility helper: generate a hexDump with addresses; |
2962 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
2963 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
2964 |
to support display of alien encoded binary data." |
|
2965 |
||
18666 | 2966 |
|dataSize lines nHexLines replacementForUnprintable colsPerByte characterDecoder| |
17744 | 2967 |
|
2968 |
(characterEncodingSymbol isNil or:[characterEncodingSymbol == #'iso8859-1']) ifFalse:[ |
|
2969 |
characterDecoder := CharacterEncoder encoderToEncodeFrom:characterEncodingSymbol into:#unicode. |
|
2970 |
]. |
|
17252 | 2971 |
|
2972 |
"/ used to be: |
|
2973 |
"/ replacementForUnprintable := $. |
|
2974 |
replacementForUnprintable := Character value:16rB7. "/ a centered dot. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2975 |
|
17744 | 2976 |
"/ cols needed per byte in the hex dump |
2977 |
colsPerByte := ((255 printStringRadix:numberBase) size). |
|
2978 |
||
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2979 |
"generate a virtual collection which evaluates and returns lines on-demand" |
18666 | 2980 |
dataSize := dataOrFileStream isStream |
2981 |
ifTrue:[ dataOrFileStream fileSize ] |
|
2982 |
ifFalse:[ dataOrFileStream size ]. |
|
2983 |
nHexLines := (dataSize + 15) // 16. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2984 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2985 |
lines := VirtualArray new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2986 |
lines setSize:nHexLines + (nHexLines // 16). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2987 |
lines |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2988 |
generator:[:lineNr | |
17744 | 2989 |
|blockNr lineNrInBlock startOffset lineStream asciiLineStream byte line |
2990 |
decodedChar charPrinted| |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2991 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2992 |
blockNr := (lineNr - 1) // 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2993 |
lineNrInBlock := (lineNr - 1) \\ 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2994 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2995 |
lineNrInBlock == 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2996 |
line := '' |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2997 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2998 |
startOffset := ((blockNr * 16) + lineNrInBlock) * 16. |
17744 | 2999 |
|
3000 |
"/ two streams; one for the hex bytes, one for the ascii-interpretation |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3001 |
lineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3002 |
asciiLineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3003 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3004 |
lineStream nextPutAll:((startOffset+virtualStart) hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3005 |
lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3006 |
1 to:16 do:[:i | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3007 |
i ~~ 1 ifTrue:[ lineStream space ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3008 |
|
18666 | 3009 |
(startOffset + i) > dataSize ifTrue:[ |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3010 |
asciiLineStream nextPut:(Character space). |
17744 | 3011 |
lineStream spaces:colsPerByte. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3012 |
] ifFalse:[ |
18666 | 3013 |
dataOrFileStream isStream ifTrue:[ |
3014 |
dataOrFileStream position:(startOffset + i - 1). |
|
3015 |
byte := dataOrFileStream nextByte. |
|
3016 |
] ifFalse:[ |
|
3017 |
byte := dataOrFileStream at:startOffset + i. |
|
3018 |
]. |
|
17746 | 3019 |
lineStream nextPutAll:(byte printStringRadix:numberBase size:colsPerByte fill:$0). |
17744 | 3020 |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3021 |
|
17744 | 3022 |
decodedChar := byte. |
3023 |
characterDecoder notNil ifTrue:[ |
|
3024 |
decodedChar := characterDecoder encode:byte. |
|
3025 |
]. |
|
3026 |
||
3027 |
charPrinted := replacementForUnprintable. |
|
3028 |
decodedChar notNil ifTrue:[ |
|
3029 |
((decodedChar between:32 and:127) or:[(decodedChar between:(128+32) and:(128+127))]) ifTrue:[ |
|
3030 |
charPrinted := Character value:decodedChar. |
|
16188 | 3031 |
] ifFalse:[ |
17744 | 3032 |
(decodedChar between:0 and:31) ifTrue:[ |
3033 |
"/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400 |
|
3034 |
"/ are perfect here, but usually not available in the font |
|
3035 |
"/ and we have currently no way of knowing if they are... |
|
3036 |
"/ (could let the font draw into a bitmap and check if there is something...) |
|
18805 | 3037 |
"/ For now, write a dot.· |
17744 | 3038 |
"/ charPrinted := (Character value:(byte + 16r2400)) |
3039 |
]. |
|
16188 | 3040 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3041 |
]. |
17744 | 3042 |
asciiLineStream nextPut:charPrinted. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3043 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3044 |
]. |
17744 | 3045 |
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
|
3046 |
, asciiLineStream contents. |
11262 | 3047 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3048 |
line |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3049 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3050 |
^ lines. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3051 |
|
17744 | 3052 |
"Created: / 12-11-2017 / 11:24:29 / cg" |
17750 | 3053 |
"Modified: / 12-11-2017 / 14:17:59 / cg" |
18666 | 3054 |
"Modified: / 12-03-2019 / 16:16:53 / Claus Gittinger" |
3055 |
! |
|
3056 |
||
3057 |
contentsOfBytesAsHexDump:dataOrFileStream numberOfAddressDigits:addrDigits addressStart:virtualStart |
|
17744 | 3058 |
"utility helper: generate a hexDump with addresses; the character columns at the right show |
3059 |
the iso8859-1 characters" |
|
17753 | 3060 |
|
3061 |
^ self |
|
18666 | 3062 |
contentsOfBytesAsDump:dataOrFileStream base:16 |
17744 | 3063 |
numberOfAddressDigits:addrDigits |
3064 |
addressStart:virtualStart |
|
17753 | 3065 |
characterEncoding:#'iso8859-1' |
11262 | 3066 |
|
3067 |
"Created: / 13-02-2012 / 15:01:46 / cg" |
|
17744 | 3068 |
"Modified: / 12-11-2017 / 12:07:12 / cg" |
17753 | 3069 |
"Modified: / 14-11-2017 / 17:48:19 / mawalch" |
18666 | 3070 |
"Modified (format): / 12-03-2019 / 16:38:26 / Claus Gittinger" |
3071 |
! |
|
3072 |
||
3073 |
contentsOfBytesAsHexDump:dataOrFileStream numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
|
17744 | 3074 |
"utility helper: generate a hexDump with addresses; |
3075 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
3076 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
3077 |
to support display of alien encoded binary data." |
|
3078 |
||
3079 |
^ self |
|
18666 | 3080 |
contentsOfBytesAsDump:dataOrFileStream base:16 |
17744 | 3081 |
numberOfAddressDigits:addrDigits |
3082 |
addressStart:virtualStart |
|
3083 |
characterEncoding:characterEncodingSymbol |
|
3084 |
||
3085 |
"Created: / 12-11-2017 / 11:21:44 / cg" |
|
18666 | 3086 |
"Modified (format): / 12-03-2019 / 16:38:31 / Claus Gittinger" |
17744 | 3087 |
! |
3088 |
||
3089 |
contentsOfFileAsDump:f base:numberBase withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3090 |
"opens the file, get its contents and generates a dump for it" |
|
3091 |
||
4610 | 3092 |
|resources fileName stream data offs |
17768 | 3093 |
addrDigits lines answer sizeLimit showLastPart setNewLimit thisFileSizeString| |
4610 | 3094 |
|
3095 |
resources := self classResources. |
|
3096 |
||
3097 |
fileName := f baseName. |
|
3098 |
f isDirectory ifTrue:[ |
|
18609 | 3099 |
Dialog warn:(resources string:'"%1" is a directory.' with:fileName). |
4610 | 3100 |
^ nil |
3101 |
]. |
|
3102 |
f exists ifFalse:[ |
|
18609 | 3103 |
Dialog warn:(resources string:'oops, "%1" is gone or unreadable.' with:fileName). |
4610 | 3104 |
^ nil |
3105 |
]. |
|
3106 |
f isReadable ifFalse:[ |
|
18609 | 3107 |
Dialog warn:(resources string:'"%1" is unreadable.' with:fileName). |
4610 | 3108 |
^ nil |
3109 |
]. |
|
17768 | 3110 |
f fileSize > (self maxFileSizeShownWithoutAsking) ifTrue:[ |
8472 | 3111 |
limitOrNil notNil ifTrue:[ |
3112 |
sizeLimit := limitOrNil. |
|
3113 |
showLastPart := showLastPartOrNil |
|
3114 |
] ifFalse:[ |
|
17768 | 3115 |
setNewLimit := false. |
3116 |
thisFileSizeString := (UnitConverter fileSizeStringFor:f fileSize). |
|
3117 |
||
3118 |
Dialog |
|
3119 |
withOptoutOption:[ setNewLimit := true ] |
|
3120 |
labelled:(resources string:'No longer ask for files smaller than %1' with:thisFileSizeString) |
|
3121 |
do:[ |
|
3122 |
answer := Dialog |
|
3123 |
confirmWithCancel:(resources |
|
3124 |
stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' |
|
3125 |
with:(fileName contractTo:40) allBold |
|
3126 |
with:thisFileSizeString) |
|
3127 |
labels:#('Cancel' 'Show All' 'Show First Part' ). |
|
3128 |
]. |
|
8472 | 3129 |
answer isNil ifTrue:[^ nil]. |
3130 |
answer ifTrue:[ |
|
17769 | 3131 |
sizeLimit := (4 * 1024 * 1024) "max:self maxFileSizeShownWithoutAsking". |
17768 | 3132 |
] ifFalse:[ |
3133 |
setNewLimit ifTrue:[ |
|
3134 |
self maxFileSizeShownWithoutAsking:(self maxFileSizeShownWithoutAsking max:f fileSize). |
|
3135 |
]. |
|
3136 |
]. |
|
8436 | 3137 |
]. |
4610 | 3138 |
]. |
3139 |
||
18666 | 3140 |
[ |
3141 |
stream := f readStream binary. |
|
3142 |
sizeLimit notNil ifTrue:[ |
|
3143 |
showLastPart == true ifTrue:[ |
|
3144 |
stream position:(f fileSize - sizeLimit). |
|
3145 |
]. |
|
3146 |
data := stream nextBytes:sizeLimit. |
|
3147 |
] ifFalse:[ |
|
3148 |
f fileSize > (1024*1024) ifTrue:[ |
|
3149 |
data := stream |
|
3150 |
] ifFalse:[ |
|
3151 |
data := stream contents. |
|
3152 |
]. |
|
3153 |
]. |
|
3154 |
] ensure:[ |
|
3155 |
(stream notNil and:[stream ~~ data]) ifTrue:[ |
|
3156 |
stream close. |
|
3157 |
]. |
|
3158 |
]. |
|
3159 |
||
4610 | 3160 |
offs := 0. |
3161 |
lines := StringCollection new. |
|
3162 |
||
3163 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
3164 |
||
11262 | 3165 |
^ self |
17744 | 3166 |
contentsOfBytesAsDump:data base:numberBase |
11262 | 3167 |
numberOfAddressDigits:addrDigits |
3168 |
addressStart:0 |
|
17744 | 3169 |
characterEncoding:characterEncoding |
3170 |
||
3171 |
"Created: / 12-11-2017 / 12:08:10 / cg" |
|
17769 | 3172 |
"Modified: / 19-11-2017 / 15:01:34 / cg" |
18666 | 3173 |
"Modified: / 12-03-2019 / 16:18:46 / Claus Gittinger" |
17744 | 3174 |
! |
3175 |
||
3176 |
contentsOfFileAsHexDump:f |
|
3177 |
"opens the file, get its contents and generates a dump for it" |
|
3178 |
||
3179 |
^ self |
|
3180 |
contentsOfFileAsHexDump:f |
|
3181 |
withLimit:nil |
|
3182 |
lastPart:nil |
|
3183 |
characterEncoding:#'iso8859-1' |
|
3184 |
||
3185 |
"Modified (comment): / 12-11-2017 / 12:09:30 / cg" |
|
3186 |
! |
|
3187 |
||
3188 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil |
|
3189 |
"opens the file, get its contents and generates a dump for it" |
|
3190 |
||
3191 |
^ self |
|
3192 |
contentsOfFileAsHexDump:f |
|
3193 |
withLimit:limitOrNil |
|
3194 |
lastPart:showLastPartOrNil |
|
3195 |
characterEncoding:#'iso-8859-1' |
|
3196 |
||
3197 |
"Modified (comment): / 12-11-2017 / 12:09:34 / cg" |
|
3198 |
! |
|
3199 |
||
3200 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3201 |
"opens the file, get its contents and generates a dump for it" |
|
3202 |
||
3203 |
^ self |
|
3204 |
contentsOfFileAsDump:f base:16 |
|
3205 |
withLimit:limitOrNil |
|
3206 |
lastPart:showLastPartOrNil |
|
3207 |
characterEncoding:characterEncoding |
|
3208 |
||
3209 |
"Created: / 12-11-2017 / 12:02:05 / cg" |
|
4610 | 3210 |
! ! |
3211 |
||
17868 | 3212 |
!AbstractFileBrowser class methodsFor:'utilities - files'! |
3213 |
||
3214 |
allFilesInDirectories:directories forWhich:aBlock |
|
3215 |
|allFiles| |
|
3216 |
||
3217 |
directories isEmpty ifTrue:[^ #()]. |
|
3218 |
||
3219 |
allFiles := OrderedCollection new. |
|
3220 |
directories do:[:dir| |
|
3221 |
[ |
|
3222 |
|fileNames| |
|
3223 |
||
3224 |
fileNames := dir directoryContents. |
|
3225 |
fileNames notNil ifTrue:[ |
|
3226 |
fileNames := fileNames |
|
3227 |
collect:[:fn | dir construct:fn] |
|
3228 |
thenSelect:[:fn | fn isDirectory not and:[aBlock value:fn]]. |
|
3229 |
allFiles addAll:fileNames. |
|
3230 |
] |
|
3231 |
] on:FileStream openErrorSignal do:[:ex| |
|
3232 |
self warn:(self classResources stringWithCRs:'Cannot access: %1\(%2)' |
|
3233 |
with:ex pathName |
|
3234 |
with:ex description). |
|
3235 |
ex proceedWith:nil. |
|
3236 |
]. |
|
3237 |
]. |
|
3238 |
||
3239 |
^ allFiles |
|
3240 |
! |
|
3241 |
||
3242 |
fileFindDuplicatesIn:directories |
|
3243 |
"scan directories for duplicate files. |
|
17871 | 3244 |
return a dictionary mapping duplicate files to their original; |
3245 |
the oldest file found will be the value (original), the younger files (copies) will be the keys. |
|
17868 | 3246 |
Files without duplicate(s) will not have an entry in the dictionary." |
3247 |
||
3248 |
|infoDir filesBySize anySameSized |
|
3249 |
result allFiles| |
|
3250 |
||
3251 |
directories isEmpty ifTrue:[^ #()]. |
|
3252 |
||
3253 |
allFiles := self allFilesInDirectories:directories forWhich:[:f | true]. |
|
3254 |
allFiles isEmpty ifTrue:[^ #()]. |
|
3255 |
||
3256 |
"/ for each, get the file's info (size, modificationTime etc.). |
|
3257 |
infoDir := Dictionary new. |
|
3258 |
allFiles do:[:fn | |
|
3259 |
infoDir at:fn put:(fn info) |
|
3260 |
]. |
|
3261 |
||
3262 |
"/ in a first pass, collect groups by the same size |
|
3263 |
"/ remember those fileSizes for which multiple files exist |
|
3264 |
filesBySize := Dictionary new. |
|
3265 |
anySameSized := false. |
|
3266 |
infoDir keysAndValuesDo:[:fn :info | |
|
3267 |
|sz entry| |
|
3268 |
||
3269 |
sz := info fileSize. |
|
3270 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
3271 |
entry add:fn. |
|
3272 |
entry size > 1 ifTrue:[ anySameSized := true ]. |
|
3273 |
]. |
|
3274 |
||
3275 |
"/ any of same size ? |
|
3276 |
anySameSized ifFalse:[^ #() ]. |
|
3277 |
||
3278 |
result := Dictionary new. |
|
3279 |
||
3280 |
"/ now walk over the same-sized files and compare the contents. |
|
3281 |
filesBySize do:[:entry | |
|
3282 |
|files| |
|
3283 |
||
3284 |
entry size > 1 ifTrue:[ |
|
3285 |
files := entry asArray. |
|
3286 |
files |
|
3287 |
sort:[:a :b | |
|
3288 |
|tA tB| |
|
3289 |
tA := (infoDir at:a) modificationTime. |
|
3290 |
tB := (infoDir at:b) modificationTime. |
|
3291 |
tA < tB |
|
3292 |
]. |
|
3293 |
||
3294 |
1 to:files size-1 do:[:idx1 | |
|
3295 |
|fn1| |
|
3296 |
||
3297 |
fn1 := files at:idx1. |
|
3298 |
idx1+1 to:files size do:[:idx2 | |
|
3299 |
|fn2| |
|
3300 |
||
3301 |
fn2 := files at:idx2. |
|
3302 |
||
3303 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
3304 |
"/ compare the files |
|
3305 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3306 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
|
17871 | 3307 |
result at:fn2 put:fn1. |
17868 | 3308 |
] |
3309 |
] |
|
3310 |
] |
|
3311 |
] |
|
3312 |
] |
|
3313 |
]. |
|
3314 |
||
17869 | 3315 |
result := result associations copy. |
3316 |
"/ result := result collect:[:assoc | |
|
3317 |
"/ |f1 f2| |
|
3318 |
"/ |
|
3319 |
"/ f1 := assoc key asString. |
|
3320 |
"/ f2 := assoc value asString. |
|
3321 |
"/ f1 < f2 ifTrue:[ |
|
3322 |
"/ f2 -> f1 |
|
3323 |
"/ ] ifFalse:[ |
|
3324 |
"/ f1 -> f2 |
|
3325 |
"/ ] |
|
3326 |
"/ ]. |
|
17868 | 3327 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
3328 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
17869 | 3329 |
result sort:[:f1 :f2 | f1 key < f2 key]. |
17868 | 3330 |
^ result |
3331 |
! ! |
|
3332 |
||
3892 | 3333 |
!AbstractFileBrowser methodsFor:'actions'! |
3334 |
||
3335 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 3336 |
"setup and launch a querybox to ask for a unix command. |
3892 | 3337 |
Then evaluate aBlock passing the command-string as argument." |
3338 |
||
16160 | 3339 |
|box osName commandString alwaysOpenLikeThisHolder openCmd suffix| |
3892 | 3340 |
|
3341 |
osName := OperatingSystem platformName. |
|
3342 |
||
3343 |
box := FilenameEnterBox |
|
4414 | 3344 |
title:(resources string:'Execute %1 command:' with:osName) |
3345 |
okText:(resources string:'Execute') |
|
4523 | 3346 |
action:[:cmd | commandString := cmd]. |
3892 | 3347 |
|
3348 |
fileName notNil ifTrue:[ |
|
4414 | 3349 |
self initialCommandFor:fileName into:box. |
3892 | 3350 |
]. |
16160 | 3351 |
alwaysOpenLikeThisHolder := false asValue. |
3352 |
box verticalPanel add:((CheckBox label:'Always use this command for this file type') model:alwaysOpenLikeThisHolder). |
|
3892 | 3353 |
box directory:(self getDirWithoutFileName:fileName). |
16160 | 3354 |
box open. |
3355 |
||
3356 |
"/ box destroy. |
|
3357 |
alwaysOpenLikeThisHolder value ifTrue:[ |
|
3358 |
openCmd := commandString upTo:$". |
|
3359 |
suffix := fileName suffix. |
|
16306 | 3360 |
UserPreferences current |
3361 |
defaultFileOpenCommandFor:suffix put:(openCmd,' "%1"'); |
|
3362 |
beModified. |
|
3363 |
self breakPoint:#cg. |
|
16160 | 3364 |
]. |
3365 |
||
4523 | 3366 |
commandString notNil ifTrue:[ |
3367 |
aBlock value:commandString |
|
3368 |
]. |
|
3369 |
||
3892 | 3370 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
3371 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
3372 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
3373 |
! |
|
3374 |
||
3375 |
changeFileBrowserTitleTo:aString |
|
4774 | 3376 |
self |
3377 |
applicationNamed:#FileBrowserV2 |
|
5009 | 3378 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 3379 |
! |
3380 |
||
3381 |
copyFileList |
|
4774 | 3382 |
"copy the fileList to the clipBoard" |
3383 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3384 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3385 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3386 |
fileList := self |
4774 | 3387 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3388 |
ifPresentDo:[:app | app browserFileList]. |
3389 |
||
3390 |
fileList notNil ifTrue:[ |
|
3391 |
self copyFileListToClipBoard:fileList. |
|
3392 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3393 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3394 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3395 |
copyFileListToClipBoard:fileList |
4774 | 3396 |
"copy the itemList to the clipBoard" |
3397 |
||
3398 |
|stream| |
|
3399 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3400 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 3401 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3402 |
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
|
3403 |
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
|
3404 |
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
|
3405 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3406 |
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
|
3407 |
(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
|
3408 |
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
|
3409 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3410 |
]. |
3892 | 3411 |
]. |
6034 | 3412 |
self window setClipboardText:stream contents. |
3892 | 3413 |
! |
3414 |
||
3415 |
copySelectedFilenames |
|
4774 | 3416 |
"copy the selected fileNames to the clipBoard" |
3417 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3418 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3419 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3420 |
fileList := self |
4774 | 3421 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3422 |
ifPresentDo:[:appl | appl selectedFileNames]. |
3423 |
fileList notNil ifTrue:[ |
|
3424 |
self copyFileListToClipBoard:fileList. |
|
3425 |
]. |
|
3892 | 3426 |
! |
3427 |
||
10923 | 3428 |
doAddArchiver |
3429 |
|files| |
|
3430 |
||
3431 |
files := self currentSelectedFiles. |
|
3432 |
files size == 1 ifFalse:[ |
|
17818 | 3433 |
Dialog information:(resources string:'Select exactly one archive.'). |
10923 | 3434 |
^ self |
3435 |
]. |
|
3436 |
||
3437 |
self |
|
3438 |
applicationNamed:#FileApplicationNoteBook |
|
3439 |
ifPresentDo:[:appl | appl doAddArchiverOn:files first]. |
|
3440 |
||
3441 |
"Created: / 29-11-2011 / 19:01:31 / cg" |
|
17818 | 3442 |
"Modified: / 29-11-2017 / 12:25:47 / cg" |
10923 | 3443 |
! |
3444 |
||
3892 | 3445 |
doAddTerminal |
5960 | 3446 |
|dir| |
3447 |
||
3448 |
dir := self currentDirectory. |
|
3449 |
dir isNil ifTrue:[ |
|
4414 | 3450 |
dir := Filename homeDirectory |
3892 | 3451 |
]. |
4774 | 3452 |
|
5009 | 3453 |
self |
3454 |
applicationNamed:#FileApplicationNoteBook |
|
3455 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
18734 | 3456 |
|
3457 |
"Modified (format): / 10-04-2019 / 05:53:35 / Claus Gittinger" |
|
3892 | 3458 |
! |
3459 |
||
3460 |
doOpenSearchFile |
|
5961 | 3461 |
|item file| |
3462 |
||
3463 |
file := self firstSelectedFileName. |
|
3464 |
file isNil ifTrue:[ |
|
3465 |
file := Filename homeDirectory asAbsoluteFilename. |
|
3466 |
]. |
|
3467 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 3468 |
self openSearchFileOn:item. |
3469 |
! |
|
3470 |
||
3471 |
doShowFileContents |
|
5009 | 3472 |
self |
3473 |
applicationNamed:#DirectoryContentsBrowser |
|
3474 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
3475 |
||
3476 |
^ nil |
|
3892 | 3477 |
! |
3478 |
||
3479 |
doShowProperties |
|
3480 |
"show long stat (file)-info" |
|
3481 |
||
3482 |
self fileGetInfo:true |
|
3483 |
! |
|
3484 |
||
14577 | 3485 |
enterAction |
3486 |
self |
|
3487 |
applicationNamed:#DirectoryContentsBrowser |
|
3488 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl enterAction ]]. |
|
3489 |
! |
|
3490 |
||
5528 | 3491 |
fileEncodingDialog |
14497 | 3492 |
"open a dialog to allow change of the file's character encoding. |
5528 | 3493 |
Files are converted to internal encoding when read, and converted back |
3494 |
to this encoding when saved. |
|
3495 |
Notice: currently, not too many encodings are supported by the system." |
|
3496 |
||
3497 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
3498 |
||
3499 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
3500 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
3501 |
||
3502 |
bindings := IdentityDictionary new. |
|
3503 |
bindings at:#encodingList put:encodingDescr. |
|
3504 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 3505 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
3506 |
||
5528 | 3507 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
3508 |
ifTrue:[ |
|
3509 |
idx := (bindings at:#selectedEncoding) value. |
|
3510 |
selectedEncoding := encodings at:idx. |
|
3511 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 3512 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 3513 |
]. |
5737 | 3514 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 3515 |
]. |
3516 |
||
3517 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
3518 |
! |
|
3519 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3520 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3521 |
"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
|
3522 |
|
5959 | 3523 |
|currentFileNameHolder currentSel| |
3524 |
||
3525 |
currentFileNameHolder := self currentFileNameHolder. |
|
3526 |
||
3527 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3528 |
(currentSel includes:aFilename) ifFalse:[ |
9677 | 3529 |
self withWaitCursorDo:[ |
3530 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
|
3531 |
] |
|
3532 |
]. |
|
3533 |
||
3534 |
"Modified: / 29-12-2010 / 11:04:29 / cg" |
|
3892 | 3535 |
! |
3536 |
||
11053 | 3537 |
lineEndConventionDialog |
3538 |
"open a dialog to allow change of the line end conventions |
|
3539 |
(when writing files)" |
|
3540 |
||
3541 |
|bindings| |
|
3542 |
||
3543 |
bindings := IdentityDictionary new. |
|
3544 |
bindings at:#lineEndConvention put:(self lineEndConvention asValue). |
|
3545 |
||
3546 |
(self openDialogInterface:#lineEndConventionDialogSpec withBindings:bindings) |
|
3547 |
ifTrue:[ |
|
15208 | 3548 |
self lineEndConventionHolder value:(bindings at:#lineEndConvention) value asSymbol |
11053 | 3549 |
]. |
3550 |
||
3551 |
"Created: / 06-01-2012 / 15:34:51 / cg" |
|
3552 |
! |
|
3553 |
||
4392 | 3554 |
newTextEditor |
5009 | 3555 |
self |
3556 |
applicationNamed:#FileApplicationNoteBook |
|
15936 | 3557 |
ifPresentDo:[:appl | |
3558 |
|editor files item| |
|
3559 |
||
3560 |
editor := appl newTextEditor. |
|
3561 |
(files := self currentSelectedFiles) size == 1 ifTrue:[ |
|
3562 |
item := DirectoryContentsBrowser itemClass fileName:files first. |
|
3563 |
editor item:item. |
|
3564 |
]. |
|
3565 |
^ editor |
|
3566 |
]. |
|
5009 | 3567 |
|
3568 |
^ nil. |
|
3569 |
! |
|
3570 |
||
3571 |
openApplByFileItem:anItem |
|
8490 | 3572 |
"/ q: is the following always wanted ? |
9267 | 3573 |
self window sensor shiftDown ifFalse:[ |
17715 | 3574 |
((anItem mimeType startsWith:'application/x-expecco-') |
3575 |
and:[(Smalltalk at:#ExpeccoStartup) notNil]) ifTrue:[ |
|
3576 |
(Smalltalk at:#ExpeccoStartup) main:{anItem fileName asString}. |
|
3577 |
^ self. |
|
3578 |
]. |
|
3579 |
||
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3580 |
"/ cg: no - batch and shell scripts are to be |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3581 |
"/ anItem fileName isExecutableProgram ifTrue:[ |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3582 |
"/ self executeCommand:anItem fileName pathName. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3583 |
"/ ^ self. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3584 |
"/ ]. |
9267 | 3585 |
|
8490 | 3586 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
3587 |
"/ Error handle:[:ex | |
|
3588 |
"/ ] do:[ |
|
3589 |
"/ OperatingSystem |
|
3590 |
"/ shellExecute:nil |
|
3591 |
"/ lpOperation:'open' |
|
3592 |
"/ lpFile:(anItem fileName pathName) |
|
3593 |
"/ lpParameters:nil |
|
3594 |
"/ lpDirectory:(self directory pathName) |
|
3595 |
"/ nShowCmd:#SW_SHOWNORMAL. |
|
3596 |
"/ ^ self. |
|
3597 |
"/ ] |
|
3598 |
"/ ] |
|
9267 | 3599 |
]. |
5306 | 3600 |
^ self |
5009 | 3601 |
applicationNamed:#FileApplicationNoteBook |
5306 | 3602 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3603 |
|
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3604 |
"Modified: / 06-09-2011 / 11:11:15 / cg" |
17715 | 3605 |
"Modified: / 18-10-2017 / 10:15:15 / stefan" |
3892 | 3606 |
! |
3607 |
||
4392 | 3608 |
openApplForFile:aFilename |
5306 | 3609 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 3610 |
! |
3611 |
||
3892 | 3612 |
openCommandResultApplication |
3613 |
||
5009 | 3614 |
self |
3615 |
applicationNamed:#FileApplicationNoteBook |
|
3616 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
3617 |
||
3618 |
^ nil |
|
3892 | 3619 |
! |
3620 |
||
5010 | 3621 |
openNewTextEditorOn:anItem |
5009 | 3622 |
self |
3623 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3624 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 3625 |
|
3626 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3627 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3628 |
|
5010 | 3629 |
openSearchFileOn:anItem |
5009 | 3630 |
self |
3631 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3632 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 3633 |
|
3634 |
^ nil. |
|
3892 | 3635 |
! |
3636 |
||
5162 | 3637 |
openTextEditorForFile:aFilename |
3638 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
3639 |
! |
|
3640 |
||
5010 | 3641 |
openTextEditorOn:anItem |
5009 | 3642 |
self |
3643 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3644 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 3645 |
|
3646 |
^ nil. |
|
3892 | 3647 |
! |
3648 |
||
5010 | 3649 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 3650 |
self |
3651 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3652 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 3653 |
|
3654 |
^ nil. |
|
4618 | 3655 |
! |
3656 |
||
5959 | 3657 |
setCurrentFileName:aFilename |
3658 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
3659 |
! |
|
3660 |
||
3661 |
setCurrentFileNames:aCollectionOfFilenames |
|
3662 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
3663 |
! |
|
3664 |
||
11053 | 3665 |
tabStopConversionDialog |
3666 |
"open a dialog to allow change of the tab stop conversion (when reading/writing files)" |
|
3667 |
||
3668 |
|bindings| |
|
3669 |
||
3670 |
bindings := IdentityDictionary new. |
|
3671 |
bindings at:#tabStops put:(self inputTabColumnConversion asValue). |
|
3672 |
||
3673 |
(self openDialogInterface:#tabStopConversionDialogSpec withBindings:bindings) |
|
3674 |
ifTrue:[ |
|
3675 |
self inputTabColumnConversionHolder value:(bindings at:#tabStops) value |
|
3676 |
]. |
|
3677 |
||
3678 |
"Created: / 06-01-2012 / 15:36:06 / cg" |
|
3679 |
! |
|
3680 |
||
3892 | 3681 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3682 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3683 |
aColOfFiles notNil ifTrue:[ |
5959 | 3684 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3685 |
]. |
3892 | 3686 |
! |
3687 |
||
3688 |
updateCurrentDirectory |
|
5739 | 3689 |
self updateCurrentDirectory:false |
3690 |
! |
|
3691 |
||
3692 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3693 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3694 |
|
5009 | 3695 |
self |
3696 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 3697 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 3698 |
self |
3699 |
applicationNamed:#DirectoryTreeBrowser |
|
3700 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 3701 |
! |
3702 |
||
5739 | 3703 |
updateCurrentDirectoryWithReread |
3704 |
self updateCurrentDirectory:true |
|
3705 |
! |
|
3706 |
||
4345 | 3707 |
withActivityIndicationDo:aBlock |
3708 |
||
3709 |
self activityVisibilityChannel value:true. |
|
3710 |
[ |
|
9361 | 3711 |
self withWaitCursorDo:[ |
3712 |
aBlock value. |
|
3713 |
] |
|
4345 | 3714 |
] ensure:[ |
3715 |
self activityVisibilityChannel value:false. |
|
3716 |
] |
|
3892 | 3717 |
! ! |
3718 |
||
3719 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
3720 |
||
3721 |
addBookmark |
|
3722 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
6725 | 3723 |
self addBookmarks:(self currentSelectedDirectories). |
5960 | 3724 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 3725 |
! |
3726 |
||
3727 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3728 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3729 |
self class addBookmark:path |
3892 | 3730 |
]. |
3731 |
! |
|
3732 |
||
8013 | 3733 |
editBookmarks |
17849 | 3734 |
self class editBookmarksWithDefault: self currentSelectedDirectories firstOrNil. |
3735 |
||
3736 |
"Modified: / 13-12-2017 / 23:24:39 / stefan" |
|
8013 | 3737 |
! |
3738 |
||
3892 | 3739 |
hasBookmarks |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3740 |
^ self class hasBookmarks |
3892 | 3741 |
! |
3742 |
||
3743 |
hasBookmarksToRemove |
|
3744 |
|bookmarks directories| |
|
3745 |
||
3982 | 3746 |
directories := self currentSelectedDirectories. |
3892 | 3747 |
bookmarks := self class directoryBookmarks. |
17416 | 3748 |
^ (bookmarks notEmptyOrNil and:[directories notEmpty]) |
3749 |
||
3750 |
"Modified: / 17-02-2017 / 08:25:22 / cg" |
|
3892 | 3751 |
! |
3752 |
||
3753 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3754 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3755 |
self class removeBookmark:dir |
3892 | 3756 |
]. |
4679 | 3757 |
! |
3758 |
||
3759 |
saveBookmarks |
|
3760 |
self class saveBookmarks |
|
3892 | 3761 |
! ! |
3762 |
||
3763 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
3764 |
||
3765 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 3766 |
|cmd suffix cmdHist historySize| |
3892 | 3767 |
|
3768 |
cmdHist := self class commandHistory. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
3769 |
(aCommandString notEmptyOrNil) ifTrue:[ |
4414 | 3770 |
cmdHist notNil ifTrue:[ |
3771 |
cmdHist addFirst:aCommandString. |
|
6369 | 3772 |
historySize := self class commandHistorySize. |
3773 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 3774 |
cmdHist removeLast |
3775 |
] |
|
3776 |
]. |
|
3777 |
aFilename notNil ifTrue:[ |
|
3778 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
3779 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
3780 |
DefaultCommandPerSuffix := Dictionary new. |
|
3781 |
]. |
|
3782 |
suffix := aFilename asFilename suffix. |
|
3783 |
suffix notNil ifTrue:[ |
|
3784 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
3785 |
] |
|
3786 |
] |
|
3892 | 3787 |
] |
3788 |
! |
|
3789 |
||
3790 |
doBack |
|
6286 | 3791 |
"go backward in the history" |
3892 | 3792 |
|
4022 | 3793 |
| fileName| |
3794 |
||
6369 | 3795 |
fileName := self directoryHistory goBackward. |
3892 | 3796 |
fileName notNil ifTrue:[ |
4347 | 3797 |
self gotoFile:(fileName asFilename). |
3892 | 3798 |
] |
3799 |
! |
|
3800 |
||
3801 |
doForward |
|
6286 | 3802 |
"go forward in the history" |
3892 | 3803 |
|
3964 | 3804 |
| fileName| |
3805 |
||
6369 | 3806 |
fileName := self directoryHistory goForward. |
3892 | 3807 |
fileName notNil ifTrue:[ |
4414 | 3808 |
self gotoFile:(fileName asFilename). |
4022 | 3809 |
] ifFalse:[ |
4414 | 3810 |
self enableForward value:false. |
4022 | 3811 |
|
3812 |
]. |
|
3892 | 3813 |
! ! |
3814 |
||
3815 |
!AbstractFileBrowser methodsFor:'applications'! |
|
3816 |
||
5009 | 3817 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
3818 |
|appl| |
|
3819 |
||
3820 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
3821 |
appl notNil ifTrue:[ |
|
3822 |
^ aBlock value:appl |
|
3823 |
]. |
|
3824 |
^ nil. |
|
3825 |
! |
|
3826 |
||
4004 | 3827 |
directoryContentsBrowser |
3828 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 3829 |
! ! |
3830 |
||
3831 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
3832 |
||
3833 |
applications |
|
3834 |
^ aspects at:#applications |
|
3835 |
! |
|
3836 |
||
3837 |
backgroundProcesses |
|
3838 |
||
3839 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
3840 |
! |
|
3841 |
||
4230 | 3842 |
canMake |
15259 | 3843 |
^ self aspectFor:#canMake ifAbsent:[ ValueHolder with:false ]. |
4230 | 3844 |
! |
3845 |
||
18246 | 3846 |
canOpenChangeBrowser |
3847 |
^ self aspectFor:#canOpenChangeBrowser ifAbsent:[ false asValue ]. |
|
3848 |
||
3849 |
"Created: / 30-06-2018 / 18:29:53 / Claus Gittinger" |
|
3850 |
! |
|
3851 |
||
3892 | 3852 |
currentDirectories |
6725 | 3853 |
" returns a holder on a Collection of all currently selected directories |
3854 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3892 | 3855 |
" |
3856 |
||
3857 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
3858 |
! |
|
3859 |
||
6725 | 3860 |
currentDirectoriesValue |
3861 |
" returns a Collection of all currently selected directories |
|
3862 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3863 |
" |
|
3864 |
||
3865 |
^ self currentDirectories value |
|
3866 |
! |
|
3867 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3868 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3869 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3870 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3871 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3872 |
|
6725 | 3873 |
directories := self currentSelectedDirectories. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3874 |
(directories size ~= 1) ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3875 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3876 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3877 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3878 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3879 |
|
13856 | 3880 |
currentDirectoryDisplayed |
3881 |
"Return a directory as Filename that is currently displayed in the browser" |
|
3882 |
||
3883 |
^self subclassResponsibility |
|
3884 |
||
3885 |
"Created: / 14-01-2013 / 11:57:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3886 |
! |
|
3887 |
||
3892 | 3888 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3889 |
"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
|
3890 |
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
|
3891 |
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
|
3892 |
|
6589 | 3893 |
^ self aspectFor:#currentFileNameHolder |
3894 |
ifAbsent:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3895 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3896 |
|
4692 | 3897 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3898 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3899 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3900 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3901 |
currentSel asValue |
6589 | 3902 |
] |
3903 |
notPresentDo:[:holder| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3904 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3905 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3906 |
newFilenames := Set new. |
6589 | 3907 |
filenames do:[:eachFilename| |
18805 | 3908 |
|existingFilename count| |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3909 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3910 |
existingFilename notNil ifTrue:[ |
18805 | 3911 |
count := 0. |
3912 |
[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
|
3913 |
existingFilename := existingFilename directory. |
18805 | 3914 |
count := count + 1. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3915 |
]. |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3916 |
existingFilename exists ifTrue:[ |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3917 |
newFilenames add:existingFilename. |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3918 |
]. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3919 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3920 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3921 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3922 |
] |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3923 |
|
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3924 |
"Modified: / 27-11-2010 / 15:42:45 / cg" |
18805 | 3925 |
"Modified: / 05-06-2019 / 14:12:48 / Claus Gittinger" |
3892 | 3926 |
! |
3927 |
||
5528 | 3928 |
defaultFileEncoding |
3929 |
^ #'iso8859-1' "/ #'utf-8' |
|
3930 |
! |
|
3931 |
||
3892 | 3932 |
enableDirectoryUp |
3933 |
||
15259 | 3934 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[ValueHolder with:false] |
3892 | 3935 |
! |
3936 |
||
6456 | 3937 |
enableGotoDefaultDirectory |
15259 | 3938 |
^ self aspectFor:#enableGotoDefaultDirectory ifAbsent:[ ValueHolder with:true ]. |
4593 | 3939 |
! |
3940 |
||
8168 | 3941 |
enableGotoDesktop |
14308 | 3942 |
"/ backward compatibility |
3943 |
^ self enableGotoDesktopDirectory. |
|
8168 | 3944 |
! |
3945 |
||
9572 | 3946 |
enableGotoDesktopDirectory |
15259 | 3947 |
^ self aspectFor:#enableGotoDesktopDirectory ifAbsent:[ ValueHolder with:true ]. |
9572 | 3948 |
|
3949 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3950 |
! |
|
3951 |
||
18511 | 3952 |
enableGotoDocumentsDirectory |
3953 |
^ self aspectFor:#enableGotoDocumentsDirectory ifAbsent:[ ValueHolder with:true ]. |
|
3954 |
||
3955 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3956 |
! |
|
3957 |
||
18352 | 3958 |
enableGotoDownloadsDirectory |
3959 |
^ self aspectFor:#enableGotoDownloadsDirectory ifAbsent:[ ValueHolder with:true ]. |
|
3960 |
||
3961 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3962 |
! |
|
3963 |
||
6434 | 3964 |
enableGotoSmalltalkDirectory |
6456 | 3965 |
^ self aspectFor:#enableGotoSmalltalkDirectory ifAbsent:[ true asValue ]. |
6434 | 3966 |
! |
3967 |
||
17187 | 3968 |
enableGotoSmalltalkWorkspaceDirectory |
3969 |
^ self aspectFor:#enableGotoSmalltalkWorkspaceDirectory ifAbsent:[ true asValue ]. |
|
3970 |
! |
|
3971 |
||
9677 | 3972 |
enableGotoTempDirectory |
3973 |
^ self aspectFor:#enableGotoTempDirectory ifAbsent:[ true asValue ]. |
|
3974 |
||
3975 |
"Created: / 29-12-2010 / 11:01:17 / cg" |
|
3976 |
! |
|
3977 |
||
3892 | 3978 |
enableHome |
3979 |
||
3980 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
3981 |
! |
|
3982 |
||
9596 | 3983 |
enableMakeCurrentDirectory |
3984 |
^ self aspectFor:#enableMakeCurrentDirectory ifAbsent:[ true asValue ]. |
|
3985 |
||
3986 |
"Created: / 26-10-2010 / 17:17:58 / cg" |
|
3987 |
! |
|
3988 |
||
3892 | 3989 |
enableViewNoteBookApplication |
3990 |
||
3991 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
3992 |
! |
|
3993 |
||
5528 | 3994 |
fileEncoding |
3995 |
^ self fileEncodingHolder value |
|
3996 |
! |
|
3997 |
||
3998 |
fileEncoding:newEncoding |
|
5533 | 3999 |
self fileEncodingHolder value:newEncoding. |
4000 |
||
4001 |
self |
|
4002 |
applicationNamed:#FileApplicationNoteBook |
|
4003 |
ifPresentDo:[:nb | |
|
4004 |
|appl| |
|
4005 |
||
4006 |
appl := nb selectedApplication. |
|
5535 | 4007 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 4008 |
appl fileEncoding:newEncoding |
4009 |
] |
|
4010 |
]. |
|
5528 | 4011 |
! |
4012 |
||
5737 | 4013 |
fileEncodingHolder |
4014 |
^ self |
|
4015 |
aspectFor:#fileEncodingHolder |
|
4016 |
ifAbsent:[ |
|
4017 |
self |
|
4018 |
applicationNamed:#FileApplicationNoteBook |
|
4019 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
4020 |
] |
|
4021 |
! |
|
4022 |
||
17485 | 4023 |
fileEntryFieldHolder |
4024 |
^ self subclassResponsibility. |
|
4025 |
||
4026 |
"Created: / 31-03-2017 / 11:36:49 / stefan" |
|
4027 |
! |
|
4028 |
||
5961 | 4029 |
firstSelectedFileName |
4030 |
|files| |
|
4031 |
||
7560 | 4032 |
files := self currentSelectedObjects. |
5961 | 4033 |
files notEmpty ifTrue:[ |
4034 |
^ files first |
|
4035 |
]. |
|
4036 |
^ nil |
|
7560 | 4037 |
|
4038 |
"Modified: / 04-12-2006 / 13:14:53 / cg" |
|
5961 | 4039 |
! |
4040 |
||
6456 | 4041 |
gotoDefaultDirectoryIsVisible |
9596 | 4042 |
^ true. |
4043 |
"/ ^ (Filename defaultDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
4044 |
||
4045 |
"Modified: / 26-10-2010 / 17:23:51 / cg" |
|
6456 | 4046 |
! |
4047 |
||
9572 | 4048 |
gotoDesktopDirectoryIsVisible |
4049 |
Filename desktopDirectory = Filename homeDirectory ifTrue:[^ false]. |
|
4050 |
||
4051 |
^ (Filename desktopDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
4052 |
||
4053 |
"Created: / 01-10-2010 / 16:26:27 / cg" |
|
4054 |
! |
|
4055 |
||
4618 | 4056 |
hasFileSelection |
4057 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
4058 |
! |
|
4059 |
||
9490 | 4060 |
hasNotTwoDirectoriesSelectedHolder |
4061 |
^ self |
|
4062 |
aspectFor:#hasNotTwoDirectoriesSelectedHolder |
|
4063 |
ifAbsent:[ |
|
4064 |
BlockValue |
|
4065 |
with:[:m | self hasTwoDirectoriesSelected not] |
|
4066 |
argument:self currentFileNameHolder |
|
4067 |
]. |
|
4068 |
||
4069 |
"Created: / 20-05-2010 / 10:45:50 / cg" |
|
4070 |
! |
|
4071 |
||
5830 | 4072 |
hasNotTwoFilesSelectedHolder |
9490 | 4073 |
^ self |
4074 |
aspectFor:#hasNotTwoFilesSelectedHolder |
|
5830 | 4075 |
ifAbsent:[ |
4076 |
BlockValue |
|
4077 |
with:[:m | self hasTwoFilesSelected not] |
|
4078 |
argument:self currentFileNameHolder |
|
4079 |
]. |
|
9490 | 4080 |
|
4081 |
"Modified: / 20-05-2010 / 10:46:01 / cg" |
|
5830 | 4082 |
! |
4083 |
||
3892 | 4084 |
hasSelection |
17923 | 4085 |
"aspect holding true, if a file is selected" |
3892 | 4086 |
|
4087 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
4088 |
! |
|
4089 |
||
9490 | 4090 |
hasTwoDirectoriesSelectedHolder |
4091 |
^ self |
|
4092 |
aspectFor:#hasTwoDirectoriesSelectedHolder |
|
4093 |
ifAbsent:[ |
|
4094 |
BlockValue |
|
4095 |
with:[:m | self hasTwoDirectoriesSelected] |
|
4096 |
argument:self currentFileNameHolder |
|
4097 |
]. |
|
4098 |
||
4099 |
"Created: / 20-05-2010 / 10:45:41 / cg" |
|
4100 |
! |
|
4101 |
||
4414 | 4102 |
hasTwoFilesSelectedHolder |
9490 | 4103 |
^ self |
4104 |
aspectFor:#hasTwoFilesSelectedHolder |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4105 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4106 |
BlockValue |
5830 | 4107 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4108 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4109 |
]. |
9490 | 4110 |
|
4111 |
"Modified: / 20-05-2010 / 10:46:08 / cg" |
|
4414 | 4112 |
! |
4113 |
||
11053 | 4114 |
inputTabColumnConversion |
4115 |
^ self inputTabColumnConversionHolder value |
|
4116 |
||
4117 |
"Created: / 06-01-2012 / 15:25:56 / cg" |
|
4118 |
! |
|
4119 |
||
4120 |
inputTabColumnConversionHolder |
|
4121 |
^ self |
|
4122 |
aspectFor:#inputTabColumnConversionHolder |
|
4123 |
ifAbsent:[ |
|
4124 |
self |
|
4125 |
applicationNamed:#FileApplicationNoteBook |
|
4126 |
ifPresentDo:[:appl | appl inputTabColumnConversionHolder]. |
|
4127 |
] |
|
4128 |
||
4129 |
"Created: / 06-01-2012 / 15:26:16 / cg" |
|
4130 |
! |
|
4131 |
||
4132 |
lineEndConvention |
|
15208 | 4133 |
^ self lineEndConventionHolder value asSymbol |
11053 | 4134 |
|
4135 |
"Created: / 06-01-2012 / 13:05:14 / cg" |
|
4136 |
! |
|
4137 |
||
11591 | 4138 |
lineEndConvention: aSymbol |
18525 | 4139 |
self lineEndConventionHolder value:(aSymbol ifNotNil:[aSymbol asSymbol]) |
11591 | 4140 |
|
4141 |
"Created: / 11-07-2012 / 19:51:58 / cg" |
|
18525 | 4142 |
"Modified: / 13-11-2018 / 11:13:41 / Stefan Vogel" |
11591 | 4143 |
! |
4144 |
||
11053 | 4145 |
lineEndConventionHolder |
4146 |
^ self |
|
4147 |
aspectFor:#lineEndConventionHolder |
|
4148 |
ifAbsent:[ |
|
4149 |
self |
|
4150 |
applicationNamed:#FileApplicationNoteBook |
|
4151 |
ifPresentDo:[:appl | appl lineEndConventionHolder]. |
|
4152 |
] |
|
4153 |
||
4154 |
"Created: / 06-01-2012 / 13:02:51 / cg" |
|
4155 |
! |
|
4156 |
||
5737 | 4157 |
lockFileEncoding:aBoolean |
4158 |
self lockFileEncodingHolder value:aBoolean. |
|
4159 |
||
4160 |
self |
|
4161 |
applicationNamed:#FileApplicationNoteBook |
|
4162 |
ifPresentDo:[:nb | |
|
4163 |
|appl| |
|
4164 |
||
4165 |
appl := nb selectedApplication. |
|
4166 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
4167 |
appl lockFileEncoding:aBoolean |
|
4168 |
] |
|
4169 |
]. |
|
4170 |
! |
|
4171 |
||
4172 |
lockFileEncodingHolder |
|
4173 |
^ self |
|
4174 |
aspectFor:#lockFileEncodingHolder |
|
4175 |
ifAbsent:[ |
|
4176 |
self |
|
4177 |
applicationNamed:#FileApplicationNoteBook |
|
4178 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
4179 |
] |
|
4180 |
! |
|
4181 |
||
13856 | 4182 |
makeCommandHolder |
4183 |
^ self aspectFor:#makeCommandHolder ifAbsent:[ nil asValue ]. |
|
4184 |
||
4185 |
"Created: / 13-04-2012 / 17:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4186 |
! |
|
4187 |
||
4523 | 4188 |
notify:aString |
11108 | 4189 |
"aString is shown in the lower pane" |
4190 |
||
4523 | 4191 |
self notifyChannel value:aString |
11108 | 4192 |
|
4193 |
"Modified (comment): / 11-01-2012 / 21:46:55 / cg" |
|
4523 | 4194 |
! |
4195 |
||
3892 | 4196 |
notifyChannel |
4197 |
||
4198 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 4199 |
! |
4200 |
||
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4201 |
progressPercentageHolder |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4202 |
^ self aspectFor:#progressPercentageHolder ifAbsent:[ nil asValue ]. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4203 |
|
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4204 |
"Created: / 11-10-2010 / 12:54:46 / cg" |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4205 |
! |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4206 |
|
4071 | 4207 |
rootHolder |
4208 |
"holder, which keeps the rootHolder of the treeView |
|
4209 |
" |
|
4210 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4211 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4212 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4213 |
]. |
8192
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4214 |
! |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4215 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4216 |
rootHolder:aHolder |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4217 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4218 |
self aspectFor:#rootHolder put:aHolder |
3892 | 4219 |
! ! |
4220 |
||
4221 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
4222 |
||
4223 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 4224 |
"returns the model for an aspect; these are stored in a common dictionary" |
4225 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4226 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 4227 |
! |
4228 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4229 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 4230 |
"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
|
4231 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4232 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4233 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4234 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4235 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4236 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4237 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4238 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4239 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4240 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4241 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4242 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4243 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4244 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4245 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4246 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4247 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4248 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4249 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4250 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4251 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4252 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4253 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4254 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4255 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4256 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4257 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4258 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4259 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4260 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4261 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4262 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4263 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4264 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4265 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4266 |
aspectFor:something put:aValueHolder |
6284 | 4267 |
"stores the model for an aspect; these are stored in a common dictionary" |
4268 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4269 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4270 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4271 |
|
3892 | 4272 |
aspects |
6284 | 4273 |
"returns the common aspect dictionary" |
4274 |
||
3892 | 4275 |
^ aspects |
4276 |
! |
|
4277 |
||
4278 |
runtimeAspectValueFor:something |
|
4279 |
"returns the default aspect item from the class variable RuntimeAspects |
|
4280 |
" |
|
4281 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
4282 |
! |
|
4283 |
||
4201 | 4284 |
saveAspectValues |
16306 | 4285 |
|prefs saveAspects aspectValue| |
4286 |
||
4287 |
prefs := UserPreferences current. |
|
4288 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4289 |
saveAspects := self class userPreferencesAspectList keys. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4290 |
saveAspects do:[ :aspectKey | |
4201 | 4291 |
aspectValue := (self perform:aspectKey) value. |
16306 | 4292 |
prefs |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4293 |
at: ('fileBrowser_',aspectKey asString) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4294 |
put: aspectValue. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4295 |
]. |
16306 | 4296 |
prefs beModified. |
4297 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4298 |
"Modified: / 04-09-2006 / 10:02:41 / cg" |
4201 | 4299 |
! |
4300 |
||
3892 | 4301 |
saveRuntimeAspectValues |
4302 |
|savedAspects dictionary value isHolder aspect| |
|
4303 |
||
5941 | 4304 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 4305 |
dictionary := Dictionary new. |
5941 | 4306 |
savedAspects do:[:aspectKey | |
4414 | 4307 |
aspect := self perform:aspectKey. |
4308 |
isHolder := aspect isValueModel. |
|
5941 | 4309 |
isHolder ifTrue:[ |
4310 |
value := aspect value |
|
4311 |
] ifFalse:[ |
|
4312 |
value := aspect |
|
4313 |
]. |
|
4314 |
dictionary at:aspectKey |
|
4315 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
4316 |
]. |
|
4317 |
RuntimeAspects := dictionary. |
|
3892 | 4318 |
! |
4319 |
||
4201 | 4320 |
userPreferencesAspectValueFor:something |
4321 |
"returns the default aspect from the Userpreferences |
|
3892 | 4322 |
" |
4201 | 4323 |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4324 |
(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
|
4325 |
^ UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4326 |
at:('fileBrowser_',something) asSymbol |
9579
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4327 |
ifAbsent:nil "(self class userPreferencesAspectList at:something)". |
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4328 |
|
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4329 |
"Modified: / 14-10-2010 / 19:16:38 / cg" |
3892 | 4330 |
! ! |
4331 |
||
4011 | 4332 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
4333 |
||
9015 | 4334 |
filter:aString |
4335 |
self filterModel value:aString |
|
4336 |
! |
|
4337 |
||
4018 | 4338 |
filterBackgroundColor |
4339 |
||
4340 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
4341 |
! |
|
4342 |
||
4011 | 4343 |
filterBlockHolder |
4344 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4345 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 4346 |
! |
4347 |
||
4348 |
filterListModel |
|
4349 |
||
4350 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
4351 |
! |
|
4352 |
||
4353 |
filterModel |
|
5941 | 4354 |
|m| |
4355 |
||
4356 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
4357 |
^ m |
|
4011 | 4358 |
! |
4359 |
||
8185
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4360 |
filterModel:aHolder |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4361 |
self aspectFor:#filterModel put:aHolder. |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4362 |
! |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4363 |
|
4018 | 4364 |
filterValueBox |
4365 |
||
4366 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
4367 |
! |
|
4368 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4369 |
makeFilterBlock |
14497 | 4370 |
"return a two-arg filterblock on the file's path- and base-name. This block should return true for files |
9102 | 4371 |
to be shown" |
4372 |
||
17481 | 4373 |
| filterString filterStrings filters notFilters showHidden filterBlock caseSensitive| |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4374 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4375 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4376 |
filterString = '' ifTrue:[filterString := '*']. |
17481 | 4377 |
caseSensitive := "ignoreCaseInPattern ?" Filename isCaseSensitive. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4378 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4379 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
12760 | 4380 |
filterStrings := filterStrings |
4381 |
select:[:eachFilter | eachFilter withoutSeparators notEmpty]. |
|
4382 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4383 |
filters := filterStrings |
12760 | 4384 |
reject:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
4385 |
thenCollect: |
|
4386 |
[:eachPattern | |
|
4387 |
|pattern| |
|
4388 |
||
4389 |
pattern := eachPattern withoutSeparators. |
|
15597 | 4390 |
pattern includesMatchCharacters ifFalse:[ |
4391 |
"JV@2012-03-05: Add implict star at the beginning and at the end of pattern, |
|
4392 |
that's how most of the other applications behave - do what most users expect" |
|
17772 | 4393 |
"/ pattern first == $* ifFalse:[pattern := '*' , pattern]. |
4394 |
"/ pattern last == $* ifFalse:[pattern := pattern , '*']. |
|
4395 |
[:name :baseName | baseName asLowercase includesString:pattern caseSensitive:caseSensitive] |
|
4396 |
] ifTrue:[ |
|
4397 |
pattern = '*' ifTrue:[ |
|
4398 |
[:name :baseName | true]. |
|
4399 |
] ifFalse:[ |
|
4400 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
|
4401 |
]. |
|
15597 | 4402 |
]. |
12760 | 4403 |
]. |
4404 |
||
4405 |
notFilters := filterStrings |
|
4406 |
select:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
|
4407 |
thenCollect: |
|
4408 |
[:eachPattern | |
|
9296 | 4409 |
|pattern| |
4410 |
||
4411 |
pattern := eachPattern withoutSeparators. |
|
12760 | 4412 |
pattern := (pattern copyFrom:2) withoutSeparators. |
17481 | 4413 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
9296 | 4414 |
]. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4415 |
|
12760 | 4416 |
|
4417 |
(filters size == 1 and:[notFilters isEmpty]) ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4418 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4419 |
] ifFalse:[ |
12760 | 4420 |
filters isEmpty ifTrue:[ |
4421 |
filterBlock := [:name :baseName | |
|
4422 |
(notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not |
|
4423 |
]. |
|
4424 |
] ifFalse:[ |
|
4425 |
notFilters isEmpty ifTrue:[ |
|
4426 |
filterBlock := [:name :baseName | |
|
4427 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4428 |
]. |
|
4429 |
] ifFalse:[ |
|
4430 |
filterBlock := [:name :baseName | |
|
4431 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4432 |
and:[ (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not ] |
|
4433 |
]. |
|
4434 |
] |
|
4435 |
] |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4436 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4437 |
|
4011 | 4438 |
showHidden := self showHiddenFiles value. |
4439 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4440 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4441 |
]. |
9296 | 4442 |
^ [:name :baseName | |
4443 |
name isHidden not and:[filterBlock value:name value:baseName]]. |
|
13856 | 4444 |
|
4445 |
"Modified: / 05-02-2012 / 01:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17481 | 4446 |
"Modified: / 27-03-2017 / 12:52:08 / stefan" |
17772 | 4447 |
"Modified: / 20-11-2017 / 22:02:04 / cg" |
4018 | 4448 |
! |
4449 |
||
4450 |
shownFiles |
|
4451 |
||
4452 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 4453 |
! ! |
4454 |
||
14126 | 4455 |
|
3892 | 4456 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
4457 |
||
4458 |
dirHistory |
|
6369 | 4459 |
"obsolete" |
4460 |
^ self directoryHistory |
|
4461 |
! |
|
4462 |
||
4463 |
directoryHistory |
|
3952 | 4464 |
^ self class directoryHistory |
3892 | 4465 |
! |
4466 |
||
4467 |
enableBack |
|
4468 |
||
15259 | 4469 |
^ self aspectFor:#enableBack ifAbsent:[ValueHolder with:false] |
3892 | 4470 |
! |
4471 |
||
4472 |
enableFileHistory |
|
4473 |
||
15259 | 4474 |
^ self aspectFor:#enableFileHistory ifAbsent:[ValueHolder with:false] |
3892 | 4475 |
! |
4476 |
||
4477 |
enableForward |
|
4478 |
||
15259 | 4479 |
^ self aspectFor:#enableForward ifAbsent:[ValueHolder with:false] |
3892 | 4480 |
! |
4481 |
||
4482 |
fileHistory |
|
9820
07b7d7929e3e
variable renamed in: #fileHistory
Stefan Vogel <sv@exept.de>
parents:
9793
diff
changeset
|
4483 |
^ self aspectFor:#fileHistory ifAbsent:[OrderedSet new] |
3892 | 4484 |
! ! |
4485 |
||
4486 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
4487 |
||
4345 | 4488 |
activityVisibilityChannel |
6284 | 4489 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 4490 |
|
15259 | 4491 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ ValueHolder with:false ]. |
4345 | 4492 |
! |
4493 |
||
15111 | 4494 |
alwaysUseSmalltalkTools |
4495 |
" aspect to prevent os tools to be opened on double click" |
|
4496 |
||
15259 | 4497 |
^ self aspectFor:#alwaysUseSmalltalkTools ifAbsent:[ ValueHolder with:true ]. |
15111 | 4498 |
! |
4499 |
||
6602 | 4500 |
changeSetBrowserItemVisible |
4501 |
^ Screen current ctrlDown. |
|
4502 |
! |
|
4503 |
||
11135 | 4504 |
cvsMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4505 |
^ ConfigurableFeatures includesFeature: #CVSSupportEnabled |
11135 | 4506 |
|
4507 |
"Created: / 15-01-2012 / 13:00:05 / cg" |
|
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4508 |
"Modified: / 19-01-2012 / 10:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4509 |
! |
4510 |
||
13856 | 4511 |
hgMenusAreShown |
4512 |
^ (ConfigurableFeatures includesFeature: #HGSupportEnabled) |
|
4513 |
||
4514 |
"Created: / 14-01-2013 / 11:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4515 |
! |
|
4516 |
||
11135 | 4517 |
mercurialMenusAreShown |
11147 | 4518 |
^ ConfigurableFeatures hasMercurialSupportEnabled |
11135 | 4519 |
|
4520 |
"Created: / 15-01-2012 / 13:00:00 / cg" |
|
4521 |
! |
|
4522 |
||
4110 | 4523 |
openAlwaysInTextEditor |
18274 | 4524 |
"aspect for open every file in TextEditor don't use e.g. HtmlEditor for *.html'" |
4110 | 4525 |
|
15111 | 4526 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
18274 | 4527 |
|
4528 |
"Modified (comment): / 19-07-2018 / 15:28:00 / Stefan Vogel" |
|
4110 | 4529 |
! |
4530 |
||
3892 | 4531 |
openMultipleApplicationsForType |
4532 |
||
4201 | 4533 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
4534 |
open TextEditor " |
|
4535 |
||
3892 | 4536 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
4537 |
! |
|
4538 |
||
11137 | 4539 |
perforceMenusAreShown |
11996
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4540 |
^ (ConfigurableFeatures includesFeature: #PerforceSupportEnabled) |
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4541 |
and:[ ConfigurableFeatures hasPerforceSupportEnabled ] |
11137 | 4542 |
|
4543 |
"Created: / 15-01-2012 / 13:12:11 / cg" |
|
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4544 |
"Modified: / 19-01-2012 / 10:43:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11996
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4545 |
"Modified: / 02-11-2012 / 11:19:59 / cg" |
11137 | 4546 |
! |
4547 |
||
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
|
4548 |
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
|
4549 |
|
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
|
4550 |
^ 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
|
4551 |
|
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
|
4552 |
"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
|
4553 |
! |
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
|
4554 |
|
4201 | 4555 |
showDirectoryTree |
4556 |
||
4557 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 4558 |
! |
4559 |
||
4554 | 4560 |
showDiskUsageHolder |
4561 |
|holder| |
|
4562 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
4563 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 4564 |
holder addDependent:self. |
4554 | 4565 |
^ holder |
4566 |
! |
|
4567 |
||
3892 | 4568 |
showHiddenFiles |
4569 |
||
9582 | 4570 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
4571 |
||
4572 |
"Modified: / 15-10-2010 / 10:28:17 / cg" |
|
3892 | 4573 |
! |
4574 |
||
9108 | 4575 |
showHiddenFiles:aHolder |
4576 |
self aspectFor:#showHiddenFiles put:aHolder. |
|
4577 |
! |
|
4578 |
||
4579 |
shownFiles:aHolder |
|
4580 |
self aspectFor:#shownFiles put:aHolder. |
|
4581 |
! |
|
4582 |
||
11135 | 4583 |
svnMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4584 |
^ ConfigurableFeatures includesFeature: #SubversionSupportEnabled |
11135 | 4585 |
|
4586 |
"Created: / 15-01-2012 / 13:02:03 / cg" |
|
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4587 |
"Modified: / 19-01-2012 / 10:43:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4588 |
! |
4589 |
||
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4590 |
tagsBrowserVisibleHolder |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4591 |
masterApplication notNil ifTrue:[ |
11162
faf8af233ac0
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
11156
diff
changeset
|
4592 |
^ masterApplication perform:#tagsBrowserVisibleHolder ifNotUnderstood:false |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4593 |
]. |
10762
311190be6490
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
10757
diff
changeset
|
4594 |
^ self aspectFor:#tagsBrowserVisibleHolder ifAbsent:[ FileApplicationNoteBook::TextEditor defaultTagsBrowserVisible asValue ]. |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4595 |
|
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4596 |
"Created: / 27-06-2011 / 16:02:59 / cg" |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4597 |
! |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4598 |
|
10757
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4599 |
useCodeView2InTools |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4600 |
^ self aspectFor:#useCodeView2InTools ifAbsent:[ UserPreferences current useCodeView2InTools asValue ]. |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4601 |
|
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4602 |
"Created: / 06-10-2011 / 11:45:58 / cg" |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4603 |
! |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4604 |
|
4648 | 4605 |
userContextAvailable |
4606 |
||
4607 |
" aspect for show group and user columns in contents view |
|
4608 |
windows provides no user context" |
|
4609 |
||
4610 |
^ OperatingSystem isMSWINDOWSlike not |
|
4611 |
! |
|
4612 |
||
3892 | 4613 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4614 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4615 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4616 |
^ self directoryContentsBrowser viewDescription |
3892 | 4617 |
! |
4618 |
||
4619 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4620 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 4621 |
" |
3892 | 4622 |
|
6121 | 4623 |
|directoryContentsBrowser| |
4624 |
||
4625 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
4626 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
4627 |
^ directoryContentsBrowser viewDetails |
|
3892 | 4628 |
! |
4629 |
||
4630 |
viewDirectoryDescription |
|
4631 |
||
4201 | 4632 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
4633 |
on change directory " |
|
4634 |
||
3892 | 4635 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
4636 |
! |
|
4637 |
||
4201 | 4638 |
viewDirsInContentsBrowser |
4639 |
||
4640 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
9319
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4641 |
|
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4642 |
" |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4643 |
UserPreferences current viewDirsInContentsBrowser |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4644 |
" |
4201 | 4645 |
! |
4646 |
||
5870 | 4647 |
viewFilesInContentsBrowser |
4648 |
||
4649 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
4650 |
! |
|
4651 |
||
3892 | 4652 |
viewFilesInDirectoryTree |
4653 |
||
4201 | 4654 |
" aspect for view files in tree view (not only directories) " |
4655 |
||
3892 | 4656 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
4657 |
! |
|
4658 |
||
4659 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4660 |
" aspect for show group information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4661 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4662 |
^ self directoryContentsBrowser viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4663 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4664 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4665 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4666 |
" aspect for show file-type icon in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4667 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4668 |
^ self directoryContentsBrowser viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4669 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4670 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4671 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4672 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4673 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4674 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 4675 |
! |
4676 |
||
4677 |
viewNoteBookApplicationHolder |
|
4678 |
||
4679 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
4680 |
! |
|
4681 |
||
4682 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4683 |
" aspect for show owner information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4684 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4685 |
^ self directoryContentsBrowser viewOwner |
3892 | 4686 |
! |
4687 |
||
4688 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4689 |
" aspect for show permission information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4690 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4691 |
^ self directoryContentsBrowser viewPermissions |
3892 | 4692 |
! |
4693 |
||
4694 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4695 |
" aspect for show image previev in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4696 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4697 |
^ self directoryContentsBrowser viewPreview |
3892 | 4698 |
! |
4699 |
||
4700 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4701 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4702 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4703 |
^ self directoryContentsBrowser viewSize |
3892 | 4704 |
! |
4705 |
||
4974 | 4706 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4707 |
" aspect for show size-in-bytes information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4708 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4709 |
^ self directoryContentsBrowser viewSizeInBytes |
4974 | 4710 |
! |
4711 |
||
5312 | 4712 |
viewSizeInKiloBytes |
4713 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
4714 |
||
4715 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
4716 |
! |
|
4717 |
||
3892 | 4718 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4719 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4720 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4721 |
^ self directoryContentsBrowser viewTime |
3892 | 4722 |
! |
4723 |
||
4724 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4725 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4726 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4727 |
^ self directoryContentsBrowser viewType |
3892 | 4728 |
! ! |
4729 |
||
4730 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
4731 |
||
4732 |
executeCommand:cmd |
|
4733 |
||
4734 |
self executeCommand:cmd inDirectory:nil |
|
4735 |
! |
|
4736 |
||
5880 | 4737 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 4738 |
| nameString executionBlock| |
4739 |
||
5880 | 4740 |
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
|
4741 |
nameString := 'Execute: ', cmd. |
3892 | 4742 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4743 |
! |
|
4744 |
||
4745 |
getExecutionBlockForCommand:cmd |
|
4746 |
||
4747 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
4748 |
! |
|
4749 |
||
5880 | 4750 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
4751 |
| dir| |
|
4752 |
||
4753 |
dir := directoryOrNil. |
|
4754 |
directoryOrNil isNil ifTrue:[ |
|
4755 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6671 | 4756 |
dir isNil ifTrue:[ |
12493 | 4757 |
Dialog warn:(resources string:'Please select a single directory.'). |
16732 | 4758 |
AbortOperationRequest raise. |
6671 | 4759 |
^ nil |
4760 |
]. |
|
3892 | 4761 |
]. |
4523 | 4762 |
|
4763 |
^ [:stream| |
|
4764 |
stream notNil ifTrue:[ |
|
4414 | 4765 |
OperatingSystem |
4766 |
executeCommand:cmd |
|
4767 |
inputFrom:nil |
|
4768 |
outputTo:stream |
|
4769 |
errorTo:stream |
|
4770 |
inDirectory:dir |
|
16732 | 4771 |
lineWise:true |
16825 | 4772 |
showWindow:false |
4414 | 4773 |
onError:[:status| false]. |
4774 |
] |
|
4523 | 4775 |
]. |
3892 | 4776 |
! |
4777 |
||
4778 |
killAllRunningBackgroundProcesses |
|
4779 |
||
4780 |
self backgroundProcesses do:[ : process | |
|
4523 | 4781 |
self notify:'kill ', process name. |
4414 | 4782 |
process terminate. |
3892 | 4783 |
]. |
4784 |
! |
|
4785 |
||
4786 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
4787 |
| stream process appl nameString| |
|
4788 |
||
4789 |
appl := self openCommandResultApplication. |
|
4790 |
stream := appl resultStream. |
|
4791 |
nameString := aString ? 'Execution Result'. |
|
4792 |
appl changeTabTo:nameString. |
|
4523 | 4793 |
|
16102 | 4794 |
process := |
4795 |
[ |
|
4796 |
[aBlock value:stream] |
|
4797 |
ensure:[ |
|
4798 |
self backgroundProcesses remove:process ifAbsent:[]. |
|
4799 |
appl process value:nil. |
|
4800 |
||
4801 |
"/ close automatically, if there was no output. |
|
4571 | 4802 |
"/ appl resultStream contents isEmpty ifTrue:[ |
4803 |
"/ appl doClose. |
|
4804 |
"/ ] |
|
16102 | 4805 |
stream nextPutLine:'Done.'. |
4806 |
self enqueueMessage:#updateCurrentDirectory. |
|
4807 |
] |
|
4808 |
] newProcess. |
|
3892 | 4809 |
process priority:(Processor userBackgroundPriority). |
4810 |
process name:nameString. |
|
4811 |
self backgroundProcesses add:process. |
|
4812 |
appl process value:process. |
|
4813 |
process resume. |
|
4814 |
! ! |
|
4815 |
||
4816 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
4817 |
||
4915 | 4818 |
currentFileNameHolderChanged |
4819 |
"/ self currentFileNameHolderChangedForCommon |
|
4820 |
! |
|
4821 |
||
4577 | 4822 |
currentFileNameHolderChangedForCommon |
18389 | 4823 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty dir| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4824 |
|
7560 | 4825 |
selection := self currentSelectedObjects. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4826 |
self class currentSelection:selection. |
4734 | 4827 |
|
13521 | 4828 |
selectionNotEmpty := selection notEmptyOrNil. |
5476 | 4829 |
self hasSelection value:selectionNotEmpty. |
4830 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
18246 | 4831 |
self canOpenChangeBrowser value:(selectionNotEmpty). |
4734 | 4832 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4833 |
newDirectories := self directoriesForFiles:selection. |
6725 | 4834 |
oldDirectories := self currentSelectedDirectories. |
4011 | 4835 |
oldDirectories ~= newDirectories ifTrue:[ |
4347 | 4836 |
self currentDirectories value:newDirectories. |
4837 |
size := newDirectories size. |
|
4774 | 4838 |
rootInTreeView := self |
4839 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 4840 |
ifPresentDo:[:appl | appl rootHolder]. |
4841 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
4842 |
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
|
4843 |
|
4347 | 4844 |
newDirectories notEmpty ifTrue:[ |
6369 | 4845 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 4846 |
]. |
18389 | 4847 |
(dir := Filename homeDirectory) notNil ifTrue:[ |
4848 |
self enableHome value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4849 |
]. |
|
14308 | 4850 |
"/ self enableGotoDesktop value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
18389 | 4851 |
(dir := Filename defaultDirectory) notNil ifTrue:[ |
4852 |
self enableGotoDefaultDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4853 |
]. |
|
4854 |
(dir := self smalltalkDirectory) notNil ifTrue:[ |
|
4855 |
self enableGotoSmalltalkDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4856 |
]. |
|
4857 |
(dir := Filename desktopDirectory) notNil ifTrue:[ |
|
4858 |
self enableGotoDesktopDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4859 |
]. |
|
4860 |
(dir := Filename downloadsDirectory) notNil ifTrue:[ |
|
4861 |
self enableGotoDownloadsDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4862 |
]. |
|
18511 | 4863 |
(dir := Filename documentsDirectory) notNil ifTrue:[ |
4864 |
self enableGotoDocumentsDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4865 |
]. |
|
18389 | 4866 |
(dir := self tempDirectory) notNil ifTrue:[ |
4867 |
self enableGotoTempDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4868 |
]. |
|
4011 | 4869 |
]. |
9599
6ffff091db22
changed: #currentFileNameHolderChangedForCommon
Claus Gittinger <cg@exept.de>
parents:
9596
diff
changeset
|
4870 |
self enableGotoDefaultDirectory value:(self currentDirectory isNil or:[self currentDirectory pathName ~= OperatingSystem getCurrentDirectory]). |
9596 | 4871 |
self enableMakeCurrentDirectory value:(newDirectories size == 1 |
4872 |
and:[ newDirectories first asFilename pathName ~= OperatingSystem getCurrentDirectory ]). |
|
4022 | 4873 |
self enableForward value:self canForward. |
4734 | 4874 |
self enableBack value:self canBackward. |
6095 | 4875 |
|
13856 | 4876 |
self updateCanMake. |
7560 | 4877 |
|
9677 | 4878 |
"Modified: / 29-12-2010 / 11:01:52 / cg" |
13856 | 4879 |
"Modified: / 17-12-2013 / 08:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18389 | 4880 |
"Modified: / 17-09-2018 / 16:25:36 / Claus Gittinger" |
4011 | 4881 |
! |
4882 |
||
4883 |
filterModelChanged |
|
4884 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4885 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 4886 |
! |
4887 |
||
3892 | 4888 |
update:something with:aParameter from:changedObject |
4889 |
||
4890 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
4891 |
and the things that have to be done if it runs standalone " |
|
4892 |
||
4893 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 4894 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4895 |
^ self |
3892 | 4896 |
]. |
3989 | 4897 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4898 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4899 |
^ self |
3989 | 4900 |
]. |
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4901 |
changedObject == self sortBlockProperty ifTrue:[ |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4902 |
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
|
4903 |
^ self |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4904 |
]. |
4011 | 4905 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4906 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4907 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4908 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4909 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4910 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4911 |
^ self |
4004 | 4912 |
]. |
4781 | 4913 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 4914 |
self notify:nil. |
4781 | 4915 |
^ self |
4916 |
]. |
|
3989 | 4917 |
|
3892 | 4918 |
super update:something with:aParameter from:changedObject |
5543 | 4919 |
! |
4920 |
||
6095 | 4921 |
updateCanMake |
4922 |
|dir can| |
|
4923 |
||
4924 |
can := false. |
|
4925 |
dir := self currentDirectory. |
|
4926 |
dir notNil ifTrue:[ |
|
13856 | 4927 |
"/ Check for make |
6095 | 4928 |
can := (dir asFilename construct:'Makefile') exists. |
13856 | 4929 |
can ifFalse:[ |
4930 |
can := (dir asFilename construct:'makefile') exists. |
|
4931 |
]. |
|
6095 | 4932 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
4933 |
can ifFalse:[ |
|
13856 | 4934 |
can := (self currentDirectory asFilename construct:'bc.mak') exists. |
6095 | 4935 |
] |
4936 |
]. |
|
13856 | 4937 |
can ifTrue:[ |
4938 |
self makeCommandHolder value: 'make'. |
|
4939 |
self canMake value: true. |
|
4940 |
^ self |
|
4941 |
]. |
|
4942 |
||
4943 |
"/Check for Apache ant |
|
4944 |
(OperatingSystem canExecuteCommand: 'ant') ifTrue:[ |
|
4945 |
can := (dir asFilename construct:'build.xml') exists. |
|
4946 |
can ifTrue:[ |
|
4947 |
self makeCommandHolder value: 'ant'. |
|
4948 |
self canMake value: true. |
|
4949 |
^ self |
|
4950 |
]. |
|
4951 |
]. |
|
4952 |
||
4953 |
"/Add more here... |
|
4954 |
||
6095 | 4955 |
]. |
4956 |
self canMake value:can. |
|
13856 | 4957 |
|
4958 |
"Modified: / 17-12-2013 / 08:13:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6095 | 4959 |
! |
4960 |
||
5543 | 4961 |
updateListAfterDelete:colOfFiles |
17871 | 4962 |
self updateCurrentDirectoryWithReread |
3892 | 4963 |
! ! |
4964 |
||
4965 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
4966 |
||
4967 |
canPaste |
|
4968 |
||
15259 | 4969 |
^ self aspectFor:#canPaste ifAbsent:[ ValueHolder with:false ]. |
3892 | 4970 |
! |
4971 |
||
4972 |
clipboard |
|
4973 |
||
4974 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
4975 |
! |
|
4976 |
||
4977 |
copyFilesToClipBoard:colOfFiles |
|
4978 |
self putInClipBoard:colOfFiles as:#copy. |
|
4979 |
! |
|
4980 |
||
4981 |
cutFilesToClipBoard:colOfFiles |
|
4982 |
"defete current selected files/directories |
|
4983 |
" |
|
4984 |
self putInClipBoard:colOfFiles as:#cut. |
|
4985 |
! |
|
4986 |
||
4987 |
emptyClipBoard |
|
4988 |
||
4989 |
self clipboard files:nil. |
|
4990 |
self canPaste value:false. |
|
4991 |
! |
|
4992 |
||
4993 |
putInClipBoard:colOfFiles as:aSymbol |
|
4994 |
| stream clp| |
|
4995 |
||
4996 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
4997 |
clp := self clipboard. |
|
4998 |
clp files:nil. |
|
4999 |
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
|
5000 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
5001 |
stream := String writeStream. |
3892 | 5002 |
stream nextPutAll:aSymbol asString. |
5003 |
stream nextPutAll:' <'. |
|
5004 |
stream nextPutAll:colOfFiles first asString. |
|
5005 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 5006 |
stream nextPutAll:' ...'. |
3892 | 5007 |
]. |
5008 |
stream nextPutAll:'> to clipboard'. |
|
5009 |
||
4523 | 5010 |
self notify:stream contents. |
3892 | 5011 |
clp files:colOfFiles. |
5012 |
self canPaste value:true. |
|
5013 |
! ! |
|
5014 |
||
5015 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
5016 |
||
5017 |
canDropFiles:dropedObjects for:filename |
|
6284 | 5018 |
|filenameDirString filenameDir| |
3892 | 5019 |
|
5020 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 5021 |
|
3892 | 5022 |
filenameDir := self getDirWithoutFileName:filename. |
7491 | 5023 |
filenameDir isNil ifTrue:[^ false ]. |
13232 | 5024 |
filenameDir isWritableDirectory ifFalse:[^ false]. |
6284 | 5025 |
|
3892 | 5026 |
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
|
5027 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
5028 |
dropedObjects do:[:aDropObject | |
6284 | 5029 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
5030 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
5031 |
"/ |
|
5032 |
"/ dropFileName := aDropObject theObject. |
|
5033 |
"/ dropFileNameString := dropFileName asString. |
|
5034 |
"/ dropFileName isDirectory ifTrue:[ |
|
5035 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
5036 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
5037 |
"/ ^ false |
|
5038 |
"/ ] |
|
5039 |
"/ ] ifFalse:[ |
|
5040 |
"/ physicalPathName := dropFileName physicalPathName. |
|
5041 |
"/ (filenameDirString = dropFileName directory asString |
|
5042 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
5043 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
5044 |
"/ self notify:'Cannot drop a file into same directory'. |
|
5045 |
"/ ^ false |
|
5046 |
"/ ] |
|
5047 |
"/ ] |
|
5048 |
]. |
|
5049 |
self notify:nil. |
|
5050 |
^ true |
|
5051 |
! |
|
5052 |
||
5053 |
canDropObject:aDropObject into:aDirectory |
|
5054 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
5055 |
||
5056 |
dropFileName := aDropObject theObject. |
|
5057 |
dropFileNameString := dropFileName asString. |
|
5058 |
dropFileName isDirectory ifTrue:[ |
|
5059 |
filenameDirString := aDirectory asString. |
|
5060 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
5061 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
5062 |
^ false |
|
4414 | 5063 |
] |
6284 | 5064 |
] ifFalse:[ |
5065 |
physicalPathName := dropFileName physicalPathName. |
|
5066 |
(aDirectory = dropFileName directory |
|
5067 |
or:[ aDropObject isFileInArchive not |
|
5068 |
and:[physicalPathName notNil |
|
5069 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
5070 |
self notify:'Cannot drop a file into same directory'. |
|
5071 |
^ false |
|
5072 |
] |
|
5073 |
]. |
|
5074 |
^ true. |
|
3892 | 5075 |
! |
5076 |
||
7406 | 5077 |
canDropObjects:aCollectionOfDropObjects in:aWidget |
17865 | 5078 |
^ aCollectionOfDropObjects contains:#isFileObject |
7406 | 5079 |
|
5080 |
"Created: / 13-10-2006 / 15:52:49 / cg" |
|
5081 |
! |
|
5082 |
||
17202 | 5083 |
doStartDrag:arg1 in:arg2 |
5084 |
^ self class doStartDrag:arg1 in:arg2 |
|
6479 | 5085 |
! |
5086 |
||
7408 | 5087 |
dropObjects:aCollectionOfDropObjects in:aWidget at:position |
7990 | 5088 |
|fileEntryFieldHolder destDir dropObject fn d| |
5089 |
||
5090 |
fileEntryFieldHolder := self masterApplication notNil |
|
5091 |
ifTrue:[ self masterApplication fileEntryFieldHolder ] |
|
5092 |
ifFalse:[ self fileEntryFieldHolder ]. |
|
5093 |
||
5094 |
aWidget model == fileEntryFieldHolder ifTrue:[ |
|
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5095 |
dropObject := aCollectionOfDropObjects first. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5096 |
dropObject isFileObject ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5097 |
fn := dropObject theObject asFilename. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5098 |
dropObject isDirectory ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5099 |
d := fn. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5100 |
] ifFalse:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5101 |
d := fn directory. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5102 |
]. |
7990 | 5103 |
fileEntryFieldHolder value:d pathName. |
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5104 |
]. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5105 |
^ self. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5106 |
]. |
6479 | 5107 |
|
5108 |
destDir := self currentDirectory. |
|
5109 |
destDir isNil ifTrue:[^ self]. |
|
5110 |
||
8601 | 5111 |
self withWaitCursorDo:[ |
5112 |
aCollectionOfDropObjects do:[:dropObject | |
|
5113 |
|fn| |
|
5114 |
||
5115 |
dropObject isFileObject ifTrue:[ |
|
5116 |
fn := dropObject theObject asFilename. |
|
5117 |
dropObject isDirectory ifTrue:[ |
|
8808
cb6476c0cd3a
oops - drop of directories was broken
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
5118 |
fn recursiveCopyTo:destDir |
8601 | 5119 |
] ifFalse:[ |
8950
48c69259d82d
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
8887
diff
changeset
|
5120 |
fn copyTo:(destDir / fn baseName ) |
8601 | 5121 |
] |
6479 | 5122 |
] |
8601 | 5123 |
]. |
5124 |
]. |
|
9268
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5125 |
self directoryContentsBrowser notNil ifTrue:[ |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5126 |
self directoryContentsBrowser |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5127 |
directoryContentsChangeFlag:true; |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5128 |
wakeUp |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5129 |
]. |
7408 | 5130 |
|
5131 |
"Created: / 13-10-2006 / 18:26:41 / cg" |
|
3892 | 5132 |
! ! |
5133 |
||
5134 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
5135 |
||
5136 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 5137 |
"copy to" |
5138 |
||
7635 | 5139 |
^ self copyFile:aSourceFile to:aDestFile repairCorruptedFiles:false |
5140 |
||
5141 |
"Modified: / 07-02-2007 / 18:46:44 / cg" |
|
5142 |
! |
|
5143 |
||
5144 |
copyFile:aSourceFile to:aDestFile repairCorruptedFiles:repairCorruptedFiles |
|
5145 |
"copy to" |
|
5146 |
||
5147 |
|copyOperation msg| |
|
5148 |
||
5149 |
repairCorruptedFiles ifTrue:[ |
|
5150 |
copyOperation := FileOperation copyCorruptedFile:aSourceFile to:aDestFile |
|
5151 |
] ifFalse:[ |
|
5152 |
copyOperation := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
|
5153 |
]. |
|
5154 |
copyOperation result ifTrue:[ |
|
6190 | 5155 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 5156 |
] ifFalse:[ |
7635 | 5157 |
msg := copyOperation errorString. |
6190 | 5158 |
]. |
5159 |
self notify:msg. |
|
7635 | 5160 |
^ copyOperation result |
5161 |
||
5162 |
"Created: / 07-02-2007 / 18:46:34 / cg" |
|
3892 | 5163 |
! |
5164 |
||
5165 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
6374 | 5166 |
|copy result| |
3892 | 5167 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5168 |
self withActivityIndicationDo:[ |
5961 | 5169 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
6374 | 5170 |
copy result ifTrue:[ |
5171 |
result := Dictionary withKeys:(copy collectionOfCopiedFiles) andValues:(copy collectionOfNewFiles). |
|
5172 |
] ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5173 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5174 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5175 |
self updateCurrentDirectory. |
3892 | 5176 |
]. |
6374 | 5177 |
^ result |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5178 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5179 |
"Modified: / 25-07-2006 / 09:07:04 / cg" |
3892 | 5180 |
! |
5181 |
||
15569 | 5182 |
copyFromToRepairingCorruptedFiles |
5183 |
"ask for source and destination and copy the entered file. |
|
5184 |
Especially useful for raw devices to copy corrupted disks/files |
|
5185 |
" |
|
5186 |
||
5187 |
|source destination| |
|
5188 |
||
5189 |
source := Dialog |
|
5190 |
requestDirectoryName:(resources string:'Copy from:') |
|
5191 |
default:(LastMoveDestination ? self currentDirectory) |
|
5192 |
ok:(resources string:'Continue') |
|
5193 |
abort:nil. |
|
5194 |
||
5195 |
source isEmptyOrNil ifTrue:[^ self]. |
|
5196 |
source := source asFilename. |
|
5197 |
||
5198 |
destination := Dialog |
|
5199 |
requestDirectoryName:(resources string:'Copy "%1" to:' with:source) |
|
5200 |
default:(LastMoveDestination ? self currentDirectory) |
|
5201 |
ok:(resources string:'Copy') |
|
5202 |
abort:nil. |
|
5203 |
||
5204 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
5205 |
destination := destination asFilename. |
|
5206 |
||
5207 |
self copyFile:source to:destination repairCorruptedFiles:true. |
|
5208 |
! |
|
5209 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5210 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
12850 | 5211 |
|size msg answer file| |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5212 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5213 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5214 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5215 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5216 |
"/ 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
|
5217 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5218 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5219 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5220 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5221 |
"/ 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
|
5222 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5223 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5224 |
"/ 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
|
5225 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5226 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5227 |
"/ 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
|
5228 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5229 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5230 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5231 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5232 |
stringWithCRs:'Copy or move\\%1:\ %2\to:\ %3 ?' |
17762 | 5233 |
with:(resources string: |
5234 |
(file type == #regular |
|
5235 |
ifTrue:'file' |
|
5236 |
ifFalse:[ |
|
5237 |
file isDirectory |
|
5238 |
ifTrue:'directory' |
|
5239 |
ifFalse:'object'])) |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5240 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5241 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5242 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5243 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5244 |
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
|
5245 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5246 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 5247 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5248 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5249 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5250 |
request:msg |
8127 | 5251 |
label:(resources string:'Copy or Move') |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
5252 |
image:(WarningBox iconBitmap) |
8127 | 5253 |
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
|
5254 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5255 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5256 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5257 |
^ answer. |
17762 | 5258 |
|
5259 |
"Modified: / 17-11-2017 / 13:16:42 / cg" |
|
3892 | 5260 |
! |
5261 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5262 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 5263 |
"copy or move aColOfSourceFiles to aDirectory. |
5264 |
Asks the used if a move or a copy is wanted. |
|
5265 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
5266 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5267 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5268 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5269 |
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
|
5270 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5271 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5272 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5273 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5274 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5275 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5276 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5277 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5278 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5279 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5280 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5281 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 5282 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5283 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5284 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5285 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5286 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5287 |
|
4745 | 5288 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5289 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5290 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5291 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5292 |
^ true. |
3892 | 5293 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5294 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5295 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5296 |
^ true. |
3892 | 5297 |
]. |
4745 | 5298 |
^ false. |
3892 | 5299 |
! |
5300 |
||
6107 | 5301 |
copySelectionTo |
5302 |
"copy the selected file(s) to another directory" |
|
5303 |
||
13704 | 5304 |
self copySelectionToRepairingCorruptedFiles:false. |
5305 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5306 |
|
5307 |
"Modified: / 07-02-2007 / 18:42:48 / cg" |
|
5308 |
! |
|
5309 |
||
5310 |
copySelectionToRepairingCorruptedFiles |
|
5311 |
"copy the selected file(s) to another directory" |
|
5312 |
||
13704 | 5313 |
self copySelectionToRepairingCorruptedFiles:true. |
5314 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5315 |
|
5316 |
"Created: / 07-02-2007 / 18:42:59 / cg" |
|
5317 |
! |
|
5318 |
||
5319 |
copySelectionToRepairingCorruptedFiles:repairingCorruptedFiles |
|
5320 |
"copy the selected file(s) to another directory" |
|
5321 |
||
6299 | 5322 |
|selectedFiles msg destination directory| |
5323 |
||
7560 | 5324 |
selectedFiles := self currentSelectedObjects copy. |
6299 | 5325 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
5326 |
||
5327 |
msg := (selectedFiles size > 1) |
|
14588 | 5328 |
ifTrue:[ 'Copy Selected Items to Directory:' ] |
5329 |
ifFalse:[ 'Copy "%1" to Directory:' ]. |
|
6299 | 5330 |
|
5331 |
destination := Dialog |
|
14588 | 5332 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first baseName) |
7635 | 5333 |
default:(LastMoveDestination ? self currentDirectory) |
5334 |
ok:(resources string:'Copy') |
|
5335 |
abort:nil. |
|
5336 |
||
6299 | 5337 |
destination isEmptyOrNil ifTrue:[^ self]. |
5338 |
destination := destination asFilename. |
|
5339 |
||
5340 |
destination isDirectory ifFalse:[ |
|
5341 |
selectedFiles size == 1 ifTrue:[ |
|
5342 |
directory := destination directory. |
|
5343 |
directory isDirectory ifTrue:[ |
|
5344 |
LastMoveDestination := directory. |
|
7635 | 5345 |
self copyFile:selectedFiles first to:destination repairCorruptedFiles:repairingCorruptedFiles. |
6299 | 5346 |
^ self. |
5347 |
] |
|
5348 |
] |
|
5349 |
]. |
|
5350 |
||
5351 |
LastMoveDestination := destination. |
|
7635 | 5352 |
repairingCorruptedFiles ifTrue:[ |
5353 |
selectedFiles do:[:eachFile | |
|
5354 |
self copyFile:eachFile to:destination repairCorruptedFiles:repairingCorruptedFiles. |
|
5355 |
]. |
|
5356 |
^ self. |
|
5357 |
] ifFalse:[ |
|
5358 |
self copyFiles:selectedFiles to:destination |
|
5359 |
] |
|
5360 |
||
5361 |
"Created: / 07-02-2007 / 18:42:35 / cg" |
|
6107 | 5362 |
! |
5363 |
||
3892 | 5364 |
deleteFile:aFile |
6373 | 5365 |
"delete the selected files/directories" |
3892 | 5366 |
|
5367 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
5368 |
! |
|
5369 |
||
5370 |
deleteFiles:colOfFiles |
|
6373 | 5371 |
"delete some files/directories" |
5372 |
||
5081 | 5373 |
^ self deleteFiles:colOfFiles confirm:true. |
5374 |
! |
|
5375 |
||
5376 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 5377 |
"delete some files/directories" |
5378 |
||
5673 | 5379 |
|delete result| |
3892 | 5380 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5381 |
self withActivityIndicationDo:[ |
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5382 |
ProgressNotification handle:[:info | |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5383 |
self progressPercentageHolder value:info progressValue. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5384 |
info proceed |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5385 |
] do:[ |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5386 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5387 |
result := delete result. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5388 |
]. |
5673 | 5389 |
result notNil ifTrue:[ |
5390 |
result ifFalse:[ |
|
5391 |
self notify:delete errorString. |
|
5753 | 5392 |
] ifTrue:[ |
5393 |
self updateListAfterDelete:colOfFiles. |
|
5394 |
] |
|
4394 | 5395 |
]. |
5673 | 5396 |
]. |
5397 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5398 |
|
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5399 |
"Modified: / 11-10-2010 / 13:08:24 / cg" |
3892 | 5400 |
! |
5401 |
||
6169 | 5402 |
eraseFiles:colOfFiles |
6373 | 5403 |
"erase (clear and delete) some files/directories" |
5404 |
||
6169 | 5405 |
^ self eraseFiles:colOfFiles confirm:true. |
5406 |
! |
|
5407 |
||
5408 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 5409 |
"erase (clear and delete) some files/directories" |
5410 |
||
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5411 |
|deleteOperation result fileSize| |
6169 | 5412 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5413 |
self withActivityIndicationDo:[ |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5414 |
fileSize := colOfFiles first asFilename fileSize. |
8294 | 5415 |
deleteOperation := FileOperation eraseFiles:colOfFiles confirm:confirm. |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5416 |
(colOfFiles size == 1 and:[ fileSize < (10*1024*1024) ]) |
8294 | 5417 |
ifTrue:[ |
5418 |
result := deleteOperation result. |
|
5419 |
] ifFalse:[ |
|
5420 |
ProgressIndicator |
|
5421 |
displayProgressNotifications:'Erasing' |
|
5422 |
abortable:true |
|
5423 |
at:nil |
|
5424 |
during:[ |
|
5425 |
result := deleteOperation result. |
|
5426 |
]. |
|
5427 |
]. |
|
5428 |
||
6169 | 5429 |
result notNil ifTrue:[ |
5430 |
result ifFalse:[ |
|
8294 | 5431 |
self notify:deleteOperation errorString. |
6169 | 5432 |
] ifTrue:[ |
5433 |
self updateListAfterDelete:colOfFiles. |
|
5434 |
] |
|
5435 |
]. |
|
5436 |
]. |
|
5437 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5438 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5439 |
"Modified: / 25-07-2006 / 09:07:16 / cg" |
6169 | 5440 |
! |
5441 |
||
3892 | 5442 |
moveFile:aSourceFile to:aDestFile |
6373 | 5443 |
"move a file/directory" |
3892 | 5444 |
|
5445 |
|move| |
|
5446 |
||
5961 | 5447 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 5448 |
move result ifTrue:[ |
15346 | 5449 |
self notify:(resources string: 'move "%1" to "%2"' with:aSourceFile asString with:aDestFile asString). |
3892 | 5450 |
] ifFalse:[ |
4523 | 5451 |
self notify:move errorString. |
3892 | 5452 |
]. |
17871 | 5453 |
self updateCurrentDirectoryWithReread. |
3892 | 5454 |
^ move result |
5455 |
! |
|
5456 |
||
5457 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 5458 |
"move some files to aDirectory" |
5459 |
||
3892 | 5460 |
|move| |
5461 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5462 |
self withActivityIndicationDo:[ |
5961 | 5463 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5464 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5465 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5466 |
]. |
17871 | 5467 |
self updateCurrentDirectoryWithReread. |
3892 | 5468 |
]. |
6373 | 5469 |
^ move collectionOfMovedFiles |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5470 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5471 |
"Modified: / 25-07-2006 / 09:07:32 / cg" |
3892 | 5472 |
! |
5473 |
||
6107 | 5474 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5475 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5476 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5477 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5478 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5479 |
destinationDirectory := Dialog |
14588 | 5480 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items to Directory:') |
5789 | 5481 |
default:(LastMoveDestination ? self currentDirectory) |
6952 | 5482 |
ok:(resources string:'Move') |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5483 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5484 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5485 |
|
5789 | 5486 |
LastMoveDestination := destinationDirectory. |
13704 | 5487 |
self moveFiles:(self currentSelectedObjects copy) to:destinationDirectory asFilename. |
5488 |
self updateCurrentDirectoryWithReread. |
|
5489 |
||
7560 | 5490 |
|
5491 |
"Modified: / 04-12-2006 / 13:15:12 / cg" |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5492 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5493 |
|
3892 | 5494 |
newDirectory |
5495 |
"ask for and create a new directory" |
|
5496 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5497 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5498 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5499 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5500 |
directory isNil ifTrue:[ |
18175 | 5501 |
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
|
5502 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5503 |
]. |
4521 | 5504 |
|
5505 |
"/ 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
|
5506 |
selectedFiles := self currentSelectedFiles. |
4521 | 5507 |
selectedFiles size == 1 ifTrue:[ |
5508 |
singleSelectedFile := selectedFiles first. |
|
5509 |
||
5510 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
13714 | 5511 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5512 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
5513 |
||
5514 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
13714 | 5515 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5516 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
5517 |
]. |
|
5518 |
]. |
|
5519 |
]. |
|
5520 |
||
5961 | 5521 |
|
4521 | 5522 |
defaultAnswer notNil ifTrue:[ |
5961 | 5523 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 5524 |
] ifFalse:[ |
5961 | 5525 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 5526 |
]. |
5527 |
createOp result ifFalse:[ ^ self]. |
|
5528 |
newFile := createOp createdFile. |
|
3892 | 5529 |
newFile notNil ifTrue:[ |
17871 | 5530 |
self updateCurrentDirectoryWithReread. |
3892 | 5531 |
] |
17818 | 5532 |
|
5533 |
"Modified: / 29-11-2017 / 12:26:41 / cg" |
|
18175 | 5534 |
"Modified: / 01-06-2018 / 12:49:43 / Claus Gittinger" |
3892 | 5535 |
! |
5536 |
||
5537 |
newFile |
|
5538 |
"ask for and create a new file" |
|
5539 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5540 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5541 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5542 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5543 |
directory isNil ifTrue:[ |
18175 | 5544 |
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
|
5545 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5546 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5547 |
|
3982 | 5548 |
curFile := self firstSelectedFile. |
3892 | 5549 |
curFile notNil ifTrue:[ |
4414 | 5550 |
file := curFile. |
3892 | 5551 |
] ifFalse:[ |
4414 | 5552 |
file := directory. |
3892 | 5553 |
]. |
5961 | 5554 |
create := FileOperation createFileIn:file. |
3892 | 5555 |
create result ifFalse:[ ^ self]. |
5556 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
17818 | 5557 |
|
5558 |
"Modified: / 29-11-2017 / 12:26:51 / cg" |
|
18175 | 5559 |
"Modified: / 01-06-2018 / 12:49:50 / Claus Gittinger" |
3892 | 5560 |
! |
5561 |
||
5562 |
newHardLink |
|
5563 |
"ask for and create a hard link (unix only)" |
|
5564 |
||
6151 | 5565 |
self newLink:#hard. |
5566 |
! |
|
5567 |
||
5568 |
newLink:typeOfLink |
|
3892 | 5569 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
5570 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5571 |
| sel dir create createdFile| |
3892 | 5572 |
|
7560 | 5573 |
sel := self currentSelectedObjects. |
4979
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5574 |
(sel size ~= 1) ifTrue:[ |
18175 | 5575 |
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
|
5576 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5577 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5578 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5579 |
|
6151 | 5580 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 5581 |
create result ifFalse:[ ^ self]. |
5582 |
createdFile := create createdFile. |
|
5583 |
createdFile notNil ifTrue:[ |
|
6151 | 5584 |
typeOfLink == #soft ifTrue:[ |
17871 | 5585 |
self updateCurrentDirectoryWithReread. |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5586 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5587 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5588 |
] |
3892 | 5589 |
]. |
7560 | 5590 |
|
17818 | 5591 |
"Modified: / 29-11-2017 / 12:26:58 / cg" |
18175 | 5592 |
"Modified: / 01-06-2018 / 12:49:32 / Claus Gittinger" |
3892 | 5593 |
! |
5594 |
||
5595 |
newSoftLink |
|
5596 |
"ask for and create a soft link (unix only)" |
|
5597 |
||
6151 | 5598 |
self newLink:#soft. |
3892 | 5599 |
! |
5600 |
||
5601 |
pasteFiles |
|
6373 | 5602 |
"paste from clipBoard" |
5603 |
||
5604 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 5605 |
|
5606 |
files := self clipboard files. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
5607 |
files isEmptyOrNil ifTrue:[ ^ self ]. |
6373 | 5608 |
|
5609 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
5610 |
||
3892 | 5611 |
buffer := self clipboard copy. |
3982 | 5612 |
directories := self currentSelectedDirectories. |
5880 | 5613 |
directories size ~~ 1 ifTrue:[ |
4414 | 5614 |
|box dirStringCol| |
5880 | 5615 |
|
4414 | 5616 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
5617 |
box := ListSelectionBox new. |
|
6373 | 5618 |
box title:'Paste into which directory ?'. |
4414 | 5619 |
box list:dirStringCol. |
5620 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5621 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5622 |
box destroy. |
3892 | 5623 |
] ifFalse:[ |
5880 | 5624 |
destination := directories anElement. |
3892 | 5625 |
]. |
6373 | 5626 |
|
5627 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 5628 |
buffer files copy do:[:aFile| |
5629 |
aFile directory = destination ifTrue:[ |
|
5630 |
buffer files remove:aFile. |
|
5631 |
]. |
|
5632 |
]. |
|
5633 |
]. |
|
5634 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6374 | 5635 |
copiedFiles notEmptyOrNil ifTrue:[ |
5636 |
thisIsAFileMoveOperation ifTrue:[ |
|
5637 |
self deleteFiles:(copiedFiles keys) confirm:false. |
|
5638 |
]. |
|
5639 |
||
5640 |
"/ select those pasted files. |
|
5641 |
self updateCurrentDirectory:true. |
|
5642 |
self currentFileNameHolder value:copiedFiles values. |
|
5643 |
] |
|
3892 | 5644 |
! |
5645 |
||
5646 |
renameFile:aFile |
|
5647 |
"rename the selected file(s)" |
|
5648 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5649 |
^ self renameFiles:(Array with:aFile). |
3892 | 5650 |
! |
5651 |
||
4230 | 5652 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 5653 |
"rename filename to newFileString" |
5654 |
||
5655 |
|rename| |
|
5656 |
||
5961 | 5657 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 5658 |
rename result ifTrue:[ |
4230 | 5659 |
aBoolean ifTrue:[ |
5660 |
self updateAndSelect:(rename renamedFiles). |
|
5661 |
]. |
|
3892 | 5662 |
] ifFalse:[ |
4523 | 5663 |
self notify:rename errorString. |
3892 | 5664 |
]. |
5665 |
^ rename result |
|
5666 |
! |
|
5667 |
||
5668 |
renameFiles:aColOfFiles |
|
6373 | 5669 |
"rename some file(s)" |
3892 | 5670 |
|
5671 |
|rename| |
|
5672 |
||
5961 | 5673 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 5674 |
rename result ifFalse:[ |
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5675 |
self notify:rename errorString. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5676 |
^ nil. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5677 |
]. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5678 |
^ rename |
3892 | 5679 |
! |
5680 |
||
5681 |
renameSelection |
|
5682 |
"rename the selected file(s)" |
|
5683 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5684 |
|renamed| |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5685 |
|
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5686 |
renamed := self renameFiles:(self currentSelectedObjects copy). |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5687 |
renamed notNil ifTrue:[ |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5688 |
self updateAndSelect:renamed renamedFiles. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5689 |
]. |
7560 | 5690 |
|
5691 |
"Modified: / 04-12-2006 / 13:15:24 / cg" |
|
3892 | 5692 |
! ! |
5693 |
||
4080 | 5694 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 5695 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5696 |
bookmarksMenu |
3952 | 5697 |
<resource: #programMenu> |
5698 |
||
14941 | 5699 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec. |
5700 |
! |
|
5701 |
||
5702 |
bookmarksMenuForBaseSpec:aBaseMenuSpec |
|
5703 |
<resource: #programMenu> |
|
5704 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5705 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5706 |
|
14941 | 5707 |
menu := aBaseMenuSpec decodeAsLiteralArray. |
7763 | 5708 |
|
5709 |
"/ add the bookmark items ... |
|
5710 |
bookmarks := self class directoryBookmarks. |
|
5711 |
bookmarks notEmptyOrNil ifTrue:[ |
|
14604 | 5712 |
menu addSeparator. |
7763 | 5713 |
bookmarks do:[:dirName | |
12963 | 5714 |
menu addItem:(MenuItem |
5715 |
label:dirName asString |
|
5716 |
itemValue:[ |
|
5717 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
|
5718 |
self setCurrentFileName:dirName. |
|
5719 |
]. |
|
5720 |
]). |
|
7763 | 5721 |
]. |
5722 |
]. |
|
4080 | 5723 |
menu findGuiResourcesIn:self. |
7763 | 5724 |
^ menu |
5725 |
||
11135 | 5726 |
"Modified: / 14-01-2012 / 21:14:03 / cg" |
7763 | 5727 |
! |
5728 |
||
5729 |
canBackward |
|
5730 |
^ self directoryHistory canBackward. |
|
5731 |
||
5732 |
"Modified: / 27-03-2007 / 10:54:55 / cg" |
|
5733 |
! |
|
5734 |
||
5735 |
canForward |
|
5736 |
^ self directoryHistory canForward. |
|
5737 |
||
5738 |
"Modified: / 27-03-2007 / 10:54:57 / cg" |
|
5739 |
! |
|
5740 |
||
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5741 |
gotoBookmarksMenu |
7763 | 5742 |
<resource: #programMenu> |
5743 |
||
14941 | 5744 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec2. |
6099 | 5745 |
! |
5746 |
||
3892 | 5747 |
menuDirHistory:backOrForward |
7763 | 5748 |
"initialize the history menu" |
5749 |
||
3892 | 5750 |
<resource: #programMenu > |
5751 |
||
7763 | 5752 |
|hist menu pathList currentSel currentPath| |
5753 |
||
5754 |
hist := self directoryHistory. |
|
5755 |
hist isEmpty ifTrue:[^ nil]. |
|
5756 |
||
3892 | 5757 |
backOrForward == #back ifTrue:[ |
6725 | 5758 |
currentSel := self currentSelectedDirectories. |
4347 | 5759 |
currentSel size == 1 ifTrue:[ |
5760 |
currentPath := currentSel first asString. |
|
5761 |
] ifFalse:[ |
|
5762 |
currentPath := nil. |
|
5763 |
]. |
|
7763 | 5764 |
pathList := hist getBackCollection. |
3892 | 5765 |
] ifFalse:[ |
7763 | 5766 |
pathList := hist getForwardCollection. |
3892 | 5767 |
]. |
4022 | 5768 |
pathList isEmpty ifTrue:[ ^ nil]. |
7763 | 5769 |
|
6370 | 5770 |
pathList size > 30 ifTrue:[ |
5771 |
pathList := pathList copyTo:30 |
|
5772 |
]. |
|
7763 | 5773 |
|
5774 |
menu := Menu new. |
|
5775 |
||
3964 | 5776 |
pathList do:[:aPath| |
14593 | 5777 |
menu addItem:(MenuItem |
5778 |
label:aPath |
|
5779 |
itemValue:[ self setCurrentFileName:(aPath asFilename) ] |
|
5780 |
translateLabel:false). |
|
3952 | 5781 |
]. |
7763 | 5782 |
menu findGuiResourcesIn:self. |
3892 | 5783 |
^ menu |
7763 | 5784 |
|
11783 | 5785 |
"Modified: / 09-09-2012 / 13:07:22 / cg" |
3892 | 5786 |
! |
5787 |
||
5788 |
menuDirHistoryBack |
|
5789 |
"initialize the directory menu |
|
5790 |
" |
|
5791 |
<resource: #programMenu > |
|
5792 |
||
5793 |
^ self menuDirHistory:#back. |
|
5794 |
! |
|
5795 |
||
5796 |
menuDirHistoryForward |
|
5797 |
"initialize the directory menu |
|
5798 |
" |
|
5799 |
<resource: #programMenu > |
|
5800 |
||
5801 |
^ self menuDirHistory:#forward. |
|
3906 | 5802 |
! |
5803 |
||
5804 |
menuFileHistory |
|
5805 |
"initialize the file history menu |
|
5806 |
" |
|
5807 |
<resource: #programMenu > |
|
5808 |
||
7763 | 5809 |
|menu hist text removeItem| |
3906 | 5810 |
|
5811 |
hist := self fileHistory. |
|
5812 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5813 |
|
7763 | 5814 |
menu := Menu new. |
5815 |
||
5816 |
hist copy do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5817 |
aFileItem fileName exists ifTrue:[ |
12963 | 5818 |
menu addItem:(MenuItem |
5819 |
label: aFileItem fileName asString |
|
14593 | 5820 |
itemValue: |
5821 |
[ |
|
5822 |
self setCurrentFileName:(aFileItem fileName). |
|
5823 |
self openApplByFileItem:aFileItem |
|
5824 |
] |
|
5825 |
translateLabel:false). |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5826 |
] ifFalse:[ |
7763 | 5827 |
"/ remove all not existing history entries |
5828 |
hist remove:aFileItem. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5829 |
] |
3906 | 5830 |
]. |
7763 | 5831 |
menu addSeparator. |
5832 |
||
4080 | 5833 |
removeItem := MenuItem new. |
5834 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5835 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5836 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 5837 |
removeItem label:text. |
11783 | 5838 |
removeItem |
5839 |
itemValue:[ |
|
5840 |
self fileHistory removeAll. |
|
5841 |
self enableFileHistory value:false. |
|
5842 |
]. |
|
3906 | 5843 |
menu addItem:removeItem. |
7763 | 5844 |
menu findGuiResourcesIn:self. |
3906 | 5845 |
^ menu |
7763 | 5846 |
|
11783 | 5847 |
"Modified (format): / 09-09-2012 / 13:07:36 / cg" |
3952 | 5848 |
! |
5849 |
||
4080 | 5850 |
sortMenu |
5851 |
<resource: #programMenu > |
|
5852 |
||
5853 |
|menu| |
|
5854 |
||
7763 | 5855 |
menu := Menu decodeFromLiteralArray:self class sortMenu. |
4080 | 5856 |
menu findGuiResourcesIn:self. |
5857 |
^ menu |
|
7763 | 5858 |
|
5859 |
"Modified: / 27-03-2007 / 10:47:42 / cg" |
|
4080 | 5860 |
! |
5861 |
||
5862 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5863 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5864 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5865 |
specHere := self class viewDetailsMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5866 |
itemsHere := specHere at:2. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5867 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5868 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5869 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5870 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5871 |
spec := specHere copy. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5872 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5873 |
^ spec |
4080 | 5874 |
! |
5875 |
||
5876 |
viewInContentsBrowserMenu |
|
5009 | 5877 |
self |
5878 |
applicationNamed:#DirectoryContentsBrowser |
|
5879 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
5880 |
||
5881 |
^ nil. |
|
4080 | 5882 |
! |
5883 |
||
3952 | 5884 |
visitedDirectoriesMenu |
5885 |
<resource: #programMenu > |
|
5886 |
||
5887 |
|menu histCopy text removeItem| |
|
5888 |
||
7763 | 5889 |
histCopy := self directoryHistory. |
5890 |
histCopy isEmpty ifTrue:[^ nil]. |
|
5891 |
||
3952 | 5892 |
menu := Menu new. |
7763 | 5893 |
|
5894 |
histCopy do:[:aFile| |
|
12963 | 5895 |
menu addItem:(MenuItem |
5896 |
label:aFile asString |
|
5897 |
itemValue:[ |
|
5898 |
self setCurrentFileName:(aFile path asFilename). |
|
5899 |
]). |
|
7763 | 5900 |
]. |
5901 |
menu addSeparator. |
|
5902 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5903 |
"/ 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
|
5904 |
text := (resources string:'Clear History'). |
3952 | 5905 |
removeItem := MenuItem new. |
4040 | 5906 |
removeItem translateLabel:true. |
3952 | 5907 |
removeItem label:text. |
11783 | 5908 |
removeItem |
5909 |
itemValue:[ |
|
5910 |
self directoryHistory removeAll. |
|
5911 |
self enableForward value:self canForward. |
|
5912 |
self enableBack value:self canBackward. |
|
5913 |
]. |
|
7763 | 5914 |
|
3952 | 5915 |
menu addItem:removeItem. |
7763 | 5916 |
menu findGuiResourcesIn:self. |
3952 | 5917 |
^ menu |
7763 | 5918 |
|
11783 | 5919 |
"Modified: / 09-09-2012 / 13:07:45 / cg" |
3892 | 5920 |
! ! |
5921 |
||
5880 | 5922 |
!AbstractFileBrowser methodsFor:'menu actions'! |
5923 |
||
5924 |
doCompareTwoFiles |
|
5925 |
self openDiffView. |
|
5926 |
! |
|
5927 |
||
5928 |
doGoDirectoryUp |
|
18511 | 5929 |
"navigate up to the parent folder" |
5930 |
||
5960 | 5931 |
| upDir directory rootInTreeView| |
5880 | 5932 |
|
5933 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
5934 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 5935 |
directory := self currentDirectory. |
5936 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 5937 |
] ifFalse:[ |
5938 |
rootInTreeView := self |
|
5939 |
applicationNamed:#DirectoryTreeBrowser |
|
5940 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 5941 |
directory := rootInTreeView value asFilename. |
5942 |
]. |
|
5943 |
upDir := directory directory. |
|
5959 | 5944 |
self setCurrentFileName:upDir. |
5880 | 5945 |
! |
5946 |
||
5947 |
doGotoDefaultDirectory |
|
18511 | 5948 |
"navigate to the default folder (is the current directory)" |
5949 |
||
5880 | 5950 |
self gotoFile:(Filename defaultDirectory). |
5951 |
! |
|
5952 |
||
8091 | 5953 |
doGotoDesktopDirectory |
18511 | 5954 |
"navigate to the desktop folder" |
5955 |
||
8091 | 5956 |
self gotoFile:(Filename desktopDirectory). |
5957 |
! |
|
5958 |
||
18036 | 5959 |
doGotoDocumentsDirectory |
18511 | 5960 |
"navigate to the documents folder" |
5961 |
||
18036 | 5962 |
self gotoFile:(Filename documentsDirectory). |
5963 |
! |
|
5964 |
||
5965 |
doGotoDownloadsDirectory |
|
18511 | 5966 |
"navigate to the downloads folder" |
5967 |
||
18036 | 5968 |
self gotoFile:(Filename downloadsDirectory). |
5969 |
! |
|
5970 |
||
5880 | 5971 |
doGotoHomeDirectory |
18511 | 5972 |
"navigate to the home folder" |
5973 |
||
8091 | 5974 |
self gotoFile:(Filename homeDirectory). |
5880 | 5975 |
! |
5976 |
||
6434 | 5977 |
doGotoSmalltalkDirectory |
18511 | 5978 |
"navigate to the smalltalk bin folder (where the stx executable is)" |
5979 |
||
6434 | 5980 |
self gotoFile:(self smalltalkDirectory). |
5981 |
! |
|
5982 |
||
17187 | 5983 |
doGotoSmalltalkWorkspaceDirectory |
18511 | 5984 |
"navigate to the user's smalltalk workspace folder" |
5985 |
||
17187 | 5986 |
self gotoFile:(UserPreferences current workspaceDirectory). |
5987 |
! |
|
5988 |
||
9677 | 5989 |
doGotoTempDirectory |
5990 |
self gotoFile:(self tempDirectory). |
|
5991 |
||
5992 |
"Created: / 29-12-2010 / 11:03:17 / cg" |
|
5993 |
! |
|
5994 |
||
9596 | 5995 |
doMakeCurrentDirectory |
17582 | 5996 |
<resource: #obsolete> |
5997 |
||
5998 |
"/ no longer |
|
5999 |
^ self |
|
6000 |
"/ OperatingSystem setCurrentDirectory:(self currentDirectory pathName). |
|
6001 |
"/ self currentFileNameHolderChangedForCommon. |
|
9596 | 6002 |
|
6003 |
"Created: / 26-10-2010 / 17:21:19 / cg" |
|
17582 | 6004 |
"Modified (format): / 17-07-2017 / 10:09:39 / cg" |
9596 | 6005 |
! |
6006 |
||
5880 | 6007 |
fileGetInfo:longInfo |
6008 |
"get info on selected file - show it in a box" |
|
6009 |
||
6010 |
|string box updater| |
|
6011 |
||
6012 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
6013 |
string notNil ifTrue:[ |
|
6014 |
box := InfoBox title:string. |
|
6015 |
updater := [ |
|
6016 |
[true] whileTrue:[ |
|
6017 |
Delay waitForSeconds:2. |
|
6018 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
6019 |
string isNil ifTrue:[ ^ self]. |
|
6020 |
box title:string |
|
6021 |
] |
|
6022 |
] fork. |
|
6023 |
box show. |
|
6024 |
updater terminate. |
|
6025 |
box destroy |
|
6026 |
] |
|
6434 | 6027 |
! |
6028 |
||
17686 | 6029 |
showDeltaBetweenTwoImageFiles |
6030 |
|i1 i2 delta| |
|
6031 |
||
6032 |
i1 := Image fromFile:(self selectedFileNames first). |
|
6033 |
i2 := Image fromFile:(self selectedFileNames second). |
|
6034 |
delta := ImageAlgorithms new differenceImageBetween:i1 and:i2. |
|
6035 |
ImageView openOn:delta. |
|
6036 |
||
6037 |
"Created: / 10-09-2017 / 16:59:08 / cg" |
|
6038 |
! |
|
6039 |
||
6434 | 6040 |
smalltalkDirectory |
8590 | 6041 |
|stxPath| |
6434 | 6042 |
|
6043 |
stxPath := OperatingSystem pathOfSTXExecutable. |
|
8590 | 6044 |
stxPath isNil ifTrue:[ |
6045 |
^ Filename currentDirectory |
|
6046 |
]. |
|
6047 |
^ stxPath asFilename directory. |
|
9677 | 6048 |
! |
6049 |
||
6050 |
tempDirectory |
|
6051 |
^ Filename tempDirectory. |
|
6052 |
||
6053 |
"Created: / 29-12-2010 / 11:03:00 / cg" |
|
5880 | 6054 |
! ! |
6055 |
||
11139 | 6056 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
6057 |
||
14262 | 6058 |
addDirToJavaSourcePath |
6059 |
"add the current path to java's sourcePath |
|
6060 |
(only available with ST/J System" |
|
6061 |
||
6062 |
Java addToSourcePath:self currentDirectory pathName |
|
6063 |
||
6064 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
6065 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
6066 |
! |
|
6067 |
||
11139 | 6068 |
copyFiles |
6069 |
self |
|
6070 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
6071 |
! |
|
6072 |
||
6073 |
cutFiles |
|
6074 |
self |
|
6075 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
6076 |
! |
|
6077 |
||
6078 |
deleteFiles |
|
6079 |
self |
|
6080 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
6081 |
! |
|
6082 |
||
6083 |
eraseFiles |
|
6084 |
self |
|
6085 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
6086 |
! |
|
6087 |
||
14262 | 6088 |
fileAddToJavaSourcePath |
6089 |
"add the current path to java's sourcePath |
|
6090 |
(only available with ST/J System" |
|
6091 |
||
17865 | 6092 |
Java notNil ifTrue:[ |
6093 |
self currentSelectedObjects do:[:each | |
|
6094 |
Java addToSourcePath:(each pathName) |
|
6095 |
]. |
|
14262 | 6096 |
]. |
6097 |
||
6098 |
"Created: / 9.11.1998 / 05:41:34 / cg" |
|
6099 |
"Modified: / 9.11.1998 / 05:56:00 / cg" |
|
6100 |
! |
|
6101 |
||
11139 | 6102 |
openSettingsDialog |
6103 |
|dialog| |
|
6104 |
||
6105 |
dialog := FileBrowserV2SettingsDialog new. |
|
6106 |
dialog settingsDialog:self. |
|
6107 |
dialog allButOpen. |
|
6108 |
dialog doReload. |
|
6109 |
dialog openWindow |
|
6110 |
! |
|
6111 |
||
6112 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
6113 |
|files dirs| |
|
6114 |
||
6115 |
files := self currentSelectedFiles. |
|
6116 |
files notEmpty ifTrue:[ |
|
6117 |
aBlock value:files. |
|
6118 |
] ifFalse:[ |
|
6119 |
dirs := self currentSelectedDirectories. |
|
6120 |
dirs notEmpty ifTrue:[ |
|
6121 |
aBlock value:dirs. |
|
6122 |
]. |
|
6123 |
]. |
|
6124 |
! ! |
|
6125 |
||
6126 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
|
6127 |
||
6128 |
openAboutThisApplication |
|
6129 |
"opens an about box for this application." |
|
6130 |
||
6131 |
Dialog aboutClass:self class. |
|
6132 |
! |
|
6133 |
||
6134 |
openHTMLDocument:relativeDocPath |
|
6135 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
6136 |
! ! |
|
6137 |
||
6138 |
!AbstractFileBrowser methodsFor:'menu actions-scm-cvs'! |
|
3892 | 6139 |
|
15905 | 6140 |
canCvsAddAndCommit |
6141 |
||
6142 |
|selectedFiles| |
|
6143 |
||
6144 |
selectedFiles := self currentSelectedObjects. |
|
6145 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
6146 |
! |
|
6147 |
||
6148 |
canRemoveCVSContainer |
|
6149 |
^ self currentSelectedFiles |
|
6150 |
contains:[:fileName| |
|
6151 |
|dirOfFile cvsDir| |
|
6152 |
||
6153 |
dirOfFile := self getDirWithoutFileName:fileName. |
|
6154 |
cvsDir := dirOfFile construct:'CVS'. |
|
6155 |
cvsDir isDirectory |
|
6156 |
]. |
|
6157 |
! |
|
6158 |
||
12777 | 6159 |
commitFilesToCVS:files |
6160 |
|numFiles| |
|
6161 |
||
6162 |
(numFiles := files size) > 0 ifTrue:[ |
|
6163 |
self withActivityIndicationDo:[ |
|
6164 |
self cvsCommitFiles:files |
|
6165 |
] |
|
6166 |
] |
|
6167 |
! |
|
6168 |
||
3892 | 6169 |
cvsAddAndCommit |
4849 | 6170 |
self cvsAddAndCommitAsBinary:false |
6171 |
! |
|
6172 |
||
6173 |
cvsAddAndCommitAsBinary:asBinary |
|
8588 | 6174 |
|sel log logArg binArg cmd dir executionBlock nameString| |
3892 | 6175 |
|
6176 |
log := Dialog |
|
11139 | 6177 |
requestText:(resources string:'Enter initial log message:') |
4414 | 6178 |
lines:10 |
6179 |
columns:70 |
|
6180 |
initialAnswer:nil. |
|
8322
cf10f08b6164
care for cancel in #cvsAddAndCommitAsBinary:
Claus Gittinger <cg@exept.de>
parents:
8294
diff
changeset
|
6181 |
log isNil ifTrue:[^ self]. |
3892 | 6182 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6183 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6184 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6185 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6186 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6187 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6188 |
|
8588 | 6189 |
binArg := ''. |
6190 |
asBinary ifTrue:[ |
|
6191 |
binArg := '-kb '. |
|
6192 |
]. |
|
3982 | 6193 |
sel := self currentSelectedFiles. |
11139 | 6194 |
executionBlock := |
6195 |
[:stream | |
|
6196 |
log notNil ifTrue:[ |
|
17416 | 6197 |
sel notEmptyOrNil ifTrue:[ |
11139 | 6198 |
sel do:[:fn | |
6199 |
|nameArg| |
|
6200 |
||
6201 |
nameArg := '"',fn baseName,'"'. |
|
6202 |
||
6203 |
dir := self getDirWithoutFileName:fn. |
|
6204 |
cmd := 'cvs add ',logArg,' ',binArg,nameArg. |
|
6205 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6206 |
||
6207 |
cmd := ('cvs commit -l ',logArg,' ',nameArg). |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6208 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
11139 | 6209 |
"/ mhmh - it seems that only old CVS implementations (at least turqoise) |
6210 |
"/ support and need the 'admin -kb' command. |
|
6211 |
"/ newer ones use the '-kb' option in the 'cvs add' command |
|
6212 |
asBinary ifTrue:[ |
|
6213 |
cmd := ('cvs admin -kb ' , nameArg). |
|
6214 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6215 |
||
6216 |
cmd := ('cvs upd ' , nameArg). |
|
6217 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6218 |
]. |
|
6219 |
] |
|
6220 |
] |
|
6221 |
] |
|
6222 |
]. |
|
4107 | 6223 |
nameString := 'Command> cvs add and commit'. |
3892 | 6224 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
11139 | 6225 |
|
17416 | 6226 |
"Modified: / 17-02-2017 / 08:25:16 / cg" |
3892 | 6227 |
! |
6228 |
||
4849 | 6229 |
cvsAddBinaryAndCommit |
6230 |
self cvsAddAndCommitAsBinary:true |
|
6231 |
! |
|
6232 |
||
3892 | 6233 |
cvsCommit |
12777 | 6234 |
|selectedFiles| |
3892 | 6235 |
|
3982 | 6236 |
selectedFiles:= self currentSelectedFiles. |
12777 | 6237 |
self cvsCommitFiles:selectedFiles |
6238 |
! |
|
6239 |
||
6240 |
cvsCommitFiles:files |
|
6241 |
|nFiles log logTmp s logArg msg executionBlock nameString | |
|
6242 |
||
6243 |
nFiles := files size. |
|
6244 |
nFiles == 0 ifTrue:[^ self]. |
|
6245 |
||
6246 |
nFiles == 1 ifTrue:[ |
|
6247 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(files first baseName) |
|
3892 | 6248 |
] ifFalse:[ |
12777 | 6249 |
nFiles > 1 ifTrue:[ |
6250 |
msg := resources string:'Enter log message for %1 files to checkIn' with:nFiles printString |
|
4414 | 6251 |
] ifFalse:[ |
6627 | 6252 |
msg := resources string:'Enter log message for checkIn' |
4414 | 6253 |
] |
3892 | 6254 |
]. |
6255 |
||
6256 |
log := Dialog |
|
4414 | 6257 |
requestText:msg |
6258 |
lines:10 |
|
6259 |
columns:70 |
|
6260 |
initialAnswer:nil. |
|
3892 | 6261 |
|
4663 | 6262 |
log isNil ifTrue:[^ self]. |
12777 | 6263 |
log := log replChar:$" withString:'\"'. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6264 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6265 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
12777 | 6266 |
"/ save the log message into another tempFile ... |
13121 | 6267 |
s := FileStream newTemporary. |
6268 |
logTmp := s fileName. |
|
12777 | 6269 |
s nextPutAll:log. |
6270 |
s close. |
|
6271 |
||
6272 |
logArg := '-F "', logTmp pathName, '"'. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6273 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6274 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6275 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6276 |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6277 |
executionBlock := [:stream | |
12777 | 6278 |
[ |
6279 |
files do:[:fn | |
|
6280 |
| dir nameArg cmd | |
|
6281 |
||
6282 |
nameArg := '"',fn baseName,'"'. |
|
6283 |
dir := fn directory. |
|
6284 |
cmd := 'cvs commit ',logArg,' ' , nameArg. |
|
6285 |
stream showCR:fn pathName. |
|
6286 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
4663 | 6287 |
] |
12777 | 6288 |
] ensure:[ |
6289 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6290 |
]. |
|
4107 | 6291 |
]. |
6292 |
nameString := 'Command> cvs commit'. |
|
6293 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 6294 |
! |
6295 |
||
14527 | 6296 |
cvsCommitFolder |
6297 |
|dir log logTmp s logArg msg executionBlock nameString | |
|
6298 |
||
6299 |
(dir := self currentDirectory) isNil ifTrue:[ ^ self ]. |
|
6300 |
||
6301 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(dir baseName). |
|
6302 |
log := Dialog |
|
6303 |
requestText:msg |
|
6304 |
lines:10 |
|
6305 |
columns:70 |
|
6306 |
initialAnswer:nil. |
|
6307 |
||
6308 |
log isNil ifTrue:[^ self]. |
|
6309 |
log := log replChar:$" withString:'\"'. |
|
6310 |
||
6311 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6312 |
"/ save the log message into another tempFile ... |
|
6313 |
s := FileStream newTemporary. |
|
6314 |
logTmp := s fileName. |
|
6315 |
s nextPutAll:log. |
|
6316 |
s close. |
|
6317 |
||
6318 |
logArg := '-F "', logTmp pathName, '"'. |
|
6319 |
] ifFalse:[ |
|
6320 |
logArg := '-m ''' , log , ''''. |
|
6321 |
]. |
|
6322 |
||
6323 |
executionBlock := [:stream | |
|
6324 |
[ |
|
6325 |
|cmd| |
|
6326 |
||
6327 |
cmd := 'cvs commit ',logArg. |
|
6328 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6329 |
] ensure:[ |
|
6330 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6331 |
]. |
|
6332 |
]. |
|
6333 |
||
6334 |
nameString := 'Command> cvs commit'. |
|
6335 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6336 |
! |
|
6337 |
||
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6338 |
cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6339 |
|selectedFiles| |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6340 |
|
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6341 |
selectedFiles:= self currentSelectedFiles. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6342 |
selectedFiles do:[:each | |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6343 |
|out diffs| |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6344 |
|
15589 | 6345 |
out := CharacterWriteStream new:100. |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6346 |
OperatingSystem |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6347 |
executeCommand:'cvs diff -b ',each baseName |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6348 |
outputTo:out |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6349 |
inDirectory:each directoryName. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6350 |
diffs := out contents. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6351 |
TextView openWith:diffs. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6352 |
]. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6353 |
|
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6354 |
"Modified: / 23-01-2012 / 14:08:28 / cg" |
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6355 |
! |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6356 |
|
15211 | 6357 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
6358 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
6359 |
||
6360 |
|toRemove updateRunning executionBlock nameString| |
|
6361 |
||
6362 |
updateRunning := self backgroundProcesses value notEmpty. |
|
6363 |
self killAllRunningBackgroundProcesses. |
|
6364 |
toRemove := OrderedCollection new. |
|
6365 |
||
6366 |
executionBlock := |
|
6367 |
[:stream | |
|
6368 |
|cmd logArg prevDir prevFiles| |
|
6369 |
||
6370 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6371 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
|
6372 |
] ifFalse:[ |
|
6373 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
|
6374 |
]. |
|
6375 |
prevFiles := ''. |
|
6376 |
||
6377 |
filesToRemove do:[:fileName | |
|
6378 |
|dir file| |
|
6379 |
||
6380 |
dir := fileName directory. |
|
6381 |
(prevDir notNil and:[prevDir ~= dir]) ifTrue:[ |
|
6382 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6383 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6384 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6385 |
prevFiles := ''. |
|
6386 |
]. |
|
6387 |
||
17116 | 6388 |
OsError handle:[:ex| |
15211 | 6389 |
"was not able to remove it" |
6390 |
| lastError msg | |
|
6391 |
lastError := OperatingSystem lastErrorString. |
|
6392 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
6393 |
lastError isNil ifFalse:[ |
|
6394 |
msg := msg , '\\(' , lastError , ')' |
|
6395 |
]. |
|
6396 |
Dialog warn:msg withCRs |
|
6397 |
] do:[ |
|
6398 |
(fileName isSymbolicLink) ifFalse:[ |
|
6399 |
fileName remove. |
|
6400 |
file := fileName baseName. |
|
6401 |
cmd := ('cvs remove -f "',file,'"'). |
|
6402 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6403 |
"/ Transcript show:dir; space; showCR:cmd. |
|
6404 |
] |
|
6405 |
]. |
|
6406 |
prevDir := dir. |
|
6407 |
prevFiles := prevFiles,' ',file. |
|
6408 |
]. |
|
6409 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6410 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6411 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6412 |
]. |
|
6413 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
|
6414 |
filesToRemove size > 1 ifTrue:[ |
|
6415 |
nameString := nameString, ' ...'. |
|
6416 |
]. |
|
6417 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6418 |
! |
|
3892 | 6419 |
|
6420 |
cvsRemoveFileAndCVSContainer |
|
12493 | 6421 |
|files| |
6422 |
||
6423 |
files := self currentSelectedFiles copy. |
|
6424 |
self removeFilesAndCVSContainers:files |
|
3892 | 6425 |
! |
6426 |
||
9338 | 6427 |
cvsRevisionLog |
6428 |
| cmd sel executionBlock nameString| |
|
6429 |
||
6430 |
sel := self currentSelectedObjects. |
|
6431 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6432 |
||
6433 |
executionBlock := [:stream | |
|
6434 |
sel do:[:fn | |
|
6435 |
| dir nameArg | |
|
6436 |
||
6437 |
nameArg := '"',fn baseName,'"'. |
|
6438 |
dir := fn directory. |
|
6439 |
cmd := 'cvs log ' , nameArg. |
|
6440 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6441 |
] |
|
6442 |
]. |
|
6443 |
nameString := 'Command> cvs log'. |
|
6444 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6445 |
! |
|
6446 |
||
8562 | 6447 |
cvsTagSelection |
12856 | 6448 |
|tag tags cmd| |
6449 |
||
6450 |
tag := Dialog |
|
6451 |
request:(resources string:'Tag (possibly multiple, separated by ";"):') |
|
6452 |
initialAnswer:(CVSSourceCodeManager recentTag). |
|
6453 |
tag isEmptyOrNil ifTrue:[^ self ]. |
|
6454 |
||
6455 |
CVSSourceCodeManager recentTag:tag. |
|
8562 | 6456 |
|
6457 |
CVSSourceCodeManager notNil ifTrue:[ |
|
6458 |
cmd := CVSSourceCodeManager cvsExecutable. |
|
6459 |
] ifFalse:[ |
|
6460 |
cmd := 'cvs'. |
|
6461 |
]. |
|
6462 |
||
12856 | 6463 |
tags := tag asCollectionOfSubstringsSeparatedByAny:',;'. |
6464 |
tags do:[:eachTag | |
|
6465 |
self executeCommand:('%1 tag -F "%2" %3' |
|
6466 |
bindWith:cmd |
|
12858 | 6467 |
with:(eachTag withoutSeparators) |
12856 | 6468 |
with:(self makeFileNameArgumentString)) |
6469 |
]. |
|
8562 | 6470 |
! |
6471 |
||
3892 | 6472 |
cvsUpdateAll |
6473 |
| cmd | |
|
6474 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6475 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6476 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6477 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6478 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6479 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6480 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6481 |
self executeCommand:(cmd, ' upd -l'). |
3892 | 6482 |
! |
6483 |
||
6484 |
cvsUpdateAllRecursive |
|
6485 |
| cmd | |
|
6486 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6487 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6488 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6489 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6490 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6491 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6492 |
self executeCommand:(cmd, ' upd -d'). |
3892 | 6493 |
! |
6494 |
||
6495 |
cvsUpdateSelection |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6496 |
|stream cmd| |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6497 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6498 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6499 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6500 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6501 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6502 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6503 |
|
15589 | 6504 |
stream := CharacterWriteStream new. |
8563 | 6505 |
stream |
6506 |
nextPutAll:cmd; |
|
6507 |
nextPutAll:' upd '; |
|
6508 |
nextPutAll:(self makeFileNameArgumentString). |
|
6509 |
||
6510 |
self executeCommand:stream contents. |
|
6511 |
! |
|
6512 |
||
6513 |
makeFileNameArgumentString |
|
6514 |
|stream| |
|
6515 |
||
15589 | 6516 |
stream := CharacterWriteStream new. |
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6517 |
self currentSelectedFiles do:[: file | |
8563 | 6518 |
stream nextPut:$". |
4414 | 6519 |
stream nextPutAll:file baseName. |
8563 | 6520 |
stream nextPutAll:'" '. |
6521 |
]. |
|
6522 |
^ stream contents. |
|
12493 | 6523 |
! |
6524 |
||
6525 |
removeFilesAndCVSContainers:files |
|
6526 |
|numFiles question aswer| |
|
6527 |
||
6528 |
(numFiles := files size) > 0 ifTrue:[ |
|
6529 |
numFiles > 1 ifTrue:[ |
|
6530 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:numFiles |
|
6531 |
] ifFalse:[ |
|
6532 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(files first baseName allBold) |
|
6533 |
]. |
|
6534 |
||
6535 |
aswer := Dialog |
|
6536 |
confirm:question withCRs |
|
6537 |
yesLabel:(resources string:'Remove') |
|
6538 |
noLabel:(resources string:'Cancel'). |
|
6539 |
||
6540 |
aswer ifTrue:[ |
|
6541 |
self withActivityIndicationDo:[ |
|
6542 |
self cvsRemoveAndRemoveFromCVS:files |
|
6543 |
] |
|
6544 |
] |
|
6545 |
] |
|
3892 | 6546 |
! ! |
6547 |
||
14126 | 6548 |
|
11139 | 6549 |
!AbstractFileBrowser methodsFor:'menu actions-scm-mercurial'! |
6550 |
||
6551 |
mercurialAdd |
|
6552 |
|executionBlock sel maxCmdSize| |
|
6553 |
||
6554 |
maxCmdSize := 512. |
|
6555 |
||
6556 |
sel := self currentSelectedObjects. |
|
6557 |
sel isEmptyOrNil ifTrue:[ |
|
6558 |
^ self |
|
6559 |
]. |
|
6560 |
||
6561 |
executionBlock := |
|
6562 |
[:stream | |
|
6563 |
|prevDir cmd| |
|
6564 |
||
6565 |
prevDir := nil. |
|
6566 |
sel do:[:fn | |
|
6567 |
|nameArg dir| |
|
6568 |
||
6569 |
nameArg := '"',fn baseName,'"'. |
|
6570 |
dir := fn directory. |
|
6571 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6572 |
"/ flush |
|
6573 |
cmd notNil ifTrue:[ |
|
6574 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6575 |
cmd := nil. |
|
6576 |
] |
|
6577 |
]. |
|
6578 |
cmd isNil ifTrue:[ |
|
6579 |
cmd := 'hg add'. |
|
6580 |
]. |
|
6581 |
cmd := cmd,' ',nameArg. |
|
6582 |
prevDir := dir. |
|
6583 |
]. |
|
6584 |
cmd notNil ifTrue:[ |
|
6585 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6586 |
cmd := nil. |
|
6587 |
]. |
|
6588 |
stream nextPutLine:'Commit to finish the transaction'. |
|
6589 |
]. |
|
6590 |
||
6591 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg add'. |
|
6592 |
||
6593 |
"Created: / 15-01-2012 / 15:55:47 / cg" |
|
6594 |
! |
|
6595 |
||
6596 |
mercurialCommit |
|
6597 |
|dir executionBlock| |
|
6598 |
||
6599 |
"/ dir := self currentDirectory. |
|
6600 |
dir := self directoryContentsBrowser directory. |
|
6601 |
executionBlock := |
|
6602 |
[:stream | |
|
6603 |
(self getExecutionBlockForCommand:'hg commit' |
|
6604 |
inDirectory:dir) value:stream. |
|
6605 |
stream nextPutLine:'Push to sync other repositories'. |
|
6169 | 6606 |
]. |
11139 | 6607 |
|
6608 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg commit'. |
|
6609 |
||
6610 |
"Created: / 15-01-2012 / 16:21:27 / cg" |
|
6611 |
! |
|
6612 |
||
11144 | 6613 |
mercurialInit |
6614 |
|dir executionBlock| |
|
6615 |
||
6616 |
dir := self directoryContentsBrowser directory. |
|
6617 |
||
6618 |
(Dialog confirm:(resources |
|
6619 |
string:'Initialize new Mercurial Repository in %1?' |
|
6620 |
with:dir baseName)) ifFalse:[^ self]. |
|
6621 |
||
6622 |
executionBlock := |
|
6623 |
[:stream | |
|
6624 |
(self getExecutionBlockForCommand:('hg init') |
|
6625 |
inDirectory:dir) value:stream. |
|
6626 |
]. |
|
6627 |
||
6628 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg init'. |
|
6629 |
||
6630 |
"Created: / 17-01-2012 / 15:58:46 / cg" |
|
6631 |
! |
|
6632 |
||
11139 | 6633 |
mercurialPush |
6634 |
|destination dir executionBlock| |
|
6635 |
||
6636 |
destination := Dialog request:'Mercurial Repository' |
|
6637 |
initialAnswer:(LastMercurialRepository ? MercurialSourceCodeManager repositoryName). |
|
6638 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
6639 |
||
6640 |
LastMercurialRepository := destination. |
|
6641 |
||
6642 |
dir := self directoryContentsBrowser directory. |
|
6643 |
executionBlock := |
|
6644 |
[:stream | |
|
6645 |
(self getExecutionBlockForCommand:('hg push "%1"' bindWith:destination) |
|
6646 |
inDirectory:dir) value:stream. |
|
6647 |
]. |
|
6648 |
||
6649 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg push'. |
|
6650 |
||
6651 |
"Created: / 15-01-2012 / 16:29:41 / cg" |
|
6652 |
! |
|
6653 |
||
6654 |
mercurialStatus |
|
6655 |
|executionBlock sel maxCmdSize| |
|
6656 |
||
6657 |
maxCmdSize := 512. |
|
6658 |
||
6659 |
sel := self currentSelectedObjects. |
|
6660 |
sel isEmptyOrNil ifTrue:[ |
|
6661 |
^ self |
|
6662 |
]. |
|
6663 |
||
6664 |
executionBlock := |
|
6665 |
[:stream | |
|
6666 |
|prevDir cmd| |
|
6667 |
||
6668 |
prevDir := nil. |
|
6669 |
sel do:[:fn | |
|
6670 |
|nameArg dir| |
|
6671 |
||
6672 |
nameArg := '"',fn baseName,'"'. |
|
6673 |
dir := fn directory. |
|
6674 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6675 |
"/ flush |
|
6676 |
cmd notNil ifTrue:[ |
|
6677 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6678 |
cmd := nil. |
|
6679 |
] |
|
6680 |
]. |
|
6681 |
cmd isNil ifTrue:[ |
|
6682 |
cmd := 'hg status'. |
|
6683 |
]. |
|
6684 |
cmd := cmd,' ',nameArg. |
|
6685 |
prevDir := dir. |
|
6686 |
]. |
|
6687 |
cmd notNil ifTrue:[ |
|
6688 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6689 |
cmd := nil. |
|
6690 |
]. |
|
6691 |
]. |
|
6692 |
||
6693 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg status'. |
|
6694 |
||
6695 |
"Created: / 15-01-2012 / 19:43:08 / cg" |
|
3892 | 6696 |
! ! |
6697 |
||
4849 | 6698 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
3892 | 6699 |
|
8510 | 6700 |
allFilesInSelectedDirectoriesForWhich:aBlock |
17868 | 6701 |
^ self class allFilesInDirectories:(self currentSelectedDirectories) forWhich:aBlock |
8510 | 6702 |
! |
6703 |
||
18426 | 6704 |
changeSetFromGSTSource |
6705 |
GSTFileReader isNil ifTrue:[ Smalltalk loadPackage:'stx:libbasic2']. |
|
6706 |
||
6707 |
self withWaitCursorDo:[ |
|
6708 |
self currentSelectedFiles do:[:fn | |
|
6709 |
|changeSet| |
|
6710 |
||
18746 | 6711 |
(fn suffix sameAs:'st') ifTrue:[ |
18426 | 6712 |
changeSet := GSTFileReader new changeSetFromStream:fn readStream. |
6713 |
(Tools::ChangeSetBrowser2 |
|
6714 |
on: changeSet |
|
6715 |
label: fn baseName) |
|
6716 |
beTwoColumn; |
|
6717 |
targetNamespace:nil; |
|
6718 |
targetPackage:nil; |
|
6719 |
open |
|
6720 |
] |
|
6721 |
] |
|
6722 |
] |
|
6723 |
||
6724 |
"Created: / 23-09-2018 / 01:32:46 / Claus Gittinger" |
|
18746 | 6725 |
"Modified: / 01-05-2019 / 11:21:34 / Claus Gittinger" |
18426 | 6726 |
! |
6727 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6728 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6729 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6730 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6731 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6732 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6733 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6734 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6735 |
"/ 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
|
6736 |
"/ 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
|
6737 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6738 |
conv := OrderedCollection new. |
4722 | 6739 |
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
|
6740 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6741 |
outSuffix = 'png' ifTrue:[ |
4722 | 6742 |
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
|
6743 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6744 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6745 |
outSuffix = 'gif' ifTrue:[ |
4722 | 6746 |
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
|
6747 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6748 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6749 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 6750 |
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
|
6751 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6752 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6753 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 6754 |
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
|
6755 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6756 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6757 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6758 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6759 |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6760 |
convertImageFrom:fileName to:outFile onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6761 |
|writer image outSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6762 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6763 |
outSuffix := outFile suffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6764 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6765 |
((writer := MIMETypes imageReaderForSuffix:outSuffix) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6766 |
and:[ (image := Image fromFile:fileName) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6767 |
and:[ writer canRepresent:image ]]) ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6768 |
"/ can do it with Smalltalk tools |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6769 |
writer save:image onFile:outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6770 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6771 |
"/ use external tools (pbm-package, if available) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6772 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6773 |
convertImageUsingExternalFileToolsFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6774 |
toSuffix:outSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6775 |
onError:exceptionBlock. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6776 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6777 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6778 |
"Created: / 20-05-2010 / 11:12:36 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6779 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6780 |
|
4367 | 6781 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6782 |
self convertImageToSuffix:'gif' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6783 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6784 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6785 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6786 |
self convertImageToSuffix:'jpg' |
4531 | 6787 |
! |
6788 |
||
6789 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6790 |
self convertImageToSuffix:'png' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6791 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6792 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6793 |
convertImageToSuffix:outSuffix |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6794 |
|outFile filesToConvert| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6795 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6796 |
self withActivityIndicationDo:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6797 |
filesToConvert := self currentSelectedObjects copy. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6798 |
filesToConvert do:[:fileName | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6799 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6800 |
|
18453 | 6801 |
fileName isRegularFile ifTrue:[ |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6802 |
|skip| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6803 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6804 |
skip := false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6805 |
outFile := fileName withSuffix:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6806 |
outFile exists ifTrue:[ |
4722 | 6807 |
|answer| |
6808 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6809 |
answer := Dialog |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6810 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6811 |
default:false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6812 |
answer isNil ifTrue:[AbortSignal raise]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6813 |
answer ifFalse:[ skip := true ]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6814 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6815 |
skip ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6816 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6817 |
convertImageFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6818 |
to:outFile |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6819 |
onError:[:errMsg | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6820 |
filesToConvert size == 1 ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6821 |
Dialog warn:errMsg |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6822 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6823 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6824 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6825 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6826 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6827 |
]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6828 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6829 |
self updateAndSelect:nil. |
4367 | 6830 |
] |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6831 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6832 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6833 |
self notify:nil. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6834 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6835 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6836 |
"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
|
6837 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6838 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6839 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6840 |
self convertImageToSuffix:'xpm' |
4367 | 6841 |
! |
6842 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6843 |
convertImageUsingExternalFileToolsFrom:fileName toSuffix:outSuffix onError:exceptionBlock |
13121 | 6844 |
|inFile outFile chainOfConversions conversionStream |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6845 |
eachConversionSuffixCommandPair eachConversionCommand eachConversionSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6846 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6847 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6848 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6849 |
chainOfConversions isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6850 |
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
|
6851 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6852 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6853 |
conversionStream := chainOfConversions readStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6854 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6855 |
inFile := fileName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6856 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6857 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6858 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6859 |
eachConversionCommand == #readToXPM ifTrue:[ |
13121 | 6860 |
|image tempStreamXPM| |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6861 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6862 |
image := Image fromFile:(inFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6863 |
image isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6864 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6865 |
^ false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6866 |
]. |
13121 | 6867 |
tempStreamXPM := FileStream newTemporaryWithSuffix:'xpm'. |
6868 |
XPMReader save:image onStream:tempStreamXPM. |
|
6869 |
tempStreamXPM close. |
|
6870 |
inFile := tempStreamXPM fileName. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6871 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6872 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6873 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6874 |
[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6875 |
|command errOutput errMsg| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6876 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6877 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6878 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6879 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6880 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6881 |
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
|
6882 |
|
13121 | 6883 |
outFile := (FileStream newTemporaryWithSuffix:eachConversionSuffix) close pathName. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6884 |
command := eachConversionCommand |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6885 |
bindWith:(inFile pathName) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6886 |
with:(outFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6887 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6888 |
errOutput := String writeStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6889 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6890 |
(OperatingSystem executeCommand:command errorTo:errOutput) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6891 |
errMsg := resources |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6892 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6893 |
with:inFile baseName allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6894 |
with:eachConversionSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6895 |
with:eachConversionCommand allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6896 |
with:errOutput contents. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6897 |
exceptionBlock value:errMsg. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6898 |
|
18024 | 6899 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
6900 |
outFile remove. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6901 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6902 |
]. |
18024 | 6903 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6904 |
inFile := outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6905 |
eachConversionSuffixCommandPair := conversionStream next |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6906 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6907 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6908 |
] ifCurtailed:[ |
18024 | 6909 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
6910 |
outFile remove. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6911 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6912 |
^ true. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6913 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6914 |
"Created: / 20-05-2010 / 11:05:50 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6915 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6916 |
|
3892 | 6917 |
createProjectAndOpenProjectBrowser |
6918 |
|nm f s directory| |
|
6919 |
||
6920 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 6921 |
directory := self currentDirectory. |
3892 | 6922 |
nm := directory baseName. |
6923 |
f := (directory construct:nm) withSuffix:'prj'. |
|
6924 |
f exists ifTrue:[ |
|
4414 | 6925 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
6926 |
^ self. |
|
3892 | 6927 |
]. |
6928 |
s := f writeStream. |
|
6929 |
s nextPutAll:' |
|
6930 |
name ''' , nm , ''' |
|
6931 |
type #classLibrary |
|
6932 |
package #''private:' , nm , ''' |
|
6933 |
prerequisites nil |
|
6934 |
||
6935 |
classes #( ) |
|
6936 |
'. |
|
6937 |
s close. |
|
6938 |
ProjectBrowser openOnFile:f. |
|
6939 |
! |
|
6940 |
||
5880 | 6941 |
doExecuteCommand |
6942 |
"execute an OperatingSystem-command" |
|
6943 |
||
6944 |
| action fileName| |
|
6945 |
||
6946 |
fileName := self firstSelectedFile. |
|
6947 |
action := [:command | |
|
6948 |
self addToCommandHistory:command for:fileName. |
|
6949 |
self executeCommand:command. |
|
6950 |
]. |
|
6951 |
self askForCommandFor:fileName thenDo:action |
|
6952 |
! |
|
6953 |
||
6954 |
doExecuteScript |
|
16941 | 6955 |
"execute a Smalltalk script" |
5880 | 6956 |
|
6957 |
|textHolder dialog template dummyClass dummyInstance| |
|
6958 |
||
6959 |
template := |
|
6960 |
'"/ Smalltalk script: |
|
6961 |
||
16084 | 6962 |
"/ the following variables are accessible: |
5880 | 6963 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
6964 |
"/ selectedFiles (= ...) |
|
6965 |
"/ |
|
6966 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
6967 |
"/ |
|
6968 |
"/ Useful operations are: |
|
6969 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
6970 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
6971 |
"/ directory directory |
|
6972 |
"/ |
|
6973 |
"/ example: move all files which match a aarticular pattern to |
|
6974 |
"/ a separate directory: |
|
6975 |
"/ |
|
6976 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
6977 |
"/ |
|
6978 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
6979 |
"/ |
|
6980 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
6981 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
6982 |
"/ idx := eachBaseNameString indexOf:$_. |
|
6983 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
6984 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
6985 |
"/ newDir := directory construct:prefix. |
|
6986 |
"/ newDir exists ifFalse:[ |
|
6987 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
6988 |
"/ newDir makeDirectory. |
|
6989 |
"/ ]. |
|
6990 |
"/ ]. |
|
6991 |
"/ newDir exists ifTrue:[ |
|
6992 |
"/ oldFile := directory construct:eachBaseNameString. |
|
6993 |
"/ newFile := newDir construct:rest. |
|
6994 |
"/ oldFile moveTo:newFile |
|
6995 |
"/ ] |
|
6996 |
"/ ] |
|
6997 |
"/ ] |
|
6998 |
'. |
|
6999 |
||
7000 |
LastScriptBlockString isNil ifTrue:[ |
|
7001 |
LastScriptBlockString := template. |
|
7002 |
]. |
|
7003 |
||
7004 |
textHolder := ValueHolder new. |
|
7005 |
dialog := Dialog |
|
7006 |
forRequestText:(resources string:'Enter script') |
|
7007 |
editViewClass:CodeView |
|
7008 |
lines:25 |
|
7009 |
columns:70 |
|
7010 |
initialAnswer:LastScriptBlockString |
|
7011 |
model:textHolder. |
|
7012 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
7013 |
dialog open. |
|
7014 |
dialog accepted ifFalse:[^ self]. |
|
7015 |
||
7016 |
LastScriptBlockString := textHolder value. |
|
7017 |
||
7018 |
Class classConventionViolationConfirmationQuerySignal |
|
7019 |
answer:true |
|
7020 |
do:[ |
|
7021 |
dummyClass := Object class |
|
7022 |
name:#Dummy |
|
7023 |
inEnvironment:nil |
|
7024 |
subclassOf:Object |
|
7025 |
instanceVariableNames:'directory selectedFiles' |
|
7026 |
variable:false |
|
7027 |
words:true |
|
7028 |
pointers:true |
|
7029 |
classVariableNames:'' |
|
7030 |
poolDictionaries:'' |
|
7031 |
category:#dummyCategory |
|
7032 |
comment:nil |
|
7033 |
changed:true. |
|
7034 |
]. |
|
7035 |
||
7036 |
dummyInstance := dummyClass basicNew. |
|
7037 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
7038 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
7039 |
||
7040 |
Compiler |
|
7041 |
evaluate:textHolder value |
|
7042 |
in:nil |
|
7043 |
receiver:dummyInstance |
|
7044 |
notifying:nil |
|
7045 |
logged:false |
|
7046 |
ifFail:[] |
|
7047 |
compile:true. |
|
7048 |
||
7049 |
"/ fileName := self firstSelectedFile. |
|
7050 |
"/ action := [:command | |
|
7051 |
"/ self addToCommandHistory:command for:fileName. |
|
7052 |
"/ self executeCommand:command. |
|
7053 |
"/ ]. |
|
7054 |
"/ self askForCommandFor:fileName thenDo:action |
|
7055 |
! |
|
7056 |
||
4230 | 7057 |
doMake |
7938 | 7058 |
|dir cmd| |
4230 | 7059 |
|
13856 | 7060 |
cmd := self makeCommandHolder value. |
7061 |
||
7062 |
"Make" |
|
7063 |
cmd = 'make' ifTrue:[ |
|
7064 |
dir := self theSingleSelectedDirectoryOrNil. |
|
7065 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
7066 |
dir notNil ifTrue:[ |
|
7067 |
(dir construct:'bmake.bat') exists ifTrue:[ |
|
7068 |
cmd := 'bmake.bat'. |
|
7069 |
] |
|
7938 | 7070 |
] |
13856 | 7071 |
]. |
7072 |
self executeCommand:cmd. |
|
7073 |
^self. |
|
7074 |
]. |
|
7075 |
||
7076 |
"Apache ant" |
|
7077 |
cmd = 'ant' ifTrue:[ |
|
7078 |
self executeCommand:cmd. |
|
7079 |
^self. |
|
7080 |
]. |
|
7081 |
||
7082 |
"Add more here..." |
|
7083 |
||
7084 |
"Modified (comment): / 13-04-2012 / 17:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4230 | 7085 |
! |
7086 |
||
8256 | 7087 |
doOpenCBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7088 |
"the CBrowser is an eXept-internal C-language IDE tool. |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7089 |
(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
|
7090 |
20 years ago ;-)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7091 |
|
8256 | 7092 |
|destDir| |
7093 |
||
18433 | 7094 |
((Smalltalk at:#'CBrowser') isNil or:[ (Smalltalk at:#'CBrowser::Browser') isNil ]) ifTrue:[ |
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7095 |
Smalltalk loadPackage:'exept:CC' |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7096 |
]. |
8256 | 7097 |
destDir := self currentDirectory. |
18433 | 7098 |
(Smalltalk at:#'CBrowser::Browser') openIn:destDir pathName |
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7099 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7100 |
"Modified: / 04-10-2011 / 13:41:31 / cg" |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7101 |
"Modified (comment): / 27-07-2012 / 20:41:40 / cg" |
18433 | 7102 |
"Modified: / 26-09-2018 / 12:37:34 / Claus Gittinger" |
8256 | 7103 |
! |
7104 |
||
7829 | 7105 |
doOpenExplorer |
18433 | 7106 |
"corresponding menu item is visible on a windows machine only" |
7107 |
||
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7108 |
self currentDirectory asFilename openExplorer |
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7109 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7110 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
18433 | 7111 |
"Modified (comment): / 26-09-2018 / 12:38:08 / Claus Gittinger" |
7829 | 7112 |
! |
7113 |
||
12473 | 7114 |
doOpenFinder |
18433 | 7115 |
"corresponding menu item is visible on a mac only" |
7116 |
||
12473 | 7117 |
self currentDirectory asFilename openFinder |
7118 |
||
7119 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
|
18433 | 7120 |
"Modified (comment): / 26-09-2018 / 12:38:00 / Claus Gittinger" |
12473 | 7121 |
! |
7122 |
||
18432 | 7123 |
doOpenGDBApplication |
7124 |
"the GDBApplication is a cg-private debugging tool" |
|
7125 |
||
7126 |
|destDir| |
|
7127 |
||
7128 |
(Smalltalk at:#'GDBApplication') isNil ifTrue:[ |
|
7129 |
Smalltalk loadPackage:'cg:tools' |
|
7130 |
]. |
|
7131 |
destDir := self currentDirectory. |
|
7132 |
(Smalltalk at:#'GDBApplication') openOn:destDir |
|
7133 |
||
7134 |
"Created: / 26-09-2018 / 12:09:32 / Claus Gittinger" |
|
7135 |
! |
|
7136 |
||
12811 | 7137 |
doOpenMonticelloBrowser |
18433 | 7138 |
(Smalltalk at:#'MCMczReader') isNil ifTrue:[ |
7139 |
Smalltalk loadPackage:'stx:goodies/monticello'. |
|
7140 |
(Smalltalk at:#'MCMczReader') isNil ifTrue:[ |
|
7141 |
Dialog warn:'Failed to load the monticello package'. |
|
7142 |
^ self. |
|
7143 |
]. |
|
7144 |
]. |
|
12874
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
7145 |
|
12811 | 7146 |
self withWaitCursorDo:[ |
7147 |
self currentSelectedFiles do:[:fn | |
|
7148 |
|version snapshot| |
|
7149 |
||
18746 | 7150 |
(fn suffix sameAs:'mcz') ifTrue:[ |
18433 | 7151 |
version := (Smalltalk at:#'MCMczReader') versionFromFile:fn. |
12811 | 7152 |
snapshot := version snapshot. |
7153 |
(Tools::ChangeSetBrowser2 |
|
7154 |
on: snapshot asChangeSet |
|
7155 |
label: version info name) |
|
7156 |
beTwoColumn; |
|
7157 |
targetNamespace:nil; |
|
7158 |
targetPackage:nil; |
|
7159 |
open |
|
7160 |
] |
|
7161 |
] |
|
7162 |
] |
|
18433 | 7163 |
|
18746 | 7164 |
"Modified: / 01-05-2019 / 11:23:23 / Claus Gittinger" |
12811 | 7165 |
! |
7166 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7167 |
doOpenSettings |
8168 | 7168 |
self openSettingsDialog |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7169 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7170 |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7171 |
doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7172 |
"open using win32-shell" |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7173 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7174 |
|fileName| |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7175 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7176 |
fileName := self firstSelectedFile. |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7177 |
fileName notNil ifTrue:[ |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7178 |
OperatingSystem |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7179 |
openApplicationForDocument:fileName pathName |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7180 |
operation:#open |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7181 |
] |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7182 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7183 |
"Modified: / 21-07-2012 / 12:26:10 / cg" |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7184 |
! |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7185 |
|
7104 | 7186 |
editMode:aSymbol |
7187 |
self |
|
7188 |
applicationNamed:#FileApplicationNoteBook |
|
7189 |
ifPresentDo:[:appl | |
|
7190 |
|subApp| |
|
7191 |
||
7192 |
subApp := appl selectedApplication. |
|
7193 |
subApp notNil ifTrue:[ |
|
7194 |
^ subApp perform:aSymbol |
|
7195 |
] |
|
7196 |
]. |
|
7197 |
||
7198 |
"Created: / 11-09-2006 / 12:42:08 / cg" |
|
7199 |
! |
|
7200 |
||
7201 |
editModeInsert |
|
7202 |
self editMode:#editModeInsert |
|
7203 |
||
7204 |
"Created: / 11-09-2006 / 12:40:36 / cg" |
|
7205 |
! |
|
7206 |
||
7207 |
editModeInsertAndSelect |
|
7208 |
self editMode:#editModeInsertAndSelect |
|
7209 |
||
7210 |
"Created: / 11-09-2006 / 12:40:45 / cg" |
|
7211 |
! |
|
7212 |
||
7213 |
editModeOverwrite |
|
7214 |
self editMode:#editModeOverwrite |
|
7215 |
||
7216 |
"Modified: / 11-09-2006 / 12:42:26 / cg" |
|
7217 |
! |
|
7218 |
||
15528 | 7219 |
fetchFileByURL |
7220 |
|url destinationFilename| |
|
7221 |
||
17818 | 7222 |
url := Dialog request:(resources string:'URL to Fetch:') initialAnswer:'http://host/path'. |
15528 | 7223 |
url isEmptyOrNil ifTrue:[^ self]. |
7224 |
url := url asURL. |
|
7225 |
||
17818 | 7226 |
destinationFilename := Dialog request:(resources string:'Download As:') initialAnswer:(UnixFilename named:url path) baseName. |
15528 | 7227 |
destinationFilename isEmptyOrNil ifTrue:[^ self]. |
7228 |
||
7229 |
destinationFilename := self currentDirectory asFilename / destinationFilename. |
|
7230 |
destinationFilename exists ifTrue:[ |
|
7231 |
|answer| |
|
7232 |
||
7233 |
answer := Dialog |
|
7234 |
confirm:(resources string:'Overwrite existing %1 ?' with:destinationFilename baseName allBold) |
|
7235 |
default:false. |
|
7236 |
answer ~~ true ifTrue:[^ self]. |
|
7237 |
]. |
|
7238 |
self withActivityIndicationDo:[ |
|
7239 |
self notify:(resources string:'Fetching %1' with:url). |
|
7240 |
HTTPInterface get:url destinationFile:destinationFilename. |
|
7241 |
self notify:nil. |
|
7242 |
] |
|
7243 |
||
17818 | 7244 |
"Modified: / 29-11-2017 / 12:26:13 / cg" |
15528 | 7245 |
! |
7246 |
||
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7247 |
fileContentsAsByteArray |
17769 | 7248 |
|file fileSize| |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7249 |
|
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7250 |
file := self firstSelectedFile. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7251 |
file isNil ifTrue:[^ self ]. |
17769 | 7252 |
|
7253 |
file := file asFilename. |
|
7254 |
||
7255 |
(fileSize := file fileSize) > (1024*1024) ifTrue:[ |
|
7256 |
fileSize > (128*1024*1024) ifTrue:[ |
|
11889 | 7257 |
Dialog warn:(resources string:'File is too big'). |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7258 |
^ self. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7259 |
]. |
17769 | 7260 |
(Dialog confirm:(resources |
7261 |
string:'File is big (%1) - proceed?' |
|
7262 |
with:(UnitConverter fileSizeStringFor:fileSize)) |
|
7263 |
) ifFalse:[^ self]. |
|
7264 |
]. |
|
7265 |
file binaryContentsOfEntireFile inspect |
|
7266 |
||
7267 |
"Modified: / 19-11-2017 / 14:58:43 / cg" |
|
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7268 |
! |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7269 |
|
3892 | 7270 |
fileFileIn |
7271 |
"fileIn the selected file(s)" |
|
7272 |
||
7273 |
self fileFileInLazy:false |
|
7274 |
! |
|
7275 |
||
7324 | 7276 |
fileFileIn:aFilename lazy:lazy |
7277 |
"fileIn a file" |
|
7278 |
||
7279 |
self withActivityIndicationDo:[ |
|
7280 |
self notify:('File in:', aFilename asFilename baseName). |
|
7281 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7282 |
self notify:nil. |
|
7283 |
] |
|
7284 |
||
7285 |
"Created: / 20-09-2006 / 14:28:35 / cg" |
|
7286 |
! |
|
7287 |
||
3892 | 7288 |
fileFileInLazy |
7289 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
7290 |
||
7291 |
self fileFileInLazy:true |
|
7292 |
! |
|
7293 |
||
7294 |
fileFileInLazy:lazy |
|
7295 |
"fileIn the selected file(s)" |
|
7296 |
||
7324 | 7297 |
self currentSelectedFiles do:[:fileName | |
7298 |
self fileIn:fileName lazy:lazy |
|
7299 |
]. |
|
7300 |
||
7301 |
"Modified: / 20-09-2006 / 14:29:24 / cg" |
|
3892 | 7302 |
! |
7303 |
||
12497 | 7304 |
fileFileInPackage |
7305 |
"assuming the current directory is a package directory, load it" |
|
7306 |
||
7307 |
|packageDir dir path top packageID| |
|
7308 |
||
7309 |
"/ find a reasonable package-id (walk up until we find stx) |
|
7310 |
path := ''. |
|
7311 |
dir := packageDir := self currentDirectory. |
|
7312 |
||
7313 |
top := (Smalltalk projectDirectoryForPackage:'stx') asFilename. |
|
7314 |
[ (dir / 'stx') = top ] whileFalse:[ |
|
7315 |
path := dir baseName , '/' , path. |
|
7316 |
dir := dir directory. |
|
7317 |
dir isNil ifTrue:[ |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7318 |
Dialog warn:'Could not find a path from "stx" to the current directory.'. |
12497 | 7319 |
"/ should ask the user for a packageID and proceed... |
7320 |
^ self. |
|
7321 |
]. |
|
7322 |
]. |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7323 |
packageID := path copyButLast:1. |
12497 | 7324 |
Smalltalk loadPackage:packageID fromDirectory:packageDir asAutoloaded:true |
7325 |
! |
|
7326 |
||
3892 | 7327 |
fileFileInToNameSpace |
7328 |
"fileIn the selected file(s)<into a nameSpace" |
|
7329 |
||
7330 |
|ns listOfKnownNameSpaces| |
|
7331 |
||
7332 |
listOfKnownNameSpaces := Set new. |
|
7333 |
NameSpace |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
7334 |
allNameSpaces |
4414 | 7335 |
do:[:eachNameSpace | |
7336 |
listOfKnownNameSpaces add:eachNameSpace name |
|
7337 |
]. |
|
3892 | 7338 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
7339 |
||
7340 |
ns := Dialog |
|
4414 | 7341 |
request:'During fileIn, new classes are created in nameSpace:' |
7342 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
7343 |
list:listOfKnownNameSpaces. |
|
3892 | 7344 |
ns isEmptyOrNil ifTrue:[^ self]. |
7345 |
||
7346 |
LastEnforcedNameSpace := ns. |
|
7347 |
ns := NameSpace name:ns. |
|
7348 |
||
7349 |
Class nameSpaceQuerySignal |
|
4414 | 7350 |
answer:ns |
7351 |
do:[ |
|
7352 |
self fileFileInLazy:false |
|
7353 |
] |
|
3892 | 7354 |
! |
7355 |
||
7356 |
fileFindAllDuplicates |
|
7357 |
"scan directory and all subdirs for duplicate files" |
|
7358 |
||
7359 |
|fileNames dir infoDir filesBySize |
|
7360 |
result info dirPrefix myName stream textBox maxLength directories| |
|
7361 |
||
7362 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7363 |
self withActivityIndicationDo:[ |
4414 | 7364 |
result := Dictionary new. |
7365 |
myName := self class name asString. |
|
7366 |
directories := self currentSelectedDirectories. |
|
7367 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 7368 |
|
4414 | 7369 |
dir := directories first. |
3892 | 7370 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7371 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7372 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7373 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 7374 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
7375 |
with:ex pathName |
|
7376 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7377 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7378 |
]. |
4765 | 7379 |
fileNames := fileNames |
7380 |
collect:[:fn | dir construct:fn] |
|
18453 | 7381 |
thenSelect:[:fn | fn isRegularFile]. |
3892 | 7382 |
|
7383 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 7384 |
infoDir := Dictionary new. |
7385 |
fileNames do:[:fn | |
|
7386 |
infoDir at:fn put:(fn fileSize) |
|
7387 |
]. |
|
7388 |
||
14497 | 7389 |
"/ for each, get the file's size. |
4414 | 7390 |
"/ in a first pass, look for files of the same size and |
7391 |
"/ compare them ... |
|
3892 | 7392 |
|
7393 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 7394 |
filesBySize := Dictionary new. |
7395 |
infoDir keysAndValuesDo:[:fn :sz | |
|
7396 |
|entry| |
|
7397 |
||
7398 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7399 |
entry add:fn. |
|
7400 |
]. |
|
7401 |
||
7402 |
"/ any of same size ? |
|
3892 | 7403 |
|
7404 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 7405 |
filesBySize do:[:entry | |
7406 |
|files| |
|
7407 |
||
7408 |
entry size > 1 ifTrue:[ |
|
7409 |
files := entry asArray. |
|
7410 |
1 to:files size-1 do:[:idx1 | |
|
7411 |
idx1+1 to:files size do:[:idx2 | |
|
7412 |
|fn1 fn2| |
|
7413 |
||
7414 |
fn1 := files at:idx1. |
|
7415 |
fn2 := files at:idx2. |
|
3892 | 7416 |
|
7417 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 7418 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
7419 |
"/ compare the files |
|
7420 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7421 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 7422 |
result at:fn1 put:fn2. |
7423 |
] |
|
7424 |
] |
|
7425 |
] |
|
7426 |
] |
|
7427 |
] |
|
7428 |
]. |
|
3892 | 7429 |
|
7430 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 7431 |
dirPrefix := dir pathName. |
7432 |
result := result associations. |
|
7433 |
result := result collect:[:assoc | |
|
7434 |
|f1 f2| |
|
7435 |
||
7436 |
f1 := assoc key name. |
|
7437 |
f2 := assoc value name. |
|
7438 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
7439 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
7440 |
]. |
|
7441 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
7442 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
7443 |
]. |
|
7444 |
f1 < f2 ifTrue:[ |
|
7445 |
f2 -> f1 |
|
7446 |
] ifFalse:[ |
|
7447 |
f1 -> f2 |
|
7448 |
] |
|
7449 |
]. |
|
7450 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
7451 |
||
7452 |
info := OrderedCollection new. |
|
7453 |
result do:[:assoc | |
|
7454 |
info add:(assoc key , ' same as ' , assoc value) |
|
7455 |
]. |
|
7456 |
info isEmpty ifTrue:[ |
|
11889 | 7457 |
Dialog information:(resources string:'No duplicate files found.'). |
5543 | 7458 |
^ self. |
4414 | 7459 |
]. |
3892 | 7460 |
]. |
7461 |
||
15589 | 7462 |
stream := CharacterWriteStream new. |
11688 | 7463 |
stream nextPutAllLines:info. |
5542 | 7464 |
|
3892 | 7465 |
textBox := TextBox new. |
7466 |
textBox initialText:(stream contents). |
|
5542 | 7467 |
stream close. |
11889 | 7468 |
textBox title:(resources string:'File duplicates in directory: %1' with:dir asString). |
3892 | 7469 |
textBox readOnly:true. |
7470 |
textBox noCancel. |
|
11889 | 7471 |
textBox label:(resources string:'Duplicates in %1' with:dir asString). |
3892 | 7472 |
maxLength := 10. |
7473 |
info do:[: el | |
|
4414 | 7474 |
maxLength := maxLength max:(el size). |
3892 | 7475 |
]. |
7476 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 7477 |
textBox maxExtent:Screen current extent. |
7478 |
textBox openModeless. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7479 |
|
11688 | 7480 |
"Modified: / 27-07-2012 / 09:29:00 / cg" |
3892 | 7481 |
! |
7482 |
||
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7483 |
fileFindDuplicateFile |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7484 |
"scan directory for duplicates of the selected files" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7485 |
|
10306 | 7486 |
|files filesBySize samePerFile stream textBox mustHaveMatches| |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7487 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7488 |
files := self currentSelectedFiles. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7489 |
files isEmpty ifTrue:[^ self]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7490 |
|
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7491 |
self withWaitCursorDo:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7492 |
filesBySize := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7493 |
files do:[:fn | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7494 |
|sz entry| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7495 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7496 |
sz := fn asFilename fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7497 |
(filesBySize at:sz ifAbsentPut:[Set new]) add:fn. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7498 |
]. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7499 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7500 |
samePerFile := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7501 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7502 |
self currentSelectedDirectories do:[:eachDir | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7503 |
eachDir recursiveDirectoryContentsAsFilenamesDo:[:eachFile | |
18453 | 7504 |
eachFile isRegularFile ifTrue:[ |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7505 |
|sz possibleMatches| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7506 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7507 |
sz := eachFile fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7508 |
possibleMatches := filesBySize at:sz ifAbsent:nil. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7509 |
possibleMatches notNil ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7510 |
possibleMatches do:[:eachFileWithSameSize | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7511 |
eachFileWithSameSize ~= eachFile ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7512 |
(eachFileWithSameSize sameContentsAs:eachFile) ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7513 |
(samePerFile at:eachFileWithSameSize ifAbsentPut:[Set new]) add:eachFile |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7514 |
] |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7515 |
] |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7516 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7517 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7518 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7519 |
] |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7520 |
]. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7521 |
]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7522 |
|
15589 | 7523 |
stream := CharacterWriteStream with:'Duplicates:'. |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7524 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7525 |
do:[:origFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7526 |
|sameFiles| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7527 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7528 |
sameFiles := samePerFile at:origFile. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7529 |
stream nextPutLine:origFile baseName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7530 |
(sameFiles asOrderedCollection collect:[:each | each baseName]) sort do:[:eachSameName | |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7531 |
stream nextPutAll:' '; nextPutLine:eachSameName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7532 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7533 |
]. |
10306 | 7534 |
stream nextPutLine:'Files without duplicates:'. |
7535 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7536 |
do:[:origFile | |
|
7537 |
|sameFiles| |
|
7538 |
||
7539 |
sameFiles := samePerFile at:origFile. |
|
7540 |
sameFiles isEmpty ifTrue:[ |
|
7541 |
stream nextPutLine:origFile baseName. |
|
7542 |
]. |
|
7543 |
]. |
|
7544 |
||
7545 |
mustHaveMatches := Dialog request:'Must have for duplicates matching ?:' initialAnswer:(LastMustMatchPattern ? '[a-z][a-z][a-z]_[0-9][0-9][0-9].*'). |
|
7546 |
mustHaveMatches notEmptyOrNil ifTrue:[ |
|
7547 |
LastMustMatchPattern := mustHaveMatches. |
|
7548 |
||
7549 |
stream nextPutLine:'Files without duplicates in xxx_nnn.jpg:'. |
|
7550 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7551 |
do:[:origFile | |
|
7552 |
|sameFiles| |
|
7553 |
||
7554 |
sameFiles := samePerFile at:origFile. |
|
7555 |
sameFiles notEmpty ifTrue:[ |
|
7556 |
(sameFiles contains:[:file | mustHaveMatches match:file baseName]) ifFalse:[ |
|
7557 |
stream nextPutLine:origFile baseName. |
|
7558 |
] |
|
7559 |
]. |
|
7560 |
]. |
|
7561 |
]. |
|
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7562 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7563 |
textBox := TextBox new. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7564 |
textBox initialText:(stream contents). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7565 |
textBox title:'Files with same contents'. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7566 |
textBox readOnly:true. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7567 |
textBox noCancel. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7568 |
textBox extent:(350@400). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7569 |
textBox maxExtent:Screen current extent. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7570 |
textBox openModeless. "/ showAtPointer. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7571 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7572 |
"Created: / 11-07-2011 / 12:39:44 / cg" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7573 |
! |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7574 |
|
3892 | 7575 |
fileFindDuplicates |
7576 |
"scan directory for duplicate files" |
|
7577 |
||
17869 | 7578 |
|directories duplicates info |
7579 |
commonDir prefixSize stream titleStream textBox maxLength| |
|
8510 | 7580 |
|
7581 |
directories := self currentSelectedDirectories. |
|
17869 | 7582 |
duplicates := self class fileFindDuplicatesIn:directories. |
7583 |
duplicates isEmpty ifTrue:[ |
|
17868 | 7584 |
Dialog information:'No duplicate files found.'. |
7585 |
^ self. |
|
7586 |
]. |
|
7587 |
||
7588 |
info := OrderedCollection new. |
|
17869 | 7589 |
commonDir := self getBestDirectory. |
7590 |
prefixSize := commonDir asString size. |
|
7591 |
duplicates do:[:assoc | |
|
17871 | 7592 |
|dup orig| |
7593 |
||
7594 |
dup := assoc key. |
|
7595 |
orig := assoc value. |
|
17868 | 7596 |
prefixSize > 1 ifTrue:[ |
17871 | 7597 |
dup := dup pathNameRelativeFrom:commonDir. |
7598 |
orig := orig pathNameRelativeFrom:commonDir. |
|
17869 | 7599 |
"/ fn1 := ('..', (fn1 name copyFrom:(prefixSize + 1))). |
7600 |
"/ fn2 := ('..', (fn2 copyFrom:(prefixSize + 1))). |
|
17868 | 7601 |
]. |
17871 | 7602 |
(dup includes:Character space) ifTrue:[ |
7603 |
dup := '"' , dup , '"' |
|
7604 |
]. |
|
7605 |
(orig includes:Character space) ifTrue:[ |
|
7606 |
orig := '"' , orig , '"' |
|
7607 |
]. |
|
7608 |
info add:(dup , ' duplicate of ' , orig) |
|
17868 | 7609 |
]. |
7610 |
||
15589 | 7611 |
stream := CharacterWriteStream new. |
11688 | 7612 |
stream nextPutAllLines:info. |
7613 |
||
17869 | 7614 |
titleStream := CharacterWriteStream with:'File duplicates in director'. |
3892 | 7615 |
directories size == 1 ifTrue:[ |
12602 | 7616 |
titleStream nextPutAll:'y: '; nextPutAll: directories first asString. |
3892 | 7617 |
] ifFalse:[ |
4535 | 7618 |
titleStream nextPutLine:'ies: '. |
4355 | 7619 |
directories do:[:dir| |
17868 | 7620 |
prefixSize > 1 ifTrue:[ |
4355 | 7621 |
titleStream nextPutAll:'..'. |
17868 | 7622 |
titleStream nextPutLine:((dir asString) copyFrom:(prefixSize + 1)). |
4355 | 7623 |
] ifFalse:[ |
4535 | 7624 |
titleStream nextPutLine:(dir asString). |
4355 | 7625 |
]. |
7626 |
] |
|
3892 | 7627 |
]. |
5543 | 7628 |
|
3892 | 7629 |
textBox := TextBox new. |
7630 |
textBox initialText:(stream contents). |
|
7631 |
textBox title:(titleStream contents). |
|
7632 |
textBox readOnly:true. |
|
7633 |
textBox noCancel. |
|
14715 | 7634 |
stream := WriteStream on:''. |
7635 |
stream nextPutAll:'Duplicates in '. |
|
4170 | 7636 |
directories do:[ :aDirectory | |
4355 | 7637 |
stream nextPutAll:aDirectory baseName. |
7638 |
stream space. |
|
4050 | 7639 |
]. |
4170 | 7640 |
textBox label:stream contents. |
3892 | 7641 |
maxLength := 10. |
7642 |
info do:[: el | |
|
4355 | 7643 |
maxLength := maxLength max:(el size). |
3892 | 7644 |
]. |
5092 | 7645 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
7646 |
textBox maxExtent:Screen current extent. |
|
17869 | 7647 |
textBox addButton:(Button |
7648 |
label:(resources string:'Remove Duplicates') |
|
7649 |
action:[ |
|
7650 |
(Dialog confirm:(resources string:'Remove %1 duplicate files?' with:duplicates size)) ifTrue:[ |
|
7651 |
duplicates do:[:eachAssoc | |
|
17871 | 7652 |
eachAssoc key remove |
17869 | 7653 |
]. |
17871 | 7654 |
]. |
7655 |
textBox close. |
|
7656 |
self updateCurrentDirectoryWithReread. |
|
17869 | 7657 |
]). |
4355 | 7658 |
textBox openModeless. "/ showAtPointer. |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7659 |
|
11688 | 7660 |
"Modified: / 27-07-2012 / 09:29:14 / cg" |
3892 | 7661 |
! |
7662 |
||
7663 |
fileFindFile |
|
5961 | 7664 |
|filename| |
7665 |
||
7666 |
filename := self firstSelectedFileName. |
|
7667 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7668 |
filename := Filename homeDirectory. |
3892 | 7669 |
]. |
4101 | 7670 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 7671 |
! |
7672 |
||
8510 | 7673 |
fileFindSimilarImages |
7674 |
"scan directory for similar image files" |
|
7675 |
||
8512 | 7676 |
|result stream textBox directories imageFiles histogramsV histogramsH |
7677 |
similarV similarH similar alreadyPrinted| |
|
8510 | 7678 |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7679 |
self withWaitCursorDo:[ |
8510 | 7680 |
self withActivityIndicationDo:[ |
7681 |
result := Dictionary new. |
|
7682 |
||
7683 |
directories := self currentSelectedDirectories. |
|
7684 |
directories isEmpty ifTrue:[^ self]. |
|
7685 |
||
13714 | 7686 |
imageFiles := self allFilesInSelectedDirectoriesForWhich:[:f | f mimeTypeFromName isImageType]. |
8511 | 7687 |
"/ imageFiles := imageFiles select:[:f | f baseName startsWith:'foo']. |
7688 |
imageFiles sort:[:a :b | a pathName < b pathName]. |
|
7689 |
||
8510 | 7690 |
"/ for each, get the color histogram |
7691 |
histogramsV := Dictionary new. |
|
7692 |
histogramsH := Dictionary new. |
|
7693 |
imageFiles do:[:fn | |
|
7694 |
|hist image| |
|
7695 |
||
7696 |
image := Image fromFile:fn. |
|
7697 |
Transcript showCR:'generating histogram for ',fn baseName. |
|
7698 |
hist := ImageColorHistogram new forImage:image. |
|
7699 |
histogramsV at:fn put:(hist histogramVectorV). |
|
7700 |
histogramsH at:fn put:(hist histogramVectorH). |
|
7701 |
]. |
|
7702 |
||
7703 |
similarH := Dictionary new. |
|
7704 |
similarV := Dictionary new. |
|
7705 |
similar := Dictionary new. |
|
7706 |
||
8512 | 7707 |
(self firstSelectedFile notNil |
7708 |
ifTrue:[ Array with:self firstSelectedFile ] |
|
7709 |
ifFalse:[ imageFiles ]) |
|
7710 |
do:[:eachFile1 | |
|
8510 | 7711 |
|setOfSimilar distancesV distancesH| |
7712 |
||
7713 |
distancesV := OrderedCollection new. |
|
7714 |
distancesH := OrderedCollection new. |
|
7715 |
setOfSimilar := OrderedCollection new. |
|
7716 |
||
7717 |
imageFiles do:[:eachFile2 | |
|
7718 |
|v1 v2 dV dH| |
|
7719 |
||
7720 |
eachFile1 ~= eachFile2 ifTrue:[ |
|
7721 |
v1 := histogramsV at:eachFile1. |
|
7722 |
v2 := histogramsV at:eachFile2. |
|
7723 |
dV := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7724 |
distancesV add:(eachFile2 -> dV). |
|
7725 |
v1 := histogramsH at:eachFile1. |
|
7726 |
v2 := histogramsH at:eachFile2. |
|
7727 |
dH := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7728 |
distancesH add:(eachFile2 -> dH). |
|
7729 |
(dV < 10000 and:[dH < 10000]) ifTrue:[ |
|
8512 | 7730 |
setOfSimilar add:eachFile2->(dV + dH). |
8510 | 7731 |
]. |
7732 |
] |
|
7733 |
]. |
|
7734 |
distancesV sort:[:a1 :a2 | a1 value < a2 value]. |
|
7735 |
distancesH sort:[:a1 :a2 | a1 value < a2 value]. |
|
7736 |
similarV at:eachFile1 put:distancesV. |
|
7737 |
similarH at:eachFile1 put:distancesH. |
|
7738 |
setOfSimilar notEmpty ifTrue:[ similar at:eachFile1 put:setOfSimilar ]. |
|
7739 |
]. |
|
7740 |
||
7741 |
similar isEmpty ifTrue:[ |
|
7742 |
Dialog information:'No similarities found.'. |
|
7743 |
^ self. |
|
7744 |
]. |
|
7745 |
]. |
|
7746 |
||
15589 | 7747 |
stream := CharacterWriteStream new. |
8512 | 7748 |
alreadyPrinted := Set new. |
7749 |
||
7750 |
imageFiles do:[:eachFile | |
|
7751 |
|eachSet| |
|
7752 |
||
7753 |
(alreadyPrinted includes:eachFile) ifFalse:[ |
|
7754 |
eachSet := similar at:eachFile ifAbsent:nil. |
|
7755 |
eachSet notNil ifTrue:[ |
|
7756 |
stream nextPutLine:eachFile pathName. |
|
7757 |
eachSet do:[:info | |
|
7758 |
|fn2 dist| |
|
7759 |
||
7760 |
fn2 := info key. |
|
7761 |
dist := info value. |
|
7762 |
stream nextPutAll:' '. |
|
7763 |
stream nextPutAll:fn2 pathName. |
|
7764 |
stream nextPutLine:' (',dist printString,')'. |
|
7765 |
alreadyPrinted add:fn2. |
|
7766 |
]. |
|
7767 |
stream cr. |
|
7768 |
]. |
|
8510 | 7769 |
]. |
7770 |
]. |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7771 |
]. |
8510 | 7772 |
|
7773 |
textBox := TextBox new. |
|
7774 |
textBox initialText:(stream contents). |
|
7775 |
textBox title:'File similarities:'. |
|
7776 |
textBox readOnly:true. |
|
7777 |
textBox noCancel. |
|
7778 |
||
7779 |
textBox label:'File similarities'. |
|
7780 |
textBox extent:(400@((similar size max:40)* 10)). |
|
7781 |
textBox maxExtent:Screen current extent. |
|
7782 |
textBox openModeless. "/ showAtPointer. |
|
7783 |
||
7784 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
|
7785 |
! |
|
7786 |
||
4618 | 7787 |
fileHexDump |
17744 | 7788 |
|file item| |
4618 | 7789 |
|
7790 |
file := self firstSelectedFile. |
|
7791 |
file notNil ifTrue:[ |
|
7792 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 7793 |
self |
7794 |
applicationNamed:#FileApplicationNoteBook |
|
7795 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 7796 |
]. |
17744 | 7797 |
|
7798 |
"Modified (format): / 12-11-2017 / 11:19:56 / cg" |
|
4618 | 7799 |
! |
7800 |
||
7324 | 7801 |
fileIn:aFilename |
7802 |
"fileIn a file" |
|
7803 |
||
7804 |
self fileIn:aFilename lazy:false |
|
7805 |
||
7806 |
"Created: / 20-09-2006 / 14:30:06 / cg" |
|
7807 |
! |
|
7808 |
||
7809 |
fileIn:aFilename lazy:lazy |
|
7810 |
"fileIn a file" |
|
7811 |
||
7812 |
self withActivityIndicationDo:[ |
|
7813 |
self notify:('File in:', aFilename asFilename baseName). |
|
7814 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7815 |
self notify:nil. |
|
7816 |
] |
|
7817 |
||
7818 |
"Created: / 20-09-2006 / 14:29:21 / cg" |
|
7819 |
! |
|
7820 |
||
4930 | 7821 |
filterSelectedFiles:whichFilter |
7822 |
|selectedFiles numFiles msg filterBlock| |
|
7823 |
||
7560 | 7824 |
selectedFiles := self currentSelectedObjects. |
4930 | 7825 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
7826 |
||
7827 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
7828 |
numFiles > 1 ifTrue:[ |
|
7829 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
7830 |
]. |
|
7831 |
||
7832 |
(Dialog |
|
6352 | 7833 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 7834 |
initialAnswer:false |
7835 |
) ifFalse:[ |
|
7836 |
^ self |
|
7837 |
]. |
|
7838 |
||
7839 |
whichFilter == #rot13 ifTrue:[ |
|
7840 |
filterBlock := [:charIn | charIn rot13 ]. |
|
7841 |
]. |
|
7842 |
"/ add more here... |
|
7843 |
||
7844 |
filterBlock isNil ifTrue:[ |
|
7845 |
self information:'No such filter: ' , whichFilter. |
|
7846 |
^ self. |
|
7847 |
]. |
|
7848 |
||
7849 |
selectedFiles do:[:fileName | |
|
7850 |
|s| |
|
7851 |
||
7852 |
self notify:('Processing:', fileName baseName). |
|
18453 | 7853 |
fileName isRegularFile ifTrue:[ |
4930 | 7854 |
[ |
7855 |
|inFile outFile in out| |
|
7856 |
||
7857 |
inFile := fileName asFilename. |
|
7858 |
outFile := (fileName pathName , '.filter') asFilename. |
|
7859 |
||
7860 |
[ |
|
7861 |
|charIn charOut| |
|
7862 |
||
7863 |
in := inFile readStream. |
|
7864 |
out := outFile writeStream. |
|
7865 |
[in atEnd] whileFalse:[ |
|
7866 |
charIn := in next. |
|
7867 |
charOut := filterBlock value:charIn. |
|
7868 |
out nextPut:charOut. |
|
7869 |
]. |
|
13683 | 7870 |
out close. out:= nil. |
4930 | 7871 |
outFile renameTo:inFile. |
7872 |
] ensure:[ |
|
7873 |
out notNil ifTrue:[ out close ]. |
|
7874 |
in notNil ifTrue:[ in close ]. |
|
18024 | 7875 |
outFile remove. |
4930 | 7876 |
] |
7877 |
] on:FileStream openErrorSignal do:[:ex| |
|
7878 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
7879 |
]. |
|
7880 |
] |
|
7881 |
]. |
|
6190 | 7882 |
self notify:nil. |
7560 | 7883 |
|
7884 |
"Modified: / 04-12-2006 / 13:14:48 / cg" |
|
4930 | 7885 |
! |
7886 |
||
9784 | 7887 |
forEachParsedXmlFileDo:aBlock |
7888 |
"parse all selected XML files, for each dom-tree, evaluate aBlock" |
|
7889 |
||
7890 |
self withActivityIndicationDo:[ |
|
7891 |
| selectedFiles xmlDocument | |
|
7892 |
||
7893 |
selectedFiles:= self currentSelectedFiles. |
|
7894 |
selectedFiles do:[:fileName | |
|
7895 |
XML::XMLSignal handle:[:ex | |
|
14551 | 7896 |
Dialog |
7897 |
information:('Error while reading XML:\ %1' bindWith:ex description) withCRs |
|
7898 |
title:'XML Error'. |
|
9784 | 7899 |
^ self. |
7900 |
] do:[ |
|
7901 |
|s d magic encoder document| |
|
7902 |
||
7903 |
s := fileName asFilename readStream. |
|
14012 | 7904 |
[ |
7905 |
s binary. |
|
7906 |
magic := (s next:2). |
|
7907 |
magic = #[254 255] ifTrue:[ |
|
7908 |
"/ UTF16BE |
|
7909 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16be. |
|
7910 |
] ifFalse:[ |
|
7911 |
magic = #[255 254] ifTrue:[ |
|
7912 |
"/ UTF16LE |
|
7913 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16le. |
|
7914 |
]. |
|
7915 |
]. |
|
7916 |
] ensure:[ |
|
7917 |
s close. |
|
7918 |
]. |
|
9784 | 7919 |
document notNil ifTrue:[ |
7920 |
xmlDocument := XML::XMLParser |
|
7921 |
processDocumentString:document |
|
7922 |
beforeScanDo:[:parse| parse validate:false]. |
|
7923 |
] ifFalse:[ |
|
7924 |
xmlDocument := XML::XMLParser |
|
7925 |
processDocumentInFilename:fileName |
|
7926 |
beforeScanDo:[:parse| parse validate:false]. |
|
7927 |
] |
|
7928 |
]. |
|
7929 |
aBlock value:xmlDocument. |
|
7930 |
]. |
|
7931 |
] |
|
7932 |
||
7933 |
"Created: / 17-02-2011 / 13:58:21 / cg" |
|
7934 |
! |
|
7935 |
||
8832 | 7936 |
forEachSelectedFileIgnoringDirectories:ignoreDirs do:aBlock |
7937 |
|numItems path files| |
|
7938 |
||
7939 |
files := self currentSelectedFiles. |
|
7940 |
||
7941 |
(numItems := files size) > 2 ifTrue:[ |
|
7942 |
(self |
|
7943 |
confirm:(resources string:'Open for each of the %1 items ?' |
|
7944 |
with:numItems)) ifFalse:[^ self]. |
|
7945 |
]. |
|
7946 |
||
7947 |
self withActivityIndicationDo:[ |
|
7948 |
files do:[:fileName | |
|
7949 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
7950 |
fileName isAbsolute ifTrue:[ |
|
17239 | 7951 |
path := fileName name. |
8832 | 7952 |
] ifFalse:[ |
7953 |
path := fileName pathName. |
|
7954 |
]. |
|
7955 |
aBlock value:path |
|
7956 |
] |
|
7957 |
]. |
|
7958 |
]. |
|
17239 | 7959 |
|
7960 |
"Modified: / 19-01-2017 / 16:57:03 / stefan" |
|
8832 | 7961 |
! |
7962 |
||
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7963 |
generateDetachedSignaturesForSelectedFiles |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7964 |
"generate detached signature (pkcs7) files from the contents of the selected files. |
16941 | 7965 |
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
|
7966 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7967 |
self withActivityIndicationDo:[ |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7968 |
self currentSelectedFiles do:[:fn | |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7969 |
|data hash signature signatureFile| |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7970 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7971 |
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
|
7972 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7973 |
data := fn contentsAsString. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7974 |
hash := SHA1Stream hashValueOf:data. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7975 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7976 |
signature := Expecco::KeyFileGenerator new signExpeccoCode:hash. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7977 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7978 |
signatureFile := fn addSuffix:'sig'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7979 |
signatureFile contents:signature. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7980 |
]. |
13677 | 7981 |
self updateCurrentDirectoryWithReread. |
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7982 |
self notify:nil. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7983 |
] |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7984 |
! |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7985 |
|
15211 | 7986 |
generatePatchInstallerForSelectedFiles |
7987 |
"generate an expecco patch, which installs the selected file(s). |
|
7988 |
Opens a dialog asking for the target directory and if the patch should be signed" |
|
7989 |
||
7990 |
|dialog targetDirHolder targetDir |
|
7991 |
generateSignedPatchHolder patchFileNameHolder patchFileName| |
|
7992 |
||
7993 |
targetDirHolder := '.' asValue. |
|
7994 |
generateSignedPatchHolder := true asValue. |
|
7995 |
patchFileNameHolder := '/tmp/00nn_patchFile.st' asValue. |
|
7996 |
||
7997 |
dialog := Dialog new. |
|
7998 |
dialog label:(resources string:'Patch Installer for File(s)'). |
|
7999 |
dialog addTextLabel:'Patchfile Name' adjust:#left. |
|
8000 |
dialog addInputFieldOn:patchFileNameHolder tabable:true. |
|
8001 |
dialog addTextLabel:'Target directory (relative to executable''s directory at execution time)' adjust:#left. |
|
8002 |
dialog addInputFieldOn:targetDirHolder tabable:true. |
|
8003 |
dialog addCheckBox:'Generate Signed Patch' on:generateSignedPatchHolder. |
|
8004 |
dialog addAbortAndOkButtons. |
|
8005 |
dialog open. |
|
8006 |
||
8007 |
dialog accepted ifFalse:[^ self]. |
|
8008 |
||
8009 |
targetDir := targetDirHolder value asFilename. |
|
8010 |
patchFileName := patchFileNameHolder value asFilename. |
|
8011 |
||
8012 |
self withActivityIndicationDo:[ |
|
8013 |
|outStream zipArchive pkcs7SignedData signatureFilename| |
|
8014 |
||
8015 |
self notify:'Generating self extracting st script: ', patchFileName name, '...'. |
|
8016 |
outStream := patchFileName writeStream. |
|
8017 |
outStream nextPutAll:' |
|
8018 |
|patchStream zipArchive| |
|
8019 |
patchStream := Expecco::Browser::CurrentPatchStreamQuery query. |
|
8020 |
patchStream isNil ifTrue:[ self error:''sorry, this patch can only be installed in expecco 2.6.2 and newer (missing CurrentPatchStreamQuery)'']. |
|
8021 |
zipArchive := ZipArchive readingFrom:patchStream. |
|
8022 |
zipArchive members do:[:each | zipArchive extract:each fileName]. |
|
8023 |
patchStream setToEnd. "/ to force fileIn to finish |
|
8024 |
!! |
|
8025 |
||
8026 |
!! !! |
|
8027 |
||
8028 |
'. |
|
8029 |
zipArchive := ZipArchive writingTo:outStream. "/ newFileNamed:(patchFileName). |
|
8030 |
||
8031 |
self currentSelectedFiles do:[:fn | |
|
8032 |
|inStream signatureFilename| |
|
8033 |
||
8034 |
inStream := fn asFilename readStream. |
|
8035 |
zipArchive addFile: (targetDir construct:fn asFilename baseName) name fromStream:inStream. |
|
8036 |
inStream close. |
|
8037 |
]. |
|
8038 |
||
16975 | 8039 |
zipArchive close. |
15211 | 8040 |
|
8041 |
generateSignedPatchHolder value ifTrue:[ |
|
8042 |
self notify:'Generating signed file from: ', patchFileName name, '...'. |
|
8043 |
||
8044 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:patchFileName contentsOfEntireFile. |
|
8045 |
signatureFilename := patchFileName withSuffix:'expeccoPatch'. |
|
8046 |
signatureFilename contents:pkcs7SignedData. |
|
8047 |
]. |
|
8048 |
self notify:nil. |
|
8049 |
] |
|
8050 |
! |
|
13783 | 8051 |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8052 |
generateSignaturesForSelectedFiles |
13783 | 8053 |
"generate signed pkcs7 files from the contents of the selected files. |
8054 |
These can be delivered as expeccoPatch files" |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8055 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8056 |
self withActivityIndicationDo:[ |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8057 |
self currentSelectedFiles do:[:fn | |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8058 |
|pkcs7SignedData signatureFilename| |
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8059 |
|
8646 | 8060 |
self notify:'Generating signed file from: ', (fn baseName), '...'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8061 |
|
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8062 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:fn contentsOfEntireFile. |
12094 | 8063 |
signatureFilename := fn withSuffix:'expeccoPatch'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8064 |
signatureFilename contents:pkcs7SignedData. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8065 |
]. |
13677 | 8066 |
self updateCurrentDirectoryWithReread. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8067 |
self notify:nil. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8068 |
] |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8069 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8070 |
|
9784 | 8071 |
inspectXmlFile |
8072 |
"Show an XML file - either in an XMLInspector or fall back to |
|
8073 |
a plain inspector on the XML tree" |
|
8074 |
||
8075 |
self forEachParsedXmlFileDo:[:xmlDocument | |
|
8076 |
XML::XMLInspector notNil ifTrue:[ |
|
8077 |
XML::XMLInspector openOn:xmlDocument. |
|
8078 |
] ifFalse:[ |
|
8079 |
"fall back..." |
|
8080 |
xmlDocument inspect. |
|
8081 |
] |
|
8082 |
]. |
|
8083 |
||
8084 |
"Modified: / 17-02-2011 / 13:58:16 / cg" |
|
8085 |
! |
|
8086 |
||
3892 | 8087 |
installAllAsAutoloaded |
8088 |
"install all classes found here as autoloaded classes" |
|
8089 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8090 |
self installAllAsAutoloadedRecursive:false |
3892 | 8091 |
! |
8092 |
||
6521 | 8093 |
installAllAsAutoloadedRecursive |
8094 |
"install all classes found here and in subdirectories as autoloaded classes" |
|
8095 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8096 |
self installAllAsAutoloadedRecursive:true |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8097 |
! |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8098 |
|
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8099 |
installAllAsAutoloadedRecursive:aBoolean |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8100 |
"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
|
8101 |
|
6521 | 8102 |
[ |
15507 | 8103 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
8104 |
|installAction| |
|
8105 |
||
8106 |
installAction := |
|
8107 |
[:fn | |
|
8108 |
(fn suffix = 'st') ifTrue:[ |
|
8109 |
self notify:('Install as autoloaded: ', fn baseName). |
|
8110 |
self installAsAutoloaded:fn. |
|
8111 |
] |
|
8112 |
]. |
|
8113 |
||
8114 |
self withActivityIndicationDo:[ |
|
8115 |
self currentSelectedDirectories do:[:dir| |
|
8116 |
aBoolean ifTrue:[ |
|
8117 |
dir recursiveDirectoryContentsAsFilenamesDo:installAction |
|
8118 |
] ifFalse:[ |
|
8119 |
dir directoryContentsAsFilenamesDo:installAction |
|
15152 | 8120 |
]. |
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8121 |
]. |
15507 | 8122 |
self notify:nil. |
8123 |
]. |
|
8124 |
] |
|
6521 | 8125 |
] fork. |
8126 |
! |
|
8127 |
||
3892 | 8128 |
installAsAutoloaded:aFilename |
8129 |
"install aFilename as autoloaded class" |
|
8130 |
||
13292 | 8131 |
Smalltalk installAutoloadedClassFromSourceFile:aFilename |
8132 |
||
8133 |
"Modified: / 01-08-2013 / 16:58:09 / cg" |
|
3892 | 8134 |
! |
8135 |
||
15211 | 8136 |
joinSelectedFiles |
8137 |
|selectedFiles numFiles msg outFileName outFile outStream| |
|
8138 |
||
8139 |
selectedFiles := self currentSelectedObjects. |
|
8140 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
8141 |
||
8142 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
8143 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
8144 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
|
8145 |
outFile := selectedFiles first directory construct:outFileName. |
|
8146 |
||
8147 |
outStream := outFile writeStream. |
|
8148 |
||
8149 |
selectedFiles do:[:fileName | |
|
8150 |
self notify:('Adding:', fileName baseName). |
|
17997 | 8151 |
fileName readingFileDo:[:inStream | |
8152 |
inStream copyToEndInto:outStream. |
|
8153 |
]. |
|
15211 | 8154 |
]. |
8155 |
outStream close. |
|
8156 |
self notify:nil. |
|
8157 |
||
8158 |
"Modified: / 04-12-2006 / 13:15:10 / cg" |
|
8159 |
! |
|
4558 | 8160 |
|
6292 | 8161 |
loadImageThenDo:aBlock |
3892 | 8162 |
|img path files| |
8163 |
||
3982 | 8164 |
files := self currentSelectedFiles. |
3892 | 8165 |
files isEmpty ifTrue:[ ^ self]. |
8166 |
files do:[:fileName | |
|
4414 | 8167 |
path := fileName. |
18453 | 8168 |
path isRegularFile ifTrue:[ |
4414 | 8169 |
img := Image fromFile:(path pathName). |
8170 |
img notNil ifTrue:[ |
|
6292 | 8171 |
aBlock value:img |
4414 | 8172 |
] ifFalse:[ |
15346 | 8173 |
Dialog warn:(resources string:'Unknown image format: "%1"' with:fileName asString) |
4414 | 8174 |
] |
8175 |
] |
|
3892 | 8176 |
]. |
8177 |
! |
|
8178 |
||
13089 | 8179 |
loadSignatureSupport |
8180 |
Expecco::KeyFileGenerator isNil ifTrue:[ |
|
14047 | 8181 |
Smalltalk loadPackage:'exept:expecco/license' |
13089 | 8182 |
]. |
8183 |
! |
|
8184 |
||
3892 | 8185 |
openASN1Browser |
8186 |
||
8187 |
self openTool:OSI::ASN1Browser |
|
8188 |
! |
|
8189 |
||
8190 |
openAppletViewer |
|
8191 |
|numItems files| |
|
8192 |
||
3982 | 8193 |
files := self currentSelectedFiles. |
3892 | 8194 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 8195 |
(self |
8196 |
confirm:(resources string:'open for each of the %1 items ?' |
|
8197 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 8198 |
]. |
8199 |
||
8200 |
Java startupJavaSystem. |
|
8201 |
"/ Java markAllClassesUninitialized. |
|
8202 |
"/ Java initAllStaticFields. |
|
8203 |
"/ Java initAllClasses. |
|
8204 |
||
8205 |
files do:[:fileName | |
|
4414 | 8206 |
|p path| |
8207 |
||
8208 |
path := fileName. |
|
18453 | 8209 |
path isRegularFile ifTrue:[ |
4414 | 8210 |
p := Java |
8211 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
8212 |
argumentString:path pathName. |
|
8213 |
p resume. |
|
8214 |
] |
|
3892 | 8215 |
]. |
8216 |
! |
|
8217 |
||
8218 |
openCBrowser |
|
6031 | 8219 |
|dir files| |
5880 | 8220 |
|
8221 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8222 |
dir isNil ifTrue:[ ^ self]. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8223 |
self withActivityIndicationDo:[ |
7560 | 8224 |
files := self currentSelectedObjects. |
6031 | 8225 |
files notEmptyOrNil ifTrue:[ |
8226 |
CBrowser::Browser openOn:files first. |
|
8227 |
] ifFalse:[ |
|
8228 |
CBrowser::Browser openIn:dir. |
|
8229 |
] |
|
3892 | 8230 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8231 |
|
7560 | 8232 |
"Modified: / 04-12-2006 / 13:15:19 / cg" |
3892 | 8233 |
! |
8234 |
||
4230 | 8235 |
openChangeSetBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8236 |
"open a changeSet browser on the selected file(s)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8237 |
|
4230 | 8238 |
self |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8239 |
openTool:(UserPreferences current changeSetBrowserClass) |
4230 | 8240 |
with:#openOnFile: |
8241 |
ignoreDirectories:true |
|
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8242 |
|
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8243 |
"Modified (comment): / 27-07-2012 / 20:42:55 / cg" |
4230 | 8244 |
! |
8245 |
||
3892 | 8246 |
openChangesBrowser |
8247 |
"open a change browser on the selected file(s)" |
|
8248 |
||
18774 | 8249 |
|files remaining| |
18775 | 8250 |
|
8251 |
files := self currentSelectedFiles. |
|
8252 |
remaining := files copy. |
|
8253 |
||
8254 |
"/ special for github-downloaded package&class folders (one method per file) |
|
8255 |
"/ these are named .package and .class |
|
18774 | 8256 |
GitHubSmalltalkPackageReader notNil ifTrue:[ |
8257 |
files do:[:fn | |
|
8258 |
fn isDirectory ifTrue:[ |
|
18248 | 8259 |
(fn suffix = 'package') ifTrue:[ |
8260 |
ChangeSetBrowser openOn:(GitHubSmalltalkPackageReader readPackageFrom:fn). |
|
18774 | 8261 |
remaining remove:fn. |
8262 |
] ifFalse:[ |
|
8263 |
(fn suffix = 'class') ifTrue:[ |
|
8264 |
ChangeSetBrowser openOn:(GitHubSmalltalkClassReader readClassFrom:fn). |
|
8265 |
remaining remove:fn. |
|
8266 |
]. |
|
8267 |
]. |
|
18248 | 8268 |
]. |
18774 | 8269 |
]. |
8270 |
remaining isEmpty ifTrue:[^ self]. |
|
18246 | 8271 |
]. |
8272 |
||
18775 | 8273 |
"/ special for new github-downloaded source files |
8274 |
"/ these are named *.class.st, *.extension.st and *.trait.st |
|
8275 |
remaining copy do:[:fn | |
|
8276 |
#( '.class' '.extension' '.trait') contains:[:suff | |
|
8277 |
|changeSet| |
|
8278 |
||
8279 |
(fn withoutSuffix baseName endsWith:suff) ifTrue:[ |
|
8280 |
fn readingFileDo:[:in | |
|
8281 |
changeSet := ChangeSet fromGithubPharoSmalltalkStream:in. |
|
8282 |
]. |
|
8283 |
ChangeSetBrowser openOn:changeSet. |
|
8284 |
remaining remove:fn. |
|
8285 |
]. |
|
8286 |
]. |
|
8287 |
remaining isEmpty ifTrue:[^ self]. |
|
8288 |
]. |
|
8289 |
||
3892 | 8290 |
self openTool:(UserPreferences current changesBrowserClass) |
18246 | 8291 |
|
18775 | 8292 |
"Modified: / 26-05-2019 / 02:58:27 / Claus Gittinger" |
3892 | 8293 |
! |
8294 |
||
8295 |
openDiffView |
|
15215 | 8296 |
"open a diff-view on the two selected files" |
8297 |
||
8298 |
|name1 name2 files title |
|
8299 |
defaultName defaultDir| |
|
6460 | 8300 |
|
8301 |
files := self currentSelectedObjects. |
|
3892 | 8302 |
files isEmpty ifTrue:[ |
6460 | 8303 |
Dialog warn:(resources string:'You have to select a file first'). |
4414 | 8304 |
^ self. |
3892 | 8305 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8306 |
|
3892 | 8307 |
(files size == 2) ifTrue:[ |
4414 | 8308 |
name1 := files last. |
8309 |
name2 := files first. |
|
3892 | 8310 |
] ifFalse:[ |
4414 | 8311 |
LastFileDiffFile notNil ifTrue:[ |
11052 | 8312 |
LastFileDiffFile exists ifTrue:[ |
8313 |
name1 := LastFileDiffFile. |
|
8314 |
]. |
|
8315 |
"/ | directory | |
|
8316 |
"/ directory := self currentDirectory. |
|
8317 |
"/ directory notNil ifTrue:[ |
|
8318 |
"/ lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
8319 |
"/ (lastFile exists and:[lastFile isReadable]) ifTrue:[ |
|
8320 |
"/ name1 := lastFile. |
|
8321 |
"/ ] |
|
8322 |
"/ ] |
|
4414 | 8323 |
]. |
8324 |
name2 := files first. |
|
6460 | 8325 |
title := resources string:'Show differences between "%1" and:' with:name2 baseName. |
4414 | 8326 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
11052 | 8327 |
defaultDir := name1 notNil ifTrue:[name1 directory] ifFalse:[self currentDirectory]. |
4414 | 8328 |
name1 := DialogBox |
8329 |
requestFileName:title |
|
8330 |
default:defaultName |
|
6460 | 8331 |
ok:(resources string:'OK') |
8332 |
abort:(resources string:'Compare against File List') |
|
4414 | 8333 |
pattern:'*' |
11052 | 8334 |
fromDirectory:defaultDir. |
3892 | 8335 |
]. |
15215 | 8336 |
self openDiffViewOn:name1 and:name2 |
8337 |
||
8338 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
|
8339 |
! |
|
8340 |
||
8341 |
openDiffViewOn:fileArg1 and:fileArg2 |
|
8342 |
"open a diff-view on two files" |
|
8343 |
||
17769 | 8344 |
|file1 file2 file1Size file2Size text1 text2 d err nm l1 sameContents msg| |
15215 | 8345 |
|
8346 |
file1 := fileArg1. |
|
8347 |
file2 := fileArg2. |
|
3892 | 8348 |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8349 |
self withWaitCursorDo:[ |
15215 | 8350 |
(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
|
8351 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
14126 | 8352 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l string]]. |
15215 | 8353 |
file1 := nil. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8354 |
l1 := 'browser contents' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8355 |
] ifFalse:[ |
15215 | 8356 |
file1 := file1 asFilename. |
8357 |
LastFileDiffFile := file1. |
|
8358 |
file1 isReadable ifFalse:[ |
|
8359 |
nm := file1. |
|
8360 |
file1 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8361 |
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
|
8362 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8363 |
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
|
8364 |
]. |
4414 | 8365 |
]. |
15215 | 8366 |
l1 := file1 pathName |
4414 | 8367 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8368 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8369 |
err isNil ifTrue:[ |
15215 | 8370 |
file2 isReadable ifFalse:[ |
8371 |
nm := file2. |
|
8372 |
file2 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8373 |
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
|
8374 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8375 |
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
|
8376 |
]. |
4414 | 8377 |
]. |
8378 |
]. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8379 |
err notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8380 |
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
|
8381 |
^ self |
6176 | 8382 |
]. |
8383 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8384 |
self withActivityIndicationDo:[ |
17769 | 8385 |
file1Size := file1 isNil ifTrue:[0] ifFalse:[file1 fileSize]. |
8386 |
file2Size := file2 isNil ifTrue:[0] ifFalse:[file2 fileSize]. |
|
8387 |
||
8388 |
((file1Size > (1024*1024*32)) or:[ file2Size > (1024*1024*32) ]) ifTrue:[ |
|
8389 |
file1Size = file2Size ifTrue:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8390 |
ProgressIndicator |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8391 |
displayBusyIndicator:'Comparing...' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8392 |
at:(Screen default center) |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8393 |
during:[ |
15215 | 8394 |
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
|
8395 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8396 |
sameContents ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8397 |
self information:'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8398 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8399 |
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
|
8400 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8401 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8402 |
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
|
8403 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8404 |
^ self. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8405 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8406 |
|
15215 | 8407 |
file1 notNil ifTrue:[ |
8408 |
file1 isDirectory ifTrue:[ |
|
8409 |
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
|
8410 |
] ifFalse:[ |
15215 | 8411 |
text1 := file1 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8412 |
] |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8413 |
]. |
15215 | 8414 |
file2 isDirectory ifTrue:[ |
8415 |
text2 := file2 directoryContents asString. |
|
6460 | 8416 |
] ifFalse:[ |
15215 | 8417 |
text2 := file2 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8418 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8419 |
text1 = text2 ifTrue:[ |
15215 | 8420 |
(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
|
8421 |
msg := 'Same filename lists.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8422 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8423 |
msg := 'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8424 |
]. |
16911 | 8425 |
self information:msg |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8426 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8427 |
d := DiffTextView |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8428 |
openOn:text1 label:l1 |
15215 | 8429 |
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
|
8430 |
d topView label:(resources string:'File Differences'). |
6460 | 8431 |
] |
4414 | 8432 |
] |
3892 | 8433 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8434 |
|
17769 | 8435 |
"Modified: / 19-11-2017 / 15:00:47 / cg" |
3892 | 8436 |
! |
8437 |
||
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8438 |
openDirectoryDiffView |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8439 |
"open a directory diff-view" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8440 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8441 |
|name1 name2 files| |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8442 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8443 |
files := self currentSelectedObjects. |
11108 | 8444 |
files notEmpty ifTrue:[ |
8445 |
name1 := files first asFilename. |
|
18453 | 8446 |
name1 asFilename isRegularFile ifTrue:[ |
11108 | 8447 |
name1 := name1 directory |
8448 |
]. |
|
8449 |
]. |
|
8450 |
||
8451 |
(files size == 2) ifTrue:[ |
|
8452 |
name2 := files second. |
|
8453 |
] ifFalse:[ |
|
8454 |
(files size ~= 1) ifTrue:[ |
|
8455 |
Dialog warn:(resources string:'Please select one or two directories.'). |
|
8456 |
^ self. |
|
8457 |
]. |
|
8458 |
name2 := Dialog |
|
8459 |
requestDirectoryName:(resources |
|
8460 |
string:'Recursive compare "%1" with folder:' |
|
8461 |
with:name1 asFilename baseName) |
|
8462 |
default:(LastFileDiffDirectory ? self currentDirectory). |
|
8463 |
name2 isEmptyOrNil ifTrue:[^ self]. |
|
8464 |
LastFileDiffDirectory := name2. |
|
8465 |
]. |
|
8466 |
name2 := name2 asFilename. |
|
8467 |
||
18453 | 8468 |
name2 asFilename isRegularFile ifTrue:[ |
11108 | 8469 |
name2 := name2 directory |
8470 |
]. |
|
8471 |
||
8472 |
self |
|
8473 |
applicationNamed:#FileApplicationNoteBook |
|
8474 |
ifPresentDo:[:appl | ^ appl openCompareDirectory:name1 with:name2]. |
|
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8475 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8476 |
"Created: / 20-05-2010 / 15:01:17 / cg" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8477 |
! |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8478 |
|
3892 | 8479 |
openEditor |
8480 |
self openTool:EditTextView |
|
8481 |
! |
|
8482 |
||
4957 | 8483 |
openGV |
8484 |
self openOSCommandWithFiles:'gv' |
|
8485 |
! |
|
8486 |
||
3892 | 8487 |
openHTMLReader |
8488 |
||
8489 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
8490 |
! |
|
8491 |
||
8492 |
openImageEditor |
|
6292 | 8493 |
[ |
8494 |
self loadImageThenDo:[:img | img edit] |
|
8495 |
] fork |
|
3892 | 8496 |
! |
8497 |
||
8498 |
openImageInspector |
|
6292 | 8499 |
[ |
8500 |
self loadImageThenDo:[:img | img inspect] |
|
8501 |
] fork |
|
3892 | 8502 |
! |
8503 |
||
8504 |
openImagePreview |
|
5778 | 8505 |
[ |
8506 |
self |
|
6292 | 8507 |
loadImageThenDo: |
5778 | 8508 |
[:img | |
8509 |
|i top viewer| |
|
8510 |
||
8511 |
top := StandardSystemView new. |
|
8512 |
||
8513 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8514 |
i := img. |
|
8515 |
top extent:200@200. |
|
8516 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
8517 |
top openAndWait. |
|
8518 |
||
8519 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
8520 |
i := i magnifiedPreservingRatioTo:200@200. |
|
8521 |
]. |
|
8522 |
viewer image:i. |
|
8523 |
]. |
|
3892 | 8524 |
] fork |
8525 |
! |
|
8526 |
||
8527 |
openMP3Player |
|
8528 |
|file| |
|
8529 |
||
3982 | 8530 |
file := self currentSelectedFiles. |
3892 | 8531 |
(file isEmpty) ifTrue:[ |
4414 | 8532 |
^ self. |
3892 | 8533 |
]. |
8534 |
file := file first. |
|
8535 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
8536 |
! |
|
8537 |
||
4957 | 8538 |
openOSCommandWithFiles:command |
8539 |
|files fileNames| |
|
8540 |
||
8541 |
files := self currentSelectedFiles. |
|
8542 |
(files isEmpty) ifTrue:[ |
|
8543 |
^ self. |
|
8544 |
]. |
|
8545 |
||
8546 |
fileNames := files collect:[:each | |
|
8547 |
'"' , each asFilename pathName , '"' |
|
8548 |
]. |
|
8549 |
||
8550 |
[ |
|
8551 |
OperatingSystem |
|
4959 | 8552 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
8553 |
inDirectory:(files first asFilename directory). |
|
4957 | 8554 |
] fork |
8555 |
! |
|
8556 |
||
4820 | 8557 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8558 |
|files fileNames cmd arg| |
4820 | 8559 |
|
8560 |
files := self currentSelectedFiles. |
|
8561 |
(files isEmpty) ifTrue:[ |
|
8562 |
^ self. |
|
8563 |
]. |
|
12972 | 8564 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'. |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8565 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8566 |
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
|
8567 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8568 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8569 |
|
4820 | 8570 |
fileNames := |
8571 |
files |
|
8572 |
collect: |
|
8573 |
[:each | |
|
8574 |
'"' , each asFilename pathName , '"' |
|
8575 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8576 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8577 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8578 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8579 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8580 |
]. |
4820 | 8581 |
|
4950 | 8582 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8583 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 8584 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8585 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8586 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 8587 |
! |
8588 |
||
4958 | 8589 |
openRP |
8590 |
self openOSCommandWithFiles:'realplay' |
|
8591 |
! |
|
8592 |
||
8426 | 8593 |
openResourceFileEditor |
8594 |
||
8595 |
self |
|
8596 |
openTool: Tools::InternationalLanguageTranslationEditor |
|
8597 |
with: #openOnFile: |
|
8598 |
! |
|
8599 |
||
3892 | 8600 |
openSlideShow |
5880 | 8601 |
|dir| |
8602 |
||
8603 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8604 |
dir isNil ifTrue:[^ self]. |
|
8605 |
||
3892 | 8606 |
CodingExamples_GUI::SlideShow openIn:dir. |
8607 |
! |
|
8608 |
||
8609 |
openSnapshotImageBrowser |
|
4491 | 8610 |
"Sorry, for now, only the old browser can handle snapShotImages." |
8611 |
||
3892 | 8612 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
8613 |
! |
|
8614 |
||
8615 |
openTerminal |
|
5880 | 8616 |
|dir| |
8617 |
||
8618 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 8619 |
|
5300 | 8620 |
TerminalApplication notNil ifTrue:[ |
8621 |
TerminalApplication openIn:dir |
|
8622 |
] ifFalse:[ |
|
8623 |
VT100TerminalView openShellIn:dir. |
|
8624 |
]. |
|
3892 | 8625 |
! |
8626 |
||
8627 |
openTool:aToolClass |
|
8628 |
"open a tool on the selected file(s)" |
|
8629 |
||
8630 |
^ self openTool:aToolClass ignoreDirectories:true |
|
8631 |
! |
|
8632 |
||
8633 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
8634 |
"open a tool on the selected file(s)" |
|
8635 |
||
8636 |
^ self |
|
4414 | 8637 |
openTool:aToolClass |
8638 |
with:#openOn: |
|
8639 |
ignoreDirectories:ignoreDirs |
|
3892 | 8640 |
! |
8641 |
||
8426 | 8642 |
openTool:aToolClass with:aSelector |
8643 |
"open a tool on the selected file(s)" |
|
8644 |
||
8645 |
^ self openTool:aToolClass with:aSelector ignoreDirectories:true |
|
8646 |
! |
|
8647 |
||
3892 | 8648 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
8649 |
"open a tool on the selected file(s)" |
|
8650 |
||
8832 | 8651 |
|tool| |
3892 | 8652 |
|
8653 |
aToolClass isNil ifTrue:[ |
|
4414 | 8654 |
Dialog warn:'Sorry, that tool seems to be not available'. |
8655 |
^ nil. |
|
3892 | 8656 |
]. |
8832 | 8657 |
self forEachSelectedFileIgnoringDirectories:ignoreDirs do:[:path | |
8658 |
tool := aToolClass perform:aSelector with:path. |
|
3892 | 8659 |
]. |
8660 |
^ tool |
|
8832 | 8661 |
! |
8662 |
||
8663 |
openWebBrowser |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8664 |
self |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8665 |
forEachSelectedFileIgnoringDirectories:true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8666 |
do:[:path | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8667 |
Error |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8668 |
handle:[:ex | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8669 |
Dialog warn:'Shell execution failed: ',ex description |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8670 |
] do:[ |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8671 |
OperatingSystem openApplicationForDocument:path operation:#open. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8672 |
^ self. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8673 |
] |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8674 |
]. |
3892 | 8675 |
! |
8676 |
||
6022 | 8677 |
openWorkspace |
8678 |
self |
|
8679 |
openTool:WorkspaceApplication |
|
8680 |
with:#openOnFile: |
|
8681 |
ignoreDirectories:true |
|
8682 |
! |
|
8683 |
||
4950 | 8684 |
openXV |
4957 | 8685 |
self openOSCommandWithFiles:'xv' |
4950 | 8686 |
! |
8687 |
||
3892 | 8688 |
openZipTool |
5880 | 8689 |
|zipTool| |
3892 | 8690 |
|
8691 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 8692 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 8693 |
]. |
8694 |
! |
|
8695 |
||
8696 |
readAbbrevFile |
|
8697 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
8698 |
||
5880 | 8699 |
|directories| |
3892 | 8700 |
|
3982 | 8701 |
directories := self currentSelectedDirectories. |
3892 | 8702 |
directories isEmpty ifTrue:[^ self]. |
8703 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8704 |
self withActivityIndicationDo:[ |
5880 | 8705 |
directories do:[:eachDir | |
8706 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
8707 |
] |
|
5828 | 8708 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8709 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8710 |
"Modified: / 25-07-2006 / 09:07:43 / cg" |
3892 | 8711 |
! |
8712 |
||
6460 | 8713 |
readAndShowResources |
8714 |
self withActivityIndicationDo:[ |
|
8715 |
| selectedFiles| |
|
8716 |
||
8717 |
selectedFiles:= self currentSelectedFiles. |
|
8718 |
selectedFiles do:[:fileName | |
|
8719 |
resources := ResourcePack fromFile:fileName. |
|
8720 |
resources inspect. |
|
8721 |
]. |
|
8722 |
] |
|
8723 |
! |
|
8724 |
||
17831 | 8725 |
removeBakAndSavFiles |
8726 |
"remove all .sav and .bak files (after confirmation)" |
|
8727 |
||
8728 |
|filesToRemove directories| |
|
8729 |
||
8730 |
directories := self currentSelectedDirectories. |
|
8731 |
directories isEmptyOrNil ifTrue:[ |
|
8732 |
directories := Array with:self currentDirectory |
|
8733 |
]. |
|
8734 |
||
8735 |
self withActivityIndicationDo:[ |
|
8736 |
filesToRemove := OrderedCollection new. |
|
8737 |
directories do:[:eachDirectoryToScan | |
|
8738 |
eachDirectoryToScan filesDo:[:fn | |
|
8739 |
(#('sav' 'bak') includes:fn suffix) ifTrue:[ |
|
8740 |
filesToRemove add:fn. |
|
8741 |
] |
|
8742 |
] |
|
8743 |
]. |
|
8744 |
filesToRemove isEmpty ifTrue:[ |
|
8745 |
Dialog information:(resources string:'Nothing to remove'). |
|
8746 |
^ self. |
|
8747 |
]. |
|
8748 |
(Dialog confirm:(resources string:'Remove %1 file(s) ?' with:filesToRemove size)) ifFalse:[ |
|
8749 |
^ self |
|
8750 |
]. |
|
8751 |
filesToRemove do:[:each | |
|
8752 |
each remove |
|
8753 |
]. |
|
17871 | 8754 |
self updateCurrentDirectoryWithReread |
17831 | 8755 |
]. |
8756 |
! |
|
8757 |
||
3892 | 8758 |
singleFileFileIn:fileName lazy:lazy |
8759 |
"fileIn the selected file(s)" |
|
8760 |
||
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8761 |
|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
|
8762 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8763 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8764 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8765 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8766 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8767 |
[ |
4345 | 8768 |
(ObjectFileLoader notNil |
5491 | 8769 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 8770 |
AbortOperationRequest catch:[ |
8771 |
|p| |
|
8772 |
||
8773 |
"/ |
|
8774 |
"/ look if already loaded ... then unload first |
|
8775 |
"/ |
|
8776 |
p := fileName pathName. |
|
8777 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
8778 |
(Dialog confirm:(resources |
|
8779 |
string:'%1 is already loaded; load anyway ?' |
|
8780 |
with:p)) ifFalse:[ |
|
8781 |
^ self |
|
8782 |
]. |
|
8783 |
notifyString := 'unloading old ' , p , ' ...'. |
|
8784 |
Transcript showCR:notifyString. |
|
4523 | 8785 |
self notify:notifyString. |
4345 | 8786 |
ObjectFileLoader unloadObjectFile:p. |
8787 |
]. |
|
8788 |
||
8789 |
notifyString := 'loading ' , p , ' ...'. |
|
8790 |
Transcript showCR:notifyString. |
|
4523 | 8791 |
self notify:notifyString. |
12426 | 8792 |
(ObjectFileLoader loadObjectFile:p) isNil ifTrue:[ |
8793 |
notifyString := 'Error: could not load ' , p. |
|
8794 |
Transcript showCR:notifyString. |
|
8795 |
self notify:notifyString. |
|
8796 |
] ifFalse:[ |
|
8797 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
8798 |
]. |
|
4345 | 8799 |
] |
8800 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
8801 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
8802 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
8803 |
aStream := fileName readStreamOrNil. |
4345 | 8804 |
aStream notNil ifTrue:[ |
8805 |
aStream fileInBinary. |
|
8806 |
] |
|
8807 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8808 |
((fileName hasSuffix:'class') or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 8809 |
"/ loading a java class file |
8810 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 8811 |
JavaClassReader loadFile:fileName |
4345 | 8812 |
] |
8813 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
8814 |
"/ loading a sif (smalltalk interchange format) file |
|
8815 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
8816 |
SmalltalkInterchangeFileManager newForFileIn |
|
8817 |
fileName: fileName pathName; |
|
8818 |
fileIn. |
|
8819 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
|
8820 |
Parcel isNil ifTrue:[ |
|
8821 |
Dialog warn:'Parcel support not loaded.' |
|
8822 |
] ifFalse:[ |
|
8823 |
Parcel loadParcelFrom: fileName pathName |
|
8824 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8825 |
] ifFalse:[ (fileName hasSuffix:'jar') ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8826 |
JavaVM isNil ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8827 |
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
|
8828 |
^ self. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8829 |
] ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8830 |
JavaVM booted ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8831 |
(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
|
8832 |
JavaVM boot. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8833 |
]. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8834 |
JavaVM loadClassesIn: fileName. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8835 |
] |
4345 | 8836 |
] ifFalse:[ |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8837 |
"/ ask programming languages... |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8838 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
14360 | 8839 |
(lang isNil and:[(fileName hasSuffix:'js')]) ifTrue:[ |
14362 | 8840 |
Smalltalk loadPackage:'stx:libjavascript'. |
14360 | 8841 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
8842 |
]. |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8843 |
(lang notNil and:[lang ~= SmalltalkLanguage]) ifTrue:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8844 |
lang fileIn:fileName. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8845 |
] ifFalse:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8846 |
"/ loading a regular (chunk) or xml source file |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8847 |
Error handle:[:ex | |
15675 | 8848 |
self errorNotify:'Error during file in: ', ex description. |
15981 | 8849 |
ex resume. |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8850 |
] do:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8851 |
aStream := fileName readStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8852 |
[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8853 |
Class withoutUpdatingChangesDo:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8854 |
wasLazy := Compiler compileLazy:lazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8855 |
Smalltalk fileInStream:aStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8856 |
]. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8857 |
Class addInfoRecord:('fileIn ' , fileName asString) |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8858 |
] ensure:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8859 |
Compiler compileLazy:wasLazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8860 |
aStream close |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8861 |
] |
4345 | 8862 |
] |
8863 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8864 |
]]]] |
4345 | 8865 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8866 |
] 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
|
8867 |
|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
|
8868 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8869 |
isRedef := false. |
12684 | 8870 |
sig := ex creator. |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8871 |
(dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8872 |
action := #continue |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8873 |
] ifFalse:[ |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8874 |
(sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8875 |
ex reject |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8876 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8877 |
sig == Class methodRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8878 |
msg := 'trying to overwrite method:\\ ' , ex oldMethod whoString , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8879 |
, ex oldPackage , ''' with method from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8880 |
label := 'Method redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8881 |
redefKind := 'method'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8882 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8883 |
] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8884 |
msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8885 |
, ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8886 |
label := 'Class redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8887 |
redefKind := 'class'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8888 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8889 |
] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender| |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8890 |
label := msg := 'Breakpoint/Halt in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8891 |
sender := ex suspendedContext. |
18805 | 8892 |
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
|
8893 |
] ifFalse:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8894 |
label := 'Error in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8895 |
msg := 'error in fileIn: %1' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8896 |
]]]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8897 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8898 |
msg := msg bindWith:ex description. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8899 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8900 |
labels := #('Cancel' 'Skip' 'Debug' 'Compare Sources'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8901 |
values := #(abort skip debug compareSources). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8902 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8903 |
isRedef ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8904 |
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
|
8905 |
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
|
8906 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8907 |
labels := labels , #('Keep Package' ). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8908 |
values := values , #(keep). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8909 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8910 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8911 |
labels := labels , #( 'Continue' 'ContinueForAll'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8912 |
values := values , #( continue continueForAll). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8913 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8914 |
AbortAllOperationWantedQuery query ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8915 |
labels := #('Cancel All') , labels. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8916 |
values := #(cancelAll) , values. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8917 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8918 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8919 |
action := Dialog |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8920 |
choose:(msg withCRs) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8921 |
label:label |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8922 |
image:(WarningBox iconBitmap) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8923 |
labels:labels |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8924 |
values:values |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8925 |
default:#continue |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8926 |
onCancel:#abort. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8927 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8928 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8929 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8930 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8931 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8932 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8933 |
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
|
8934 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8935 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8936 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8937 |
(action == #compareSources) ifTrue:[ |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8938 |
DiffCodeView |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8939 |
openOn:(ex oldMethod source) label:'Old Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8940 |
and:(ex newMethod source) label:'New Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8941 |
title:ex description. |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8942 |
ex resignalAs:ex |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8943 |
]. |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
8944 |
(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
|
8945 |
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
|
8946 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8947 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8948 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8949 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8950 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8951 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8952 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8953 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8954 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8955 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8956 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8957 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8958 |
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
|
8959 |
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
|
8960 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8961 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8962 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8963 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8964 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8965 |
] |
7040 | 8966 |
|
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8967 |
"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
|
8968 |
"Modified: / 19-02-2014 / 12:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4531 | 8969 |
! |
8970 |
||
4558 | 8971 |
splitFile:infile intoPiecesOfSize:kiloBytes |
8972 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
8973 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
8974 |
||
8975 |
bufferSize := 32*1024. |
|
8976 |
||
8977 |
inStream := infile readStream. |
|
8978 |
||
8979 |
bytesPerSplit := kiloBytes * 1024. |
|
8980 |
||
8981 |
remaining := infile fileSize. |
|
8982 |
splitIndex := 1. |
|
8983 |
[remaining > 0] whileTrue:[ |
|
8984 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8985 |
outStream := outFile asFilename writeStream. |
|
8986 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
8987 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
8988 |
buffer := ByteArray new:bufferSize. |
|
8989 |
n := inStream |
|
8990 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
8991 |
into:buffer |
|
8992 |
startingAt:1. |
|
8993 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
8994 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
8995 |
remaining := remaining - n. |
|
8996 |
]. |
|
8997 |
outStream close. |
|
8998 |
splitIndex := splitIndex + 1. |
|
8999 |
]. |
|
9000 |
inStream close. |
|
9001 |
! |
|
9002 |
||
15906 | 9003 |
splitFile:infile intoPiecesWithNumberOfLines:numberOfLines |
9004 |
|splitIndex line |
|
9005 |
inStream outFile outStream remainingLinesInThisOutfile| |
|
9006 |
||
9007 |
inStream := infile readStream. |
|
9008 |
||
9009 |
splitIndex := 1. |
|
9010 |
[inStream atEnd] whileFalse:[ |
|
9011 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
9012 |
outStream := outFile asFilename writeStream. |
|
9013 |
remainingLinesInThisOutfile := numberOfLines. |
|
9014 |
[(remainingLinesInThisOutfile > 0) and:[inStream atEnd not]] whileTrue:[ |
|
9015 |
line := inStream nextLine. |
|
15910 | 9016 |
outStream nextPutLine:line. |
15906 | 9017 |
remainingLinesInThisOutfile := remainingLinesInThisOutfile - 1. |
9018 |
]. |
|
9019 |
outStream close. |
|
9020 |
splitIndex := splitIndex + 1. |
|
9021 |
]. |
|
9022 |
inStream close. |
|
9023 |
! |
|
9024 |
||
4558 | 9025 |
splitSelectedFiles |
6264 | 9026 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 9027 |
|
12871 | 9028 |
selectedFiles := self currentSelectedFiles. |
4558 | 9029 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
9030 |
||
6265 | 9031 |
msg := (numFiles > 1) |
9032 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
9033 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 9034 |
|
6352 | 9035 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 9036 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
9037 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 9038 |
kiloBytes isNil ifTrue:[^ self]. |
9039 |
||
9040 |
selectedFiles do:[:fileName | |
|
18453 | 9041 |
fileName isRegularFile ifTrue:[ |
9042 |
self notify:('Splitting:', fileName baseName). |
|
4558 | 9043 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
9044 |
] |
|
9045 |
]. |
|
6190 | 9046 |
self notify:nil. |
6265 | 9047 |
|
7560 | 9048 |
"Modified: / 04-12-2006 / 13:15:26 / cg" |
4558 | 9049 |
! |
9050 |
||
15906 | 9051 |
splitSelectedFilesByLines |
9052 |
|selectedFiles numFiles msg numLinesString numLines| |
|
9053 |
||
9054 |
selectedFiles := self currentSelectedFiles. |
|
9055 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
9056 |
||
9057 |
msg := (numFiles > 1) |
|
9058 |
ifTrue:'Split each of the %1 files into pieces with number of lines:' |
|
9059 |
ifFalse:'Split %2 into pieces with number of lines:'. |
|
9060 |
||
9061 |
numLinesString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
9062 |
numLinesString isEmptyOrNil ifTrue:[^ self]. |
|
9063 |
||
9064 |
numLines := Integer readFrom:numLinesString onError:nil. |
|
9065 |
numLines isNil ifTrue:[^ self]. |
|
9066 |
||
9067 |
selectedFiles do:[:fileName | |
|
18453 | 9068 |
fileName isRegularFile ifTrue:[ |
9069 |
self notify:('Splitting:', fileName baseName). |
|
15906 | 9070 |
self splitFile:fileName intoPiecesWithNumberOfLines:numLines |
9071 |
] |
|
9072 |
]. |
|
9073 |
self notify:nil. |
|
9074 |
! |
|
9075 |
||
15211 | 9076 |
truncateSelectedFilesToZeroSize |
9077 |
|selectedFiles numFiles msg| |
|
9078 |
||
9079 |
selectedFiles := self currentSelectedObjects. |
|
9080 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
9081 |
||
9082 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
|
9083 |
numFiles > 1 ifTrue:[ |
|
9084 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
|
9085 |
]. |
|
9086 |
||
9087 |
(Dialog |
|
9088 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
|
9089 |
initialAnswer:false |
|
9090 |
) ifFalse:[ |
|
9091 |
^ self |
|
9092 |
]. |
|
9093 |
||
9094 |
selectedFiles do:[:fileName | |
|
9095 |
|s| |
|
9096 |
||
18453 | 9097 |
fileName isRegularFile ifTrue:[ |
9098 |
self notify:('Truncating:', fileName baseName). |
|
15211 | 9099 |
[ |
9100 |
s := fileName writeStream. |
|
9101 |
s close. |
|
9102 |
] on:FileStream openErrorSignal do:[:ex| |
|
9103 |
self warn:('Cannot truncate "%1".' bindWith:fileName baseName allBold). |
|
9104 |
]. |
|
9105 |
] |
|
9106 |
]. |
|
9107 |
self notify:nil. |
|
9108 |
||
9109 |
"Modified: / 04-12-2006 / 13:15:28 / cg" |
|
9110 |
! ! |
|
3892 | 9111 |
|
4849 | 9112 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 9113 |
|
9114 |
anySTFilesPresent |
|
9115 |
^ self anyFilesPresentWithSuffix:'st' |
|
9116 |
! |
|
9117 |
||
9118 |
canCreateNewProject |
|
9119 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
17865 | 9120 |
^ self currentSelectedFiles |
9121 |
contains:[:fileName| |
|
9122 |
| suffix| |
|
9123 |
suffix := fileName suffix asLowercase. |
|
9124 |
(suffix = 'prj' or:[suffix = 'st']) |
|
9125 |
] |
|
3892 | 9126 |
! |
9127 |
||
9128 |
canDoTerminal |
|
9129 |
||
9130 |
^ OperatingSystem isUNIXlike |
|
9131 |
or:[OperatingSystem isMSWINDOWSlike] |
|
9132 |
! |
|
9133 |
||
9134 |
canDoTerminalAndSystemIsDOS |
|
9135 |
||
9136 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
9137 |
! |
|
9138 |
||
9139 |
canDoTerminalAndSystemIsUnix |
|
9140 |
||
9141 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
9142 |
! |
|
9143 |
||
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9144 |
canGenerateSignatureFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
9145 |
"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
|
9146 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9147 |
Expecco::KeyFileGenerator isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9148 |
Expecco::KeyFile isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9149 |
|
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
9150 |
^ self currentSelectedFiles notEmptyOrNil |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9151 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9152 |
|
12811 | 9153 |
canOpenMonticelloBrowser |
9154 |
^ self currentSelectedFiles |
|
9155 |
contains:[:fileName| |
|
18746 | 9156 |
fileName suffix sameAs:'mcz' |
12811 | 9157 |
] |
18746 | 9158 |
|
9159 |
"Modified: / 01-05-2019 / 11:21:16 / Claus Gittinger" |
|
12811 | 9160 |
! |
9161 |
||
3892 | 9162 |
canReadAbbrevFile |
9163 |
||
5960 | 9164 |
|currentDirectory| |
3892 | 9165 |
|
9166 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 9167 |
currentDirectory := self currentDirectory. |
9168 |
^ currentDirectory notNil |
|
9169 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 9170 |
! |
9171 |
||
9172 |
canRemoveFromSourcePath |
|
9173 |
||
9174 |
^ false |
|
9175 |
! |
|
9176 |
||
13089 | 9177 |
cannotGenerateSignatureFiles |
9178 |
^ self canGenerateSignatureFiles not |
|
9179 |
! |
|
9180 |
||
3892 | 9181 |
hasASN1 |
9182 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 9183 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 9184 |
|
9185 |
! |
|
9186 |
||
9187 |
hasASN1AndSelection |
|
9188 |
^ [ self hasSelection value |
|
17416 | 9189 |
and:[self currentSelectedFiles notEmptyOrNil |
4414 | 9190 |
and:[OSI::ASN1Parser notNil |
9191 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
17416 | 9192 |
|
9193 |
"Modified: / 17-02-2017 / 08:25:09 / cg" |
|
3892 | 9194 |
! |
9195 |
||
9196 |
hasCBrowser |
|
9197 |
^ [ CBrowser::Browser notNil ] |
|
9198 |
! |
|
9199 |
||
9200 |
hasJava |
|
9201 |
||
14298 | 9202 |
^ [ JavaVM notNil |
9203 |
and:[JavaClassReader notNil |
|
9204 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 9205 |
! |
9206 |
||
9207 |
hasJavaAndSelection |
|
9208 |
||
12871 | 9209 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 9210 |
and:[JavaClassReader notNil |
9211 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 9212 |
! |
9213 |
||
9214 |
hasMP3Player |
|
9215 |
||
9216 |
^ [ MP3PlayerApplication notNil |
|
4414 | 9217 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 9218 |
! |
9219 |
||
9220 |
hasMP3PlayerAndSelection |
|
9221 |
||
12871 | 9222 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 9223 |
and:[ self hasMP3Player value]] |
3892 | 9224 |
! |
9225 |
||
8426 | 9226 |
hasResourceFileSelected |
12871 | 9227 |
^ (self currentSelectedFiles) |
9228 |
contains:[:fn | |
|
18746 | 9229 |
fn suffix sameAs:'rs' |
9230 |
]. |
|
9231 |
||
9232 |
"Modified: / 01-05-2019 / 11:23:30 / Claus Gittinger" |
|
8426 | 9233 |
! |
9234 |
||
3892 | 9235 |
hasSlideShow |
9236 |
||
9237 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
9238 |
! |
|
9239 |
||
9240 |
hasSnapshotSelection |
|
9241 |
||
9242 |
^ [ |
|
4414 | 9243 |
| files | |
8426 | 9244 |
|
4414 | 9245 |
files := self currentSelectedFiles. |
9246 |
((files size == 1) |
|
9247 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 9248 |
] |
9249 |
! |
|
9250 |
||
7869 | 9251 |
hasXml |
9206 | 9252 |
^ [ XML::XMLParser notNil ] |
7869 | 9253 |
! |
9254 |
||
9255 |
hasXmlFileSelected |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
9256 |
"/ 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
|
9257 |
"/ then handle the error when it ever fails during xml-parsing. |
7869 | 9258 |
|
8426 | 9259 |
^ [ |
9260 |
|sel fileName| |
|
7869 | 9261 |
|
9262 |
sel := self currentSelectedFiles. |
|
9263 |
sel size == 1 ifTrue:[ |
|
9264 |
fileName := sel first. |
|
9265 |
fileName notNil ifTrue:[ |
|
15936 | 9266 |
#('xml' 'xsd' 'vdx') includes:fileName suffix asLowercase |
7869 | 9267 |
] ifFalse:[ |
9268 |
false |
|
9269 |
] |
|
9270 |
] ifFalse:[ |
|
9271 |
false |
|
9272 |
] |
|
9273 |
] |
|
9274 |
! |
|
9275 |
||
3892 | 9276 |
hasZipFileSelected |
17982 | 9277 |
|sel fileName suff mime| |
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9278 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9279 |
sel := self currentSelectedFiles. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9280 |
sel size == 1 ifFalse:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9281 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9282 |
fileName := sel first. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9283 |
fileName isNil ifTrue:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9284 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9285 |
suff := fileName suffix asLowercase. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9286 |
(suff = 'zip' or:[suff = 'jar']) ifTrue:[^ true]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9287 |
|
17982 | 9288 |
mime := fileName mimeTypeOfContents. |
9289 |
"/ prepare for change (iana has obsoleted the x- types) |
|
9290 |
^ (mime = 'application/x-zip-compressed') or:[mime = 'application/zip'] |
|
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9291 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9292 |
"Modified: / 14-02-2011 / 17:17:03 / cg" |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9293 |
! |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9294 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9295 |
hasZipFileSelectedHolder |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9296 |
^ [ self hasZipFileSelected ] |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9297 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9298 |
"Created: / 14-02-2011 / 17:16:08 / cg" |
3892 | 9299 |
! |
9300 |
||
9301 |
javaSupportLoaded |
|
9302 |
||
9303 |
^ false |
|
9304 |
! ! |
|
9305 |
||
14126 | 9306 |
|
9307 |
||
3906 | 9308 |
!AbstractFileBrowser methodsFor:'presentation'! |
9309 |
||
9310 |
getModeString:modeBits |
|
9311 |
"convert file-mode bits into a more user-friendly string. |
|
9312 |
This is wrong here - should be moved into OperatingSystem." |
|
9313 |
||
9314 |
^ self getModeString:modeBits |
|
4414 | 9315 |
with:#( 'owner:' $r $w $x |
9316 |
' group:' $r $w $x |
|
9317 |
' others:' $r $w $x ) |
|
3906 | 9318 |
! |
9319 |
||
9320 |
getModeString:modeBits with:texts |
|
9321 |
"convert file-mode bits into a more user-friendly string. |
|
9322 |
This is wrong here - should be moved into OperatingSystem." |
|
9323 |
||
9324 |
|bits modeString| |
|
9325 |
||
9326 |
bits := modeBits bitAnd:8r777. |
|
9327 |
modeString := ''. |
|
9328 |
||
9329 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
9330 |
with: texts do:[:bitMask :access | |
|
4414 | 9331 |
|ch| |
9332 |
||
9333 |
bitMask isNil ifTrue:[ |
|
9334 |
modeString := modeString , access |
|
9335 |
] ifFalse:[ |
|
9336 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
9337 |
ch := $- |
|
9338 |
] ifFalse:[ |
|
9339 |
ch := access |
|
9340 |
]. |
|
9341 |
modeString := modeString copyWith:ch |
|
9342 |
] |
|
3906 | 9343 |
]. |
9344 |
^ modeString |
|
9345 |
! ! |
|
9346 |
||
5880 | 9347 |
!AbstractFileBrowser methodsFor:'private'! |
9348 |
||
9349 |
theSingleSelectedDirectoryOrHomeDir |
|
9350 |
|dir| |
|
9351 |
||
5888 | 9352 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 9353 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
9354 |
^ dir. |
|
9355 |
! |
|
9356 |
||
9357 |
theSingleSelectedDirectoryOrNil |
|
9358 |
|dirs| |
|
9359 |
||
9360 |
dirs := self currentSelectedDirectories. |
|
9361 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
9362 |
^ dirs anElement. |
|
14577 | 9363 |
! |
9364 |
||
9365 |
theSingleSelectedFileOrNil |
|
9366 |
|dirs| |
|
9367 |
||
9368 |
dirs := self currentSelectedFiles. |
|
9369 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
9370 |
^ dirs anElement. |
|
18751 | 9371 |
! |
9372 |
||
9373 |
theSingleSelectedItemOrNil |
|
9374 |
|items| |
|
9375 |
||
9376 |
items := self selectedItems. |
|
9377 |
items size ~= 1 ifTrue:[ ^ nil]. |
|
9378 |
^ items anElement. |
|
9379 |
||
9380 |
"Created: / 02-05-2019 / 18:53:06 / Claus Gittinger" |
|
5880 | 9381 |
! ! |
9382 |
||
3892 | 9383 |
!AbstractFileBrowser methodsFor:'queries'! |
9384 |
||
8256 | 9385 |
cBrowserLoaded |
18432 | 9386 |
^ (Smalltalk at:#'CBrowser::Browser') notNil |
9387 |
||
9388 |
"Modified: / 26-09-2018 / 12:06:32 / Claus Gittinger" |
|
8256 | 9389 |
! |
9390 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9391 |
cBrowserMenuItemVisible |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9392 |
^ self cBrowserLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9393 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9394 |
"Created: / 04-10-2011 / 13:40:38 / cg" |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9395 |
! |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9396 |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9397 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9398 |
"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
|
9399 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9400 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9401 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9402 |
|
3906 | 9403 |
getFileInfoStringForFirstSelectedFile:longInfo |
9404 |
"get stat info on selected file - return a string which can be |
|
9405 |
shown in a box" |
|
9406 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9407 |
|selFiles filename fileOutput modeBits modeString s info |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9408 |
sizeString fileSize tAccess tModification buffer| |
3906 | 9409 |
|
7560 | 9410 |
selFiles := self currentSelectedObjects. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9411 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 9412 |
filename := selFiles first. |
9413 |
||
8364 | 9414 |
info := filename linkInfo. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9415 |
info isNil ifTrue:[ |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9416 |
^ 'Cannot get fileInfo'. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9417 |
^ nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9418 |
]. |
8364 | 9419 |
|
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
9420 |
buffer := Text writeStream. |
4765 | 9421 |
|
9422 |
buffer |
|
9423 |
nextPutAll:'filename: '; |
|
9424 |
nextPutLine:filename asString. |
|
9425 |
||
8364 | 9426 |
OperatingSystem isMSDOSlike ifTrue: [ |
9427 |
(info alternativeName notNil |
|
9428 |
and:[ info alternativeName ~= info fullName ]) ifTrue:[ |
|
9429 |
buffer nextPutAll:'shortname: '. |
|
9430 |
buffer nextPutLine:info alternativeName. |
|
9431 |
] |
|
9432 |
]. |
|
9433 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9434 |
buffer nextPutAll:'type: '. |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9435 |
info isSymbolicLink ifTrue:[ |
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9436 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9437 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9438 |
]. |
4765 | 9439 |
buffer |
9440 |
nextPutAll:'symbolic link to: '; |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
9441 |
nextPutLine:(info path ? '???'). |
3906 | 9442 |
] ifFalse:[ |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9443 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9444 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9445 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9446 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9447 |
fileOutput isNil ifTrue:[ |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9448 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9449 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9450 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9451 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9452 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9453 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9454 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9455 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9456 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9457 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9458 |
fileSize > 1024 ifTrue:[ |
8172 | 9459 |
sizeString := sizeString,' (',(UnitConverter fileSizeStringFor:fileSize),')'. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9460 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9461 |
]. |
4765 | 9462 |
buffer nextPutLine:sizeString. |
3906 | 9463 |
|
9464 |
modeBits := info mode. |
|
9465 |
modeString := self getModeString:modeBits. |
|
4765 | 9466 |
|
9467 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 9468 |
longInfo ifTrue:[ |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9469 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 9470 |
]. |
4765 | 9471 |
buffer |
9472 |
cr; |
|
9473 |
nextPutAll:'owner: '; |
|
9474 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
9475 |
||
3906 | 9476 |
longInfo ifTrue:[ |
4765 | 9477 |
buffer |
9478 |
nextPutAll:'group: '; |
|
9479 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
9480 |
||
9481 |
tAccess := info accessTime. |
|
9482 |
buffer |
|
9483 |
nextPutAll:'last access: '; |
|
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9484 |
nextPutAll:tAccess asDate printString; |
4765 | 9485 |
space; |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9486 |
nextPutLine:tAccess asTime printString. |
4765 | 9487 |
|
9488 |
tModification := info modificationTime. |
|
9489 |
buffer |
|
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9490 |
nextPutAll:'last modification: '; |
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9491 |
nextPutAll:tModification asDate printString; |
4765 | 9492 |
space; |
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9493 |
nextPutLine:tModification asTime printString. |
3906 | 9494 |
]. |
4765 | 9495 |
^ buffer contents |
7560 | 9496 |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
9497 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
3906 | 9498 |
! |
9499 |
||
8510 | 9500 |
hasImageColorHistogram |
9501 |
^ ImageColorHistogram notNil |
|
9502 |
! |
|
9503 |
||
17686 | 9504 |
hasImageHistogram |
9505 |
^ ImageAlgorithms notNil |
|
9506 |
||
9507 |
"Created: / 10-09-2017 / 16:50:34 / cg" |
|
9508 |
! |
|
9509 |
||
10258 | 9510 |
hasSubversionSupport |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
9511 |
^ ConfigurableFeatures includesFeature: #SubversionSupport |
10258 | 9512 |
|
9513 |
"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
|
9514 |
"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
|
9515 |
"Modified: / 19-01-2012 / 10:43:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10258 | 9516 |
! |
9517 |
||
3892 | 9518 |
initialCommandFor:fileName into:aBox |
9519 |
"set a useful initial command for execute box." |
|
9520 |
||
18734 | 9521 |
self class |
9522 |
initialCommandFor:fileName |
|
9523 |
in:self "Filename" currentDirectory |
|
9524 |
intoBox:aBox |
|
9525 |
||
9526 |
"Modified: / 10-04-2019 / 05:55:21 / Claus Gittinger" |
|
3892 | 9527 |
! |
9528 |
||
9529 |
isAbstractFileBrowser |
|
9530 |
||
9531 |
^ true |
|
9532 |
! |
|
9533 |
||
18432 | 9534 |
stxgdbLoaded |
9535 |
^ (Smalltalk at:#GDBApplication) notNil |
|
9536 |
||
9537 |
"Created: / 26-09-2018 / 12:06:23 / Claus Gittinger" |
|
9538 |
! |
|
9539 |
||
9540 |
stxgdbMenuItemVisible |
|
9541 |
^ self stxgdbLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
|
9542 |
||
9543 |
"Created: / 26-09-2018 / 12:05:45 / Claus Gittinger" |
|
9544 |
! |
|
9545 |
||
3892 | 9546 |
systemIsDOS |
9547 |
^ OperatingSystem isMSDOSlike |
|
9548 |
! |
|
9549 |
||
12473 | 9550 |
systemIsOSX |
9551 |
^ OperatingSystem isOSXlike |
|
9552 |
! |
|
9553 |
||
3892 | 9554 |
systemIsUnix |
9555 |
^ OperatingSystem isUNIXlike |
|
14980 | 9556 |
! |
9557 |
||
9558 |
systemSupportsVolumes |
|
9559 |
^ OperatingSystem supportsVolumes |
|
3892 | 9560 |
! ! |
9561 |
||
9562 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
9563 |
||
9564 |
allItemsOfCurrentDirectory |
|
5009 | 9565 |
self |
4774 | 9566 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 9567 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
9568 |
||
9569 |
^ nil |
|
3892 | 9570 |
! |
9571 |
||
9572 |
anyFilesPresentWithSuffix:suffix |
|
6725 | 9573 |
self currentSelectedDirectories do:[:dir| |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9574 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
9575 |
(dir directoryContentsAsFilenamesDo:[:fn | (fn suffix = suffix) ifTrue:[ ^ true]]) |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9576 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 9577 |
]. |
9578 |
^ false. |
|
9579 |
! |
|
9580 |
||
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9581 |
commonPrefixOfSelectedFiles |
4773 | 9582 |
|selFiles stringCol firstPre| |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9583 |
|
7560 | 9584 |
selFiles := self currentSelectedObjects. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9585 |
selFiles isEmpty ifTrue:[^ nil]. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9586 |
|
17865 | 9587 |
stringCol := selFiles collect:#asString. |
4773 | 9588 |
firstPre := stringCol at:1. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9589 |
stringCol from:2 do:[:el| |
4773 | 9590 |
firstPre := firstPre commonPrefixWith:el. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9591 |
]. |
4773 | 9592 |
^ firstPre asFilename |
7560 | 9593 |
|
9594 |
"Modified: / 04-12-2006 / 13:14:25 / cg" |
|
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9595 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9596 |
|
12481 | 9597 |
compressTabsOnSave |
9598 |
"if true, compress leading spaces (multiples of 8) with a tab character |
|
9599 |
when saving. |
|
9600 |
Default is true" |
|
9601 |
||
9602 |
^ true |
|
9603 |
! |
|
9604 |
||
3892 | 9605 |
currentFilesAreInSameDirectory |
9606 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9607 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 9608 |
! |
9609 |
||
9610 |
currentFilesHasDirectories |
|
9611 |
||
6725 | 9612 |
^ self currentSelectedDirectories notEmpty. |
3892 | 9613 |
! |
9614 |
||
3982 | 9615 |
directoriesForFiles:aFileCol |
11743 | 9616 |
^ aFileCol collect:[:file| self getDirWithoutFileName:file] as:Set. |
3982 | 9617 |
! |
9618 |
||
3892 | 9619 |
fileListIsEmpty |
5009 | 9620 |
self |
9621 |
applicationNamed:#DirectoryContentsBrowser |
|
9622 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
9623 |
||
9624 |
^ nil. |
|
3892 | 9625 |
! |
9626 |
||
9627 |
fileListIsNotEmpty |
|
9628 |
||
9629 |
^ self fileListIsEmpty not. |
|
9630 |
! |
|
9631 |
||
9632 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 9633 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 9634 |
|
9635 |
| file1 file2 | |
|
9636 |
||
6284 | 9637 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 9638 |
file1 := aFilename1 asFilename. |
9639 |
file2 := aFilename2 asFilename. |
|
6284 | 9640 |
|
3892 | 9641 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 9642 |
|
3892 | 9643 |
((file1 isDirectory) |
9644 |
and:[(file2 isDirectory) |
|
9645 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 9646 |
^ file1 baseName = file2 baseName |
3892 | 9647 |
]. |
3982 | 9648 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 9649 |
! |
9650 |
||
9651 |
getAllFilesAsStringCollection |
|
5009 | 9652 |
self |
9653 |
applicationNamed:#DirectoryContentsBrowser |
|
9654 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
9655 |
||
9656 |
^ nil |
|
3892 | 9657 |
! |
9658 |
||
9659 |
getBestDirectory |
|
17868 | 9660 |
"from a set of directories, return the common parent directory" |
9661 |
||
9662 |
^ self class getBestDirectoryFrom:(self currentSelectedDirectories) |
|
3892 | 9663 |
! |
9664 |
||
9665 |
getDirWithoutFileName:aFileName |
|
9666 |
||
9667 |
| dir | |
|
9668 |
aFileName isNil ifTrue:[ |
|
4414 | 9669 |
^ aFileName. |
3892 | 9670 |
]. |
9671 |
dir := aFileName asFilename. |
|
9672 |
dir isDirectory ifFalse:[ |
|
4414 | 9673 |
dir := dir directory. |
3892 | 9674 |
]. |
9675 |
^ dir. |
|
9676 |
! |
|
9677 |
||
9678 |
getInfoItem |
|
9679 |
"get filename of a description-file (.dir.info, README etc.); |
|
16778 | 9680 |
This file is automatically shown when a directory is entered. |
3892 | 9681 |
You can add more names below if you like." |
9682 |
||
5880 | 9683 |
|dir| |
9684 |
||
9685 |
dir := self theSingleSelectedDirectoryOrNil. |
|
9686 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 9687 |
|
16778 | 9688 |
#( |
3892 | 9689 |
'.dir.info' |
9690 |
'README' |
|
9691 |
'ReadMe' |
|
9692 |
'Readme' |
|
9693 |
'readme' |
|
9694 |
'read.me' |
|
9695 |
'Read.me' |
|
9696 |
'READ.ME' |
|
9697 |
'README.TXT' |
|
15915 | 9698 |
'README.txt' |
3892 | 9699 |
'readme.txt' |
9700 |
'Readme.txt' |
|
9701 |
'Info.txt' |
|
9702 |
'info.txt' |
|
9703 |
'INFO.TXT' |
|
15915 | 9704 |
'INFO.txt' |
16778 | 9705 |
) do:[:f | |
5883 | 9706 |
|n| |
4414 | 9707 |
|
5880 | 9708 |
n := dir construct:f. |
18453 | 9709 |
(n isReadable and:[n isRegularFile]) ifTrue:[ |
4414 | 9710 |
^ DirectoryContentsBrowser itemClass fileName:n |
9711 |
] |
|
3892 | 9712 |
]. |
9713 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9714 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9715 |
|
12497 | 9716 |
hasPackageDirectorySelected |
9717 |
|dir| |
|
9718 |
||
9719 |
dir := self currentDirectory. |
|
9720 |
^ dir notNil |
|
9721 |
and:[ dir exists |
|
9722 |
and:[ (dir / 'abbrev.stc') exists ]] |
|
9723 |
! |
|
9724 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9725 |
parentDirectoriesOfCurrentFiles |
11743 | 9726 |
^ self currentSelectedObjects |
9727 |
collect:[:file | file directory] as:Set |
|
7560 | 9728 |
|
9729 |
"Modified: / 04-12-2006 / 13:15:21 / cg" |
|
6521 | 9730 |
! |
9731 |
||
9732 |
recursiveAnyFilesPresentWithSuffix:suffix |
|
6652 | 9733 |
^ true. "/ the code below is too slow for a menu enabling operation |
9734 |
||
9735 |
"/ |directories| |
|
9736 |
"/ |
|
9737 |
"/ directories := self currentDirectories value. |
|
9738 |
"/ directories do:[:dir| |
|
9739 |
"/ [ |
|
9740 |
"/ dir recursiveDirectoryContentsDo:[:f | |
|
9741 |
"/ (f asFilename suffix = suffix) ifTrue:[ ^ true] |
|
9742 |
"/ ] |
|
9743 |
"/ ] on:FileStream openErrorSignal do:[:ex|]. |
|
9744 |
"/ ]. |
|
9745 |
"/ ^ false. |
|
6586 | 9746 |
! |
9747 |
||
9748 |
recursiveAnySTFilesPresent |
|
9749 |
^ self recursiveAnyFilesPresentWithSuffix:'st' |
|
3982 | 9750 |
! ! |
9751 |
||
9752 |
!AbstractFileBrowser methodsFor:'selection'! |
|
9753 |
||
9754 |
currentSelectedDirectories |
|
6725 | 9755 |
^ self currentDirectoriesValue. |
3982 | 9756 |
! |
9757 |
||
9758 |
currentSelectedFiles |
|
17865 | 9759 |
^ self currentSelectedObjects reject:#isDirectory. |
7560 | 9760 |
|
9761 |
"Modified: / 04-12-2006 / 13:14:39 / cg" |
|
3982 | 9762 |
! |
9763 |
||
6460 | 9764 |
currentSelectedObjects |
9765 |
^ self currentFileNameHolder value |
|
9766 |
! |
|
9767 |
||
3982 | 9768 |
firstSelectedFile |
7560 | 9769 |
^ self currentSelectedObjects |
12102 | 9770 |
detect:[:file | (file ? '') asFilename isDirectory not] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9771 |
ifNone:[]. |
7560 | 9772 |
|
9773 |
"Modified: / 04-12-2006 / 13:14:50 / cg" |
|
4414 | 9774 |
! |
9775 |
||
9490 | 9776 |
hasOnlyDirectoriesSelected |
9777 |
^ self currentSelectedObjects conform:[:file | file isDirectory]. |
|
9778 |
||
9779 |
"Created: / 20-05-2010 / 10:45:03 / cg" |
|
9780 |
! |
|
9781 |
||
4414 | 9782 |
hasOnlyFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9783 |
|
7560 | 9784 |
^ self currentSelectedObjects conform:[:file | file isDirectory not]. |
9785 |
||
9786 |
"Modified: / 04-12-2006 / 13:15:01 / cg" |
|
4414 | 9787 |
! |
9788 |
||
9490 | 9789 |
hasTwoDirectoriesSelected |
9790 |
||
9791 |
^ self currentSelectedObjects size == 2 |
|
9792 |
and:[self hasOnlyDirectoriesSelected] |
|
9793 |
||
9794 |
"Created: / 20-05-2010 / 10:45:18 / cg" |
|
9795 |
! |
|
9796 |
||
4414 | 9797 |
hasTwoFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9798 |
|
7560 | 9799 |
^ self currentSelectedObjects size == 2 |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9800 |
and:[self hasOnlyFilesSelected] |
7560 | 9801 |
|
9802 |
"Modified: / 04-12-2006 / 13:15:04 / cg" |
|
14577 | 9803 |
! |
9804 |
||
18751 | 9805 |
selectFiles:aCollectionOfFiles |
9806 |
self subclassResponsibility |
|
9807 |
||
9808 |
"Created: / 02-05-2019 / 18:40:04 / Claus Gittinger" |
|
9809 |
! |
|
9810 |
||
14577 | 9811 |
selectNextFile |
9812 |
self |
|
9813 |
applicationNamed:#DirectoryContentsBrowser |
|
9814 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectNextFile ]]. |
|
9815 |
! |
|
9816 |
||
9817 |
selectPreviousFile |
|
9818 |
self |
|
9819 |
applicationNamed:#DirectoryContentsBrowser |
|
9820 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectPreviousFile ]]. |
|
18751 | 9821 |
! |
9822 |
||
9823 |
selectedItems |
|
9824 |
self subclassResponsibility |
|
9825 |
||
9826 |
"Created: / 02-05-2019 / 21:27:38 / Claus Gittinger" |
|
3892 | 9827 |
! ! |
9828 |
||
3964 | 9829 |
!AbstractFileBrowser methodsFor:'sorting'! |
9830 |
||
3989 | 9831 |
currentSortOrder |
17790 | 9832 |
^ self |
9833 |
aspectFor:#currentSortOrder |
|
9834 |
ifAbsent:[ |
|
9835 |
(Dictionary new |
|
9836 |
at:#column put:nil; |
|
9837 |
at:#reverse put:false; |
|
9838 |
at:#sortCaseless put:false; |
|
9839 |
yourself |
|
9840 |
) asValue |
|
9841 |
]. |
|
9842 |
||
9843 |
"Modified: / 25-11-2017 / 17:43:00 / cg" |
|
3989 | 9844 |
! |
9845 |
||
9846 |
sortBlockHolder |
|
9847 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 9848 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9849 |
selector:#fileName |
|
9850 |
sortCaseless:self sortCaseless value |
|
9851 |
sortReverse:false) asValue. |
|
3989 | 9852 |
]. |
9853 |
! |
|
9854 |
||
9855 |
sortBlockProperty |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9856 |
|v| |
4027 | 9857 |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9858 |
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
|
9859 |
v addDependent:self. |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9860 |
^ v. |
3989 | 9861 |
! |
9862 |
||
9863 |
sortCaseless |
|
4201 | 9864 |
" aspect for sort caseless " |
3989 | 9865 |
|
13000 | 9866 |
^ self |
9867 |
aspectFor:#sortCaseless |
|
9868 |
ifAbsent:[ (Filename isCaseSensitive not) asValue ] |
|
3989 | 9869 |
! |
9870 |
||
4074 | 9871 |
sortDirectoriesBeforeFiles |
9872 |
||
4201 | 9873 |
" aspect for sort directories always before files" |
4074 | 9874 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
9875 |
! |
|
9876 |
||
3989 | 9877 |
sortFileListsBy:instanceName |
9878 |
||
9879 |
self sortFileListsBy:instanceName withReverse:true |
|
9880 |
! |
|
9881 |
||
9882 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
9883 |
| aSymbol sortCaselessLocal currentSortOrder sorter isReverse| |
3964 | 9884 |
|
9885 |
aSymbol := instanceName asSymbol. |
|
4027 | 9886 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 9887 |
sortCaselessLocal := self sortCaseless value. |
4027 | 9888 |
currentSortOrder := self currentSortOrder value. |
17790 | 9889 |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9890 |
currentSortOrder isEmptyOrNil ifTrue:[ |
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9891 |
self currentSortOrder value:(currentSortOrder := Dictionary new). |
4343 | 9892 |
currentSortOrder at:#column put:aSymbol. |
9893 |
currentSortOrder at:#reverse put:false. |
|
9894 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 9895 |
] ifFalse:[ |
4343 | 9896 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
9897 |
"/ sort caseless changed |
|
9898 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
9899 |
] ifFalse:[ |
|
9900 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
9901 |
"/ same column like before - change sort order ifReverse is true |
|
9902 |
aBoolean ifTrue:[ |
|
9903 |
isReverse := currentSortOrder at:#reverse. |
|
9904 |
currentSortOrder at:#reverse put:(isReverse not). |
|
9905 |
]. |
|
9906 |
] ifFalse:[ |
|
9907 |
"/ another column - remark column |
|
9908 |
currentSortOrder at:#column put:aSymbol. |
|
9909 |
] |
|
9910 |
] |
|
3964 | 9911 |
]. |
4027 | 9912 |
self currentSortOrder changed. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9913 |
|
5383 | 9914 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9915 |
selector:instanceName |
|
9916 |
sortCaseless:sortCaselessLocal |
|
9917 |
sortReverse:(currentSortOrder at:#reverse). |
|
9918 |
self sortBlockHolder value:sorter. |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9919 |
|
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9920 |
"Modified: / 18-09-2007 / 09:42:47 / cg" |
17790 | 9921 |
"Modified (format): / 25-11-2017 / 17:43:31 / cg" |
3964 | 9922 |
! ! |
9923 |
||
3892 | 9924 |
!AbstractFileBrowser methodsFor:'startup & release'! |
9925 |
||
16720 | 9926 |
initializeAspects |
9927 |
aspects := IdentityDictionary new. |
|
9928 |
aspects at:#applications put:(IdentityDictionary new). |
|
9929 |
! |
|
9930 |
||
3892 | 9931 |
makeDependent |
4074 | 9932 |
self filterModel addDependent:self. |
4004 | 9933 |
self currentFileNameHolder addDependent:self. |
4074 | 9934 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 9935 |
self sortCaseless addDependent:self. |
4011 | 9936 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
9937 |
self rootHolder addDependent:self. |
3892 | 9938 |
! |
9939 |
||
9940 |
masterApplication:anApplication |
|
9941 |
||
9942 |
masterApplication isNil ifTrue:[ |
|
4414 | 9943 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
9944 |
aspects := anApplication aspects |
|
9945 |
] ifFalse:[ |
|
9946 |
aspects isNil ifTrue:[ |
|
16721 | 9947 |
self initializeAspects. |
4414 | 9948 |
] |
9949 |
]. |
|
9950 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9951 |
"/ self makeDependent. |
3892 | 9952 |
]. |
3952 | 9953 |
^ super masterApplication:anApplication. |
3892 | 9954 |
! |
9955 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9956 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9957 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9958 |
super postBuildWith:aBuilder. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9959 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9960 |
|
3892 | 9961 |
postOpenWith:aBuilder |
9962 |
||
9963 |
super postOpenWith:aBuilder. |
|
14655 | 9964 |
"/ now done for all windowGroups by the group itself |
9965 |
"/ self windowGroup showWaitCursorWhenBusyForMillis:100. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9966 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9967 |
"Modified: / 25-07-2006 / 09:12:45 / cg" |
3892 | 9968 |
! ! |
9969 |
||
9970 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
9971 |
||
9972 |
files |
|
9973 |
"return the value of the instance variable 'files' (automatically generated)" |
|
9974 |
||
9975 |
^ files |
|
9976 |
! |
|
9977 |
||
9978 |
files:something |
|
9979 |
"set the value of the instance variable 'files' (automatically generated)" |
|
9980 |
||
9981 |
files := something. |
|
9982 |
! |
|
9983 |
||
9984 |
method |
|
9985 |
"return the value of the instance variable 'method' (automatically generated)" |
|
9986 |
||
9987 |
^ method |
|
9988 |
! |
|
9989 |
||
9990 |
method:something |
|
9991 |
"set the value of the instance variable 'method' (automatically generated)" |
|
9992 |
||
9993 |
method := something. |
|
9994 |
! ! |
|
9995 |
||
9996 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
9997 |
||
9998 |
locked |
|
9999 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
10000 |
||
10001 |
locked isNil ifTrue:[ |
|
4414 | 10002 |
locked := false. |
3892 | 10003 |
]. |
10004 |
^ locked |
|
10005 |
! ! |
|
10006 |
||
10007 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
10008 |
||
10009 |
doIfUnLocked:aBlock |
|
10010 |
||
10011 |
self locked ifFalse:[ |
|
4414 | 10012 |
aBlock value. |
3892 | 10013 |
]. |
10014 |
! |
|
10015 |
||
10016 |
doLocked:aBlock |
|
10017 |
||
10018 |
locked := true. |
|
4004 | 10019 |
aBlock ensure:[ |
4414 | 10020 |
locked := false. |
4004 | 10021 |
] |
3892 | 10022 |
! ! |
10023 |
||
3952 | 10024 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
10025 |
||
6369 | 10026 |
defaultHistorySize |
10027 |
^ 50 |
|
3892 | 10028 |
! ! |
10029 |
||
6371 | 10030 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 10031 |
|
10032 |
new |
|
6371 | 10033 |
^ (super new) initializeHistory. |
6369 | 10034 |
! ! |
10035 |
||
10036 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
10037 |
||
10038 |
historySize |
|
10039 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
10040 |
^ historySize |
|
10041 |
! |
|
10042 |
||
10043 |
historySize:aNumber |
|
10044 |
historySize := aNumber |
|
4032 | 10045 |
! ! |
10046 |
||
3892 | 10047 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
10048 |
||
3952 | 10049 |
addToHistory:aPath |
15803 | 10050 |
| item pathToAdd sep| |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10051 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10052 |
pathToAdd := aPath. |
15803 | 10053 |
(pathToAdd endsWith:(sep := Filename separator)) ifTrue:[ |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10054 |
pathToAdd asFilename isRootDirectory ifFalse:[ |
15803 | 10055 |
pathToAdd := pathToAdd copyButLast:(sep asString size). |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10056 |
] |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10057 |
]. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10058 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10059 |
item := self getItemFor:pathToAdd. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10060 |
self backForwardListAdd:pathToAdd. |
3952 | 10061 |
item isNil ifTrue:[ |
4347 | 10062 |
" not already in history" |
6369 | 10063 |
self size >= self historySize ifTrue:[ |
4347 | 10064 |
self removeLast. |
10065 |
]. |
|
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10066 |
item := DirectoryHistoryItem path:pathToAdd. |
3952 | 10067 |
] ifFalse:[ |
4347 | 10068 |
"already been there before; move the entry to |
10069 |
the beginning, so it will fall out later." |
|
10070 |
self remove:item. |
|
10381
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10071 |
]. |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10072 |
self addFirst:item |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10073 |
|
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10074 |
"Modified: / 24-07-2011 / 07:12:54 / cg" |
3952 | 10075 |
! |
10076 |
||
4347 | 10077 |
backForwardListAdd:aPath |
10078 |
|pathIndex| |
|
10079 |
||
10080 |
pathIndex := backForwardList indexOf:aPath. |
|
10081 |
pathIndex == 0 ifTrue:[ |
|
10082 |
" a new path comes in remove forward paths " |
|
10083 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
10084 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
10085 |
]. |
|
10086 |
] ifFalse:[ |
|
10087 |
backForwardList remove:aPath. |
|
10088 |
pathIndex <= backForwardIndex ifTrue:[ |
|
10089 |
backForwardIndex := backForwardIndex - 1. |
|
10090 |
] |
|
4022 | 10091 |
]. |
4347 | 10092 |
backForwardList add:aPath afterIndex:backForwardIndex. |
10093 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 10094 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 10095 |
backForwardList removeFirst. |
10096 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 10097 |
]. |
4347 | 10098 |
! |
10099 |
||
10100 |
goBackward |
|
4288 | 10101 |
"return the first path of the backward list; |
10102 |
remove it from the back list and add it ti the forward list." |
|
4022 | 10103 |
|
4347 | 10104 |
|retPath| |
10105 |
||
10106 |
self canBackward ifTrue:[ |
|
10107 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
10108 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 10109 |
]. |
4022 | 10110 |
^ retPath. |
10111 |
! |
|
10112 |
||
10113 |
goForward |
|
4288 | 10114 |
"return the first path of the forward list; |
10115 |
remove it from the list." |
|
4022 | 10116 |
|
4347 | 10117 |
|retPath| |
10118 |
||
10119 |
self canForward ifTrue:[ |
|
10120 |
retPath := backForwardList at:backForwardIndex + 1. |
|
10121 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 10122 |
]. |
4022 | 10123 |
^ retPath. |
10124 |
! |
|
10125 |
||
10126 |
resetForwardBackward |
|
10127 |
||
4347 | 10128 |
self initialize |
4022 | 10129 |
! |
10130 |
||
10131 |
setPosition:aPosition for:aPath |
|
10132 |
||
10133 |
self do:[:item| |
|
4414 | 10134 |
item path = aPath ifTrue:[ |
10135 |
item position:aPosition. |
|
10136 |
] |
|
4022 | 10137 |
]. |
3892 | 10138 |
! ! |
10139 |
||
4870 | 10140 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 10141 |
|
6371 | 10142 |
initializeHistory |
4032 | 10143 |
|
4347 | 10144 |
backForwardList := OrderedCollection new. |
10145 |
self reverseDo:[:el| |
|
10146 |
backForwardList add:el path. |
|
10147 |
]. |
|
10148 |
backForwardIndex := backForwardList size. |
|
4032 | 10149 |
! ! |
10150 |
||
3892 | 10151 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
10152 |
||
4288 | 10153 |
canBackward |
4347 | 10154 |
|
10155 |
^ backForwardIndex > 1 |
|
4288 | 10156 |
! |
10157 |
||
3892 | 10158 |
canForward |
4347 | 10159 |
|
10160 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
10161 |
! |
|
10162 |
||
10163 |
getBackCollection |
|
10164 |
||
10165 |
| backCol | |
|
10166 |
||
10167 |
backCol := OrderedCollection new. |
|
10168 |
self canBackward ifTrue:[ |
|
10169 |
| tmpCol | |
|
10170 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
10171 |
tmpCol reverseDo:[ :el| |
|
10172 |
backCol add:el. |
|
10173 |
] |
|
10174 |
]. |
|
10175 |
^ backCol |
|
3952 | 10176 |
! |
10177 |
||
10178 |
getForwardCollection |
|
10179 |
||
4347 | 10180 |
| forwCol | |
10181 |
||
10182 |
forwCol := OrderedCollection new. |
|
10183 |
self canForward ifTrue:[ |
|
10184 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
10185 |
]. |
|
10186 |
^ forwCol |
|
3952 | 10187 |
! |
10188 |
||
10189 |
getItemFor:aPath |
|
6627 | 10190 |
^ self detect:[:item| item path = aPath] ifNone:nil. |
10191 |
"/ self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
10192 |
"/ ^ nil. |
|
3952 | 10193 |
! |
10194 |
||
10195 |
getPositionFor:aPath |
|
10196 |
||
10197 |
|item| |
|
10198 |
||
10199 |
item := self getItemFor:aPath. |
|
10200 |
||
10201 |
item notNil ifTrue:[ |
|
4414 | 10202 |
^ item position. |
3952 | 10203 |
]. |
10204 |
^ nil |
|
10205 |
! |
|
10206 |
||
10207 |
includesPath:aPath |
|
6627 | 10208 |
^ self contains:[:item | item path = aPath]. |
10209 |
||
10210 |
"/ self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
10211 |
"/ ^ false. |
|
4347 | 10212 |
! |
10213 |
||
10214 |
nextBackwardItem |
|
10215 |
"return the first path of the backward list" |
|
10216 |
||
10217 |
|retPath| |
|
10218 |
||
10219 |
self canBackward ifTrue:[ |
|
10220 |
retPath := backForwardList at:backForwardIndex. |
|
10221 |
]. |
|
10222 |
^ retPath. |
|
10223 |
! |
|
10224 |
||
10225 |
nextForwardItem |
|
10226 |
"return the first path of the forward list" |
|
10227 |
||
10228 |
|retPath| |
|
10229 |
||
10230 |
self canForward ifTrue:[ |
|
10231 |
retPath := backForwardList at:backForwardIndex + 1. |
|
10232 |
]. |
|
10233 |
^ retPath. |
|
3952 | 10234 |
! ! |
10235 |
||
10236 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
10237 |
||
10238 |
path:aPath |
|
10239 |
||
10240 |
^ self new path:aPath |
|
10241 |
! ! |
|
10242 |
||
10243 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
10244 |
||
6433 | 10245 |
asFilename |
10246 |
^ path asFilename |
|
10247 |
! |
|
10248 |
||
3952 | 10249 |
path |
10250 |
"return the value of the instance variable 'path' (automatically generated)" |
|
10251 |
||
10252 |
^ path |
|
10253 |
! |
|
10254 |
||
10255 |
path:something |
|
10256 |
"set the value of the instance variable 'path' (automatically generated)" |
|
10257 |
||
10258 |
path := something. |
|
10259 |
! |
|
10260 |
||
10261 |
position |
|
10262 |
"return the value of the instance variable 'position' (automatically generated)" |
|
10263 |
||
10264 |
^ position |
|
10265 |
! |
|
10266 |
||
10267 |
position:something |
|
10268 |
"set the value of the instance variable 'position' (automatically generated)" |
|
10269 |
||
10270 |
position := something. |
|
10271 |
! |
|
10272 |
||
10273 |
printString |
|
10274 |
||
10275 |
^ self path asString |
|
3892 | 10276 |
! ! |
10277 |
||
10278 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
10279 |
||
10280 |
withValue:aValue isHolder:aBoolean |
|
10281 |
||
10282 |
| instance | |
|
10283 |
||
10284 |
instance := self basicNew. |
|
10285 |
instance value:aValue. |
|
10286 |
instance isHolder:aBoolean. |
|
10287 |
^ instance |
|
10288 |
! ! |
|
10289 |
||
10290 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
10291 |
||
10292 |
isHolder |
|
10293 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
10294 |
||
10295 |
^ isHolder |
|
10296 |
! |
|
10297 |
||
10298 |
isHolder:something |
|
10299 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
|
10300 |
||
10301 |
isHolder := something. |
|
10302 |
! |
|
10303 |
||
10304 |
value |
|
10305 |
"return the value of the instance variable 'value' (automatically generated)" |
|
10306 |
||
10307 |
^ value |
|
10308 |
! |
|
10309 |
||
10310 |
value:something |
|
10311 |
"set the value of the instance variable 'value' (automatically generated)" |
|
10312 |
||
10313 |
value := something. |
|
10314 |
! ! |
|
10315 |
||
10316 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
10317 |
||
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10318 |
version |
15803 | 10319 |
^ '$Header$' |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10320 |
! |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10321 |
|
8832 | 10322 |
version_CVS |
15803 | 10323 |
^ '$Header$' |
3892 | 10324 |
! ! |
12094 | 10325 |