author | Claus Gittinger <cg@exept.de> |
Sat, 13 Jul 2019 13:59:16 +0200 | |
changeset 18894 | 1b99fefd5825 |
parent 18867 | d952072b8c6c |
child 18931 | 0d7655a4fbf9 |
permissions | -rw-r--r-- |
18867 | 1 |
"{ Encoding: utf8 }" |
2 |
||
5140 | 3 |
" |
4 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
15211 | 14 |
"{ Package: 'stx:libtool' }" |
15 |
||
16 |
"{ NameSpace: Smalltalk }" |
|
17 |
||
18 |
ApplicationModel subclass:#AbstractFileBrowser |
|
19 |
instanceVariableNames:'aspects' |
|
16720 | 20 |
classVariableNames:'CommandHistory CommandHistorySize DefaultCommandPerSuffix |
21 |
DefaultFilters DirectoryBookmarks LastEnforcedNameSpace |
|
22 |
LastFileDiffDirectory LastFileDiffFile LastFileSelection |
|
23 |
LastMercurialRepository LastMoveDestination LastMustMatchPattern |
|
18609 | 24 |
LastScriptBlockString MaxFileSizeShownWithoutAsking RootHolder |
25 |
RuntimeAspects VisitedDirectories' |
|
15211 | 26 |
poolDictionaries:'' |
27 |
category:'Interface-Tools-File' |
|
28 |
! |
|
3892 | 29 |
|
30 |
AbstractFileBrowser class instanceVariableNames:'DisabledCursorImage EnabledCursorImage' |
|
31 |
||
32 |
" |
|
33 |
The following class instance variables are inherited by this class: |
|
34 |
||
14126 | 35 |
ApplicationModel - ClassResources |
36 |
Model - |
|
37 |
Object - |
|
3892 | 38 |
" |
39 |
! |
|
40 |
||
41 |
Object subclass:#Clipboard |
|
14126 | 42 |
instanceVariableNames:'method files' |
43 |
classVariableNames:'' |
|
44 |
poolDictionaries:'' |
|
45 |
privateIn:AbstractFileBrowser |
|
3892 | 46 |
! |
47 |
||
48 |
Object subclass:#CodeExecutionLock |
|
14126 | 49 |
instanceVariableNames:'locked' |
50 |
classVariableNames:'' |
|
51 |
poolDictionaries:'' |
|
52 |
privateIn:AbstractFileBrowser |
|
3892 | 53 |
! |
54 |
||
4366 | 55 |
List subclass:#DirectoryHistory |
14126 | 56 |
instanceVariableNames:'forwardList backList lastWasForwardPath lastBackPath lastAddPath |
57 |
backForwardList backForwardIndex historySize' |
|
58 |
classVariableNames:'HistorySize' |
|
59 |
poolDictionaries:'' |
|
60 |
privateIn:AbstractFileBrowser |
|
3952 | 61 |
! |
62 |
||
63 |
Object subclass:#DirectoryHistoryItem |
|
14126 | 64 |
instanceVariableNames:'path position' |
65 |
classVariableNames:'' |
|
66 |
poolDictionaries:'' |
|
67 |
privateIn:AbstractFileBrowser::DirectoryHistory |
|
3892 | 68 |
! |
69 |
||
70 |
Object subclass:#SaveAspectItem |
|
14126 | 71 |
instanceVariableNames:'value isHolder' |
72 |
classVariableNames:'' |
|
73 |
poolDictionaries:'' |
|
74 |
privateIn:AbstractFileBrowser |
|
3892 | 75 |
! |
76 |
||
5140 | 77 |
!AbstractFileBrowser class methodsFor:'documentation'! |
78 |
||
79 |
copyright |
|
80 |
" |
|
81 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
82 |
All Rights Reserved |
|
83 |
||
84 |
This software is furnished under a license and may be used |
|
85 |
only in accordance with the terms of that license and with the |
|
86 |
inclusion of the above copyright notice. This software may not |
|
87 |
be provided or otherwise made available to, or used by, any |
|
88 |
other person. No title to or ownership of the software is |
|
89 |
hereby transferred. |
|
90 |
" |
|
5967 | 91 |
! |
92 |
||
93 |
documentation |
|
94 |
" |
|
95 |
[Author:] |
|
96 |
Christian Penk |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
97 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
98 |
Notice: this certainly needs a redesign - all those abstract-abstract classes which |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
99 |
define stuff which is only needed in some parts makes this hard to understand. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
100 |
Especially the fact, that AbstractFileBrowser defines things both as abstract superclass |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
101 |
and as a container is almost incomprehensable... |
17768 | 102 |
|
103 |
[class variables:] |
|
104 |
CommandHistory |
|
105 |
CommandHistorySize |
|
106 |
DefaultCommandPerSuffix |
|
107 |
DefaultFilters |
|
108 |
DirectoryBookmarks |
|
109 |
LastEnforcedNameSpace |
|
110 |
LastFileDiffDirectory |
|
111 |
LastFileDiffFile |
|
112 |
LastFileSelection |
|
113 |
LastMercurialRepository |
|
114 |
LastMoveDestination |
|
115 |
LastMustMatchPattern |
|
116 |
LastScriptBlockString |
|
117 |
RootHolder |
|
118 |
RuntimeAspects |
|
119 |
VisitedDirectories |
|
120 |
MaxFileSizeShownWithoutAsking ..... for big files, I will ask if only the first part is |
|
121 |
to be shown. This number (if non-nil) suppresses this |
|
122 |
question for files smaller. |
|
123 |
The initial default is 1Mb (1024*1024) |
|
5967 | 124 |
" |
5140 | 125 |
! ! |
3892 | 126 |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
127 |
!AbstractFileBrowser class methodsFor:'accessing'! |
3952 | 128 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
129 |
currentSelection |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
130 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
131 |
LastFileSelection isNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
132 |
LastFileSelection := #(). |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
133 |
]. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
134 |
^ LastFileSelection |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
135 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
136 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
137 |
currentSelection:aFilenameCol |
6589 | 138 |
aFilenameCol notEmptyOrNil ifTrue:[ |
12102 | 139 |
LastFileSelection := aFilenameCol collect:[:file | (file ? '') asFilename] |
6589 | 140 |
] |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
141 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
142 |
|
3952 | 143 |
directoryHistory |
144 |
||
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
145 |
VisitedDirectories isNil ifTrue:[ |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
146 |
VisitedDirectories := self directoryHistoryClass new. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
147 |
"/ VisitedDirectories inspect. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
148 |
]. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
149 |
^ VisitedDirectories |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
150 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
151 |
"Modified: / 21-11-2012 / 08:45:49 / cg" |
3952 | 152 |
! |
153 |
||
17768 | 154 |
maxFileSizeShownWithoutAsking |
155 |
"the max. filesize which is loaded without asking if only the first |
|
156 |
part should be shown" |
|
18770 | 157 |
|
158 |
MaxFileSizeShownWithoutAsking notNil ifTrue:[^ MaxFileSizeShownWithoutAsking]. |
|
159 |
ExternalAddress pointerSize == 8 ifTrue:[ |
|
160 |
^ (32*1024*1024) |
|
161 |
]. |
|
162 |
^ (4*1024*1024) |
|
17768 | 163 |
|
164 |
"Created: / 19-11-2017 / 14:48:19 / cg" |
|
18770 | 165 |
"Modified: / 22-05-2019 / 18:19:24 / Claus Gittinger" |
17768 | 166 |
! |
167 |
||
168 |
maxFileSizeShownWithoutAsking:anIntegerOrNilForDefault |
|
169 |
"the max. filesize which is loaded without asking if only the first |
|
17769 | 170 |
part should be shown. |
171 |
Nil resets to the default (currently 1Mb)" |
|
17768 | 172 |
|
173 |
MaxFileSizeShownWithoutAsking := anIntegerOrNilForDefault |
|
174 |
||
17769 | 175 |
" |
176 |
self maxFileSizeShownWithoutAsking:nil |
|
177 |
" |
|
178 |
||
17768 | 179 |
"Created: / 19-11-2017 / 14:48:45 / cg" |
180 |
! |
|
181 |
||
3952 | 182 |
resetClassVars |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
183 |
VisitedDirectories := nil. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
184 |
LastFileSelection := nil. |
5936 | 185 |
|
186 |
" |
|
187 |
AbstractFileBrowser resetClassVars |
|
188 |
" |
|
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
189 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
190 |
"Modified: / 21-11-2012 / 08:45:53 / cg" |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
191 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
192 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
193 |
rootHolder |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
194 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
195 |
^ RootHolder |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
196 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
197 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
198 |
rootHolder:aRoot |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
199 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
200 |
RootHolder := aRoot |
3952 | 201 |
! ! |
202 |
||
4915 | 203 |
!AbstractFileBrowser class methodsFor:'accessing-bookmarks'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
204 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
205 |
addBookmark:aDirectoryPath |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
206 |
"add aDirectoryPath to the list of our known bookmarks. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
207 |
Do not add duplicates." |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
208 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
209 |
|bookmarks| |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
210 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
211 |
bookmarks := self directoryBookmarks. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
212 |
(bookmarks includes:aDirectoryPath) ifFalse:[ |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
213 |
bookmarks add:aDirectoryPath asFilename. |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
214 |
]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
215 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
216 |
|
8013 | 217 |
bookmarksFrom:aFileNameOrString |
12390 | 218 |
|bookmarks s fileName line| |
8013 | 219 |
|
220 |
fileName := aFileNameOrString asFilename. |
|
221 |
[ |
|
222 |
s := fileName readStream. |
|
223 |
] on:OpenError do:[:ex| |
|
224 |
^ nil. |
|
225 |
]. |
|
226 |
||
227 |
bookmarks := OrderedCollection new. |
|
228 |
[s atEnd] whileFalse:[ |
|
12390 | 229 |
line := s nextLine. |
230 |
(line startsWith:';') ifFalse:[ |
|
231 |
bookmarks add:(Base64Coder decode:line) asString. |
|
232 |
] |
|
8013 | 233 |
]. |
234 |
s close. |
|
235 |
||
236 |
^ bookmarks |
|
237 |
! |
|
238 |
||
4679 | 239 |
defaultBookMarksFileDirectory |
12390 | 240 |
"the directory, where the default bookmarks are stored (as defaultBookMarksFilename)" |
241 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
242 |
^ Filename homeDirectory |
4679 | 243 |
! |
244 |
||
245 |
defaultBookMarksFilename |
|
12390 | 246 |
"the filename, in which the default bookmarks are stored (in defaultBookMarksDirectory)" |
247 |
||
4679 | 248 |
^ '.fileBrowserBookmarks' |
249 |
! |
|
250 |
||
251 |
directoryBookmarks |
|
252 |
DirectoryBookmarks isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
253 |
self loadBookmarksFrom:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename). |
4679 | 254 |
|
255 |
DirectoryBookmarks isEmptyOrNil ifTrue:[ |
|
17979 | 256 |
DirectoryBookmarks := |
257 |
OrderedCollection |
|
258 |
with:(Filename homeDirectory asAbsoluteFilename) |
|
259 |
with:(Filename currentDirectory asAbsoluteFilename). |
|
4679 | 260 |
] |
261 |
]. |
|
262 |
^ DirectoryBookmarks |
|
263 |
||
264 |
" |
|
5438
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
265 |
DirectoryBookmarks := nil. |
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
266 |
self directoryBookmarks. |
4679 | 267 |
" |
268 |
! |
|
269 |
||
8013 | 270 |
directoryBookmarks: collectionOfFilenames |
271 |
||
272 |
DirectoryBookmarks := collectionOfFilenames. |
|
273 |
self saveBookmarksInDefaultBookmarksFile. |
|
274 |
! |
|
275 |
||
276 |
editBookmarksWithDefault: aFilenameOrNil |
|
277 |
| oldBookmarks newBookmarks | |
|
278 |
||
279 |
oldBookmarks := self directoryBookmarks copy. |
|
280 |
newBookmarks := BookmarksEditDialog openWith: oldBookmarks defaultBookmark: aFilenameOrNil. |
|
281 |
newBookmarks isNil ifTrue:[^ self]. |
|
282 |
self directoryBookmarks: newBookmarks. |
|
9681
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
283 |
|
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
284 |
"Modified: / 13-01-2011 / 12:52:28 / cg" |
8013 | 285 |
! |
286 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
287 |
hasBookmarks |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
288 |
^ self directoryBookmarks notEmptyOrNil |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
289 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
290 |
|
4679 | 291 |
loadBookmarksFrom:aFileNameOrString |
8013 | 292 |
|bookmarks| |
293 |
||
294 |
bookmarks := self bookmarksFrom: aFileNameOrString. |
|
295 |
bookmarks isNil ifTrue:[^ self]. |
|
4679 | 296 |
|
297 |
DirectoryBookmarks := OrderedCollection new. |
|
298 |
bookmarks do:[:eachPath | |
|
299 |
self addBookmark:eachPath asFilename |
|
300 |
]. |
|
301 |
! |
|
302 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
303 |
removeBookmark:aDirectoryPath |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
304 |
|bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
305 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
306 |
bookmarks := self directoryBookmarks. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
307 |
bookmarks isEmptyOrNil ifTrue:[ ^ self]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
308 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
309 |
bookmarks remove:aDirectoryPath ifAbsent:[]. |
4679 | 310 |
! |
311 |
||
312 |
saveBookmarks |
|
313 |
|fn| |
|
314 |
||
315 |
fn := Dialog |
|
18747 | 316 |
requestFileNameForSave:(self resources string:'Save Bookmarks') |
4679 | 317 |
default:(self defaultBookMarksFilename) |
318 |
fromDirectory:(self defaultBookMarksFileDirectory). |
|
319 |
fn isEmptyOrNil ifTrue:[^ self]. |
|
320 |
||
321 |
self saveBookmarksIn:fn |
|
9607 | 322 |
|
323 |
"Modified: / 27-10-2010 / 11:27:09 / cg" |
|
18747 | 324 |
"Modified: / 01-05-2019 / 11:45:37 / Claus Gittinger" |
4679 | 325 |
! |
326 |
||
8013 | 327 |
saveBookmarks: bookmarks in:aFileNameOrString |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
328 |
"save the bokmarks in aFileNameOrString. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
329 |
Use Base64 coding" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
330 |
|
13683 | 331 |
|bookmarkStream fileName coder| |
4679 | 332 |
|
333 |
fileName := aFileNameOrString asFilename. |
|
334 |
fileName exists ifTrue:[ |
|
13683 | 335 |
fileName renameTo:(fileName addSuffix:'sav'). |
4679 | 336 |
]. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
337 |
bookmarkStream := fileName writeStream. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
338 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
339 |
"save each bookmark in one line" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
340 |
coder := (Base64Coder on:bookmarkStream) lineLimit:nil. |
4679 | 341 |
bookmarks do:[:eachPath | |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
342 |
eachPath asFilename pathName acceptVisitor:coder. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
343 |
coder flush. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
344 |
bookmarkStream cr. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
345 |
]. |
12391 | 346 |
bookmarkStream syncData; close. |
5960 | 347 |
! |
348 |
||
8013 | 349 |
saveBookmarksIn:aFileNameOrString |
350 |
"save the bokmarks in aFileNameOrString. |
|
351 |
Use Base64 coding" |
|
352 |
||
353 |
| bookmarks | |
|
354 |
||
355 |
bookmarks := self directoryBookmarks. |
|
356 |
self saveBookmarks: bookmarks in:aFileNameOrString |
|
357 |
! |
|
358 |
||
5960 | 359 |
saveBookmarksInDefaultBookmarksFile |
360 |
self saveBookmarksIn:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename) |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
361 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
362 |
|
4915 | 363 |
!AbstractFileBrowser class methodsFor:'accessing-classes'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
364 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
365 |
directoryHistoryClass |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
366 |
^ DirectoryHistory |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
367 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
368 |
"Modified: / 21-11-2012 / 08:46:34 / cg" |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
369 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
370 |
|
18820 | 371 |
!AbstractFileBrowser class methodsFor:'aspects-visibility'! |
372 |
||
373 |
cvsMenusAreShown |
|
374 |
^ ConfigurableFeatures includesFeature: #CVSSupportEnabled |
|
375 |
||
376 |
"Created: / 15-01-2012 / 13:00:05 / cg" |
|
377 |
"Modified: / 19-01-2012 / 10:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
378 |
! |
|
379 |
||
380 |
gitMenusAreShown |
|
381 |
^ (ConfigurableFeatures includesFeature: #GITSupportEnabled) |
|
382 |
||
383 |
"Created: / 10-06-2019 / 15:56:33 / Claus Gittinger" |
|
384 |
! |
|
385 |
||
386 |
hgMenusAreShown |
|
387 |
^ (ConfigurableFeatures includesFeature: #HGSupportEnabled) |
|
388 |
||
389 |
"Created: / 14-01-2013 / 11:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
390 |
! |
|
391 |
||
392 |
mercurialMenusAreShown |
|
393 |
^ ConfigurableFeatures hasMercurialSupportEnabled |
|
394 |
||
395 |
"Created: / 15-01-2012 / 13:00:00 / cg" |
|
396 |
! |
|
397 |
||
398 |
perforceMenusAreShown |
|
399 |
^ (ConfigurableFeatures includesFeature: #PerforceSupportEnabled) |
|
400 |
and:[ ConfigurableFeatures hasPerforceSupportEnabled ] |
|
401 |
||
402 |
"Created: / 15-01-2012 / 13:12:11 / cg" |
|
403 |
"Modified: / 19-01-2012 / 10:43:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
404 |
"Modified: / 02-11-2012 / 11:19:59 / cg" |
|
405 |
! |
|
406 |
||
407 |
svnMenusAreShown |
|
408 |
^ ConfigurableFeatures includesFeature: #SubversionSupportEnabled |
|
409 |
||
410 |
"Created: / 15-01-2012 / 13:02:03 / cg" |
|
411 |
"Modified: / 19-01-2012 / 10:43:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
412 |
! ! |
|
413 |
||
3892 | 414 |
!AbstractFileBrowser class methodsFor:'defaults'! |
415 |
||
416 |
commandHistory |
|
417 |
||
418 |
CommandHistory isNil ifTrue:[ |
|
4414 | 419 |
CommandHistory := OrderedCollection new. |
3892 | 420 |
]. |
421 |
^ CommandHistory |
|
422 |
! |
|
423 |
||
424 |
commandHistorySize |
|
4190 | 425 |
"max no of entries in the HistoryList " |
6369 | 426 |
|
3892 | 427 |
CommandHistorySize isNil ifTrue:[ |
6369 | 428 |
CommandHistorySize := 150 |
3892 | 429 |
]. |
430 |
^ CommandHistorySize |
|
431 |
! |
|
432 |
||
433 |
defaultFilterList |
|
434 |
||
435 |
DefaultFilters isNil ifTrue:[ |
|
4414 | 436 |
DefaultFilters := #( '*' |
437 |
'*.st' |
|
438 |
'*.[h,c]*' |
|
12760 | 439 |
'*.txt; *.htm*' |
440 |
'*.gif; *.xpm; *.jpg; *.png' |
|
441 |
'~*o; ~*.obj; ~*.dll;' |
|
4414 | 442 |
) |
3892 | 443 |
]. |
444 |
^ DefaultFilters. |
|
12760 | 445 |
|
446 |
" |
|
447 |
DefaultFilters := nil |
|
448 |
" |
|
3892 | 449 |
! |
450 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
451 |
initialCommandFor:fileName in:aDirectory intoBox:aBox |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
452 |
"set a useful initial command in an execute box." |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
453 |
|
4523 | 454 |
|mime cmd select path suffix baseName pathName| |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
455 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
456 |
path := aDirectory filenameFor:fileName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
457 |
baseName := path baseName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
458 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
459 |
|
16160 | 460 |
cmd := UserPreferences current defaultFileOpenCommandFor:suffix. |
461 |
cmd notNil ifTrue:[ |
|
462 |
aBox initialText:(cmd bindWith:fileName pathName). |
|
463 |
^ self |
|
464 |
]. |
|
465 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
466 |
mime := MIMETypes mimeTypeForSuffix:suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
467 |
"/ mime notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
468 |
"/ cmd := self initialCommandForMIME:mime file:path |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
469 |
"/ ]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
470 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
471 |
"/ XXX should be changed to take stuff from a config file |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
472 |
"/ XXX or from resources. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
473 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
474 |
(path type == #regular) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
475 |
path isExecutableProgram ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
476 |
aBox initialText:(path pathName , ' <arguments>'). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
477 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
478 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
479 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
480 |
select := true. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
481 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
482 |
"some heuristics - my personal preferences ... |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
483 |
(actually this should come from a configfile)" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
484 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
485 |
(baseName endsWith:'akefile') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
486 |
aBox initialText:'make target' selectFrom:6 to:11. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
487 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
488 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
489 |
|
18264 | 490 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:mime. |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
491 |
cmd notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
492 |
select := false |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
493 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
494 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
495 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
496 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
497 |
(suffix = 'C') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
498 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
499 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
500 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
501 |
suffix := suffix asLowercase. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
502 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
503 |
(suffix = 'taz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
504 |
aBox initialText:'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
505 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
506 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
507 |
(suffix = 'tar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
508 |
cmd := 'tar tvf %1'. |
18578 | 509 |
select := 'tar tvf' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
510 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
511 |
(suffix = 'zoo') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
512 |
cmd := 'zoo -list %1'. |
18578 | 513 |
select := 'zoo -list' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
514 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
515 |
(suffix = 'zip') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
516 |
cmd := 'unzip -l %1'. |
18578 | 517 |
select := 'unzip -l' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
518 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
519 |
(suffix = 'jar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
520 |
cmd := 'unzip -l %1'. |
18578 | 521 |
select := 'unzip -l' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
522 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
523 |
(suffix = 'z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
524 |
(baseName asLowercase endsWith:'tar.z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
525 |
cmd := 'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
526 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
527 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
528 |
cmd := 'uncompress %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
529 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
530 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
531 |
(suffix = 'gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
532 |
(baseName asLowercase endsWith:'tar.gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
533 |
cmd := ('gunzip < %1 | tar tvf -' ). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
534 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
535 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
536 |
cmd := 'gunzip %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
537 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
538 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
539 |
(suffix = 'html') ifTrue:[ |
18578 | 540 |
"/ cmd := 'netscape %1' |
541 |
cmd := 'firefox %1'. |
|
542 |
select := 'firefox' size |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
543 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
544 |
(suffix = 'htm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
545 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
546 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
547 |
(suffix = 'uue') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
548 |
cmd := 'uudecode %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
549 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
550 |
(suffix = 'c') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
551 |
cmd := 'cc -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
552 |
select := 5. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
553 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
554 |
(suffix = 'cc') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
555 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
556 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
557 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
558 |
(suffix = 'xbm') ifTrue:[ |
18578 | 559 |
cmd := 'bitmap %1'. |
560 |
select := 'bitmap' size |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
561 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
562 |
(suffix = 'ps') ifTrue:[ |
18578 | 563 |
cmd := 'ghostview %1'. |
564 |
select := 'ghostview' size |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
565 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
566 |
((suffix = '1') or:[suffix = 'man']) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
567 |
cmd := 'nroff -man %1'. |
18578 | 568 |
select := 'nroff -man' size |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
569 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
570 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
571 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
572 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
573 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
574 |
DefaultCommandPerSuffix isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
575 |
cmd := '<cmd>' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
576 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
577 |
cmd := DefaultCommandPerSuffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
578 |
at:suffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
579 |
ifAbsent:'<cmd>'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
580 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
581 |
cmd := cmd , ' %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
582 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
583 |
|
4523 | 584 |
pathName := path pathName. |
585 |
OperatingSystem isUNIXlike ifTrue:[ |
|
586 |
pathName includesSeparator ifTrue:[ |
|
587 |
pathName := '"' , pathName , '"' |
|
588 |
] |
|
589 |
]. |
|
590 |
||
591 |
cmd := cmd bindWith:pathName. |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
592 |
select == false ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
593 |
aBox initialText:cmd |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
594 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
595 |
select class == Interval ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
596 |
aBox initialText:cmd selectFrom:select start to:select stop |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
597 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
598 |
select isInteger ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
599 |
select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
600 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
601 |
aBox initialText:cmd selectFrom:1 to:select |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
602 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
603 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
604 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
605 |
|
18264 | 606 |
"Modified: / 24-09-1997 / 16:34:52 / stefan" |
607 |
"Modified: / 09-04-1998 / 17:15:57 / cg" |
|
608 |
"Modified: / 09-07-2018 / 11:16:30 / Stefan Vogel" |
|
18578 | 609 |
"Modified: / 05-02-2019 / 10:23:20 / Claus Gittinger" |
3892 | 610 |
! |
611 |
||
5941 | 612 |
listOfRuntimeValuesToRemember |
613 |
" list of all aspects that will be remembered after closing a FileBrowserV2" |
|
614 |
||
615 |
^ #( |
|
616 |
"/ #filterModel |
|
617 |
#enableFileHistory |
|
618 |
#fileHistory |
|
619 |
#currentSortOrder |
|
620 |
#sortBlockProperty |
|
621 |
) |
|
3892 | 622 |
! |
623 |
||
624 |
resetAspects |
|
625 |
||
626 |
RuntimeAspects := nil. |
|
627 |
||
5941 | 628 |
" |
629 |
self resetAspects |
|
630 |
" |
|
3892 | 631 |
! |
632 |
||
633 |
runtimeAspects |
|
634 |
||
635 |
RuntimeAspects isNil ifTrue:[ |
|
4414 | 636 |
RuntimeAspects := Dictionary new. |
3892 | 637 |
]. |
638 |
^ RuntimeAspects |
|
639 |
! |
|
640 |
||
4201 | 641 |
userPreferencesAspectList |
642 |
" list of all aspects that will be saved with save settings |
|
643 |
that aspects will be image consistent if the settings are saved in Launcher |
|
11501 | 644 |
don't forget to add a access methods in UserPreferences if you add a aspect here |
4201 | 645 |
" |
646 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
647 |
^ Dictionary |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
648 |
withKeysAndValues:#( |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
649 |
viewDirsInContentsBrowser true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
650 |
showDirectoryTree true |
11501 | 651 |
showHiddenFiles true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
652 |
viewDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
653 |
viewDetails true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
654 |
viewDirectoryDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
655 |
viewFilesInDirectoryTree false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
656 |
viewGroup false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
657 |
viewOwner false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
658 |
viewPermissions false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
659 |
viewPreview false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
660 |
viewSize true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
661 |
viewSizeInKiloBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
662 |
viewSizeInBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
663 |
viewTime true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
664 |
viewType false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
665 |
openMultipleApplicationsForType false |
7788 | 666 |
filenameEntryFieldVisibleHolder true |
667 |
toolBarVisibleHolder true |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
668 |
sortDirectoriesBeforeFiles true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
669 |
openAlwaysInTextEditor false |
15111 | 670 |
alwaysUseSmalltalkTools true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
671 |
sortCaseless false |
13011 | 672 |
"/ useCodeView2InTools true -- vanishes |
14709
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
673 |
showDirectoriesOnTop false |
4201 | 674 |
) |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
675 |
|
11501 | 676 |
"Modified: / 11-05-2012 / 09:22:04 / cg" |
14709
dc6998e427f4
Added option to show directories always in top of the list in directory contents view.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14659
diff
changeset
|
677 |
"Modified: / 12-08-2014 / 13:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3892 | 678 |
! ! |
679 |
||
17202 | 680 |
!AbstractFileBrowser class methodsFor:'drag & drop'! |
681 |
||
682 |
doStartDrag:aDropSource in:aView |
|
683 |
"set the cursors before starting the drag & drop operation" |
|
684 |
||
685 |
|hdl| |
|
686 |
||
687 |
hdl := DragAndDropManager new. |
|
688 |
||
689 |
hdl disabledCursor:self disabledCursorIcon. |
|
690 |
hdl enabledCursor:self enabledCursorIcon. |
|
691 |
hdl alienCursor:nil. |
|
692 |
||
693 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft. |
|
694 |
||
695 |
"Modified: / 23-07-2007 / 23:00:38 / cg" |
|
696 |
! ! |
|
697 |
||
5398 | 698 |
!AbstractFileBrowser class methodsFor:'help specs'! |
699 |
||
17889 | 700 |
basicHelpSpec |
6099 | 701 |
<resource: #help> |
702 |
||
17889 | 703 |
^ super helpSpec addPairsFrom:#( |
6099 | 704 |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
705 |
#lockFileEncoding |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
706 |
'Do not guess the encoding from the file''s contents.' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
707 |
|
6100 | 708 |
#closeTabButton |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
709 |
'Close this tab' |
6100 | 710 |
|
6099 | 711 |
#addTerminal |
17182 | 712 |
'Add a shell terminal page' |
6099 | 713 |
|
714 |
#make |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
715 |
'Call the make command' |
6099 | 716 |
|
717 |
#searchFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
718 |
'Search a file' |
6099 | 719 |
|
720 |
#directoryUp |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
721 |
'Directory up' |
6099 | 722 |
|
723 |
#directoryBack |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
724 |
'Directory back' |
6099 | 725 |
|
726 |
#directoryForward |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
727 |
'Directory forward' |
6099 | 728 |
|
729 |
#directoryHistory |
|
730 |
'Directory' |
|
731 |
||
732 |
#copyFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
733 |
'Copy the selected file(s)' |
6099 | 734 |
|
735 |
#cutFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
736 |
'Cut the selected file(s)' |
6099 | 737 |
|
738 |
#editFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
739 |
'Edit the selected file' |
6099 | 740 |
|
741 |
#fileHome |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
742 |
'Goto home directory' |
6099 | 743 |
|
8093 | 744 |
#fileDesktop |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
745 |
'Goto desktop directory' |
8093 | 746 |
|
6099 | 747 |
#fileGotoDefault |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
748 |
'Goto default directory (ST/X start directory)' |
6099 | 749 |
|
6454 | 750 |
#fileGotoSmalltalkDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
751 |
'Goto Smalltalk directory (ST/X application)' |
6454 | 752 |
|
6456 | 753 |
#fileGotoDefaultDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
754 |
'Goto current directory' |
6456 | 755 |
|
6099 | 756 |
#pasteFile |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
757 |
'Paste file(s)' |
6099 | 758 |
|
759 |
#deleteFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
760 |
'Delete the selected file(s)' |
6099 | 761 |
|
762 |
#fileIn |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
763 |
'File in' |
6099 | 764 |
|
765 |
#fileHistory |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
766 |
'File history' |
6099 | 767 |
|
768 |
#fileGotoBookmark |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
769 |
'Goto bookmarked directory' |
6099 | 770 |
|
771 |
#hideToolBar |
|
13910 | 772 |
'Hide the toolbar (show again via "View"-menu)' |
6099 | 773 |
|
774 |
#hideFilenameEntryField |
|
13910 | 775 |
'Hide filename & filter fields (show again via "View"-menu)' |
776 |
||
777 |
#hideBookmarks |
|
778 |
'Hide the bookmarks (show again via "View"-menu)' |
|
6099 | 779 |
|
780 |
#openChangeBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
781 |
'Open a Changebrowser on file' |
6099 | 782 |
|
783 |
#showFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
784 |
'Show file details' |
6099 | 785 |
|
786 |
#hideFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
787 |
'Hide file details' |
6099 | 788 |
|
789 |
#toggleDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
790 |
'Show/hide file details' |
6099 | 791 |
|
792 |
#viewDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
793 |
'Show/hide file details' |
6099 | 794 |
|
795 |
#selectDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
796 |
'Select file details to be shown' |
6099 | 797 |
|
8088 | 798 |
#showDifferences |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
799 |
'Show differences between file and editor versions' |
8088 | 800 |
|
801 |
#toggleHexDisplay |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
802 |
'Toggle between hexadecimal and textual representation' |
8088 | 803 |
|
804 |
#findInBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
805 |
'Navigate the browser''s file list to the edited file' |
8088 | 806 |
|
807 |
#saveFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
808 |
'Save the editor''s contents into the file' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
809 |
|
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
810 |
#saveFileAs |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
811 |
'Save the editor''s contents into another file' |
8088 | 812 |
|
813 |
#reloadFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
814 |
'Reload from the file' |
8088 | 815 |
|
816 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
817 |
'Send to the printer' |
8088 | 818 |
|
6099 | 819 |
). |
820 |
||
8261 | 821 |
" |
17889 | 822 |
self helpSpec |
8261 | 823 |
" |
824 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
825 |
"Modified: / 06-10-2011 / 14:55:27 / cg" |
8261 | 826 |
! |
827 |
||
17889 | 828 |
helpSpec |
8261 | 829 |
<resource: #programHelp> |
830 |
||
831 |
|spec hist resources| |
|
832 |
||
17889 | 833 |
spec := self basicHelpSpec. |
8261 | 834 |
|
835 |
"/ add help items for the history |
|
6099 | 836 |
hist := self directoryHistory. |
837 |
hist notNil ifTrue:[ |
|
838 |
resources := self classResources. |
|
839 |
hist canForward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
840 |
spec at:#directoryForward put:[ resources string:'Forward to: %1' with:hist nextForwardItem ]. |
6099 | 841 |
]. |
842 |
hist canBackward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
843 |
spec at:#directoryBack put:[ resources string:'Back to: %1' with:hist nextBackwardItem ]. |
6099 | 844 |
]. |
845 |
]. |
|
846 |
^ spec. |
|
847 |
||
848 |
" |
|
17889 | 849 |
self helpSpec |
6099 | 850 |
" |
851 |
||
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
852 |
"Modified: / 03-11-2007 / 12:05:01 / cg" |
5398 | 853 |
! ! |
854 |
||
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
855 |
!AbstractFileBrowser class methodsFor:'image specs'! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
856 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
857 |
clearHistoryIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
858 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
859 |
|
17413 | 860 |
^ ToolbarIconLibrary deleteIcon |
861 |
"/ ^ Icon deleteIcon |
|
862 |
||
863 |
"Modified: / 15-02-2017 / 19:45:24 / cg" |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
864 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
865 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
866 |
copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
867 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
868 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
869 |
^ ToolbarIconLibrary copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
870 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
871 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
872 |
cutIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
873 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
874 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
875 |
^ ToolbarIconLibrary cut20x20Icon2 "cut28x28Icon" |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
876 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
877 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
878 |
deleteIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
879 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
880 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
881 |
^ ToolbarIconLibrary erase20x20Icon "/ delete28x28Icon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
882 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
883 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
884 |
directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
885 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
886 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
887 |
^ ToolbarIconLibrary directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
888 |
! |
3892 | 889 |
|
15211 | 890 |
disabledCursorIcon |
891 |
"This resource specification was automatically generated |
|
892 |
by the ImageEditor of ST/X." |
|
893 |
||
894 |
"Do not manually edit this!! If it is corrupted, |
|
895 |
the ImageEditor may not be able to read the specification." |
|
896 |
||
897 |
" |
|
17202 | 898 |
self disabledCursorIcon inspect |
899 |
ImageEditor openOnClass:self andSelector:#disabledCursorIcon |
|
15211 | 900 |
Icon flushCachedIcons |
901 |
" |
|
902 |
||
903 |
<resource: #image> |
|
904 |
||
905 |
^Icon |
|
906 |
constantNamed:#'AbstractFileBrowser class disabledCursorIcon' |
|
907 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
908 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@XF@@@H@P@@DOB@@BLLP@AA@"@@RHD @H1AD@BRHI@@$QBP@IBH$@BPQI@@"BLP@D QH@ADBB@@H0Q@@AC |
|
909 |
8 @@H@P@@A X@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
910 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@_>@@@O?0@@G?>@@C<O0@A?@>@@_8G @O?A<@C38O@@<_C0@OC8<@C0_O@@>C?0@G _8@A<C>@@O0_@@A? |
|
911 |
? @@O?0@@A?8@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
912 |
! |
|
6337 | 913 |
|
15211 | 914 |
enabledCursorIcon |
915 |
"This resource specification was automatically generated |
|
916 |
by the ImageEditor of ST/X." |
|
917 |
||
918 |
"Do not manually edit this!! If it is corrupted, |
|
919 |
the ImageEditor may not be able to read the specification." |
|
920 |
||
921 |
" |
|
17202 | 922 |
self enabledCursorIcon inspect |
923 |
ImageEditor openOnClass:self andSelector:#enabledCursorIcon |
|
15211 | 924 |
Icon flushCachedIcons |
925 |
" |
|
926 |
||
927 |
<resource: #image> |
|
928 |
||
929 |
^Icon |
|
930 |
constantNamed:#'AbstractFileBrowser class enabledCursorIcon' |
|
931 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
932 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@@@@@?0_0@@@@@@C?A?@@@@@@@@AP@@@@T@@@@E@@@@A |
|
933 |
P@@@@T@@@@E@@@@AP@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
934 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@?8?0@O>O<@C?#?@@@G@@@@A0@@@@\@@@@G@@@@A |
|
935 |
0@@@@\@@@@G@@@@A0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
936 |
! |
|
6337 | 937 |
|
3892 | 938 |
fileInIcon |
939 |
<resource: #programImage> |
|
940 |
||
6116 | 941 |
^ ToolbarIconLibrary fileInIcon |
3892 | 942 |
! |
943 |
||
6079 | 944 |
historyBackIcon |
945 |
<resource: #programImage> |
|
946 |
||
947 |
^ ToolbarIconLibrary historyBackIcon |
|
948 |
! |
|
949 |
||
950 |
historyForwardIcon |
|
951 |
<resource: #programImage> |
|
952 |
||
953 |
^ ToolbarIconLibrary historyForwardIcon |
|
954 |
! |
|
955 |
||
3892 | 956 |
homeIcon |
957 |
<resource: #programImage> |
|
958 |
||
6079 | 959 |
^ ToolbarIconLibrary homeIcon |
3892 | 960 |
! |
961 |
||
6074 | 962 |
homeIcon2 |
6079 | 963 |
<resource: #programImage> |
964 |
||
965 |
^ ToolbarIconLibrary homeIcon2 |
|
6074 | 966 |
! |
967 |
||
968 |
htmlReloadIcon |
|
969 |
<resource: #programImage> |
|
970 |
||
971 |
^ ToolbarIconLibrary reload22x22Icon |
|
972 |
! |
|
973 |
||
15211 | 974 |
leftDownIcon |
975 |
<resource: #image> |
|
976 |
"This resource specification was automatically generated |
|
977 |
by the ImageEditor of ST/X." |
|
978 |
"Do not manually edit this!! If it is corrupted, |
|
979 |
the ImageEditor may not be able to read the specification." |
|
980 |
" |
|
981 |
self leftDownIcon inspect |
|
982 |
ImageEditor openOnClass:self andSelector:#leftDownIcon" |
|
983 |
||
984 |
^ Icon constantNamed:#'AbstractFileBrowser class leftDownIcon' |
|
985 |
ifAbsentPut:[ |
|
986 |
(Depth2Image new) |
|
987 |
width:28; |
|
988 |
height:28; |
|
989 |
photometric:(#palette); |
|
990 |
bitsPerSample:(#( 2 )); |
|
991 |
samplesPerPixel:(1); |
|
992 |
bits:(ByteArray |
|
993 |
fromPackedString:' |
|
994 |
UUUUUUUUUUUPAUUUUUUUP@UUUUUUUPB!!UUUUUU@B*AUUUUU@B*(UUUUUPB** UUUUPB***AUUUTB***(EUUUB****%UUUR*****UUUUU@*%UUUUUUPJ)UUUU |
|
995 |
UUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*$@@@@AUPJ*****)UTB******UU@******%UPJ*****)UTAUUUU |
|
996 |
UUUU@@@@@@@AUUUUUUUUUP@a'); |
|
997 |
colorMapFromArray:#[ 255 255 255 0 0 0 40 40 100 255 0 0 ]; |
|
998 |
mask:((ImageMask new) |
|
999 |
width:28; |
|
1000 |
height:28; |
|
1001 |
bits:(ByteArray |
|
1002 |
fromPackedString:' |
|
1003 |
@@@@@@@@@@@@ @@@@\@@@@O @@@G<@@@C? @@A?<@@@?? @@_?<@@G?? @@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C??? @???8@O? |
|
1004 |
?>@C??? @???8@O??>@@@@@@@@@@@@@a'); |
|
1005 |
yourself); |
|
1006 |
yourself |
|
1007 |
] |
|
1008 |
! |
|
1009 |
||
1010 |
menuHistoryList9x20Icon |
|
1011 |
<resource: #image> |
|
1012 |
"This resource specification was automatically generated |
|
1013 |
by the ImageEditor of ST/X." |
|
1014 |
"Do not manually edit this!! If it is corrupted, |
|
1015 |
the ImageEditor may not be able to read the specification." |
|
1016 |
" |
|
1017 |
self menuHistoryList9x20Icon inspect |
|
1018 |
ImageEditor openOnClass:self andSelector:#menuHistoryList9x20Icon |
|
1019 |
Icon flushCachedIcons" |
|
1020 |
||
1021 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryList9x20Icon' |
|
1022 |
ifAbsentPut:[ |
|
1023 |
(Depth1Image new) |
|
1024 |
width:9; |
|
1025 |
height:20; |
|
1026 |
photometric:(#palette); |
|
1027 |
bitsPerSample:(#( 1 )); |
|
1028 |
samplesPerPixel:(1); |
|
1029 |
bits:(ByteArray |
|
1030 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
1031 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
1032 |
mask:((ImageMask new) |
|
1033 |
width:9; |
|
1034 |
height:20; |
|
1035 |
bits:(ByteArray |
|
1036 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
1037 |
yourself); |
|
1038 |
yourself |
|
1039 |
] |
|
1040 |
! |
|
1041 |
||
1042 |
menuHistoryListIcon |
|
1043 |
<resource: #image> |
|
1044 |
"This resource specification was automatically generated |
|
1045 |
by the ImageEditor of ST/X." |
|
1046 |
"Do not manually edit this!! If it is corrupted, |
|
1047 |
the ImageEditor may not be able to read the specification." |
|
1048 |
" |
|
1049 |
self menuHistoryListIcon inspect |
|
1050 |
ImageEditor openOnClass:self andSelector:#menuHistoryListIcon" |
|
1051 |
||
1052 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryListIcon' |
|
1053 |
ifAbsentPut:[ |
|
1054 |
(Depth1Image new) |
|
1055 |
width:12; |
|
1056 |
height:12; |
|
1057 |
photometric:(#palette); |
|
1058 |
bitsPerSample:(#( 1 )); |
|
1059 |
samplesPerPixel:(1); |
|
1060 |
bits:(ByteArray fromPackedString:'??S?<O?0??C?<O?0??/?=_?0??C?<O?0'); |
|
1061 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
1062 |
mask:((ImageMask new) |
|
1063 |
width:12; |
|
1064 |
height:12; |
|
1065 |
bits:(ByteArray fromPackedString:'@@@O@@<@C0A?8C?@G8@O@@X@@@A?8@@@'); |
|
1066 |
yourself); |
|
1067 |
yourself |
|
1068 |
] |
|
1069 |
! |
|
3892 | 1070 |
|
6087 | 1071 |
newDirectoryIcon |
6074 | 1072 |
<resource: #programImage> |
1073 |
||
6087 | 1074 |
^ ToolbarIconLibrary newDirectoryIcon |
3923 | 1075 |
! |
1076 |
||
6091 | 1077 |
removeTabIcon |
1078 |
<resource: #programImage> |
|
1079 |
||
1080 |
^ ToolbarIconLibrary removeTabIcon |
|
1081 |
! |
|
1082 |
||
3892 | 1083 |
vt100Terminal |
1084 |
<resource: #programImage> |
|
1085 |
||
1086 |
^ ToolbarIconLibrary shell20x20Icon |
|
1087 |
! ! |
|
1088 |
||
5528 | 1089 |
!AbstractFileBrowser class methodsFor:'interface specs'! |
1090 |
||
15211 | 1091 |
encodingDialogSpec |
1092 |
"This resource specification was automatically generated |
|
1093 |
by the UIPainter of ST/X." |
|
1094 |
||
1095 |
"Do not manually edit this!! If it is corrupted, |
|
1096 |
the UIPainter may not be able to read the specification." |
|
1097 |
||
1098 |
" |
|
1099 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#encodingDialogSpec |
|
1100 |
AbstractFileBrowser new openInterface:#encodingDialogSpec |
|
1101 |
" |
|
1102 |
||
1103 |
<resource: #canvas> |
|
1104 |
||
1105 |
^ |
|
1106 |
#(FullSpec |
|
1107 |
name: encodingDialogSpec |
|
1108 |
window: |
|
1109 |
(WindowSpec |
|
1110 |
label: 'File Encoding' |
|
1111 |
name: 'File Encoding' |
|
1112 |
min: (Point 10 10) |
|
1113 |
bounds: (Rectangle 0 0 379 590) |
|
1114 |
) |
|
1115 |
component: |
|
1116 |
(SpecCollection |
|
1117 |
collection: ( |
|
1118 |
(LabelSpec |
|
1119 |
label: 'Select the External (File-) Encoding:' |
|
1120 |
name: 'Label1' |
|
1121 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1122 |
translateLabel: true |
|
1123 |
adjust: left |
|
1124 |
) |
|
1125 |
(DataSetSpec |
|
1126 |
name: 'Table1' |
|
1127 |
layout: (LayoutFrame 0 0 30 0 0 1 -60 1) |
|
1128 |
model: selectedEncoding |
|
1129 |
hasHorizontalScrollBar: true |
|
1130 |
hasVerticalScrollBar: true |
|
1131 |
dataList: encodingList |
|
1132 |
has3Dseparators: true |
|
1133 |
columns: |
|
1134 |
(Array |
|
1135 |
||
1136 |
(DataSetColumnSpec |
|
1137 |
label: 'Encoding' |
|
1138 |
labelButtonType: Button |
|
1139 |
height: heightOfFirstRow |
|
1140 |
model: at: |
|
1141 |
canSelect: false |
|
1142 |
isResizeable: false |
|
1143 |
showRowSeparator: false |
|
1144 |
showColSeparator: false |
|
1145 |
) |
|
1146 |
(DataSetColumnSpec |
|
1147 |
label: 'Description' |
|
1148 |
labelButtonType: Button |
|
1149 |
height: heightOfFirstRow |
|
1150 |
model: at: |
|
1151 |
canSelect: false |
|
1152 |
isResizeable: false |
|
1153 |
showRowSeparator: false |
|
1154 |
showColSeparator: false |
|
1155 |
) |
|
1156 |
) |
|
1157 |
doubleClickChannel: accept |
|
1158 |
) |
|
1159 |
(CheckBoxSpec |
|
1160 |
label: 'Lock Encoding' |
|
1161 |
name: 'LockEncodingCheckBox' |
|
1162 |
layout: (LayoutFrame 3 0 -60 1 217 0 -30 1) |
|
1163 |
activeHelpKey: lockFileEncoding |
|
1164 |
model: lockFileEncoding |
|
1165 |
translateLabel: true |
|
1166 |
) |
|
1167 |
(HorizontalPanelViewSpec |
|
1168 |
name: 'ButtonPanel' |
|
1169 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1170 |
horizontalLayout: fitSpace |
|
1171 |
verticalLayout: center |
|
1172 |
horizontalSpace: 3 |
|
1173 |
verticalSpace: 3 |
|
1174 |
reverseOrderIfOKAtLeft: true |
|
1175 |
component: |
|
1176 |
(SpecCollection |
|
1177 |
collection: ( |
|
1178 |
(ActionButtonSpec |
|
1179 |
label: 'Cancel' |
|
1180 |
name: 'Button2' |
|
1181 |
translateLabel: true |
|
1182 |
model: cancel |
|
1183 |
extent: (Point 183 22) |
|
1184 |
) |
|
1185 |
(ActionButtonSpec |
|
1186 |
label: 'OK' |
|
1187 |
name: 'Button1' |
|
1188 |
translateLabel: true |
|
1189 |
model: accept |
|
1190 |
isDefault: true |
|
1191 |
extent: (Point 184 22) |
|
1192 |
) |
|
1193 |
) |
|
1194 |
||
1195 |
) |
|
1196 |
) |
|
1197 |
) |
|
1198 |
||
1199 |
) |
|
1200 |
) |
|
1201 |
! |
|
1202 |
||
1203 |
lineEndConventionDialogSpec |
|
1204 |
"This resource specification was automatically generated |
|
1205 |
by the UIPainter of ST/X." |
|
1206 |
||
1207 |
"Do not manually edit this!! If it is corrupted, |
|
1208 |
the UIPainter may not be able to read the specification." |
|
1209 |
||
1210 |
" |
|
1211 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#lineEndConventionDialogSpec |
|
1212 |
AbstractFileBrowser new openInterface:#lineEndConventionDialogSpec |
|
1213 |
" |
|
1214 |
||
1215 |
<resource: #canvas> |
|
1216 |
||
1217 |
^ |
|
15212 | 1218 |
#(FullSpec |
1219 |
name: lineEndConventionDialogSpec |
|
1220 |
window: |
|
1221 |
(WindowSpec |
|
1222 |
label: 'Line-End Convention' |
|
1223 |
name: 'Line-End Convention' |
|
1224 |
min: (Point 10 10) |
|
1225 |
bounds: (Rectangle 0 0 379 239) |
|
1226 |
) |
|
1227 |
component: |
|
1228 |
(SpecCollection |
|
1229 |
collection: ( |
|
1230 |
(LabelSpec |
|
1231 |
label: 'Select the Line-End Convention (used when saving files):' |
|
1232 |
name: 'Label1' |
|
1233 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1234 |
translateLabel: true |
|
1235 |
adjust: left |
|
1236 |
) |
|
1237 |
(VerticalPanelViewSpec |
|
1238 |
name: 'VerticalPanel1' |
|
1239 |
layout: (LayoutFrame 20 0 40 0 0 1 -30 1) |
|
1240 |
horizontalLayout: fit |
|
1241 |
verticalLayout: topSpace |
|
1242 |
horizontalSpace: 3 |
|
1243 |
verticalSpace: 3 |
|
1244 |
component: |
|
1245 |
(SpecCollection |
|
1246 |
collection: ( |
|
1247 |
(RadioButtonSpec |
|
1248 |
label: 'NL (Unix)' |
|
1249 |
name: 'RadioButton1' |
|
1250 |
translateLabel: true |
|
1251 |
model: lineEndConvention |
|
1252 |
isTriggerOnDown: true |
|
1253 |
select: nl |
|
1254 |
extent: (Point 359 22) |
|
1255 |
) |
|
1256 |
(RadioButtonSpec |
|
1257 |
label: 'CR-NL (MSDOS)' |
|
1258 |
name: 'RadioButton4' |
|
1259 |
translateLabel: true |
|
1260 |
model: lineEndConvention |
|
1261 |
isTriggerOnDown: true |
|
1262 |
select: crlf |
|
1263 |
extent: (Point 359 22) |
|
1264 |
) |
|
1265 |
(RadioButtonSpec |
|
1266 |
label: 'CR (VMS and pre OSX mac)' |
|
1267 |
name: 'RadioButton5' |
|
1268 |
translateLabel: true |
|
1269 |
model: lineEndConvention |
|
1270 |
isTriggerOnDown: true |
|
1271 |
select: cr |
|
1272 |
extent: (Point 359 22) |
|
15211 | 1273 |
) |
15212 | 1274 |
(RadioButtonSpec |
1275 |
label: 'ETX (some modem protocols and mainframe files)' |
|
1276 |
name: 'RadioButton6' |
|
1277 |
translateLabel: true |
|
1278 |
model: lineEndConvention |
|
1279 |
isTriggerOnDown: true |
|
1280 |
select: etx |
|
1281 |
extent: (Point 359 22) |
|
1282 |
) |
|
1283 |
(RadioButtonSpec |
|
1284 |
label: 'EOT (some modem protocols and mainframe files)' |
|
1285 |
name: 'RadioButton7' |
|
1286 |
translateLabel: true |
|
1287 |
model: lineEndConvention |
|
1288 |
isTriggerOnDown: true |
|
1289 |
select: eot |
|
1290 |
extent: (Point 359 22) |
|
15211 | 1291 |
) |
15212 | 1292 |
) |
1293 |
||
1294 |
) |
|
15211 | 1295 |
) |
15212 | 1296 |
(HorizontalPanelViewSpec |
1297 |
name: 'ButtonPanel' |
|
1298 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1299 |
horizontalLayout: fitSpace |
|
1300 |
verticalLayout: center |
|
1301 |
horizontalSpace: 3 |
|
1302 |
verticalSpace: 3 |
|
1303 |
reverseOrderIfOKAtLeft: true |
|
1304 |
component: |
|
1305 |
(SpecCollection |
|
1306 |
collection: ( |
|
1307 |
(ActionButtonSpec |
|
1308 |
label: 'Cancel' |
|
1309 |
name: 'Button2' |
|
1310 |
translateLabel: true |
|
1311 |
model: cancel |
|
1312 |
extent: (Point 185 22) |
|
1313 |
) |
|
1314 |
(ActionButtonSpec |
|
1315 |
label: 'OK' |
|
1316 |
name: 'Button1' |
|
1317 |
translateLabel: true |
|
1318 |
model: accept |
|
1319 |
isDefault: true |
|
1320 |
extent: (Point 185 22) |
|
1321 |
) |
|
1322 |
) |
|
1323 |
||
1324 |
) |
|
1325 |
) |
|
1326 |
) |
|
1327 |
||
1328 |
) |
|
1329 |
) |
|
15211 | 1330 |
! |
1331 |
||
1332 |
tabStopConversionDialogSpec |
|
1333 |
"This resource specification was automatically generated |
|
1334 |
by the UIPainter of ST/X." |
|
1335 |
||
1336 |
"Do not manually edit this!! If it is corrupted, |
|
1337 |
the UIPainter may not be able to read the specification." |
|
1338 |
||
1339 |
" |
|
1340 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#tabStopConversionDialogSpec |
|
1341 |
AbstractFileBrowser new openInterface:#tabStopConversionDialogSpec |
|
1342 |
" |
|
1343 |
||
1344 |
<resource: #canvas> |
|
1345 |
||
1346 |
^ |
|
1347 |
#(FullSpec |
|
1348 |
name: 'tabStopConversionDialogSpec' |
|
1349 |
window: |
|
1350 |
(WindowSpec |
|
1351 |
label: 'Tab-Stop Conversion' |
|
1352 |
name: 'Tab-Stop Conversion' |
|
1353 |
min: (Point 10 10) |
|
1354 |
bounds: (Rectangle 0 0 379 239) |
|
1355 |
) |
|
1356 |
component: |
|
1357 |
(SpecCollection |
|
1358 |
collection: ( |
|
1359 |
(LabelSpec |
|
1360 |
label: 'Select the Tab-Stop Conversion (used when saving files):' |
|
1361 |
name: 'Label1' |
|
1362 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1363 |
translateLabel: true |
|
1364 |
adjust: left |
|
1365 |
) |
|
1366 |
(VerticalPanelViewSpec |
|
1367 |
name: 'VerticalPanel1' |
|
1368 |
layout: (LayoutFrame 0 0 30 0 0 1 -30 1) |
|
1369 |
horizontalLayout: center |
|
1370 |
verticalLayout: center |
|
1371 |
horizontalSpace: 3 |
|
1372 |
verticalSpace: 3 |
|
1373 |
component: |
|
1374 |
(SpecCollection |
|
1375 |
collection: ( |
|
1376 |
(RadioButtonSpec |
|
1377 |
label: '4' |
|
1378 |
name: 'RadioButton1' |
|
1379 |
translateLabel: true |
|
1380 |
model: tabStops |
|
1381 |
isTriggerOnDown: true |
|
1382 |
select: 4 |
|
1383 |
extent: (Point 136 22) |
|
1384 |
) |
|
1385 |
(RadioButtonSpec |
|
1386 |
label: '8' |
|
1387 |
name: 'RadioButton4' |
|
1388 |
translateLabel: true |
|
1389 |
model: tabStops |
|
1390 |
isTriggerOnDown: true |
|
1391 |
select: 8 |
|
1392 |
extent: (Point 136 22) |
|
1393 |
) |
|
1394 |
) |
|
1395 |
||
1396 |
) |
|
1397 |
) |
|
1398 |
(HorizontalPanelViewSpec |
|
1399 |
name: 'ButtonPanel' |
|
1400 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1401 |
horizontalLayout: fitSpace |
|
1402 |
verticalLayout: center |
|
1403 |
horizontalSpace: 3 |
|
1404 |
verticalSpace: 3 |
|
1405 |
reverseOrderIfOKAtLeft: true |
|
1406 |
component: |
|
1407 |
(SpecCollection |
|
1408 |
collection: ( |
|
1409 |
(ActionButtonSpec |
|
1410 |
label: 'Cancel' |
|
1411 |
name: 'Button2' |
|
1412 |
translateLabel: true |
|
1413 |
model: cancel |
|
1414 |
extent: (Point 185 22) |
|
1415 |
) |
|
1416 |
(ActionButtonSpec |
|
1417 |
label: 'OK' |
|
1418 |
name: 'Button1' |
|
1419 |
translateLabel: true |
|
1420 |
model: accept |
|
1421 |
isDefault: true |
|
1422 |
extent: (Point 185 22) |
|
1423 |
) |
|
1424 |
) |
|
1425 |
||
1426 |
) |
|
1427 |
) |
|
1428 |
) |
|
1429 |
||
1430 |
) |
|
1431 |
) |
|
1432 |
||
1433 |
"Modified: / 28-02-2012 / 11:12:38 / cg" |
|
1434 |
! ! |
|
5528 | 1435 |
|
3892 | 1436 |
!AbstractFileBrowser class methodsFor:'menu specs'! |
1437 |
||
15211 | 1438 |
baseBookmarksMenuSpec |
1439 |
"This resource specification was automatically generated |
|
1440 |
by the MenuEditor of ST/X." |
|
1441 |
||
1442 |
"Do not manually edit this!! If it is corrupted, |
|
1443 |
the MenuEditor may not be able to read the specification." |
|
1444 |
||
1445 |
" |
|
1446 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec |
|
1447 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec)) startUp |
|
1448 |
" |
|
1449 |
||
1450 |
<resource: #menu> |
|
1451 |
||
1452 |
^ |
|
1453 |
#(Menu |
|
1454 |
( |
|
1455 |
(MenuItem |
|
1456 |
enabled: currentFilesHasDirectories |
|
1457 |
label: 'Add Bookmark' |
|
1458 |
itemValue: addBookmark |
|
1459 |
translateLabel: true |
|
1460 |
) |
|
1461 |
(MenuItem |
|
1462 |
enabled: hasBookmarksToRemove |
|
1463 |
label: 'Remove Bookmark' |
|
1464 |
itemValue: removeBookmark |
|
1465 |
translateLabel: true |
|
1466 |
) |
|
1467 |
(MenuItem |
|
1468 |
label: 'Save Bookmarks In...' |
|
1469 |
itemValue: saveBookmarks |
|
1470 |
translateLabel: true |
|
1471 |
) |
|
1472 |
) |
|
1473 |
nil |
|
1474 |
nil |
|
1475 |
) |
|
1476 |
! |
|
1477 |
||
1478 |
baseBookmarksMenuSpec2 |
|
1479 |
"This resource specification was automatically generated |
|
1480 |
by the MenuEditor of ST/X." |
|
1481 |
||
1482 |
"Do not manually edit this!! If it is corrupted, |
|
1483 |
the MenuEditor may not be able to read the specification." |
|
1484 |
||
1485 |
" |
|
1486 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec2 |
|
1487 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec2)) startUp |
|
1488 |
" |
|
1489 |
||
1490 |
<resource: #menu> |
|
1491 |
||
1492 |
^ |
|
1493 |
#(Menu |
|
1494 |
( |
|
1495 |
(MenuItem |
|
1496 |
label: 'Edit Bookmarks' |
|
1497 |
itemValue: editBookmarks |
|
1498 |
translateLabel: true |
|
1499 |
) |
|
1500 |
(MenuItem |
|
1501 |
label: '-' |
|
1502 |
) |
|
1503 |
(MenuItem |
|
1504 |
enabled: currentFilesHasDirectories |
|
1505 |
label: 'Add Bookmark' |
|
1506 |
itemValue: addBookmark |
|
1507 |
translateLabel: true |
|
1508 |
) |
|
1509 |
) |
|
1510 |
nil |
|
1511 |
nil |
|
1512 |
) |
|
1513 |
! |
|
1514 |
||
1515 |
browserMenu |
|
1516 |
"This resource specification was automatically generated |
|
1517 |
by the MenuEditor of ST/X." |
|
1518 |
||
1519 |
"Do not manually edit this!! If it is corrupted, |
|
1520 |
the MenuEditor may not be able to read the specification." |
|
1521 |
||
1522 |
||
1523 |
" |
|
1524 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#browserMenu |
|
1525 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser browserMenu)) startUp |
|
1526 |
" |
|
1527 |
||
1528 |
<resource: #menu> |
|
1529 |
||
1530 |
^ |
|
1531 |
#(Menu |
|
1532 |
( |
|
1533 |
(MenuItem |
|
1534 |
label: 'Spawn Filebrowser' |
|
1535 |
itemValue: doSpawn |
|
1536 |
translateLabel: true |
|
1537 |
shortcutKey: Ctrln |
|
1538 |
) |
|
1539 |
(MenuItem |
|
1540 |
label: 'Windows Explorer' |
|
1541 |
itemValue: doOpenExplorer |
|
1542 |
translateLabel: true |
|
17946 | 1543 |
isVisible: systemIsDOS |
15211 | 1544 |
) |
1545 |
(MenuItem |
|
1546 |
label: 'Open Finder' |
|
1547 |
itemValue: doOpenFinder |
|
1548 |
translateLabel: true |
|
1549 |
isVisible: systemIsOSX |
|
1550 |
) |
|
1551 |
(MenuItem |
|
1552 |
label: 'C Browser' |
|
1553 |
itemValue: doOpenCBrowser |
|
1554 |
translateLabel: true |
|
1555 |
isVisible: cBrowserMenuItemVisible |
|
1556 |
) |
|
1557 |
(MenuItem |
|
18432 | 1558 |
label: 'STXGDB Debugger' |
1559 |
itemValue: doOpenGDBApplication |
|
1560 |
translateLabel: true |
|
1561 |
isVisible: stxgdbMenuItemVisible |
|
1562 |
) |
|
1563 |
(MenuItem |
|
15211 | 1564 |
label: '-' |
1565 |
) |
|
1566 |
(MenuItem |
|
1567 |
label: 'Add Text Editor Page' |
|
1568 |
itemValue: newTextEditor |
|
1569 |
translateLabel: true |
|
1570 |
shortcutKey: Ctrlt |
|
1571 |
) |
|
1572 |
(MenuItem |
|
1573 |
label: 'Add Shell Terminal Page' |
|
1574 |
itemValue: doAddTerminal |
|
1575 |
translateLabel: true |
|
1576 |
) |
|
1577 |
(MenuItem |
|
1578 |
label: 'Add Archiver Page' |
|
1579 |
itemValue: doAddArchiver |
|
1580 |
translateLabel: true |
|
1581 |
) |
|
1582 |
(MenuItem |
|
1583 |
label: 'Add Search Page' |
|
1584 |
itemValue: doOpenSearchFile |
|
1585 |
translateLabel: true |
|
1586 |
) |
|
1587 |
(MenuItem |
|
1588 |
label: '-' |
|
1589 |
isVisible: false |
|
1590 |
) |
|
1591 |
(MenuItem |
|
1592 |
label: 'Settings...' |
|
1593 |
itemValue: doOpenSettings |
|
1594 |
translateLabel: true |
|
1595 |
isVisible: false |
|
1596 |
) |
|
1597 |
(MenuItem |
|
1598 |
label: 'Encoding...' |
|
1599 |
itemValue: fileEncodingDialog |
|
1600 |
translateLabel: true |
|
1601 |
isVisible: false |
|
1602 |
) |
|
1603 |
(MenuItem |
|
1604 |
label: 'Line End Convention...' |
|
1605 |
itemValue: lineEndConventionDialog |
|
1606 |
translateLabel: true |
|
1607 |
isVisible: false |
|
1608 |
) |
|
1609 |
(MenuItem |
|
1610 |
label: 'Tab Stop Conversion...' |
|
1611 |
itemValue: tabStopConversionDialog |
|
1612 |
translateLabel: true |
|
1613 |
isVisible: false |
|
1614 |
) |
|
1615 |
(MenuItem |
|
1616 |
label: '-' |
|
1617 |
) |
|
1618 |
(MenuItem |
|
1619 |
label: 'Exit' |
|
1620 |
itemValue: closeRequest |
|
1621 |
translateLabel: true |
|
1622 |
) |
|
1623 |
) |
|
1624 |
nil |
|
1625 |
nil |
|
1626 |
) |
|
1627 |
||
17724 | 1628 |
"Modified: / 29-10-2017 / 11:13:49 / cg" |
18432 | 1629 |
"Modified: / 26-09-2018 / 12:07:26 / Claus Gittinger" |
15211 | 1630 |
! |
1631 |
||
1632 |
directoryMenu |
|
1633 |
"This resource specification was automatically generated |
|
1634 |
by the MenuEditor of ST/X." |
|
1635 |
||
1636 |
"Do not manually edit this!! If it is corrupted, |
|
1637 |
the MenuEditor may not be able to read the specification." |
|
1638 |
||
1639 |
||
1640 |
" |
|
1641 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#directoryMenu |
|
1642 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser directoryMenu)) startUp |
|
1643 |
" |
|
1644 |
||
1645 |
<resource: #menu> |
|
1646 |
||
1647 |
^ |
|
1648 |
#(Menu |
|
1649 |
( |
|
1650 |
(MenuItem |
|
1651 |
label: 'Bookmarks' |
|
1652 |
submenuChannel: bookmarksMenu |
|
1653 |
) |
|
1654 |
(MenuItem |
|
1655 |
label: 'Visited Directories' |
|
1656 |
submenuChannel: visitedDirectoriesMenu |
|
1657 |
) |
|
1658 |
(MenuItem |
|
1659 |
label: '-' |
|
1660 |
) |
|
1661 |
(MenuItem |
|
1662 |
label: 'Up' |
|
1663 |
itemValue: doGoDirectoryUp |
|
1664 |
) |
|
1665 |
(MenuItem |
|
1666 |
activeHelpKey: directoryBack |
|
1667 |
enabled: enableBack |
|
1668 |
label: 'Back' |
|
1669 |
itemValue: doBack |
|
1670 |
) |
|
1671 |
(MenuItem |
|
1672 |
activeHelpKey: directoryBack |
|
1673 |
enabled: enableForward |
|
1674 |
label: 'Forward' |
|
1675 |
itemValue: doForward |
|
1676 |
) |
|
1677 |
(MenuItem |
|
1678 |
label: '-' |
|
1679 |
) |
|
1680 |
(MenuItem |
|
1681 |
enabled: enableHome |
|
1682 |
label: 'Home Directory' |
|
1683 |
itemValue: doGotoHomeDirectory |
|
1684 |
) |
|
1685 |
(MenuItem |
|
1686 |
enabled: enableGotoDesktopDirectory |
|
1687 |
label: 'Desktop' |
|
1688 |
itemValue: doGotoDesktopDirectory |
|
1689 |
) |
|
1690 |
(MenuItem |
|
18511 | 1691 |
enabled: enableGotoDocumentsDirectory |
1692 |
label: 'Documents' |
|
1693 |
itemValue: doGotoDocumentsDirectory |
|
1694 |
) |
|
1695 |
(MenuItem |
|
18352 | 1696 |
enabled: enableGotoDownloadsDirectory |
1697 |
label: 'Downloads' |
|
1698 |
itemValue: doGotoDownloadsDirectory |
|
1699 |
) |
|
1700 |
(MenuItem |
|
15211 | 1701 |
enabled: enableGotoDefaultDirectory |
1702 |
label: 'Default (Current) Directory' |
|
1703 |
itemValue: doGotoDefaultDirectory |
|
1704 |
) |
|
1705 |
(MenuItem |
|
1706 |
enabled: enableGotoSmalltalkDirectory |
|
1707 |
label: 'Smalltalk (Application) Directory' |
|
1708 |
itemValue: doGotoSmalltalkDirectory |
|
1709 |
) |
|
1710 |
(MenuItem |
|
17187 | 1711 |
enabled: enableGotoSmalltalkWorkspaceDirectory |
1712 |
label: 'Smalltalk Workspace Directory' |
|
1713 |
itemValue: doGotoSmalltalkWorkspaceDirectory |
|
1714 |
) |
|
1715 |
(MenuItem |
|
15211 | 1716 |
enabled: enableGotoTempDirectory |
1717 |
label: 'Smalltalk Temp Directory' |
|
1718 |
itemValue: doGotoTempDirectory |
|
1719 |
) |
|
1720 |
(MenuItem |
|
1721 |
label: '-' |
|
17582 | 1722 |
isVisible: false |
15211 | 1723 |
) |
1724 |
(MenuItem |
|
1725 |
enabled: enableMakeCurrentDirectory |
|
1726 |
label: 'Make this the Default (Current) Directory' |
|
1727 |
itemValue: doMakeCurrentDirectory |
|
17582 | 1728 |
isVisible: false |
15211 | 1729 |
) |
1730 |
) |
|
1731 |
nil |
|
1732 |
nil |
|
1733 |
) |
|
17582 | 1734 |
|
1735 |
"Modified: / 17-07-2017 / 10:08:31 / cg" |
|
15211 | 1736 |
! |
1737 |
||
1738 |
editMenu |
|
1739 |
"This resource specification was automatically generated |
|
1740 |
by the MenuEditor of ST/X." |
|
1741 |
||
1742 |
"Do not manually edit this!! If it is corrupted, |
|
1743 |
the MenuEditor may not be able to read the specification." |
|
1744 |
||
1745 |
" |
|
1746 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#editMenu |
|
1747 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser editMenu)) startUp |
|
1748 |
" |
|
1749 |
||
1750 |
<resource: #menu> |
|
1751 |
||
1752 |
^ |
|
1753 |
#(Menu |
|
1754 |
( |
|
1755 |
(MenuItem |
|
1756 |
enabled: hasFileSelection |
|
1757 |
label: 'Copy Selected Filenames to Clipboard' |
|
1758 |
itemValue: copySelectedFilenames |
|
1759 |
translateLabel: true |
|
1760 |
) |
|
1761 |
(MenuItem |
|
1762 |
enabled: fileListIsNotEmpty |
|
1763 |
label: 'Copy all Filenames to Clipboard' |
|
1764 |
itemValue: copyFileList |
|
1765 |
translateLabel: true |
|
1766 |
) |
|
1767 |
) |
|
1768 |
nil |
|
1769 |
nil |
|
1770 |
) |
|
1771 |
! |
|
1772 |
||
1773 |
emptyMenuSpec |
|
1774 |
"This resource specification was automatically generated |
|
1775 |
by the MenuEditor of ST/X." |
|
1776 |
||
1777 |
"Do not manually edit this!! If it is corrupted, |
|
1778 |
the MenuEditor may not be able to read the specification." |
|
1779 |
||
1780 |
" |
|
1781 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#emptyMenuSpec |
|
1782 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser emptyMenuSpec)) startUp |
|
1783 |
" |
|
1784 |
||
1785 |
<resource: #menu> |
|
1786 |
||
1787 |
^ |
|
1788 |
#(#Menu |
|
1789 |
#( |
|
1790 |
) |
|
1791 |
nil |
|
1792 |
nil |
|
1793 |
) |
|
1794 |
! |
|
1795 |
||
1796 |
extraMenu |
|
1797 |
"This resource specification was automatically generated |
|
1798 |
by the MenuEditor of ST/X." |
|
1799 |
||
1800 |
"Do not manually edit this!! If it is corrupted, |
|
1801 |
the MenuEditor may not be able to read the specification." |
|
1802 |
||
1803 |
||
1804 |
" |
|
1805 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#extraMenu |
|
1806 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser extraMenu)) startUp |
|
1807 |
" |
|
1808 |
||
1809 |
<resource: #menu> |
|
1810 |
||
1811 |
^ |
|
1812 |
#(Menu |
|
1813 |
( |
|
1814 |
(MenuItem |
|
1815 |
label: 'Encoding...' |
|
1816 |
itemValue: fileEncodingDialog |
|
1817 |
translateLabel: true |
|
1818 |
) |
|
1819 |
(MenuItem |
|
1820 |
label: 'Line End Convention...' |
|
1821 |
itemValue: lineEndConventionDialog |
|
1822 |
translateLabel: true |
|
1823 |
) |
|
1824 |
(MenuItem |
|
1825 |
label: 'Tab Stop Conversion...' |
|
1826 |
itemValue: tabStopConversionDialog |
|
1827 |
translateLabel: true |
|
1828 |
) |
|
1829 |
(MenuItem |
|
1830 |
label: '-' |
|
1831 |
) |
|
1832 |
(MenuItem |
|
1833 |
label: 'Settings...' |
|
1834 |
itemValue: doOpenSettings |
|
1835 |
translateLabel: true |
|
1836 |
labelImage: (ResourceRetriever ToolbarIconLibrary settings16x16Icon 'Settings...') |
|
1837 |
) |
|
1838 |
) |
|
1839 |
nil |
|
1840 |
nil |
|
1841 |
) |
|
1842 |
! |
|
1843 |
||
1844 |
fileMenu |
|
1845 |
"This resource specification was automatically generated |
|
1846 |
by the MenuEditor of ST/X." |
|
1847 |
||
1848 |
"Do not manually edit this!! If it is corrupted, |
|
1849 |
the MenuEditor may not be able to read the specification." |
|
1850 |
||
1851 |
||
1852 |
" |
|
1853 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileMenu |
|
1854 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileMenu)) startUp |
|
1855 |
" |
|
1856 |
||
1857 |
<resource: #menu> |
|
1858 |
||
1859 |
^ |
|
1860 |
#(Menu |
|
1861 |
( |
|
1862 |
(MenuItem |
|
1863 |
enabled: enableFileHistory |
|
1864 |
label: 'File History' |
|
1865 |
submenuChannel: menuFileHistory |
|
1866 |
) |
|
1867 |
(MenuItem |
|
1868 |
label: '-' |
|
1869 |
) |
|
1870 |
(MenuItem |
|
1871 |
label: 'Open' |
|
1872 |
itemValue: doShowFileContents |
|
1873 |
) |
|
1874 |
(MenuItem |
|
1875 |
label: '-' |
|
1876 |
) |
|
1877 |
(MenuItem |
|
1878 |
enabled: hasFileSelection |
|
1879 |
label: 'FileIn' |
|
1880 |
itemValue: fileFileIn |
|
1881 |
) |
|
1882 |
(MenuItem |
|
1883 |
enabled: hasFileSelection |
|
1884 |
label: 'FileIn to Namespace...' |
|
1885 |
itemValue: fileFileInToNameSpace |
|
1886 |
) |
|
1887 |
(MenuItem |
|
1888 |
enabled: hasPackageDirectorySelected |
|
1889 |
label: 'Load Package from Here' |
|
1890 |
itemValue: fileFileInPackage |
|
1891 |
) |
|
1892 |
(MenuItem |
|
1893 |
label: '-' |
|
1894 |
) |
|
1895 |
(MenuItem |
|
1896 |
label: 'New' |
|
1897 |
submenuChannel: newMenu |
|
1898 |
keepLinkedMenu: true |
|
1899 |
) |
|
1900 |
(MenuItem |
|
1901 |
label: '-' |
|
1902 |
) |
|
1903 |
(MenuItem |
|
1904 |
enabled: hasSelection |
|
1905 |
label: 'Cut' |
|
1906 |
itemValue: cutFiles |
|
1907 |
) |
|
1908 |
(MenuItem |
|
1909 |
enabled: hasSelection |
|
1910 |
label: 'Copy' |
|
1911 |
itemValue: copyFiles |
|
1912 |
) |
|
1913 |
(MenuItem |
|
1914 |
enabled: canPaste |
|
1915 |
label: 'Paste' |
|
1916 |
itemValue: pasteFiles |
|
1917 |
) |
|
1918 |
(MenuItem |
|
1919 |
enabled: hasSelection |
|
1920 |
label: 'Delete' |
|
1921 |
itemValue: deleteFiles |
|
1922 |
) |
|
1923 |
(MenuItem |
|
1924 |
enabled: hasSelection |
|
1925 |
label: 'Erase' |
|
1926 |
itemValue: eraseFiles |
|
1927 |
) |
|
1928 |
(MenuItem |
|
1929 |
label: '-' |
|
1930 |
) |
|
1931 |
(MenuItem |
|
1932 |
enabled: hasSelection |
|
1933 |
label: 'Rename...' |
|
1934 |
itemValue: renameSelection |
|
1935 |
shortcutKey: Rename |
|
1936 |
) |
|
1937 |
(MenuItem |
|
1938 |
enabled: hasSelection |
|
1939 |
label: 'Move To...' |
|
1940 |
itemValue: moveSelectionTo |
|
1941 |
) |
|
1942 |
(MenuItem |
|
1943 |
enabled: hasSelection |
|
1944 |
label: 'Copy To...' |
|
1945 |
itemValue: copySelectionTo |
|
1946 |
) |
|
1947 |
(MenuItem |
|
1948 |
enabled: hasSelection |
|
1949 |
label: 'Properties...' |
|
1950 |
itemValue: doShowProperties |
|
1951 |
) |
|
1952 |
(MenuItem |
|
1953 |
label: '-' |
|
1954 |
isVisible: javaSupportLoaded |
|
1955 |
) |
|
1956 |
(MenuItem |
|
1957 |
enabled: canAddToClassPath |
|
1958 |
label: 'Add to Java Class Path' |
|
1959 |
isVisible: javaSupportLoaded |
|
1960 |
) |
|
1961 |
(MenuItem |
|
1962 |
enabled: canRemoveFromClassPath |
|
1963 |
label: 'Remove from Java Class Path' |
|
1964 |
isVisible: javaSupportLoaded |
|
1965 |
) |
|
1966 |
(MenuItem |
|
1967 |
enabled: canAddToSourcePath |
|
1968 |
label: 'Add to Java Source Path' |
|
1969 |
isVisible: javaSupportLoaded |
|
1970 |
) |
|
1971 |
(MenuItem |
|
1972 |
enabled: canRemoveFromSourcePath |
|
1973 |
label: 'Remove from Java Source Path' |
|
1974 |
isVisible: javaSupportLoaded |
|
1975 |
) |
|
1976 |
) |
|
1977 |
nil |
|
1978 |
nil |
|
1979 |
) |
|
1980 |
! |
|
1981 |
||
1982 |
fileOpMenu |
|
1983 |
"This resource specification was automatically generated |
|
1984 |
by the MenuEditor of ST/X." |
|
1985 |
||
1986 |
"Do not manually edit this!! If it is corrupted, |
|
1987 |
the MenuEditor may not be able to read the specification." |
|
1988 |
||
1989 |
||
1990 |
" |
|
1991 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileOpMenu |
|
1992 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileOpMenu)) startUp |
|
1993 |
" |
|
1994 |
||
1995 |
<resource: #menu> |
|
1996 |
||
1997 |
^ |
|
1998 |
#(Menu |
|
1999 |
( |
|
2000 |
(MenuItem |
|
2001 |
enabled: hasFileSelection |
|
15906 | 2002 |
label: 'Split (by size)...' |
15211 | 2003 |
itemValue: splitSelectedFiles |
2004 |
) |
|
2005 |
(MenuItem |
|
2006 |
enabled: hasFileSelection |
|
15906 | 2007 |
label: 'Split (by #lines)...' |
2008 |
itemValue: splitSelectedFilesByLines |
|
2009 |
) |
|
2010 |
(MenuItem |
|
2011 |
enabled: hasFileSelection |
|
15211 | 2012 |
label: 'Join...' |
2013 |
itemValue: joinSelectedFiles |
|
2014 |
) |
|
2015 |
(MenuItem |
|
2016 |
enabled: hasFileSelection |
|
2017 |
label: 'Copy Corrupted File To...' |
|
2018 |
itemValue: copySelectionToRepairingCorruptedFiles |
|
2019 |
) |
|
2020 |
(MenuItem |
|
15569 | 2021 |
label: 'Copy Corrupted File From -> To...' |
2022 |
itemValue: copyFromToRepairingCorruptedFiles |
|
2023 |
) |
|
2024 |
(MenuItem |
|
15211 | 2025 |
label: '-' |
2026 |
) |
|
2027 |
(MenuItem |
|
2028 |
enabled: hasFileSelection |
|
2029 |
label: 'Rot13...' |
|
2030 |
itemValue: filterSelectedFiles: |
|
2031 |
argument: rot13 |
|
2032 |
) |
|
2033 |
(MenuItem |
|
2034 |
label: '-' |
|
2035 |
) |
|
2036 |
(MenuItem |
|
2037 |
enabled: hasFileSelection |
|
2038 |
label: 'Truncate...' |
|
2039 |
itemValue: truncateSelectedFilesToZeroSize |
|
2040 |
) |
|
2041 |
(MenuItem |
|
2042 |
label: '-' |
|
2043 |
) |
|
2044 |
(MenuItem |
|
2045 |
label: 'Load Signature Support Package' |
|
2046 |
itemValue: loadSignatureSupport |
|
2047 |
isVisible: cannotGenerateSignatureFiles |
|
2048 |
) |
|
2049 |
(MenuItem |
|
2050 |
enabled: canGenerateSignatureFiles |
|
2051 |
label: 'Generate Signed Files' |
|
2052 |
itemValue: generateSignaturesForSelectedFiles |
|
2053 |
) |
|
2054 |
(MenuItem |
|
2055 |
enabled: canGenerateSignatureFiles |
|
2056 |
label: 'Generate Detached Signature Files (use for dll)' |
|
2057 |
itemValue: generateDetachedSignaturesForSelectedFiles |
|
2058 |
) |
|
2059 |
(MenuItem |
|
2060 |
enabled: canGenerateSignatureFiles |
|
2061 |
label: 'Generate Patch Installer for File(s)' |
|
2062 |
itemValue: generatePatchInstallerForSelectedFiles |
|
2063 |
) |
|
2064 |
(MenuItem |
|
2065 |
label: '-' |
|
2066 |
) |
|
2067 |
(MenuItem |
|
2068 |
enabled: hasFileSelection |
|
2069 |
label: 'File Differences' |
|
2070 |
itemValue: openDiffView |
|
2071 |
isVisible: hasTwoFilesSelectedHolder |
|
2072 |
) |
|
2073 |
(MenuItem |
|
2074 |
enabled: hasFileSelection |
|
2075 |
label: 'File Differences...' |
|
2076 |
itemValue: openDiffView |
|
2077 |
isVisible: hasNotTwoFilesSelectedHolder |
|
2078 |
) |
|
2079 |
(MenuItem |
|
2080 |
enabled: hasSelection |
|
2081 |
label: 'Directory Differences' |
|
2082 |
itemValue: openDirectoryDiffView |
|
2083 |
isVisible: hasTwoDirectoriesSelectedHolder |
|
2084 |
) |
|
2085 |
(MenuItem |
|
2086 |
enabled: hasSelection |
|
2087 |
label: 'Directory Differences...' |
|
2088 |
itemValue: openDirectoryDiffView |
|
2089 |
isVisible: hasNotTwoDirectoriesSelectedHolder |
|
2090 |
) |
|
17831 | 2091 |
(MenuItem |
2092 |
label: '-' |
|
2093 |
) |
|
2094 |
(MenuItem |
|
2095 |
label: 'Remove .bak and .sav Files...' |
|
2096 |
itemValue: removeBakAndSavFiles |
|
2097 |
) |
|
15211 | 2098 |
) |
2099 |
nil |
|
2100 |
nil |
|
2101 |
) |
|
2102 |
! |
|
2103 |
||
2104 |
newMenu |
|
2105 |
"This resource specification was automatically generated |
|
2106 |
by the MenuEditor of ST/X." |
|
2107 |
||
2108 |
"Do not manually edit this!! If it is corrupted, |
|
2109 |
the MenuEditor may not be able to read the specification." |
|
2110 |
||
2111 |
" |
|
2112 |
MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#newMenu |
|
2113 |
(Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser newMenu)) startUp |
|
2114 |
" |
|
2115 |
||
2116 |
<resource: #menu> |
|
2117 |
||
2118 |
^ |
|
2119 |
#(#Menu |
|
2120 |
#( |
|
2121 |
#(#MenuItem |
|
2122 |
#label: 'Directory...' |
|
2123 |
#translateLabel: true |
|
2124 |
#value: #newDirectory |
|
2125 |
) |
|
2126 |
#(#MenuItem |
|
2127 |
#label: 'File...' |
|
2128 |
#translateLabel: true |
|
2129 |
#value: #newFile |
|
2130 |
) |
|
2131 |
#(#MenuItem |
|
2132 |
#label: 'Hard Link...' |
|
2133 |
#translateLabel: true |
|
2134 |
#value: #newHardLink |
|
2135 |
) |
|
2136 |
#(#MenuItem |
|
2137 |
#label: 'Symbolic Link...' |
|
2138 |
#translateLabel: true |
|
2139 |
#value: #newSoftLink |
|
2140 |
) |
|
2141 |
) |
|
2142 |
nil |
|
2143 |
nil |
|
2144 |
) |
|
2145 |
! |
|
2146 |
||
2147 |
scmMenuSlice |
|
2148 |
"This resource specification was automatically generated |
|
2149 |
by the MenuEditor of ST/X." |
|
2150 |
||
2151 |
"Do not manually edit this!! If it is corrupted, |
|
2152 |
the MenuEditor may not be able to read the specification." |
|
2153 |
||
2154 |
||
2155 |
" |
|
2156 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#scmMenuSlice |
|
2157 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser scmMenuSlice)) startUp |
|
2158 |
" |
|
2159 |
||
2160 |
<resource: #menu> |
|
2161 |
||
2162 |
^ |
|
2163 |
#(Menu |
|
2164 |
( |
|
2165 |
(MenuItem |
|
2166 |
label: 'CVS' |
|
2167 |
isVisible: cvsMenusAreShown |
|
2168 |
submenuChannel: cvsMenu |
|
2169 |
) |
|
2170 |
(MenuItem |
|
2171 |
label: 'SVN' |
|
2172 |
isVisible: svnMenusAreShown |
|
2173 |
submenuChannel: svnMenu |
|
2174 |
) |
|
2175 |
(MenuItem |
|
2176 |
label: 'Mercurial' |
|
2177 |
isVisible: mercurialMenusAreShown |
|
2178 |
submenuChannel: mercurialMenu |
|
2179 |
) |
|
2180 |
(MenuItem |
|
2181 |
label: 'HG' |
|
2182 |
isVisible: hgMenusAreShown |
|
2183 |
submenuChannel: hgMenu |
|
2184 |
) |
|
2185 |
(MenuItem |
|
18820 | 2186 |
label: 'Git' |
2187 |
isVisible: gitMenusAreShown |
|
2188 |
submenuChannel: gitMenu |
|
2189 |
) |
|
2190 |
(MenuItem |
|
15211 | 2191 |
label: 'Perforce' |
2192 |
isVisible: perforceMenusAreShown |
|
2193 |
submenuChannel: perforceMenu |
|
2194 |
) |
|
2195 |
) |
|
2196 |
nil |
|
2197 |
nil |
|
2198 |
) |
|
18820 | 2199 |
|
2200 |
"Modified: / 10-06-2019 / 16:01:14 / Claus Gittinger" |
|
15211 | 2201 |
! |
2202 |
||
2203 |
showMenuSpec |
|
2204 |
"This resource specification was automatically generated |
|
2205 |
by the MenuEditor of ST/X." |
|
2206 |
||
2207 |
"Do not manually edit this!! If it is corrupted, |
|
2208 |
the MenuEditor may not be able to read the specification." |
|
2209 |
||
2210 |
" |
|
2211 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpec |
|
2212 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpec)) startUp |
|
2213 |
" |
|
2214 |
||
2215 |
<resource: #menu> |
|
2216 |
||
2217 |
^ |
|
2218 |
#(Menu |
|
2219 |
( |
|
2220 |
(MenuItem |
|
2221 |
label: 'Hidden Files' |
|
2222 |
translateLabel: true |
|
2223 |
hideMenuOnActivated: false |
|
2224 |
indication: showHiddenFiles |
|
2225 |
) |
|
2226 |
(MenuItem |
|
2227 |
label: '-' |
|
2228 |
) |
|
2229 |
(MenuItem |
|
2230 |
label: 'Directory Tree' |
|
2231 |
translateLabel: true |
|
2232 |
hideMenuOnActivated: false |
|
2233 |
indication: showDirectoryTree |
|
2234 |
) |
|
2235 |
(MenuItem |
|
2236 |
label: 'Regular Files in TreeView (Left)' |
|
2237 |
translateLabel: true |
|
2238 |
hideMenuOnActivated: false |
|
2239 |
indication: viewFilesInDirectoryTree |
|
2240 |
) |
|
2241 |
(MenuItem |
|
2242 |
label: 'Directories in ContentsView (Right)' |
|
2243 |
translateLabel: true |
|
2244 |
hideMenuOnActivated: false |
|
2245 |
indication: viewDirsInContentsBrowser |
|
2246 |
) |
|
2247 |
(MenuItem |
|
2248 |
enabled: enableViewNoteBookApplication |
|
2249 |
label: 'File Applications' |
|
2250 |
translateLabel: true |
|
2251 |
hideMenuOnActivated: false |
|
2252 |
indication: viewNoteBookApplicationHolder |
|
2253 |
) |
|
2254 |
(MenuItem |
|
2255 |
label: '-' |
|
2256 |
) |
|
2257 |
(MenuItem |
|
2258 |
label: 'DiskUsage' |
|
2259 |
translateLabel: true |
|
2260 |
hideMenuOnActivated: false |
|
2261 |
indication: showDiskUsageHolder |
|
2262 |
) |
|
2263 |
) |
|
2264 |
nil |
|
2265 |
nil |
|
2266 |
) |
|
2267 |
! |
|
2268 |
||
2269 |
showMenuSpecForDialog |
|
2270 |
"This resource specification was automatically generated |
|
2271 |
by the MenuEditor of ST/X." |
|
2272 |
||
2273 |
"Do not manually edit this!! If it is corrupted, |
|
2274 |
the MenuEditor may not be able to read the specification." |
|
2275 |
||
2276 |
" |
|
2277 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpecForDialog |
|
2278 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpecForDialog)) startUp |
|
2279 |
" |
|
2280 |
||
2281 |
<resource: #menu> |
|
2282 |
||
2283 |
^ |
|
2284 |
#(Menu |
|
2285 |
( |
|
2286 |
(MenuItem |
|
2287 |
label: 'Hidden Files' |
|
2288 |
translateLabel: true |
|
2289 |
hideMenuOnActivated: false |
|
2290 |
indication: showHiddenFiles |
|
2291 |
) |
|
2292 |
) |
|
2293 |
nil |
|
2294 |
nil |
|
2295 |
) |
|
2296 |
! |
|
2297 |
||
2298 |
sortMenu |
|
2299 |
"This resource specification was automatically generated |
|
2300 |
by the MenuEditor of ST/X." |
|
2301 |
||
2302 |
"Do not manually edit this!! If it is corrupted, |
|
2303 |
the MenuEditor may not be able to read the specification." |
|
2304 |
||
2305 |
" |
|
2306 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#sortMenu |
|
2307 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser sortMenu)) startUp |
|
2308 |
" |
|
2309 |
||
2310 |
<resource: #menu> |
|
2311 |
||
2312 |
^ |
|
2313 |
#(#Menu |
|
2314 |
#( |
|
2315 |
#(#MenuItem |
|
2316 |
#label: 'By Filename' |
|
2317 |
#translateLabel: true |
|
2318 |
#hideMenuOnActivated: false |
|
2319 |
#choice: #sortBlockProperty |
|
2320 |
#choiceValue: #baseName |
|
2321 |
) |
|
2322 |
#(#MenuItem |
|
2323 |
#label: 'By Extension' |
|
2324 |
#translateLabel: true |
|
2325 |
#hideMenuOnActivated: false |
|
2326 |
#choice: #sortBlockProperty |
|
2327 |
#choiceValue: #suffix |
|
2328 |
) |
|
2329 |
#(#MenuItem |
|
2330 |
#label: 'By Permissions' |
|
2331 |
#translateLabel: true |
|
2332 |
#hideMenuOnActivated: false |
|
2333 |
#choice: #sortBlockProperty |
|
2334 |
#choiceValue: #permissions |
|
2335 |
) |
|
2336 |
#(#MenuItem |
|
2337 |
#label: 'By Owner' |
|
2338 |
#translateLabel: true |
|
2339 |
#isVisible: #viewOwner |
|
2340 |
#hideMenuOnActivated: false |
|
2341 |
#choice: #sortBlockProperty |
|
2342 |
#choiceValue: #owner |
|
2343 |
) |
|
2344 |
#(#MenuItem |
|
2345 |
#label: 'By Group' |
|
2346 |
#translateLabel: true |
|
2347 |
#isVisible: #viewOwner |
|
2348 |
#hideMenuOnActivated: false |
|
2349 |
#choice: #sortBlockProperty |
|
2350 |
#choiceValue: #group |
|
2351 |
) |
|
2352 |
#(#MenuItem |
|
2353 |
#label: 'By Size' |
|
2354 |
#translateLabel: true |
|
2355 |
#hideMenuOnActivated: false |
|
2356 |
#choice: #sortBlockProperty |
|
2357 |
#choiceValue: #fileSize |
|
2358 |
) |
|
2359 |
#(#MenuItem |
|
2360 |
#label: 'By Date && Time' |
|
2361 |
#translateLabel: true |
|
2362 |
#hideMenuOnActivated: false |
|
2363 |
#choice: #sortBlockProperty |
|
2364 |
#choiceValue: #modificationTime |
|
2365 |
) |
|
2366 |
#(#MenuItem |
|
2367 |
#label: '-' |
|
2368 |
) |
|
2369 |
#(#MenuItem |
|
2370 |
#label: 'Ignore Case in Sort' |
|
2371 |
#translateLabel: true |
|
2372 |
#hideMenuOnActivated: false |
|
2373 |
#indication: #sortCaseless |
|
2374 |
) |
|
2375 |
#(#MenuItem |
|
2376 |
#label: 'Directories before Files' |
|
2377 |
#translateLabel: true |
|
2378 |
#hideMenuOnActivated: false |
|
2379 |
#indication: #sortDirectoriesBeforeFiles |
|
2380 |
) |
|
2381 |
) |
|
2382 |
nil |
|
2383 |
nil |
|
2384 |
) |
|
2385 |
! |
|
2386 |
||
2387 |
toolsMenuSpec |
|
2388 |
"This resource specification was automatically generated |
|
2389 |
by the MenuEditor of ST/X." |
|
2390 |
||
2391 |
"Do not manually edit this!! If it is corrupted, |
|
2392 |
the MenuEditor may not be able to read the specification." |
|
2393 |
||
2394 |
||
2395 |
" |
|
2396 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec |
|
2397 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp |
|
2398 |
" |
|
2399 |
||
2400 |
<resource: #menu> |
|
2401 |
||
2402 |
^ |
|
2403 |
#(Menu |
|
2404 |
( |
|
2405 |
(MenuItem |
|
2406 |
label: 'Open (Win32-Shell)' |
|
2407 |
itemValue: doOpenWithShellCommand |
|
2408 |
isVisible: systemIsDOS |
|
2409 |
) |
|
2410 |
(MenuItem |
|
18013 | 2411 |
label: 'Open (OSX-Application)' |
2412 |
itemValue: doOpenWithShellCommand |
|
2413 |
isVisible: systemIsOSX |
|
2414 |
) |
|
2415 |
(MenuItem |
|
15211 | 2416 |
label: 'Execute UNIX Command...' |
2417 |
itemValue: doExecuteCommand |
|
2418 |
isVisible: systemIsUnix |
|
2419 |
) |
|
2420 |
(MenuItem |
|
2421 |
label: 'Execute DOS Command...' |
|
2422 |
itemValue: doExecuteCommand |
|
2423 |
isVisible: systemIsDOS |
|
2424 |
) |
|
2425 |
(MenuItem |
|
2426 |
label: 'Execute Script...' |
|
2427 |
itemValue: doExecuteScript |
|
2428 |
) |
|
2429 |
(MenuItem |
|
2430 |
enabled: canDoTerminal |
|
2431 |
label: 'Shell Terminal' |
|
2432 |
itemValue: openTerminal |
|
2433 |
isVisible: canDoTerminalAndSystemIsUnix |
|
2434 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'Shell Terminal') |
|
2435 |
) |
|
2436 |
(MenuItem |
|
2437 |
enabled: canDoTerminal |
|
2438 |
label: 'DOS Terminal' |
|
2439 |
itemValue: openTerminal |
|
2440 |
isVisible: canDoTerminalAndSystemIsDOS |
|
2441 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'DOS Terminal') |
|
2442 |
) |
|
2443 |
(MenuItem |
|
2444 |
label: '-' |
|
2445 |
) |
|
2446 |
(MenuItem |
|
2447 |
enabled: hasFileSelection |
|
2448 |
label: 'Changes Browser' |
|
2449 |
itemValue: openChangesBrowser |
|
18773 | 2450 |
labelImage: (ResourceRetriever ToolbarIconLibrary changesBrowser16x16Icon 'Changes Browser') |
15211 | 2451 |
) |
2452 |
(MenuItem |
|
18834 | 2453 |
enabled: hasFileOrCypressPackageSelection |
15211 | 2454 |
label: 'ChangeSet Browser' |
2455 |
itemValue: openChangeSetBrowser |
|
2456 |
isVisible: changeSetBrowserItemVisible |
|
2457 |
) |
|
2458 |
(MenuItem |
|
2459 |
enabled: hasFileSelection |
|
2460 |
label: 'Workspace' |
|
2461 |
itemValue: openWorkspace |
|
2462 |
) |
|
2463 |
(MenuItem |
|
2464 |
label: '-' |
|
2465 |
) |
|
2466 |
(MenuItem |
|
2467 |
enabled: canReadAbbrevFile |
|
2468 |
label: 'Install Autoloaded' |
|
2469 |
itemValue: readAbbrevFile |
|
2470 |
) |
|
2471 |
(MenuItem |
|
2472 |
enabled: anySTFilesPresent |
|
2473 |
label: 'Install all ST-Files as Autoloaded' |
|
2474 |
itemValue: installAllAsAutoloaded |
|
2475 |
) |
|
2476 |
(MenuItem |
|
2477 |
enabled: recursiveAnySTFilesPresent |
|
2478 |
label: 'Recursive Install all ST-Files as Autoloaded' |
|
2479 |
itemValue: installAllAsAutoloadedRecursive |
|
2480 |
) |
|
2481 |
(MenuItem |
|
2482 |
label: '-' |
|
2483 |
) |
|
2484 |
(MenuItem |
|
2485 |
enabled: hasJava |
|
2486 |
label: 'Add Directory to Java Source Path (stx:libjava)' |
|
2487 |
itemValue: addDirToJavaSourcePath |
|
2488 |
) |
|
2489 |
(MenuItem |
|
2490 |
enabled: hasJava |
|
2491 |
label: 'Add Selected Files to Java Source Path (stx:libjava)' |
|
2492 |
itemValue: fileAddToJavaSourcePath |
|
2493 |
) |
|
2494 |
(MenuItem |
|
2495 |
label: '-' |
|
2496 |
) |
|
2497 |
(MenuItem |
|
2498 |
label: 'File Operations' |
|
2499 |
submenuChannel: fileOpMenu |
|
2500 |
) |
|
2501 |
(MenuItem |
|
2502 |
label: 'File Utilities' |
|
2503 |
submenu: |
|
2504 |
(Menu |
|
2505 |
( |
|
2506 |
(MenuItem |
|
2507 |
enabled: hasFileSelection |
|
2508 |
label: 'Editor' |
|
2509 |
itemValue: openEditor |
|
2510 |
) |
|
2511 |
(MenuItem |
|
2512 |
enabled: hasFileSelection |
|
2513 |
label: 'HTML Reader' |
|
2514 |
itemValue: openHTMLReader |
|
2515 |
) |
|
2516 |
(MenuItem |
|
2517 |
enabled: hasFileSelection |
|
2518 |
label: 'Web Browser' |
|
2519 |
itemValue: openWebBrowser |
|
2520 |
) |
|
2521 |
(MenuItem |
|
2522 |
label: 'XML Inspector' |
|
2523 |
itemValue: inspectXmlFile |
|
2524 |
isVisible: hasXml |
|
2525 |
showBusyCursorWhilePerforming: true |
|
2526 |
) |
|
2527 |
(MenuItem |
|
2528 |
enabled: hasFileSelection |
|
2529 |
label: 'Acroread (PDF Viewer)' |
|
2530 |
itemValue: openPDFViewer |
|
2531 |
) |
|
2532 |
(MenuItem |
|
2533 |
enabled: hasASN1AndSelection |
|
2534 |
label: 'ASN1 Browser' |
|
2535 |
itemValue: openASN1Browser |
|
2536 |
isVisible: hasASN1 |
|
2537 |
) |
|
2538 |
(MenuItem |
|
2539 |
enabled: hasCBrowser |
|
2540 |
label: 'C Browser' |
|
2541 |
itemValue: openCBrowser |
|
2542 |
isVisible: hasCBrowser |
|
2543 |
) |
|
2544 |
(MenuItem |
|
2545 |
enabled: canOpenMonticelloBrowser |
|
2546 |
label: 'Monticello Browser' |
|
2547 |
itemValue: doOpenMonticelloBrowser |
|
2548 |
) |
|
2549 |
(MenuItem |
|
2550 |
enabled: hasJavaAndSelection |
|
2551 |
label: 'Applet Viewer' |
|
2552 |
itemValue: openAppletViewer |
|
2553 |
isVisible: hasJava |
|
2554 |
) |
|
2555 |
(MenuItem |
|
2556 |
enabled: hasMP3PlayerAndSelection |
|
2557 |
label: 'MP3 Player' |
|
2558 |
itemValue: openMP3Player |
|
2559 |
isVisible: hasMP3Player |
|
2560 |
) |
|
2561 |
(MenuItem |
|
2562 |
enabled: hasFileSelection |
|
2563 |
label: 'xv (Image Viewer)' |
|
2564 |
itemValue: openXV |
|
2565 |
isVisible: systemIsUnix |
|
2566 |
) |
|
2567 |
(MenuItem |
|
2568 |
enabled: currentFilesAreInSameDirectory |
|
2569 |
label: 'Slide Show' |
|
2570 |
itemValue: openSlideShow |
|
2571 |
isVisible: hasSlideShow |
|
2572 |
) |
|
2573 |
(MenuItem |
|
2574 |
enabled: hasFileSelection |
|
2575 |
label: 'gv (Postscript Viewer)' |
|
2576 |
itemValue: openGV |
|
2577 |
isVisible: systemIsUnix |
|
2578 |
) |
|
2579 |
(MenuItem |
|
2580 |
enabled: hasMP3PlayerAndSelection |
|
2581 |
label: 'MP3 Player' |
|
2582 |
itemValue: openMP3Player |
|
2583 |
isVisible: hasMP3Player |
|
2584 |
) |
|
2585 |
(MenuItem |
|
2586 |
enabled: hasFileSelection |
|
2587 |
label: 'Realplay (avi viewer)' |
|
2588 |
itemValue: openRP |
|
2589 |
isVisible: systemIsUnix |
|
2590 |
) |
|
2591 |
(MenuItem |
|
2592 |
label: '-' |
|
2593 |
) |
|
2594 |
(MenuItem |
|
2595 |
label: 'Smalltalk' |
|
2596 |
submenu: |
|
2597 |
(Menu |
|
2598 |
( |
|
2599 |
(MenuItem |
|
2600 |
enabled: hasSnapshotSelection |
|
2601 |
label: 'Snapshot Image Browser' |
|
2602 |
itemValue: openSnapshotImageBrowser |
|
2603 |
) |
|
2604 |
(MenuItem |
|
2605 |
enabled: canCreateNewProject |
|
2606 |
label: 'Create Smalltalk Project' |
|
2607 |
itemValue: createProjectAndOpenProjectBrowser |
|
2608 |
) |
|
2609 |
(MenuItem |
|
2610 |
label: '-' |
|
2611 |
) |
|
2612 |
(MenuItem |
|
2613 |
enabled: hasResourceFileSelected |
|
2614 |
label: 'Show Contents of Resourcefile' |
|
2615 |
itemValue: readAndShowResources |
|
2616 |
) |
|
2617 |
(MenuItem |
|
2618 |
enabled: hasResourceFileSelected |
|
2619 |
label: 'Resource File Editor' |
|
2620 |
itemValue: openResourceFileEditor |
|
2621 |
showBusyCursorWhilePerforming: true |
|
2622 |
) |
|
2623 |
(MenuItem |
|
2624 |
label: '-' |
|
2625 |
) |
|
2626 |
(MenuItem |
|
2627 |
enabled: hasFileSelection |
|
2628 |
label: 'Contents as ByteArray' |
|
2629 |
itemValue: fileContentsAsByteArray |
|
2630 |
) |
|
18426 | 2631 |
(MenuItem |
2632 |
label: '-' |
|
2633 |
) |
|
2634 |
(MenuItem |
|
2635 |
enabled: hasFileSelection |
|
2636 |
label: 'Changes from GNU Smalltalk Source' |
|
2637 |
itemValue: changeSetFromGSTSource |
|
2638 |
) |
|
15211 | 2639 |
) |
2640 |
nil |
|
2641 |
nil |
|
2642 |
) |
|
2643 |
) |
|
2644 |
(MenuItem |
|
2645 |
label: 'Image' |
|
2646 |
submenu: |
|
2647 |
(Menu |
|
2648 |
( |
|
2649 |
(MenuItem |
|
2650 |
enabled: hasFileSelection |
|
2651 |
label: 'Image Editor' |
|
2652 |
itemValue: openImageEditor |
|
2653 |
) |
|
2654 |
(MenuItem |
|
2655 |
enabled: hasFileSelection |
|
2656 |
label: 'Image Preview' |
|
2657 |
itemValue: openImagePreview |
|
2658 |
) |
|
2659 |
(MenuItem |
|
2660 |
enabled: hasFileSelection |
|
2661 |
label: 'Image Inspector' |
|
2662 |
itemValue: openImageInspector |
|
2663 |
) |
|
2664 |
(MenuItem |
|
2665 |
label: '-' |
|
2666 |
) |
|
2667 |
(MenuItem |
|
2668 |
enabled: hasFileSelection |
|
2669 |
label: 'Convert to GIF' |
|
2670 |
itemValue: convertImageToGIF |
|
2671 |
) |
|
2672 |
(MenuItem |
|
2673 |
enabled: hasFileSelection |
|
2674 |
label: 'Convert to PNG' |
|
2675 |
itemValue: convertImageToPNG |
|
2676 |
) |
|
2677 |
(MenuItem |
|
2678 |
enabled: hasFileSelection |
|
2679 |
label: 'Convert to XPM' |
|
2680 |
itemValue: convertImageToXPM |
|
2681 |
) |
|
2682 |
(MenuItem |
|
2683 |
enabled: hasFileSelection |
|
2684 |
label: 'Convert to JPG' |
|
2685 |
itemValue: convertImageToJPG |
|
2686 |
) |
|
2687 |
) |
|
2688 |
nil |
|
2689 |
nil |
|
2690 |
) |
|
2691 |
) |
|
2692 |
(MenuItem |
|
15528 | 2693 |
label: 'Web' |
2694 |
submenu: |
|
2695 |
(Menu |
|
2696 |
( |
|
2697 |
(MenuItem |
|
2698 |
label: 'Fetch File by URL...' |
|
2699 |
itemValue: fetchFileByURL |
|
2700 |
) |
|
2701 |
) |
|
2702 |
nil |
|
2703 |
nil |
|
2704 |
) |
|
2705 |
) |
|
2706 |
(MenuItem |
|
15211 | 2707 |
enabled: hasZipFileSelectedHolder |
2708 |
label: 'ZipFile Tool' |
|
2709 |
itemValue: openZipTool |
|
2710 |
) |
|
2711 |
(MenuItem |
|
2712 |
enabled: hasFileSelection |
|
2713 |
label: 'Hex Dump' |
|
2714 |
itemValue: fileHexDump |
|
2715 |
) |
|
2716 |
) |
|
2717 |
nil |
|
2718 |
nil |
|
2719 |
) |
|
2720 |
) |
|
2721 |
(MenuItem |
|
2722 |
label: 'Find' |
|
2723 |
submenu: |
|
2724 |
(Menu |
|
2725 |
( |
|
2726 |
(MenuItem |
|
2727 |
label: 'File...' |
|
2728 |
itemValue: fileFindFile |
|
2729 |
) |
|
2730 |
(MenuItem |
|
2731 |
enabled: hasFileSelection |
|
2732 |
label: 'Same Contents as Selected...' |
|
2733 |
itemValue: fileFindDuplicateFile |
|
2734 |
) |
|
2735 |
(MenuItem |
|
2736 |
label: 'Duplicate Files' |
|
2737 |
itemValue: fileFindDuplicates |
|
2738 |
) |
|
2739 |
(MenuItem |
|
2740 |
enabled: hasSelection |
|
2741 |
label: 'All Duplicate Files (Recursive)' |
|
2742 |
itemValue: fileFindAllDuplicates |
|
2743 |
) |
|
2744 |
(MenuItem |
|
17686 | 2745 |
label: 'Similar Image Files (by Colors)' |
15211 | 2746 |
itemValue: fileFindSimilarImages |
2747 |
isVisible: hasImageColorHistogram |
|
2748 |
) |
|
17686 | 2749 |
(MenuItem |
2750 |
label: 'Similar Image Files (by Form)' |
|
2751 |
itemValue: fileFindSimilarImagesByForm |
|
2752 |
isVisible: hasImageHistogram |
|
2753 |
) |
|
15211 | 2754 |
) |
2755 |
nil |
|
2756 |
nil |
|
2757 |
) |
|
2758 |
) |
|
2759 |
) |
|
2760 |
nil |
|
2761 |
nil |
|
2762 |
) |
|
18834 | 2763 |
|
2764 |
"Modified: / 23-06-2019 / 13:04:17 / Claus Gittinger" |
|
15211 | 2765 |
! |
2766 |
||
2767 |
viewDetailsMenuSpec |
|
2768 |
"This resource specification was automatically generated |
|
2769 |
by the MenuEditor of ST/X." |
|
2770 |
||
2771 |
"Do not manually edit this!! If it is corrupted, |
|
2772 |
the MenuEditor may not be able to read the specification." |
|
2773 |
||
2774 |
" |
|
2775 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#viewDetailsMenuSpec |
|
2776 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser viewDetailsMenuSpec)) startUp |
|
2777 |
" |
|
2778 |
||
2779 |
<resource: #menu> |
|
2780 |
||
2781 |
^ |
|
2782 |
#(#Menu |
|
2783 |
#( |
|
2784 |
#(#MenuItem |
|
2785 |
#label: '-' |
|
2786 |
) |
|
2787 |
#(#MenuItem |
|
2788 |
#label: 'Hidden Files' |
|
2789 |
#translateLabel: true |
|
2790 |
#indication: #showHiddenFiles |
|
2791 |
) |
|
2792 |
) |
|
2793 |
nil |
|
2794 |
nil |
|
2795 |
) |
|
2796 |
! ! |
|
3892 | 2797 |
|
11144 | 2798 |
!AbstractFileBrowser class methodsFor:'menu specs-scm'! |
2799 |
||
15211 | 2800 |
cvsMenu |
2801 |
"This resource specification was automatically generated |
|
2802 |
by the MenuEditor of ST/X." |
|
2803 |
||
2804 |
"Do not manually edit this!! If it is corrupted, |
|
2805 |
the MenuEditor may not be able to read the specification." |
|
2806 |
||
2807 |
||
2808 |
" |
|
2809 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#cvsMenu |
|
2810 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser cvsMenu)) startUp |
|
2811 |
" |
|
2812 |
||
2813 |
<resource: #menu> |
|
2814 |
||
2815 |
^ |
|
2816 |
#(Menu |
|
2817 |
( |
|
2818 |
(MenuItem |
|
2819 |
label: 'Commit (CVS)...' |
|
2820 |
itemValue: cvsCommit |
|
2821 |
translateLabel: true |
|
2822 |
) |
|
2823 |
(MenuItem |
|
2824 |
enabled: canCvsAddAndCommit |
|
2825 |
label: 'Add && Commit...' |
|
2826 |
itemValue: cvsAddAndCommit |
|
2827 |
translateLabel: true |
|
2828 |
) |
|
2829 |
(MenuItem |
|
2830 |
enabled: canCvsAddAndCommit |
|
2831 |
label: 'Add as Binary && Commit...' |
|
2832 |
itemValue: cvsAddBinaryAndCommit |
|
2833 |
translateLabel: true |
|
2834 |
) |
|
2835 |
(MenuItem |
|
2836 |
label: 'Commit Folder (CVS)...' |
|
2837 |
itemValue: cvsCommitFolder |
|
2838 |
translateLabel: true |
|
2839 |
) |
|
2840 |
(MenuItem |
|
2841 |
label: '-' |
|
2842 |
) |
|
2843 |
(MenuItem |
|
2844 |
enabled: hasSelection |
|
2845 |
label: 'Update selected Files/Directories' |
|
2846 |
itemValue: cvsUpdateSelection |
|
2847 |
translateLabel: true |
|
2848 |
) |
|
2849 |
(MenuItem |
|
2850 |
label: 'Update Directory Local' |
|
2851 |
itemValue: cvsUpdateAll |
|
2852 |
translateLabel: true |
|
2853 |
) |
|
2854 |
(MenuItem |
|
2855 |
label: 'Update Directory Recursive' |
|
2856 |
itemValue: cvsUpdateAllRecursive |
|
2857 |
translateLabel: true |
|
2858 |
) |
|
2859 |
(MenuItem |
|
2860 |
label: '-' |
|
2861 |
) |
|
2862 |
(MenuItem |
|
2863 |
enabled: hasSelection |
|
2864 |
label: 'Tag...' |
|
2865 |
itemValue: cvsTagSelection |
|
2866 |
translateLabel: true |
|
2867 |
) |
|
2868 |
(MenuItem |
|
2869 |
enabled: hasSelection |
|
2870 |
label: 'Revision Log' |
|
2871 |
itemValue: cvsRevisionLog |
|
2872 |
translateLabel: true |
|
2873 |
) |
|
2874 |
(MenuItem |
|
2875 |
enabled: hasSelection |
|
2876 |
label: 'Compare with newest in Repository' |
|
2877 |
itemValue: cvsCompareWithNewest |
|
2878 |
translateLabel: true |
|
2879 |
) |
|
2880 |
(MenuItem |
|
18867 | 2881 |
enabled: hasSelection |
2882 |
label: 'Browse Repository Versions' |
|
2883 |
itemValue: cvsBrowseRepositoryVersions |
|
2884 |
translateLabel: true |
|
2885 |
) |
|
2886 |
(MenuItem |
|
15211 | 2887 |
label: '-' |
2888 |
) |
|
2889 |
(MenuItem |
|
2890 |
enabled: canRemoveCVSContainer |
|
2891 |
label: 'Remove File && CVS Container...' |
|
2892 |
itemValue: cvsRemoveFileAndCVSContainer |
|
2893 |
translateLabel: true |
|
2894 |
) |
|
2895 |
) |
|
2896 |
nil |
|
2897 |
nil |
|
2898 |
) |
|
18867 | 2899 |
|
2900 |
"Modified: / 07-07-2019 / 18:42:37 / Claus Gittinger" |
|
15211 | 2901 |
! |
2902 |
||
18820 | 2903 |
gitMenu |
2904 |
"This resource specification was automatically generated |
|
2905 |
by the MenuEditor of ST/X." |
|
2906 |
||
2907 |
"Do not manually edit this!! If it is corrupted, |
|
2908 |
the MenuEditor may not be able to read the specification." |
|
2909 |
||
2910 |
||
2911 |
" |
|
2912 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#mercurialMenu |
|
2913 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser mercurialMenu)) startUp |
|
2914 |
" |
|
2915 |
||
2916 |
<resource: #menu> |
|
2917 |
||
2918 |
^ |
|
2919 |
#(Menu |
|
2920 |
( |
|
2921 |
(MenuItem |
|
2922 |
label: 'Add' |
|
2923 |
itemValue: gitAdd |
|
2924 |
translateLabel: true |
|
2925 |
) |
|
2926 |
(MenuItem |
|
2927 |
label: 'Commit Changes' |
|
2928 |
itemValue: gitCommit |
|
2929 |
translateLabel: true |
|
2930 |
) |
|
2931 |
(MenuItem |
|
2932 |
label: 'Push...' |
|
2933 |
itemValue: gitPush |
|
2934 |
translateLabel: true |
|
2935 |
) |
|
2936 |
(MenuItem |
|
2937 |
label: 'Status' |
|
2938 |
itemValue: gitStatus |
|
2939 |
translateLabel: true |
|
2940 |
) |
|
2941 |
(MenuItem |
|
2942 |
label: '-' |
|
2943 |
) |
|
2944 |
(MenuItem |
|
2945 |
label: 'Init' |
|
2946 |
itemValue: gitInit |
|
2947 |
translateLabel: true |
|
2948 |
) |
|
2949 |
) |
|
2950 |
nil |
|
2951 |
nil |
|
2952 |
) |
|
2953 |
||
2954 |
"Created: / 10-06-2019 / 16:01:55 / Claus Gittinger" |
|
2955 |
! |
|
2956 |
||
15211 | 2957 |
mercurialMenu |
2958 |
"This resource specification was automatically generated |
|
2959 |
by the MenuEditor of ST/X." |
|
2960 |
||
2961 |
"Do not manually edit this!! If it is corrupted, |
|
2962 |
the MenuEditor may not be able to read the specification." |
|
2963 |
||
2964 |
||
2965 |
" |
|
2966 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#mercurialMenu |
|
2967 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser mercurialMenu)) startUp |
|
2968 |
" |
|
2969 |
||
2970 |
<resource: #menu> |
|
2971 |
||
2972 |
^ |
|
2973 |
#(Menu |
|
2974 |
( |
|
2975 |
(MenuItem |
|
2976 |
label: 'Add' |
|
2977 |
itemValue: mercurialAdd |
|
2978 |
translateLabel: true |
|
2979 |
) |
|
2980 |
(MenuItem |
|
2981 |
label: 'Commit Changes' |
|
2982 |
itemValue: mercurialCommit |
|
2983 |
translateLabel: true |
|
2984 |
) |
|
2985 |
(MenuItem |
|
2986 |
label: 'Push...' |
|
2987 |
itemValue: mercurialPush |
|
2988 |
translateLabel: true |
|
2989 |
) |
|
2990 |
(MenuItem |
|
2991 |
label: 'Status' |
|
2992 |
itemValue: mercurialStatus |
|
2993 |
translateLabel: true |
|
2994 |
) |
|
2995 |
(MenuItem |
|
2996 |
label: '-' |
|
2997 |
) |
|
2998 |
(MenuItem |
|
2999 |
label: 'Init' |
|
3000 |
itemValue: mercurialInit |
|
3001 |
translateLabel: true |
|
3002 |
) |
|
3003 |
) |
|
3004 |
nil |
|
3005 |
nil |
|
3006 |
) |
|
3007 |
||
3008 |
"Modified: / 17-01-2012 / 15:57:40 / cg" |
|
3009 |
! |
|
3010 |
||
3011 |
perforceMenu |
|
3012 |
"This resource specification was automatically generated |
|
3013 |
by the MenuEditor of ST/X." |
|
3014 |
||
3015 |
"Do not manually edit this!! If it is corrupted, |
|
3016 |
the MenuEditor may not be able to read the specification." |
|
3017 |
||
3018 |
||
3019 |
" |
|
3020 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#perforceMenu |
|
3021 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser perforceMenu)) startUp |
|
3022 |
" |
|
3023 |
||
3024 |
<resource: #menu> |
|
3025 |
||
3026 |
^ |
|
3027 |
#(Menu |
|
3028 |
( |
|
3029 |
(MenuItem |
|
3030 |
label: 'Commit' |
|
3031 |
itemValue: perforceCommit |
|
3032 |
translateLabel: true |
|
3033 |
) |
|
3034 |
) |
|
3035 |
nil |
|
3036 |
nil |
|
3037 |
) |
|
3038 |
||
3039 |
"Created: / 15-01-2012 / 13:12:30 / cg" |
|
3040 |
! ! |
|
11144 | 3041 |
|
3892 | 3042 |
!AbstractFileBrowser class methodsFor:'misc'! |
3043 |
||
3044 |
newLock |
|
3045 |
^ CodeExecutionLock new |
|
3046 |
! ! |
|
3047 |
||
17288 | 3048 |
!AbstractFileBrowser class methodsFor:'queries'! |
3049 |
||
3050 |
isAbstract |
|
3051 |
^ self == AbstractFileBrowser |
|
3052 |
! ! |
|
3053 |
||
17868 | 3054 |
!AbstractFileBrowser class methodsFor:'queries-file'! |
3055 |
||
3056 |
getBestDirectoryFrom:directories |
|
3057 |
"from a set of directories, return the common parent directory" |
|
3058 |
||
3059 |
|stringCol firstPre| |
|
3060 |
||
3061 |
directories isEmpty ifTrue:[^ nil]. |
|
3062 |
directories size == 1 ifTrue:[^ directories first]. |
|
3063 |
stringCol := (directories collect:[:file| file asString]) asOrderedCollection. |
|
3064 |
firstPre := stringCol at:1. |
|
3065 |
stringCol from:2 do:[:el| |
|
3066 |
firstPre := firstPre commonPrefixWith:el. |
|
3067 |
]. |
|
3068 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
3069 |
firstPre removeLast. |
|
3070 |
]. |
|
3071 |
^ firstPre asFilename |
|
3072 |
! ! |
|
3073 |
||
17746 | 3074 |
!AbstractFileBrowser class methodsFor:'utilities - dump'! |
4610 | 3075 |
|
18666 | 3076 |
contentsOfBytesAsDump:dataOrFileStream base:numberBase numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
17744 | 3077 |
"utility helper: generate a hexDump with addresses; |
3078 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
3079 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
3080 |
to support display of alien encoded binary data." |
|
3081 |
||
18666 | 3082 |
|dataSize lines nHexLines replacementForUnprintable colsPerByte characterDecoder| |
17744 | 3083 |
|
3084 |
(characterEncodingSymbol isNil or:[characterEncodingSymbol == #'iso8859-1']) ifFalse:[ |
|
3085 |
characterDecoder := CharacterEncoder encoderToEncodeFrom:characterEncodingSymbol into:#unicode. |
|
3086 |
]. |
|
17252 | 3087 |
|
3088 |
"/ used to be: |
|
3089 |
"/ replacementForUnprintable := $. |
|
3090 |
replacementForUnprintable := Character value:16rB7. "/ a centered dot. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3091 |
|
17744 | 3092 |
"/ cols needed per byte in the hex dump |
3093 |
colsPerByte := ((255 printStringRadix:numberBase) size). |
|
3094 |
||
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3095 |
"generate a virtual collection which evaluates and returns lines on-demand" |
18666 | 3096 |
dataSize := dataOrFileStream isStream |
3097 |
ifTrue:[ dataOrFileStream fileSize ] |
|
3098 |
ifFalse:[ dataOrFileStream size ]. |
|
3099 |
nHexLines := (dataSize + 15) // 16. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3100 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3101 |
lines := VirtualArray new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3102 |
lines setSize:nHexLines + (nHexLines // 16). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3103 |
lines |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3104 |
generator:[:lineNr | |
17744 | 3105 |
|blockNr lineNrInBlock startOffset lineStream asciiLineStream byte line |
3106 |
decodedChar charPrinted| |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3107 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3108 |
blockNr := (lineNr - 1) // 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3109 |
lineNrInBlock := (lineNr - 1) \\ 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3110 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3111 |
lineNrInBlock == 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3112 |
line := '' |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3113 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3114 |
startOffset := ((blockNr * 16) + lineNrInBlock) * 16. |
17744 | 3115 |
|
3116 |
"/ 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
|
3117 |
lineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3118 |
asciiLineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3119 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3120 |
lineStream nextPutAll:((startOffset+virtualStart) hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3121 |
lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3122 |
1 to:16 do:[:i | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3123 |
i ~~ 1 ifTrue:[ lineStream space ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3124 |
|
18666 | 3125 |
(startOffset + i) > dataSize ifTrue:[ |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3126 |
asciiLineStream nextPut:(Character space). |
17744 | 3127 |
lineStream spaces:colsPerByte. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3128 |
] ifFalse:[ |
18666 | 3129 |
dataOrFileStream isStream ifTrue:[ |
3130 |
dataOrFileStream position:(startOffset + i - 1). |
|
3131 |
byte := dataOrFileStream nextByte. |
|
3132 |
] ifFalse:[ |
|
3133 |
byte := dataOrFileStream at:startOffset + i. |
|
3134 |
]. |
|
17746 | 3135 |
lineStream nextPutAll:(byte printStringRadix:numberBase size:colsPerByte fill:$0). |
17744 | 3136 |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3137 |
|
17744 | 3138 |
decodedChar := byte. |
3139 |
characterDecoder notNil ifTrue:[ |
|
3140 |
decodedChar := characterDecoder encode:byte. |
|
3141 |
]. |
|
3142 |
||
3143 |
charPrinted := replacementForUnprintable. |
|
3144 |
decodedChar notNil ifTrue:[ |
|
3145 |
((decodedChar between:32 and:127) or:[(decodedChar between:(128+32) and:(128+127))]) ifTrue:[ |
|
3146 |
charPrinted := Character value:decodedChar. |
|
16188 | 3147 |
] ifFalse:[ |
17744 | 3148 |
(decodedChar between:0 and:31) ifTrue:[ |
3149 |
"/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400 |
|
3150 |
"/ are perfect here, but usually not available in the font |
|
3151 |
"/ and we have currently no way of knowing if they are... |
|
3152 |
"/ (could let the font draw into a bitmap and check if there is something...) |
|
18867 | 3153 |
"/ For now, write a dot.· |
17744 | 3154 |
"/ charPrinted := (Character value:(byte + 16r2400)) |
3155 |
]. |
|
16188 | 3156 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3157 |
]. |
17744 | 3158 |
asciiLineStream nextPut:charPrinted. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3159 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3160 |
]. |
17744 | 3161 |
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
|
3162 |
, asciiLineStream contents. |
11262 | 3163 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3164 |
line |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3165 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3166 |
^ lines. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
3167 |
|
17744 | 3168 |
"Created: / 12-11-2017 / 11:24:29 / cg" |
17750 | 3169 |
"Modified: / 12-11-2017 / 14:17:59 / cg" |
18666 | 3170 |
"Modified: / 12-03-2019 / 16:16:53 / Claus Gittinger" |
3171 |
! |
|
3172 |
||
3173 |
contentsOfBytesAsHexDump:dataOrFileStream numberOfAddressDigits:addrDigits addressStart:virtualStart |
|
17744 | 3174 |
"utility helper: generate a hexDump with addresses; the character columns at the right show |
3175 |
the iso8859-1 characters" |
|
17753 | 3176 |
|
3177 |
^ self |
|
18666 | 3178 |
contentsOfBytesAsDump:dataOrFileStream base:16 |
17744 | 3179 |
numberOfAddressDigits:addrDigits |
3180 |
addressStart:virtualStart |
|
17753 | 3181 |
characterEncoding:#'iso8859-1' |
11262 | 3182 |
|
3183 |
"Created: / 13-02-2012 / 15:01:46 / cg" |
|
17744 | 3184 |
"Modified: / 12-11-2017 / 12:07:12 / cg" |
17753 | 3185 |
"Modified: / 14-11-2017 / 17:48:19 / mawalch" |
18666 | 3186 |
"Modified (format): / 12-03-2019 / 16:38:26 / Claus Gittinger" |
3187 |
! |
|
3188 |
||
3189 |
contentsOfBytesAsHexDump:dataOrFileStream numberOfAddressDigits:addrDigits addressStart:virtualStart characterEncoding:characterEncodingSymbol |
|
17744 | 3190 |
"utility helper: generate a hexDump with addresses; |
3191 |
characterEncodingSymbol determines how characters are to be shown in the right (character) columns. |
|
3192 |
By default, this is iso8859-1, but supported are also ebcdic and ascii7, |
|
3193 |
to support display of alien encoded binary data." |
|
3194 |
||
3195 |
^ self |
|
18666 | 3196 |
contentsOfBytesAsDump:dataOrFileStream base:16 |
17744 | 3197 |
numberOfAddressDigits:addrDigits |
3198 |
addressStart:virtualStart |
|
3199 |
characterEncoding:characterEncodingSymbol |
|
3200 |
||
3201 |
"Created: / 12-11-2017 / 11:21:44 / cg" |
|
18666 | 3202 |
"Modified (format): / 12-03-2019 / 16:38:31 / Claus Gittinger" |
17744 | 3203 |
! |
3204 |
||
3205 |
contentsOfFileAsDump:f base:numberBase withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3206 |
"opens the file, get its contents and generates a dump for it" |
|
3207 |
||
4610 | 3208 |
|resources fileName stream data offs |
17768 | 3209 |
addrDigits lines answer sizeLimit showLastPart setNewLimit thisFileSizeString| |
4610 | 3210 |
|
3211 |
resources := self classResources. |
|
3212 |
||
3213 |
fileName := f baseName. |
|
3214 |
f isDirectory ifTrue:[ |
|
18609 | 3215 |
Dialog warn:(resources string:'"%1" is a directory.' with:fileName). |
4610 | 3216 |
^ nil |
3217 |
]. |
|
3218 |
f exists ifFalse:[ |
|
18609 | 3219 |
Dialog warn:(resources string:'oops, "%1" is gone or unreadable.' with:fileName). |
4610 | 3220 |
^ nil |
3221 |
]. |
|
3222 |
f isReadable ifFalse:[ |
|
18609 | 3223 |
Dialog warn:(resources string:'"%1" is unreadable.' with:fileName). |
4610 | 3224 |
^ nil |
3225 |
]. |
|
17768 | 3226 |
f fileSize > (self maxFileSizeShownWithoutAsking) ifTrue:[ |
8472 | 3227 |
limitOrNil notNil ifTrue:[ |
3228 |
sizeLimit := limitOrNil. |
|
3229 |
showLastPart := showLastPartOrNil |
|
3230 |
] ifFalse:[ |
|
17768 | 3231 |
setNewLimit := false. |
3232 |
thisFileSizeString := (UnitConverter fileSizeStringFor:f fileSize). |
|
3233 |
||
3234 |
Dialog |
|
3235 |
withOptoutOption:[ setNewLimit := true ] |
|
3236 |
labelled:(resources string:'No longer ask for files smaller than %1' with:thisFileSizeString) |
|
3237 |
do:[ |
|
3238 |
answer := Dialog |
|
3239 |
confirmWithCancel:(resources |
|
3240 |
stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' |
|
3241 |
with:(fileName contractTo:40) allBold |
|
3242 |
with:thisFileSizeString) |
|
3243 |
labels:#('Cancel' 'Show All' 'Show First Part' ). |
|
3244 |
]. |
|
8472 | 3245 |
answer isNil ifTrue:[^ nil]. |
3246 |
answer ifTrue:[ |
|
17769 | 3247 |
sizeLimit := (4 * 1024 * 1024) "max:self maxFileSizeShownWithoutAsking". |
17768 | 3248 |
] ifFalse:[ |
3249 |
setNewLimit ifTrue:[ |
|
3250 |
self maxFileSizeShownWithoutAsking:(self maxFileSizeShownWithoutAsking max:f fileSize). |
|
3251 |
]. |
|
3252 |
]. |
|
8436 | 3253 |
]. |
4610 | 3254 |
]. |
3255 |
||
18666 | 3256 |
[ |
3257 |
stream := f readStream binary. |
|
3258 |
sizeLimit notNil ifTrue:[ |
|
3259 |
showLastPart == true ifTrue:[ |
|
3260 |
stream position:(f fileSize - sizeLimit). |
|
3261 |
]. |
|
3262 |
data := stream nextBytes:sizeLimit. |
|
3263 |
] ifFalse:[ |
|
3264 |
f fileSize > (1024*1024) ifTrue:[ |
|
3265 |
data := stream |
|
3266 |
] ifFalse:[ |
|
3267 |
data := stream contents. |
|
3268 |
]. |
|
3269 |
]. |
|
3270 |
] ensure:[ |
|
3271 |
(stream notNil and:[stream ~~ data]) ifTrue:[ |
|
3272 |
stream close. |
|
3273 |
]. |
|
3274 |
]. |
|
3275 |
||
4610 | 3276 |
offs := 0. |
3277 |
lines := StringCollection new. |
|
3278 |
||
3279 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
3280 |
||
11262 | 3281 |
^ self |
17744 | 3282 |
contentsOfBytesAsDump:data base:numberBase |
11262 | 3283 |
numberOfAddressDigits:addrDigits |
3284 |
addressStart:0 |
|
17744 | 3285 |
characterEncoding:characterEncoding |
3286 |
||
3287 |
"Created: / 12-11-2017 / 12:08:10 / cg" |
|
17769 | 3288 |
"Modified: / 19-11-2017 / 15:01:34 / cg" |
18666 | 3289 |
"Modified: / 12-03-2019 / 16:18:46 / Claus Gittinger" |
17744 | 3290 |
! |
3291 |
||
3292 |
contentsOfFileAsHexDump:f |
|
3293 |
"opens the file, get its contents and generates a dump for it" |
|
3294 |
||
3295 |
^ self |
|
3296 |
contentsOfFileAsHexDump:f |
|
3297 |
withLimit:nil |
|
3298 |
lastPart:nil |
|
3299 |
characterEncoding:#'iso8859-1' |
|
3300 |
||
3301 |
"Modified (comment): / 12-11-2017 / 12:09:30 / cg" |
|
3302 |
! |
|
3303 |
||
3304 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil |
|
3305 |
"opens the file, get its contents and generates a dump for it" |
|
3306 |
||
3307 |
^ self |
|
3308 |
contentsOfFileAsHexDump:f |
|
3309 |
withLimit:limitOrNil |
|
3310 |
lastPart:showLastPartOrNil |
|
3311 |
characterEncoding:#'iso-8859-1' |
|
3312 |
||
3313 |
"Modified (comment): / 12-11-2017 / 12:09:34 / cg" |
|
3314 |
! |
|
3315 |
||
3316 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil characterEncoding:characterEncoding |
|
3317 |
"opens the file, get its contents and generates a dump for it" |
|
3318 |
||
3319 |
^ self |
|
3320 |
contentsOfFileAsDump:f base:16 |
|
3321 |
withLimit:limitOrNil |
|
3322 |
lastPart:showLastPartOrNil |
|
3323 |
characterEncoding:characterEncoding |
|
3324 |
||
3325 |
"Created: / 12-11-2017 / 12:02:05 / cg" |
|
4610 | 3326 |
! ! |
3327 |
||
17868 | 3328 |
!AbstractFileBrowser class methodsFor:'utilities - files'! |
3329 |
||
3330 |
allFilesInDirectories:directories forWhich:aBlock |
|
3331 |
|allFiles| |
|
3332 |
||
3333 |
directories isEmpty ifTrue:[^ #()]. |
|
3334 |
||
3335 |
allFiles := OrderedCollection new. |
|
3336 |
directories do:[:dir| |
|
3337 |
[ |
|
3338 |
|fileNames| |
|
3339 |
||
3340 |
fileNames := dir directoryContents. |
|
3341 |
fileNames notNil ifTrue:[ |
|
3342 |
fileNames := fileNames |
|
3343 |
collect:[:fn | dir construct:fn] |
|
3344 |
thenSelect:[:fn | fn isDirectory not and:[aBlock value:fn]]. |
|
3345 |
allFiles addAll:fileNames. |
|
3346 |
] |
|
3347 |
] on:FileStream openErrorSignal do:[:ex| |
|
3348 |
self warn:(self classResources stringWithCRs:'Cannot access: %1\(%2)' |
|
3349 |
with:ex pathName |
|
3350 |
with:ex description). |
|
3351 |
ex proceedWith:nil. |
|
3352 |
]. |
|
3353 |
]. |
|
3354 |
||
3355 |
^ allFiles |
|
3356 |
! |
|
3357 |
||
3358 |
fileFindDuplicatesIn:directories |
|
3359 |
"scan directories for duplicate files. |
|
17871 | 3360 |
return a dictionary mapping duplicate files to their original; |
3361 |
the oldest file found will be the value (original), the younger files (copies) will be the keys. |
|
17868 | 3362 |
Files without duplicate(s) will not have an entry in the dictionary." |
3363 |
||
3364 |
|infoDir filesBySize anySameSized |
|
3365 |
result allFiles| |
|
3366 |
||
3367 |
directories isEmpty ifTrue:[^ #()]. |
|
3368 |
||
3369 |
allFiles := self allFilesInDirectories:directories forWhich:[:f | true]. |
|
3370 |
allFiles isEmpty ifTrue:[^ #()]. |
|
3371 |
||
3372 |
"/ for each, get the file's info (size, modificationTime etc.). |
|
3373 |
infoDir := Dictionary new. |
|
3374 |
allFiles do:[:fn | |
|
3375 |
infoDir at:fn put:(fn info) |
|
3376 |
]. |
|
3377 |
||
3378 |
"/ in a first pass, collect groups by the same size |
|
3379 |
"/ remember those fileSizes for which multiple files exist |
|
3380 |
filesBySize := Dictionary new. |
|
3381 |
anySameSized := false. |
|
3382 |
infoDir keysAndValuesDo:[:fn :info | |
|
3383 |
|sz entry| |
|
3384 |
||
3385 |
sz := info fileSize. |
|
3386 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
3387 |
entry add:fn. |
|
3388 |
entry size > 1 ifTrue:[ anySameSized := true ]. |
|
3389 |
]. |
|
3390 |
||
3391 |
"/ any of same size ? |
|
3392 |
anySameSized ifFalse:[^ #() ]. |
|
3393 |
||
3394 |
result := Dictionary new. |
|
3395 |
||
3396 |
"/ now walk over the same-sized files and compare the contents. |
|
3397 |
filesBySize do:[:entry | |
|
3398 |
|files| |
|
3399 |
||
3400 |
entry size > 1 ifTrue:[ |
|
3401 |
files := entry asArray. |
|
3402 |
files |
|
3403 |
sort:[:a :b | |
|
3404 |
|tA tB| |
|
3405 |
tA := (infoDir at:a) modificationTime. |
|
3406 |
tB := (infoDir at:b) modificationTime. |
|
3407 |
tA < tB |
|
3408 |
]. |
|
3409 |
||
3410 |
1 to:files size-1 do:[:idx1 | |
|
3411 |
|fn1| |
|
3412 |
||
3413 |
fn1 := files at:idx1. |
|
3414 |
idx1+1 to:files size do:[:idx2 | |
|
3415 |
|fn2| |
|
3416 |
||
3417 |
fn2 := files at:idx2. |
|
3418 |
||
3419 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
3420 |
"/ compare the files |
|
3421 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3422 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
|
17871 | 3423 |
result at:fn2 put:fn1. |
17868 | 3424 |
] |
3425 |
] |
|
3426 |
] |
|
3427 |
] |
|
3428 |
] |
|
3429 |
]. |
|
3430 |
||
17869 | 3431 |
result := result associations copy. |
3432 |
"/ result := result collect:[:assoc | |
|
3433 |
"/ |f1 f2| |
|
3434 |
"/ |
|
3435 |
"/ f1 := assoc key asString. |
|
3436 |
"/ f2 := assoc value asString. |
|
3437 |
"/ f1 < f2 ifTrue:[ |
|
3438 |
"/ f2 -> f1 |
|
3439 |
"/ ] ifFalse:[ |
|
3440 |
"/ f1 -> f2 |
|
3441 |
"/ ] |
|
3442 |
"/ ]. |
|
17868 | 3443 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
3444 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
17869 | 3445 |
result sort:[:f1 :f2 | f1 key < f2 key]. |
17868 | 3446 |
^ result |
3447 |
! ! |
|
3448 |
||
3892 | 3449 |
!AbstractFileBrowser methodsFor:'actions'! |
3450 |
||
3451 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 3452 |
"setup and launch a querybox to ask for a unix command. |
3892 | 3453 |
Then evaluate aBlock passing the command-string as argument." |
3454 |
||
16160 | 3455 |
|box osName commandString alwaysOpenLikeThisHolder openCmd suffix| |
3892 | 3456 |
|
3457 |
osName := OperatingSystem platformName. |
|
3458 |
||
3459 |
box := FilenameEnterBox |
|
4414 | 3460 |
title:(resources string:'Execute %1 command:' with:osName) |
3461 |
okText:(resources string:'Execute') |
|
4523 | 3462 |
action:[:cmd | commandString := cmd]. |
3892 | 3463 |
|
3464 |
fileName notNil ifTrue:[ |
|
4414 | 3465 |
self initialCommandFor:fileName into:box. |
3892 | 3466 |
]. |
16160 | 3467 |
alwaysOpenLikeThisHolder := false asValue. |
3468 |
box verticalPanel add:((CheckBox label:'Always use this command for this file type') model:alwaysOpenLikeThisHolder). |
|
3892 | 3469 |
box directory:(self getDirWithoutFileName:fileName). |
16160 | 3470 |
box open. |
3471 |
||
3472 |
"/ box destroy. |
|
3473 |
alwaysOpenLikeThisHolder value ifTrue:[ |
|
3474 |
openCmd := commandString upTo:$". |
|
3475 |
suffix := fileName suffix. |
|
16306 | 3476 |
UserPreferences current |
3477 |
defaultFileOpenCommandFor:suffix put:(openCmd,' "%1"'); |
|
3478 |
beModified. |
|
3479 |
self breakPoint:#cg. |
|
16160 | 3480 |
]. |
3481 |
||
4523 | 3482 |
commandString notNil ifTrue:[ |
3483 |
aBlock value:commandString |
|
3484 |
]. |
|
3485 |
||
3892 | 3486 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
3487 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
3488 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
3489 |
! |
|
3490 |
||
3491 |
changeFileBrowserTitleTo:aString |
|
4774 | 3492 |
self |
3493 |
applicationNamed:#FileBrowserV2 |
|
5009 | 3494 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 3495 |
! |
3496 |
||
3497 |
copyFileList |
|
4774 | 3498 |
"copy the fileList to the clipBoard" |
3499 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3500 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3501 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3502 |
fileList := self |
4774 | 3503 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3504 |
ifPresentDo:[:app | app browserFileList]. |
3505 |
||
3506 |
fileList notNil ifTrue:[ |
|
3507 |
self copyFileListToClipBoard:fileList. |
|
3508 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3509 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3510 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3511 |
copyFileListToClipBoard:fileList |
4774 | 3512 |
"copy the itemList to the clipBoard" |
3513 |
||
3514 |
|stream| |
|
3515 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3516 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 3517 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3518 |
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
|
3519 |
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
|
3520 |
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
|
3521 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3522 |
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
|
3523 |
(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
|
3524 |
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
|
3525 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3526 |
]. |
3892 | 3527 |
]. |
6034 | 3528 |
self window setClipboardText:stream contents. |
3892 | 3529 |
! |
3530 |
||
3531 |
copySelectedFilenames |
|
4774 | 3532 |
"copy the selected fileNames to the clipBoard" |
3533 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3534 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3535 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3536 |
fileList := self |
4774 | 3537 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3538 |
ifPresentDo:[:appl | appl selectedFileNames]. |
3539 |
fileList notNil ifTrue:[ |
|
3540 |
self copyFileListToClipBoard:fileList. |
|
3541 |
]. |
|
3892 | 3542 |
! |
3543 |
||
10923 | 3544 |
doAddArchiver |
3545 |
|files| |
|
3546 |
||
3547 |
files := self currentSelectedFiles. |
|
3548 |
files size == 1 ifFalse:[ |
|
17818 | 3549 |
Dialog information:(resources string:'Select exactly one archive.'). |
10923 | 3550 |
^ self |
3551 |
]. |
|
3552 |
||
3553 |
self |
|
3554 |
applicationNamed:#FileApplicationNoteBook |
|
3555 |
ifPresentDo:[:appl | appl doAddArchiverOn:files first]. |
|
3556 |
||
3557 |
"Created: / 29-11-2011 / 19:01:31 / cg" |
|
17818 | 3558 |
"Modified: / 29-11-2017 / 12:25:47 / cg" |
10923 | 3559 |
! |
3560 |
||
3892 | 3561 |
doAddTerminal |
5960 | 3562 |
|dir| |
3563 |
||
3564 |
dir := self currentDirectory. |
|
3565 |
dir isNil ifTrue:[ |
|
4414 | 3566 |
dir := Filename homeDirectory |
3892 | 3567 |
]. |
4774 | 3568 |
|
5009 | 3569 |
self |
3570 |
applicationNamed:#FileApplicationNoteBook |
|
3571 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
18734 | 3572 |
|
3573 |
"Modified (format): / 10-04-2019 / 05:53:35 / Claus Gittinger" |
|
3892 | 3574 |
! |
3575 |
||
3576 |
doOpenSearchFile |
|
5961 | 3577 |
|item file| |
3578 |
||
3579 |
file := self firstSelectedFileName. |
|
3580 |
file isNil ifTrue:[ |
|
3581 |
file := Filename homeDirectory asAbsoluteFilename. |
|
3582 |
]. |
|
3583 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 3584 |
self openSearchFileOn:item. |
3585 |
! |
|
3586 |
||
3587 |
doShowFileContents |
|
5009 | 3588 |
self |
3589 |
applicationNamed:#DirectoryContentsBrowser |
|
3590 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
3591 |
||
3592 |
^ nil |
|
3892 | 3593 |
! |
3594 |
||
3595 |
doShowProperties |
|
3596 |
"show long stat (file)-info" |
|
3597 |
||
3598 |
self fileGetInfo:true |
|
3599 |
! |
|
3600 |
||
14577 | 3601 |
enterAction |
3602 |
self |
|
3603 |
applicationNamed:#DirectoryContentsBrowser |
|
3604 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl enterAction ]]. |
|
3605 |
! |
|
3606 |
||
5528 | 3607 |
fileEncodingDialog |
14497 | 3608 |
"open a dialog to allow change of the file's character encoding. |
5528 | 3609 |
Files are converted to internal encoding when read, and converted back |
3610 |
to this encoding when saved. |
|
3611 |
Notice: currently, not too many encodings are supported by the system." |
|
3612 |
||
3613 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
3614 |
||
3615 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
3616 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
3617 |
||
3618 |
bindings := IdentityDictionary new. |
|
3619 |
bindings at:#encodingList put:encodingDescr. |
|
3620 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 3621 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
3622 |
||
5528 | 3623 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
3624 |
ifTrue:[ |
|
3625 |
idx := (bindings at:#selectedEncoding) value. |
|
3626 |
selectedEncoding := encodings at:idx. |
|
3627 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 3628 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 3629 |
]. |
5737 | 3630 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 3631 |
]. |
3632 |
||
3633 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
3634 |
! |
|
3635 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3636 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3637 |
"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
|
3638 |
|
5959 | 3639 |
|currentFileNameHolder currentSel| |
3640 |
||
18823 | 3641 |
aFilename isNil ifTrue:[^ self]. |
3642 |
||
5959 | 3643 |
currentFileNameHolder := self currentFileNameHolder. |
3644 |
||
3645 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3646 |
(currentSel includes:aFilename) ifFalse:[ |
9677 | 3647 |
self withWaitCursorDo:[ |
3648 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
|
3649 |
] |
|
3650 |
]. |
|
3651 |
||
3652 |
"Modified: / 29-12-2010 / 11:04:29 / cg" |
|
18823 | 3653 |
"Modified: / 15-06-2019 / 08:38:21 / Claus Gittinger" |
3892 | 3654 |
! |
3655 |
||
11053 | 3656 |
lineEndConventionDialog |
3657 |
"open a dialog to allow change of the line end conventions |
|
3658 |
(when writing files)" |
|
3659 |
||
3660 |
|bindings| |
|
3661 |
||
3662 |
bindings := IdentityDictionary new. |
|
3663 |
bindings at:#lineEndConvention put:(self lineEndConvention asValue). |
|
3664 |
||
3665 |
(self openDialogInterface:#lineEndConventionDialogSpec withBindings:bindings) |
|
3666 |
ifTrue:[ |
|
15208 | 3667 |
self lineEndConventionHolder value:(bindings at:#lineEndConvention) value asSymbol |
11053 | 3668 |
]. |
3669 |
||
3670 |
"Created: / 06-01-2012 / 15:34:51 / cg" |
|
3671 |
! |
|
3672 |
||
4392 | 3673 |
newTextEditor |
5009 | 3674 |
self |
3675 |
applicationNamed:#FileApplicationNoteBook |
|
15936 | 3676 |
ifPresentDo:[:appl | |
3677 |
|editor files item| |
|
3678 |
||
3679 |
editor := appl newTextEditor. |
|
3680 |
(files := self currentSelectedFiles) size == 1 ifTrue:[ |
|
3681 |
item := DirectoryContentsBrowser itemClass fileName:files first. |
|
3682 |
editor item:item. |
|
3683 |
]. |
|
3684 |
^ editor |
|
3685 |
]. |
|
5009 | 3686 |
|
3687 |
^ nil. |
|
3688 |
! |
|
3689 |
||
3690 |
openApplByFileItem:anItem |
|
8490 | 3691 |
"/ q: is the following always wanted ? |
9267 | 3692 |
self window sensor shiftDown ifFalse:[ |
17715 | 3693 |
((anItem mimeType startsWith:'application/x-expecco-') |
3694 |
and:[(Smalltalk at:#ExpeccoStartup) notNil]) ifTrue:[ |
|
3695 |
(Smalltalk at:#ExpeccoStartup) main:{anItem fileName asString}. |
|
3696 |
^ self. |
|
3697 |
]. |
|
3698 |
||
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3699 |
"/ cg: no - batch and shell scripts are to be |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3700 |
"/ anItem fileName isExecutableProgram ifTrue:[ |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3701 |
"/ self executeCommand:anItem fileName pathName. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3702 |
"/ ^ self. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3703 |
"/ ]. |
9267 | 3704 |
|
8490 | 3705 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
3706 |
"/ Error handle:[:ex | |
|
3707 |
"/ ] do:[ |
|
3708 |
"/ OperatingSystem |
|
3709 |
"/ shellExecute:nil |
|
3710 |
"/ lpOperation:'open' |
|
3711 |
"/ lpFile:(anItem fileName pathName) |
|
3712 |
"/ lpParameters:nil |
|
3713 |
"/ lpDirectory:(self directory pathName) |
|
3714 |
"/ nShowCmd:#SW_SHOWNORMAL. |
|
3715 |
"/ ^ self. |
|
3716 |
"/ ] |
|
3717 |
"/ ] |
|
9267 | 3718 |
]. |
5306 | 3719 |
^ self |
5009 | 3720 |
applicationNamed:#FileApplicationNoteBook |
5306 | 3721 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3722 |
|
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3723 |
"Modified: / 06-09-2011 / 11:11:15 / cg" |
17715 | 3724 |
"Modified: / 18-10-2017 / 10:15:15 / stefan" |
3892 | 3725 |
! |
3726 |
||
4392 | 3727 |
openApplForFile:aFilename |
5306 | 3728 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 3729 |
! |
3730 |
||
3892 | 3731 |
openCommandResultApplication |
3732 |
||
5009 | 3733 |
self |
3734 |
applicationNamed:#FileApplicationNoteBook |
|
3735 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
3736 |
||
3737 |
^ nil |
|
3892 | 3738 |
! |
3739 |
||
5010 | 3740 |
openNewTextEditorOn:anItem |
5009 | 3741 |
self |
3742 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3743 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 3744 |
|
3745 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3746 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3747 |
|
5010 | 3748 |
openSearchFileOn:anItem |
5009 | 3749 |
self |
3750 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3751 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 3752 |
|
3753 |
^ nil. |
|
3892 | 3754 |
! |
3755 |
||
5162 | 3756 |
openTextEditorForFile:aFilename |
3757 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
3758 |
! |
|
3759 |
||
5010 | 3760 |
openTextEditorOn:anItem |
5009 | 3761 |
self |
3762 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3763 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 3764 |
|
3765 |
^ nil. |
|
3892 | 3766 |
! |
3767 |
||
5010 | 3768 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 3769 |
self |
3770 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3771 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 3772 |
|
3773 |
^ nil. |
|
4618 | 3774 |
! |
3775 |
||
5959 | 3776 |
setCurrentFileName:aFilename |
3777 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
3778 |
! |
|
3779 |
||
3780 |
setCurrentFileNames:aCollectionOfFilenames |
|
3781 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
3782 |
! |
|
3783 |
||
11053 | 3784 |
tabStopConversionDialog |
3785 |
"open a dialog to allow change of the tab stop conversion (when reading/writing files)" |
|
3786 |
||
3787 |
|bindings| |
|
3788 |
||
3789 |
bindings := IdentityDictionary new. |
|
3790 |
bindings at:#tabStops put:(self inputTabColumnConversion asValue). |
|
3791 |
||
3792 |
(self openDialogInterface:#tabStopConversionDialogSpec withBindings:bindings) |
|
3793 |
ifTrue:[ |
|
3794 |
self inputTabColumnConversionHolder value:(bindings at:#tabStops) value |
|
3795 |
]. |
|
3796 |
||
3797 |
"Created: / 06-01-2012 / 15:36:06 / cg" |
|
3798 |
! |
|
3799 |
||
3892 | 3800 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3801 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3802 |
aColOfFiles notNil ifTrue:[ |
5959 | 3803 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3804 |
]. |
3892 | 3805 |
! |
3806 |
||
3807 |
updateCurrentDirectory |
|
5739 | 3808 |
self updateCurrentDirectory:false |
3809 |
! |
|
3810 |
||
3811 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3812 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3813 |
|
5009 | 3814 |
self |
3815 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 3816 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 3817 |
self |
3818 |
applicationNamed:#DirectoryTreeBrowser |
|
3819 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 3820 |
! |
3821 |
||
5739 | 3822 |
updateCurrentDirectoryWithReread |
3823 |
self updateCurrentDirectory:true |
|
3824 |
! |
|
3825 |
||
4345 | 3826 |
withActivityIndicationDo:aBlock |
3827 |
||
3828 |
self activityVisibilityChannel value:true. |
|
3829 |
[ |
|
9361 | 3830 |
self withWaitCursorDo:[ |
3831 |
aBlock value. |
|
3832 |
] |
|
4345 | 3833 |
] ensure:[ |
3834 |
self activityVisibilityChannel value:false. |
|
3835 |
] |
|
3892 | 3836 |
! ! |
3837 |
||
3838 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
3839 |
||
3840 |
addBookmark |
|
3841 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
6725 | 3842 |
self addBookmarks:(self currentSelectedDirectories). |
5960 | 3843 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 3844 |
! |
3845 |
||
3846 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3847 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3848 |
self class addBookmark:path |
3892 | 3849 |
]. |
3850 |
! |
|
3851 |
||
8013 | 3852 |
editBookmarks |
17849 | 3853 |
self class editBookmarksWithDefault: self currentSelectedDirectories firstOrNil. |
3854 |
||
3855 |
"Modified: / 13-12-2017 / 23:24:39 / stefan" |
|
8013 | 3856 |
! |
3857 |
||
3892 | 3858 |
hasBookmarks |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3859 |
^ self class hasBookmarks |
3892 | 3860 |
! |
3861 |
||
3862 |
hasBookmarksToRemove |
|
3863 |
|bookmarks directories| |
|
3864 |
||
3982 | 3865 |
directories := self currentSelectedDirectories. |
3892 | 3866 |
bookmarks := self class directoryBookmarks. |
17416 | 3867 |
^ (bookmarks notEmptyOrNil and:[directories notEmpty]) |
3868 |
||
3869 |
"Modified: / 17-02-2017 / 08:25:22 / cg" |
|
3892 | 3870 |
! |
3871 |
||
3872 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3873 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3874 |
self class removeBookmark:dir |
3892 | 3875 |
]. |
4679 | 3876 |
! |
3877 |
||
3878 |
saveBookmarks |
|
3879 |
self class saveBookmarks |
|
3892 | 3880 |
! ! |
3881 |
||
3882 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
3883 |
||
3884 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 3885 |
|cmd suffix cmdHist historySize| |
3892 | 3886 |
|
3887 |
cmdHist := self class commandHistory. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
3888 |
(aCommandString notEmptyOrNil) ifTrue:[ |
4414 | 3889 |
cmdHist notNil ifTrue:[ |
3890 |
cmdHist addFirst:aCommandString. |
|
6369 | 3891 |
historySize := self class commandHistorySize. |
3892 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 3893 |
cmdHist removeLast |
3894 |
] |
|
3895 |
]. |
|
3896 |
aFilename notNil ifTrue:[ |
|
3897 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
3898 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
3899 |
DefaultCommandPerSuffix := Dictionary new. |
|
3900 |
]. |
|
3901 |
suffix := aFilename asFilename suffix. |
|
3902 |
suffix notNil ifTrue:[ |
|
3903 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
3904 |
] |
|
3905 |
] |
|
3892 | 3906 |
] |
3907 |
! |
|
3908 |
||
3909 |
doBack |
|
6286 | 3910 |
"go backward in the history" |
3892 | 3911 |
|
4022 | 3912 |
| fileName| |
3913 |
||
6369 | 3914 |
fileName := self directoryHistory goBackward. |
3892 | 3915 |
fileName notNil ifTrue:[ |
4347 | 3916 |
self gotoFile:(fileName asFilename). |
3892 | 3917 |
] |
3918 |
! |
|
3919 |
||
3920 |
doForward |
|
6286 | 3921 |
"go forward in the history" |
3892 | 3922 |
|
3964 | 3923 |
| fileName| |
3924 |
||
6369 | 3925 |
fileName := self directoryHistory goForward. |
3892 | 3926 |
fileName notNil ifTrue:[ |
4414 | 3927 |
self gotoFile:(fileName asFilename). |
4022 | 3928 |
] ifFalse:[ |
4414 | 3929 |
self enableForward value:false. |
18823 | 3930 |
]. |
3931 |
||
3932 |
"Modified (format): / 15-06-2019 / 08:38:41 / Claus Gittinger" |
|
3892 | 3933 |
! ! |
3934 |
||
3935 |
!AbstractFileBrowser methodsFor:'applications'! |
|
3936 |
||
5009 | 3937 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
3938 |
|appl| |
|
3939 |
||
3940 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
3941 |
appl notNil ifTrue:[ |
|
3942 |
^ aBlock value:appl |
|
3943 |
]. |
|
3944 |
^ nil. |
|
3945 |
! |
|
3946 |
||
4004 | 3947 |
directoryContentsBrowser |
3948 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 3949 |
! ! |
3950 |
||
3951 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
3952 |
||
3953 |
applications |
|
3954 |
^ aspects at:#applications |
|
3955 |
! |
|
3956 |
||
3957 |
backgroundProcesses |
|
3958 |
||
3959 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
3960 |
! |
|
3961 |
||
4230 | 3962 |
canMake |
15259 | 3963 |
^ self aspectFor:#canMake ifAbsent:[ ValueHolder with:false ]. |
4230 | 3964 |
! |
3965 |
||
18246 | 3966 |
canOpenChangeBrowser |
3967 |
^ self aspectFor:#canOpenChangeBrowser ifAbsent:[ false asValue ]. |
|
3968 |
||
3969 |
"Created: / 30-06-2018 / 18:29:53 / Claus Gittinger" |
|
3970 |
! |
|
3971 |
||
3892 | 3972 |
currentDirectories |
6725 | 3973 |
" returns a holder on a Collection of all currently selected directories |
3974 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3892 | 3975 |
" |
3976 |
||
3977 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
3978 |
! |
|
3979 |
||
6725 | 3980 |
currentDirectoriesValue |
3981 |
" returns a Collection of all currently selected directories |
|
3982 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3983 |
" |
|
3984 |
||
3985 |
^ self currentDirectories value |
|
3986 |
! |
|
3987 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3988 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3989 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3990 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3991 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3992 |
|
6725 | 3993 |
directories := self currentSelectedDirectories. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3994 |
(directories size ~= 1) ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3995 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3996 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3997 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3998 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3999 |
|
13856 | 4000 |
currentDirectoryDisplayed |
4001 |
"Return a directory as Filename that is currently displayed in the browser" |
|
4002 |
||
4003 |
^self subclassResponsibility |
|
4004 |
||
4005 |
"Created: / 14-01-2013 / 11:57:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4006 |
! |
|
4007 |
||
3892 | 4008 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4009 |
"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
|
4010 |
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
|
4011 |
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
|
4012 |
|
6589 | 4013 |
^ self aspectFor:#currentFileNameHolder |
4014 |
ifAbsent:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4015 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4016 |
|
4692 | 4017 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4018 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4019 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4020 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4021 |
currentSel asValue |
6589 | 4022 |
] |
4023 |
notPresentDo:[:holder| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4024 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4025 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4026 |
newFilenames := Set new. |
6589 | 4027 |
filenames do:[:eachFilename| |
18805 | 4028 |
|existingFilename count| |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4029 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4030 |
existingFilename notNil ifTrue:[ |
18805 | 4031 |
count := 0. |
4032 |
[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
|
4033 |
existingFilename := existingFilename directory. |
18805 | 4034 |
count := count + 1. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
4035 |
]. |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
4036 |
existingFilename exists ifTrue:[ |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
4037 |
newFilenames add:existingFilename. |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
4038 |
]. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
4039 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4040 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4041 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4042 |
] |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
4043 |
|
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
4044 |
"Modified: / 27-11-2010 / 15:42:45 / cg" |
18805 | 4045 |
"Modified: / 05-06-2019 / 14:12:48 / Claus Gittinger" |
3892 | 4046 |
! |
4047 |
||
5528 | 4048 |
defaultFileEncoding |
4049 |
^ #'iso8859-1' "/ #'utf-8' |
|
4050 |
! |
|
4051 |
||
3892 | 4052 |
enableDirectoryUp |
4053 |
||
15259 | 4054 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[ValueHolder with:false] |
3892 | 4055 |
! |
4056 |
||
6456 | 4057 |
enableGotoDefaultDirectory |
15259 | 4058 |
^ self aspectFor:#enableGotoDefaultDirectory ifAbsent:[ ValueHolder with:true ]. |
4593 | 4059 |
! |
4060 |
||
8168 | 4061 |
enableGotoDesktop |
14308 | 4062 |
"/ backward compatibility |
4063 |
^ self enableGotoDesktopDirectory. |
|
8168 | 4064 |
! |
4065 |
||
9572 | 4066 |
enableGotoDesktopDirectory |
15259 | 4067 |
^ self aspectFor:#enableGotoDesktopDirectory ifAbsent:[ ValueHolder with:true ]. |
9572 | 4068 |
|
4069 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
4070 |
! |
|
4071 |
||
18511 | 4072 |
enableGotoDocumentsDirectory |
4073 |
^ self aspectFor:#enableGotoDocumentsDirectory ifAbsent:[ ValueHolder with:true ]. |
|
4074 |
||
4075 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
4076 |
! |
|
4077 |
||
18352 | 4078 |
enableGotoDownloadsDirectory |
4079 |
^ self aspectFor:#enableGotoDownloadsDirectory ifAbsent:[ ValueHolder with:true ]. |
|
4080 |
||
4081 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
4082 |
! |
|
4083 |
||
6434 | 4084 |
enableGotoSmalltalkDirectory |
6456 | 4085 |
^ self aspectFor:#enableGotoSmalltalkDirectory ifAbsent:[ true asValue ]. |
6434 | 4086 |
! |
4087 |
||
17187 | 4088 |
enableGotoSmalltalkWorkspaceDirectory |
4089 |
^ self aspectFor:#enableGotoSmalltalkWorkspaceDirectory ifAbsent:[ true asValue ]. |
|
4090 |
! |
|
4091 |
||
9677 | 4092 |
enableGotoTempDirectory |
4093 |
^ self aspectFor:#enableGotoTempDirectory ifAbsent:[ true asValue ]. |
|
4094 |
||
4095 |
"Created: / 29-12-2010 / 11:01:17 / cg" |
|
4096 |
! |
|
4097 |
||
3892 | 4098 |
enableHome |
4099 |
||
4100 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
4101 |
! |
|
4102 |
||
9596 | 4103 |
enableMakeCurrentDirectory |
4104 |
^ self aspectFor:#enableMakeCurrentDirectory ifAbsent:[ true asValue ]. |
|
4105 |
||
4106 |
"Created: / 26-10-2010 / 17:17:58 / cg" |
|
4107 |
! |
|
4108 |
||
3892 | 4109 |
enableViewNoteBookApplication |
4110 |
||
4111 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
4112 |
! |
|
4113 |
||
5528 | 4114 |
fileEncoding |
4115 |
^ self fileEncodingHolder value |
|
4116 |
! |
|
4117 |
||
4118 |
fileEncoding:newEncoding |
|
5533 | 4119 |
self fileEncodingHolder value:newEncoding. |
4120 |
||
4121 |
self |
|
4122 |
applicationNamed:#FileApplicationNoteBook |
|
4123 |
ifPresentDo:[:nb | |
|
4124 |
|appl| |
|
4125 |
||
4126 |
appl := nb selectedApplication. |
|
5535 | 4127 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 4128 |
appl fileEncoding:newEncoding |
4129 |
] |
|
4130 |
]. |
|
5528 | 4131 |
! |
4132 |
||
5737 | 4133 |
fileEncodingHolder |
4134 |
^ self |
|
4135 |
aspectFor:#fileEncodingHolder |
|
4136 |
ifAbsent:[ |
|
4137 |
self |
|
4138 |
applicationNamed:#FileApplicationNoteBook |
|
4139 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
4140 |
] |
|
4141 |
! |
|
4142 |
||
17485 | 4143 |
fileEntryFieldHolder |
4144 |
^ self subclassResponsibility. |
|
4145 |
||
4146 |
"Created: / 31-03-2017 / 11:36:49 / stefan" |
|
4147 |
! |
|
4148 |
||
5961 | 4149 |
firstSelectedFileName |
4150 |
|files| |
|
4151 |
||
7560 | 4152 |
files := self currentSelectedObjects. |
5961 | 4153 |
files notEmpty ifTrue:[ |
4154 |
^ files first |
|
4155 |
]. |
|
4156 |
^ nil |
|
7560 | 4157 |
|
4158 |
"Modified: / 04-12-2006 / 13:14:53 / cg" |
|
5961 | 4159 |
! |
4160 |
||
6456 | 4161 |
gotoDefaultDirectoryIsVisible |
9596 | 4162 |
^ true. |
4163 |
"/ ^ (Filename defaultDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
4164 |
||
4165 |
"Modified: / 26-10-2010 / 17:23:51 / cg" |
|
6456 | 4166 |
! |
4167 |
||
9572 | 4168 |
gotoDesktopDirectoryIsVisible |
4169 |
Filename desktopDirectory = Filename homeDirectory ifTrue:[^ false]. |
|
4170 |
||
4171 |
^ (Filename desktopDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
4172 |
||
4173 |
"Created: / 01-10-2010 / 16:26:27 / cg" |
|
4174 |
! |
|
4175 |
||
18834 | 4176 |
hasFileOrCypressPackageSelection |
4177 |
^ self aspectFor:#hasFileOrCypressPackageSelection ifAbsentPut:[ false asValue ]. |
|
4178 |
||
4179 |
"Created: / 23-06-2019 / 13:05:51 / Claus Gittinger" |
|
4180 |
! |
|
4181 |
||
4618 | 4182 |
hasFileSelection |
4183 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
4184 |
! |
|
4185 |
||
9490 | 4186 |
hasNotTwoDirectoriesSelectedHolder |
4187 |
^ self |
|
4188 |
aspectFor:#hasNotTwoDirectoriesSelectedHolder |
|
4189 |
ifAbsent:[ |
|
4190 |
BlockValue |
|
4191 |
with:[:m | self hasTwoDirectoriesSelected not] |
|
4192 |
argument:self currentFileNameHolder |
|
4193 |
]. |
|
4194 |
||
4195 |
"Created: / 20-05-2010 / 10:45:50 / cg" |
|
4196 |
! |
|
4197 |
||
5830 | 4198 |
hasNotTwoFilesSelectedHolder |
9490 | 4199 |
^ self |
4200 |
aspectFor:#hasNotTwoFilesSelectedHolder |
|
5830 | 4201 |
ifAbsent:[ |
4202 |
BlockValue |
|
4203 |
with:[:m | self hasTwoFilesSelected not] |
|
4204 |
argument:self currentFileNameHolder |
|
4205 |
]. |
|
9490 | 4206 |
|
4207 |
"Modified: / 20-05-2010 / 10:46:01 / cg" |
|
5830 | 4208 |
! |
4209 |
||
3892 | 4210 |
hasSelection |
17923 | 4211 |
"aspect holding true, if a file is selected" |
3892 | 4212 |
|
4213 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
4214 |
! |
|
4215 |
||
9490 | 4216 |
hasTwoDirectoriesSelectedHolder |
4217 |
^ self |
|
4218 |
aspectFor:#hasTwoDirectoriesSelectedHolder |
|
4219 |
ifAbsent:[ |
|
4220 |
BlockValue |
|
4221 |
with:[:m | self hasTwoDirectoriesSelected] |
|
4222 |
argument:self currentFileNameHolder |
|
4223 |
]. |
|
4224 |
||
4225 |
"Created: / 20-05-2010 / 10:45:41 / cg" |
|
4226 |
! |
|
4227 |
||
4414 | 4228 |
hasTwoFilesSelectedHolder |
9490 | 4229 |
^ self |
4230 |
aspectFor:#hasTwoFilesSelectedHolder |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4231 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4232 |
BlockValue |
5830 | 4233 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4234 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
4235 |
]. |
9490 | 4236 |
|
4237 |
"Modified: / 20-05-2010 / 10:46:08 / cg" |
|
4414 | 4238 |
! |
4239 |
||
11053 | 4240 |
inputTabColumnConversion |
4241 |
^ self inputTabColumnConversionHolder value |
|
4242 |
||
4243 |
"Created: / 06-01-2012 / 15:25:56 / cg" |
|
4244 |
! |
|
4245 |
||
4246 |
inputTabColumnConversionHolder |
|
4247 |
^ self |
|
4248 |
aspectFor:#inputTabColumnConversionHolder |
|
4249 |
ifAbsent:[ |
|
4250 |
self |
|
4251 |
applicationNamed:#FileApplicationNoteBook |
|
4252 |
ifPresentDo:[:appl | appl inputTabColumnConversionHolder]. |
|
4253 |
] |
|
4254 |
||
4255 |
"Created: / 06-01-2012 / 15:26:16 / cg" |
|
4256 |
! |
|
4257 |
||
4258 |
lineEndConvention |
|
15208 | 4259 |
^ self lineEndConventionHolder value asSymbol |
11053 | 4260 |
|
4261 |
"Created: / 06-01-2012 / 13:05:14 / cg" |
|
4262 |
! |
|
4263 |
||
11591 | 4264 |
lineEndConvention: aSymbol |
18525 | 4265 |
self lineEndConventionHolder value:(aSymbol ifNotNil:[aSymbol asSymbol]) |
11591 | 4266 |
|
4267 |
"Created: / 11-07-2012 / 19:51:58 / cg" |
|
18525 | 4268 |
"Modified: / 13-11-2018 / 11:13:41 / Stefan Vogel" |
11591 | 4269 |
! |
4270 |
||
11053 | 4271 |
lineEndConventionHolder |
4272 |
^ self |
|
4273 |
aspectFor:#lineEndConventionHolder |
|
4274 |
ifAbsent:[ |
|
4275 |
self |
|
4276 |
applicationNamed:#FileApplicationNoteBook |
|
4277 |
ifPresentDo:[:appl | appl lineEndConventionHolder]. |
|
4278 |
] |
|
4279 |
||
4280 |
"Created: / 06-01-2012 / 13:02:51 / cg" |
|
4281 |
! |
|
4282 |
||
5737 | 4283 |
lockFileEncoding:aBoolean |
4284 |
self lockFileEncodingHolder value:aBoolean. |
|
4285 |
||
4286 |
self |
|
4287 |
applicationNamed:#FileApplicationNoteBook |
|
4288 |
ifPresentDo:[:nb | |
|
4289 |
|appl| |
|
4290 |
||
4291 |
appl := nb selectedApplication. |
|
4292 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
4293 |
appl lockFileEncoding:aBoolean |
|
4294 |
] |
|
4295 |
]. |
|
4296 |
! |
|
4297 |
||
4298 |
lockFileEncodingHolder |
|
4299 |
^ self |
|
4300 |
aspectFor:#lockFileEncodingHolder |
|
4301 |
ifAbsent:[ |
|
4302 |
self |
|
4303 |
applicationNamed:#FileApplicationNoteBook |
|
4304 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
4305 |
] |
|
4306 |
! |
|
4307 |
||
13856 | 4308 |
makeCommandHolder |
4309 |
^ self aspectFor:#makeCommandHolder ifAbsent:[ nil asValue ]. |
|
4310 |
||
4311 |
"Created: / 13-04-2012 / 17:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4312 |
! |
|
4313 |
||
4523 | 4314 |
notify:aString |
11108 | 4315 |
"aString is shown in the lower pane" |
4316 |
||
4523 | 4317 |
self notifyChannel value:aString |
11108 | 4318 |
|
4319 |
"Modified (comment): / 11-01-2012 / 21:46:55 / cg" |
|
4523 | 4320 |
! |
4321 |
||
3892 | 4322 |
notifyChannel |
4323 |
||
4324 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 4325 |
! |
4326 |
||
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4327 |
progressPercentageHolder |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4328 |
^ self aspectFor:#progressPercentageHolder ifAbsent:[ nil asValue ]. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4329 |
|
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4330 |
"Created: / 11-10-2010 / 12:54:46 / cg" |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4331 |
! |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4332 |
|
4071 | 4333 |
rootHolder |
4334 |
"holder, which keeps the rootHolder of the treeView |
|
4335 |
" |
|
4336 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4337 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4338 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4339 |
]. |
8192
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4340 |
! |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4341 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4342 |
rootHolder:aHolder |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4343 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
4344 |
self aspectFor:#rootHolder put:aHolder |
3892 | 4345 |
! ! |
4346 |
||
4347 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
4348 |
||
4349 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 4350 |
"returns the model for an aspect; these are stored in a common dictionary" |
4351 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4352 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 4353 |
! |
4354 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4355 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 4356 |
"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
|
4357 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4358 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4359 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4360 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4361 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4362 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4363 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4364 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4365 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4366 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4367 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4368 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4369 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4370 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4371 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4372 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4373 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4374 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4375 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4376 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4377 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4378 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4379 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4380 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4381 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4382 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4383 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4384 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4385 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4386 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4387 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4388 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4389 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4390 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
4391 |
|
18834 | 4392 |
aspectFor:something ifAbsentPut:aBlock |
4393 |
"returns the model for an aspect; these are stored in a common dictionary" |
|
4394 |
||
4395 |
^ self aspectFor:something ifAbsent:[|v| v := aBlock value. self aspectFor:something put:v. v] |
|
4396 |
||
4397 |
"Created: / 23-06-2019 / 13:05:37 / Claus Gittinger" |
|
4398 |
! |
|
4399 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4400 |
aspectFor:something put:aValueHolder |
6284 | 4401 |
"stores the model for an aspect; these are stored in a common dictionary" |
4402 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4403 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4404 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
4405 |
|
3892 | 4406 |
aspects |
6284 | 4407 |
"returns the common aspect dictionary" |
4408 |
||
3892 | 4409 |
^ aspects |
4410 |
! |
|
4411 |
||
4412 |
runtimeAspectValueFor:something |
|
4413 |
"returns the default aspect item from the class variable RuntimeAspects |
|
4414 |
" |
|
4415 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
4416 |
! |
|
4417 |
||
4201 | 4418 |
saveAspectValues |
16306 | 4419 |
|prefs saveAspects aspectValue| |
4420 |
||
4421 |
prefs := UserPreferences current. |
|
4422 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4423 |
saveAspects := self class userPreferencesAspectList keys. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4424 |
saveAspects do:[ :aspectKey | |
4201 | 4425 |
aspectValue := (self perform:aspectKey) value. |
16306 | 4426 |
prefs |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4427 |
at: ('fileBrowser_',aspectKey asString) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4428 |
put: aspectValue. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4429 |
]. |
16306 | 4430 |
prefs beModified. |
4431 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4432 |
"Modified: / 04-09-2006 / 10:02:41 / cg" |
4201 | 4433 |
! |
4434 |
||
3892 | 4435 |
saveRuntimeAspectValues |
4436 |
|savedAspects dictionary value isHolder aspect| |
|
4437 |
||
5941 | 4438 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 4439 |
dictionary := Dictionary new. |
5941 | 4440 |
savedAspects do:[:aspectKey | |
4414 | 4441 |
aspect := self perform:aspectKey. |
4442 |
isHolder := aspect isValueModel. |
|
5941 | 4443 |
isHolder ifTrue:[ |
4444 |
value := aspect value |
|
4445 |
] ifFalse:[ |
|
4446 |
value := aspect |
|
4447 |
]. |
|
4448 |
dictionary at:aspectKey |
|
4449 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
4450 |
]. |
|
4451 |
RuntimeAspects := dictionary. |
|
3892 | 4452 |
! |
4453 |
||
4201 | 4454 |
userPreferencesAspectValueFor:something |
4455 |
"returns the default aspect from the Userpreferences |
|
3892 | 4456 |
" |
4201 | 4457 |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4458 |
(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
|
4459 |
^ UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
4460 |
at:('fileBrowser_',something) asSymbol |
9579
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4461 |
ifAbsent:nil "(self class userPreferencesAspectList at:something)". |
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4462 |
|
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
4463 |
"Modified: / 14-10-2010 / 19:16:38 / cg" |
3892 | 4464 |
! ! |
4465 |
||
4011 | 4466 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
4467 |
||
9015 | 4468 |
filter:aString |
4469 |
self filterModel value:aString |
|
4470 |
! |
|
4471 |
||
4018 | 4472 |
filterBackgroundColor |
4473 |
||
4474 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
4475 |
! |
|
4476 |
||
4011 | 4477 |
filterBlockHolder |
4478 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4479 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 4480 |
! |
4481 |
||
4482 |
filterListModel |
|
4483 |
||
4484 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
4485 |
! |
|
4486 |
||
4487 |
filterModel |
|
5941 | 4488 |
|m| |
4489 |
||
4490 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
4491 |
^ m |
|
4011 | 4492 |
! |
4493 |
||
8185
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4494 |
filterModel:aHolder |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4495 |
self aspectFor:#filterModel put:aHolder. |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4496 |
! |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4497 |
|
4018 | 4498 |
filterValueBox |
4499 |
||
4500 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
4501 |
! |
|
4502 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4503 |
makeFilterBlock |
14497 | 4504 |
"return a two-arg filterblock on the file's path- and base-name. This block should return true for files |
9102 | 4505 |
to be shown" |
4506 |
||
17481 | 4507 |
| filterString filterStrings filters notFilters showHidden filterBlock caseSensitive| |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4508 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4509 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4510 |
filterString = '' ifTrue:[filterString := '*']. |
17481 | 4511 |
caseSensitive := "ignoreCaseInPattern ?" Filename isCaseSensitive. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4512 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4513 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
12760 | 4514 |
filterStrings := filterStrings |
4515 |
select:[:eachFilter | eachFilter withoutSeparators notEmpty]. |
|
4516 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4517 |
filters := filterStrings |
12760 | 4518 |
reject:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
4519 |
thenCollect: |
|
4520 |
[:eachPattern | |
|
4521 |
|pattern| |
|
4522 |
||
4523 |
pattern := eachPattern withoutSeparators. |
|
15597 | 4524 |
pattern includesMatchCharacters ifFalse:[ |
4525 |
"JV@2012-03-05: Add implict star at the beginning and at the end of pattern, |
|
4526 |
that's how most of the other applications behave - do what most users expect" |
|
17772 | 4527 |
"/ pattern first == $* ifFalse:[pattern := '*' , pattern]. |
4528 |
"/ pattern last == $* ifFalse:[pattern := pattern , '*']. |
|
4529 |
[:name :baseName | baseName asLowercase includesString:pattern caseSensitive:caseSensitive] |
|
4530 |
] ifTrue:[ |
|
4531 |
pattern = '*' ifTrue:[ |
|
4532 |
[:name :baseName | true]. |
|
4533 |
] ifFalse:[ |
|
4534 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
|
4535 |
]. |
|
15597 | 4536 |
]. |
12760 | 4537 |
]. |
4538 |
||
4539 |
notFilters := filterStrings |
|
4540 |
select:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
|
4541 |
thenCollect: |
|
4542 |
[:eachPattern | |
|
9296 | 4543 |
|pattern| |
4544 |
||
4545 |
pattern := eachPattern withoutSeparators. |
|
12760 | 4546 |
pattern := (pattern copyFrom:2) withoutSeparators. |
17481 | 4547 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
9296 | 4548 |
]. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4549 |
|
12760 | 4550 |
|
4551 |
(filters size == 1 and:[notFilters isEmpty]) ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4552 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4553 |
] ifFalse:[ |
12760 | 4554 |
filters isEmpty ifTrue:[ |
4555 |
filterBlock := [:name :baseName | |
|
4556 |
(notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not |
|
4557 |
]. |
|
4558 |
] ifFalse:[ |
|
4559 |
notFilters isEmpty ifTrue:[ |
|
4560 |
filterBlock := [:name :baseName | |
|
4561 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4562 |
]. |
|
4563 |
] ifFalse:[ |
|
4564 |
filterBlock := [:name :baseName | |
|
4565 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4566 |
and:[ (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not ] |
|
4567 |
]. |
|
4568 |
] |
|
4569 |
] |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4570 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4571 |
|
4011 | 4572 |
showHidden := self showHiddenFiles value. |
4573 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4574 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4575 |
]. |
9296 | 4576 |
^ [:name :baseName | |
4577 |
name isHidden not and:[filterBlock value:name value:baseName]]. |
|
13856 | 4578 |
|
4579 |
"Modified: / 05-02-2012 / 01:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17481 | 4580 |
"Modified: / 27-03-2017 / 12:52:08 / stefan" |
17772 | 4581 |
"Modified: / 20-11-2017 / 22:02:04 / cg" |
4018 | 4582 |
! |
4583 |
||
4584 |
shownFiles |
|
4585 |
||
4586 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 4587 |
! ! |
4588 |
||
14126 | 4589 |
|
3892 | 4590 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
4591 |
||
4592 |
dirHistory |
|
6369 | 4593 |
"obsolete" |
4594 |
^ self directoryHistory |
|
4595 |
! |
|
4596 |
||
4597 |
directoryHistory |
|
3952 | 4598 |
^ self class directoryHistory |
3892 | 4599 |
! |
4600 |
||
4601 |
enableBack |
|
4602 |
||
15259 | 4603 |
^ self aspectFor:#enableBack ifAbsent:[ValueHolder with:false] |
3892 | 4604 |
! |
4605 |
||
4606 |
enableFileHistory |
|
4607 |
||
15259 | 4608 |
^ self aspectFor:#enableFileHistory ifAbsent:[ValueHolder with:false] |
3892 | 4609 |
! |
4610 |
||
4611 |
enableForward |
|
4612 |
||
15259 | 4613 |
^ self aspectFor:#enableForward ifAbsent:[ValueHolder with:false] |
3892 | 4614 |
! |
4615 |
||
4616 |
fileHistory |
|
9820
07b7d7929e3e
variable renamed in: #fileHistory
Stefan Vogel <sv@exept.de>
parents:
9793
diff
changeset
|
4617 |
^ self aspectFor:#fileHistory ifAbsent:[OrderedSet new] |
3892 | 4618 |
! ! |
4619 |
||
4620 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
4621 |
||
4345 | 4622 |
activityVisibilityChannel |
6284 | 4623 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 4624 |
|
15259 | 4625 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ ValueHolder with:false ]. |
4345 | 4626 |
! |
4627 |
||
15111 | 4628 |
alwaysUseSmalltalkTools |
4629 |
" aspect to prevent os tools to be opened on double click" |
|
4630 |
||
15259 | 4631 |
^ self aspectFor:#alwaysUseSmalltalkTools ifAbsent:[ ValueHolder with:true ]. |
15111 | 4632 |
! |
4633 |
||
6602 | 4634 |
changeSetBrowserItemVisible |
18834 | 4635 |
^ self hasFileOrCypressPackageSelection value |
4636 |
or:[Screen current ctrlDown]. |
|
4637 |
||
4638 |
"Modified: / 23-06-2019 / 13:13:53 / Claus Gittinger" |
|
6602 | 4639 |
! |
4640 |
||
11135 | 4641 |
cvsMenusAreShown |
18820 | 4642 |
^ self class cvsMenusAreShown |
4643 |
! |
|
4644 |
||
4645 |
gitMenusAreShown |
|
4646 |
^ self class gitMenusAreShown |
|
4647 |
||
4648 |
"Created: / 10-06-2019 / 15:56:16 / Claus Gittinger" |
|
11135 | 4649 |
! |
4650 |
||
13856 | 4651 |
hgMenusAreShown |
18820 | 4652 |
^ self class hgMenusAreShown |
13856 | 4653 |
! |
4654 |
||
11135 | 4655 |
mercurialMenusAreShown |
18820 | 4656 |
^ self class mercurialMenusAreShown |
11135 | 4657 |
! |
4658 |
||
4110 | 4659 |
openAlwaysInTextEditor |
18274 | 4660 |
"aspect for open every file in TextEditor don't use e.g. HtmlEditor for *.html'" |
4110 | 4661 |
|
15111 | 4662 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
18274 | 4663 |
|
4664 |
"Modified (comment): / 19-07-2018 / 15:28:00 / Stefan Vogel" |
|
4110 | 4665 |
! |
4666 |
||
3892 | 4667 |
openMultipleApplicationsForType |
4668 |
||
4201 | 4669 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
4670 |
open TextEditor " |
|
4671 |
||
3892 | 4672 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
4673 |
! |
|
4674 |
||
11137 | 4675 |
perforceMenusAreShown |
18820 | 4676 |
^ self class perforceMenusAreShown |
11137 | 4677 |
! |
4678 |
||
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
|
4679 |
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
|
4680 |
|
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
|
4681 |
^ 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
|
4682 |
|
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
|
4683 |
"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
|
4684 |
! |
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
|
4685 |
|
4201 | 4686 |
showDirectoryTree |
4687 |
||
4688 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 4689 |
! |
4690 |
||
4554 | 4691 |
showDiskUsageHolder |
4692 |
|holder| |
|
4693 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
4694 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 4695 |
holder addDependent:self. |
4554 | 4696 |
^ holder |
4697 |
! |
|
4698 |
||
3892 | 4699 |
showHiddenFiles |
4700 |
||
9582 | 4701 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
4702 |
||
4703 |
"Modified: / 15-10-2010 / 10:28:17 / cg" |
|
3892 | 4704 |
! |
4705 |
||
9108 | 4706 |
showHiddenFiles:aHolder |
4707 |
self aspectFor:#showHiddenFiles put:aHolder. |
|
4708 |
! |
|
4709 |
||
4710 |
shownFiles:aHolder |
|
4711 |
self aspectFor:#shownFiles put:aHolder. |
|
4712 |
! |
|
4713 |
||
11135 | 4714 |
svnMenusAreShown |
18820 | 4715 |
^ self class svnMenusAreShown |
11135 | 4716 |
! |
4717 |
||
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4718 |
tagsBrowserVisibleHolder |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4719 |
masterApplication notNil ifTrue:[ |
11162
faf8af233ac0
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
11156
diff
changeset
|
4720 |
^ masterApplication perform:#tagsBrowserVisibleHolder ifNotUnderstood:false |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4721 |
]. |
10762
311190be6490
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
10757
diff
changeset
|
4722 |
^ self aspectFor:#tagsBrowserVisibleHolder ifAbsent:[ FileApplicationNoteBook::TextEditor defaultTagsBrowserVisible asValue ]. |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4723 |
|
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4724 |
"Created: / 27-06-2011 / 16:02:59 / cg" |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4725 |
! |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4726 |
|
10757
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4727 |
useCodeView2InTools |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4728 |
^ self aspectFor:#useCodeView2InTools ifAbsent:[ UserPreferences current useCodeView2InTools asValue ]. |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4729 |
|
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4730 |
"Created: / 06-10-2011 / 11:45:58 / cg" |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4731 |
! |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4732 |
|
4648 | 4733 |
userContextAvailable |
4734 |
||
4735 |
" aspect for show group and user columns in contents view |
|
4736 |
windows provides no user context" |
|
4737 |
||
4738 |
^ OperatingSystem isMSWINDOWSlike not |
|
4739 |
! |
|
4740 |
||
3892 | 4741 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4742 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4743 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4744 |
^ self directoryContentsBrowser viewDescription |
3892 | 4745 |
! |
4746 |
||
4747 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4748 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 4749 |
" |
3892 | 4750 |
|
6121 | 4751 |
|directoryContentsBrowser| |
4752 |
||
4753 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
4754 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
4755 |
^ directoryContentsBrowser viewDetails |
|
3892 | 4756 |
! |
4757 |
||
4758 |
viewDirectoryDescription |
|
4759 |
||
4201 | 4760 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
4761 |
on change directory " |
|
4762 |
||
3892 | 4763 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
4764 |
! |
|
4765 |
||
4201 | 4766 |
viewDirsInContentsBrowser |
4767 |
||
4768 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
9319
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4769 |
|
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4770 |
" |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4771 |
UserPreferences current viewDirsInContentsBrowser |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4772 |
" |
4201 | 4773 |
! |
4774 |
||
5870 | 4775 |
viewFilesInContentsBrowser |
4776 |
||
4777 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
4778 |
! |
|
4779 |
||
3892 | 4780 |
viewFilesInDirectoryTree |
4781 |
||
4201 | 4782 |
" aspect for view files in tree view (not only directories) " |
4783 |
||
3892 | 4784 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
4785 |
! |
|
4786 |
||
4787 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4788 |
" aspect for show group information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4789 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4790 |
^ self directoryContentsBrowser viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4791 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4792 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4793 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4794 |
" aspect for show file-type icon in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4795 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4796 |
^ self directoryContentsBrowser viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4797 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4798 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4799 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4800 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4801 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4802 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 4803 |
! |
4804 |
||
4805 |
viewNoteBookApplicationHolder |
|
4806 |
||
4807 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
4808 |
! |
|
4809 |
||
4810 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4811 |
" aspect for show owner information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4812 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4813 |
^ self directoryContentsBrowser viewOwner |
3892 | 4814 |
! |
4815 |
||
4816 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4817 |
" aspect for show permission information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4818 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4819 |
^ self directoryContentsBrowser viewPermissions |
3892 | 4820 |
! |
4821 |
||
4822 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4823 |
" aspect for show image previev in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4824 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4825 |
^ self directoryContentsBrowser viewPreview |
3892 | 4826 |
! |
4827 |
||
4828 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4829 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4830 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4831 |
^ self directoryContentsBrowser viewSize |
3892 | 4832 |
! |
4833 |
||
4974 | 4834 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4835 |
" aspect for show size-in-bytes information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4836 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4837 |
^ self directoryContentsBrowser viewSizeInBytes |
4974 | 4838 |
! |
4839 |
||
5312 | 4840 |
viewSizeInKiloBytes |
4841 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
4842 |
||
4843 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
4844 |
! |
|
4845 |
||
3892 | 4846 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4847 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4848 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4849 |
^ self directoryContentsBrowser viewTime |
3892 | 4850 |
! |
4851 |
||
4852 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4853 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4854 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4855 |
^ self directoryContentsBrowser viewType |
3892 | 4856 |
! ! |
4857 |
||
4858 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
4859 |
||
4860 |
executeCommand:cmd |
|
4861 |
||
4862 |
self executeCommand:cmd inDirectory:nil |
|
4863 |
! |
|
4864 |
||
5880 | 4865 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 4866 |
| nameString executionBlock| |
4867 |
||
5880 | 4868 |
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
|
4869 |
nameString := 'Execute: ', cmd. |
3892 | 4870 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4871 |
! |
|
4872 |
||
4873 |
getExecutionBlockForCommand:cmd |
|
4874 |
||
4875 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
4876 |
! |
|
4877 |
||
5880 | 4878 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
4879 |
| dir| |
|
4880 |
||
4881 |
dir := directoryOrNil. |
|
4882 |
directoryOrNil isNil ifTrue:[ |
|
4883 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6671 | 4884 |
dir isNil ifTrue:[ |
12493 | 4885 |
Dialog warn:(resources string:'Please select a single directory.'). |
16732 | 4886 |
AbortOperationRequest raise. |
6671 | 4887 |
^ nil |
4888 |
]. |
|
3892 | 4889 |
]. |
4523 | 4890 |
|
4891 |
^ [:stream| |
|
4892 |
stream notNil ifTrue:[ |
|
4414 | 4893 |
OperatingSystem |
4894 |
executeCommand:cmd |
|
4895 |
inputFrom:nil |
|
4896 |
outputTo:stream |
|
4897 |
errorTo:stream |
|
4898 |
inDirectory:dir |
|
16732 | 4899 |
lineWise:true |
16825 | 4900 |
showWindow:false |
4414 | 4901 |
onError:[:status| false]. |
4902 |
] |
|
4523 | 4903 |
]. |
3892 | 4904 |
! |
4905 |
||
4906 |
killAllRunningBackgroundProcesses |
|
4907 |
||
4908 |
self backgroundProcesses do:[ : process | |
|
4523 | 4909 |
self notify:'kill ', process name. |
4414 | 4910 |
process terminate. |
3892 | 4911 |
]. |
4912 |
! |
|
4913 |
||
4914 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
4915 |
| stream process appl nameString| |
|
4916 |
||
4917 |
appl := self openCommandResultApplication. |
|
4918 |
stream := appl resultStream. |
|
4919 |
nameString := aString ? 'Execution Result'. |
|
4920 |
appl changeTabTo:nameString. |
|
4523 | 4921 |
|
16102 | 4922 |
process := |
4923 |
[ |
|
4924 |
[aBlock value:stream] |
|
4925 |
ensure:[ |
|
4926 |
self backgroundProcesses remove:process ifAbsent:[]. |
|
4927 |
appl process value:nil. |
|
4928 |
||
4929 |
"/ close automatically, if there was no output. |
|
4571 | 4930 |
"/ appl resultStream contents isEmpty ifTrue:[ |
4931 |
"/ appl doClose. |
|
4932 |
"/ ] |
|
16102 | 4933 |
stream nextPutLine:'Done.'. |
4934 |
self enqueueMessage:#updateCurrentDirectory. |
|
4935 |
] |
|
4936 |
] newProcess. |
|
3892 | 4937 |
process priority:(Processor userBackgroundPriority). |
4938 |
process name:nameString. |
|
4939 |
self backgroundProcesses add:process. |
|
4940 |
appl process value:process. |
|
4941 |
process resume. |
|
4942 |
! ! |
|
4943 |
||
4944 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
4945 |
||
4915 | 4946 |
currentFileNameHolderChanged |
4947 |
"/ self currentFileNameHolderChangedForCommon |
|
4948 |
! |
|
4949 |
||
4577 | 4950 |
currentFileNameHolderChangedForCommon |
18389 | 4951 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty dir| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4952 |
|
7560 | 4953 |
selection := self currentSelectedObjects. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4954 |
self class currentSelection:selection. |
4734 | 4955 |
|
13521 | 4956 |
selectionNotEmpty := selection notEmptyOrNil. |
5476 | 4957 |
self hasSelection value:selectionNotEmpty. |
4958 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
18840 | 4959 |
self hasFileOrCypressPackageSelection |
4960 |
value:(selection contains:[:sel | |
|
4961 |
sel isDirectory |
|
4962 |
and:[(sel hasSuffix:'package') or:[sel hasSuffix:'class']] |
|
4963 |
]). |
|
18246 | 4964 |
self canOpenChangeBrowser value:(selectionNotEmpty). |
4734 | 4965 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4966 |
newDirectories := self directoriesForFiles:selection. |
6725 | 4967 |
oldDirectories := self currentSelectedDirectories. |
4011 | 4968 |
oldDirectories ~= newDirectories ifTrue:[ |
4347 | 4969 |
self currentDirectories value:newDirectories. |
4970 |
size := newDirectories size. |
|
4774 | 4971 |
rootInTreeView := self |
4972 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 4973 |
ifPresentDo:[:appl | appl rootHolder]. |
4974 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
4975 |
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
|
4976 |
|
4347 | 4977 |
newDirectories notEmpty ifTrue:[ |
6369 | 4978 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 4979 |
]. |
18389 | 4980 |
(dir := Filename homeDirectory) notNil ifTrue:[ |
4981 |
self enableHome value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4982 |
]. |
|
14308 | 4983 |
"/ self enableGotoDesktop value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
18389 | 4984 |
(dir := Filename defaultDirectory) notNil ifTrue:[ |
4985 |
self enableGotoDefaultDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4986 |
]. |
|
4987 |
(dir := self smalltalkDirectory) notNil ifTrue:[ |
|
4988 |
self enableGotoSmalltalkDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4989 |
]. |
|
4990 |
(dir := Filename desktopDirectory) notNil ifTrue:[ |
|
4991 |
self enableGotoDesktopDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4992 |
]. |
|
4993 |
(dir := Filename downloadsDirectory) notNil ifTrue:[ |
|
4994 |
self enableGotoDownloadsDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4995 |
]. |
|
18511 | 4996 |
(dir := Filename documentsDirectory) notNil ifTrue:[ |
4997 |
self enableGotoDocumentsDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
4998 |
]. |
|
18389 | 4999 |
(dir := self tempDirectory) notNil ifTrue:[ |
5000 |
self enableGotoTempDirectory value:((newDirectories includes:(dir asAbsoluteFilename))not). |
|
5001 |
]. |
|
4011 | 5002 |
]. |
9599
6ffff091db22
changed: #currentFileNameHolderChangedForCommon
Claus Gittinger <cg@exept.de>
parents:
9596
diff
changeset
|
5003 |
self enableGotoDefaultDirectory value:(self currentDirectory isNil or:[self currentDirectory pathName ~= OperatingSystem getCurrentDirectory]). |
9596 | 5004 |
self enableMakeCurrentDirectory value:(newDirectories size == 1 |
5005 |
and:[ newDirectories first asFilename pathName ~= OperatingSystem getCurrentDirectory ]). |
|
4022 | 5006 |
self enableForward value:self canForward. |
4734 | 5007 |
self enableBack value:self canBackward. |
6095 | 5008 |
|
13856 | 5009 |
self updateCanMake. |
7560 | 5010 |
|
9677 | 5011 |
"Modified: / 29-12-2010 / 11:01:52 / cg" |
13856 | 5012 |
"Modified: / 17-12-2013 / 08:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
18840 | 5013 |
"Modified: / 23-06-2019 / 21:42:40 / Claus Gittinger" |
4011 | 5014 |
! |
5015 |
||
5016 |
filterModelChanged |
|
5017 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
5018 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 5019 |
! |
5020 |
||
3892 | 5021 |
update:something with:aParameter from:changedObject |
5022 |
||
5023 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
5024 |
and the things that have to be done if it runs standalone " |
|
5025 |
||
5026 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 5027 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5028 |
^ self |
3892 | 5029 |
]. |
3989 | 5030 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5031 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5032 |
^ self |
3989 | 5033 |
]. |
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
5034 |
changedObject == self sortBlockProperty ifTrue:[ |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
5035 |
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
|
5036 |
^ self |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
5037 |
]. |
4011 | 5038 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5039 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5040 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5041 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5042 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5043 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
5044 |
^ self |
4004 | 5045 |
]. |
4781 | 5046 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 5047 |
self notify:nil. |
4781 | 5048 |
^ self |
5049 |
]. |
|
3989 | 5050 |
|
3892 | 5051 |
super update:something with:aParameter from:changedObject |
5543 | 5052 |
! |
5053 |
||
6095 | 5054 |
updateCanMake |
5055 |
|dir can| |
|
5056 |
||
5057 |
can := false. |
|
5058 |
dir := self currentDirectory. |
|
5059 |
dir notNil ifTrue:[ |
|
13856 | 5060 |
"/ Check for make |
6095 | 5061 |
can := (dir asFilename construct:'Makefile') exists. |
13856 | 5062 |
can ifFalse:[ |
5063 |
can := (dir asFilename construct:'makefile') exists. |
|
5064 |
]. |
|
6095 | 5065 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
5066 |
can ifFalse:[ |
|
13856 | 5067 |
can := (self currentDirectory asFilename construct:'bc.mak') exists. |
6095 | 5068 |
] |
5069 |
]. |
|
13856 | 5070 |
can ifTrue:[ |
5071 |
self makeCommandHolder value: 'make'. |
|
5072 |
self canMake value: true. |
|
5073 |
^ self |
|
5074 |
]. |
|
5075 |
||
5076 |
"/Check for Apache ant |
|
5077 |
(OperatingSystem canExecuteCommand: 'ant') ifTrue:[ |
|
5078 |
can := (dir asFilename construct:'build.xml') exists. |
|
5079 |
can ifTrue:[ |
|
5080 |
self makeCommandHolder value: 'ant'. |
|
5081 |
self canMake value: true. |
|
5082 |
^ self |
|
5083 |
]. |
|
5084 |
]. |
|
5085 |
||
5086 |
"/Add more here... |
|
5087 |
||
6095 | 5088 |
]. |
5089 |
self canMake value:can. |
|
13856 | 5090 |
|
5091 |
"Modified: / 17-12-2013 / 08:13:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6095 | 5092 |
! |
5093 |
||
5543 | 5094 |
updateListAfterDelete:colOfFiles |
17871 | 5095 |
self updateCurrentDirectoryWithReread |
3892 | 5096 |
! ! |
5097 |
||
5098 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
5099 |
||
5100 |
canPaste |
|
5101 |
||
15259 | 5102 |
^ self aspectFor:#canPaste ifAbsent:[ ValueHolder with:false ]. |
3892 | 5103 |
! |
5104 |
||
5105 |
clipboard |
|
5106 |
||
5107 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
5108 |
! |
|
5109 |
||
5110 |
copyFilesToClipBoard:colOfFiles |
|
5111 |
self putInClipBoard:colOfFiles as:#copy. |
|
5112 |
! |
|
5113 |
||
5114 |
cutFilesToClipBoard:colOfFiles |
|
5115 |
"defete current selected files/directories |
|
5116 |
" |
|
5117 |
self putInClipBoard:colOfFiles as:#cut. |
|
5118 |
! |
|
5119 |
||
5120 |
emptyClipBoard |
|
5121 |
||
5122 |
self clipboard files:nil. |
|
5123 |
self canPaste value:false. |
|
5124 |
! |
|
5125 |
||
5126 |
putInClipBoard:colOfFiles as:aSymbol |
|
5127 |
| stream clp| |
|
5128 |
||
5129 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
5130 |
clp := self clipboard. |
|
5131 |
clp files:nil. |
|
5132 |
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
|
5133 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
5134 |
stream := String writeStream. |
3892 | 5135 |
stream nextPutAll:aSymbol asString. |
5136 |
stream nextPutAll:' <'. |
|
5137 |
stream nextPutAll:colOfFiles first asString. |
|
5138 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 5139 |
stream nextPutAll:' ...'. |
3892 | 5140 |
]. |
5141 |
stream nextPutAll:'> to clipboard'. |
|
5142 |
||
4523 | 5143 |
self notify:stream contents. |
3892 | 5144 |
clp files:colOfFiles. |
5145 |
self canPaste value:true. |
|
5146 |
! ! |
|
5147 |
||
5148 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
5149 |
||
5150 |
canDropFiles:dropedObjects for:filename |
|
6284 | 5151 |
|filenameDirString filenameDir| |
3892 | 5152 |
|
5153 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 5154 |
|
3892 | 5155 |
filenameDir := self getDirWithoutFileName:filename. |
7491 | 5156 |
filenameDir isNil ifTrue:[^ false ]. |
13232 | 5157 |
filenameDir isWritableDirectory ifFalse:[^ false]. |
6284 | 5158 |
|
3892 | 5159 |
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
|
5160 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
5161 |
dropedObjects do:[:aDropObject | |
6284 | 5162 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
5163 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
5164 |
"/ |
|
5165 |
"/ dropFileName := aDropObject theObject. |
|
5166 |
"/ dropFileNameString := dropFileName asString. |
|
5167 |
"/ dropFileName isDirectory ifTrue:[ |
|
5168 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
5169 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
5170 |
"/ ^ false |
|
5171 |
"/ ] |
|
5172 |
"/ ] ifFalse:[ |
|
5173 |
"/ physicalPathName := dropFileName physicalPathName. |
|
5174 |
"/ (filenameDirString = dropFileName directory asString |
|
5175 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
5176 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
5177 |
"/ self notify:'Cannot drop a file into same directory'. |
|
5178 |
"/ ^ false |
|
5179 |
"/ ] |
|
5180 |
"/ ] |
|
5181 |
]. |
|
5182 |
self notify:nil. |
|
5183 |
^ true |
|
5184 |
! |
|
5185 |
||
5186 |
canDropObject:aDropObject into:aDirectory |
|
5187 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
5188 |
||
5189 |
dropFileName := aDropObject theObject. |
|
5190 |
dropFileNameString := dropFileName asString. |
|
5191 |
dropFileName isDirectory ifTrue:[ |
|
5192 |
filenameDirString := aDirectory asString. |
|
5193 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
5194 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
5195 |
^ false |
|
4414 | 5196 |
] |
6284 | 5197 |
] ifFalse:[ |
5198 |
physicalPathName := dropFileName physicalPathName. |
|
5199 |
(aDirectory = dropFileName directory |
|
5200 |
or:[ aDropObject isFileInArchive not |
|
5201 |
and:[physicalPathName notNil |
|
5202 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
5203 |
self notify:'Cannot drop a file into same directory'. |
|
5204 |
^ false |
|
5205 |
] |
|
5206 |
]. |
|
5207 |
^ true. |
|
3892 | 5208 |
! |
5209 |
||
7406 | 5210 |
canDropObjects:aCollectionOfDropObjects in:aWidget |
17865 | 5211 |
^ aCollectionOfDropObjects contains:#isFileObject |
7406 | 5212 |
|
5213 |
"Created: / 13-10-2006 / 15:52:49 / cg" |
|
5214 |
! |
|
5215 |
||
17202 | 5216 |
doStartDrag:arg1 in:arg2 |
5217 |
^ self class doStartDrag:arg1 in:arg2 |
|
6479 | 5218 |
! |
5219 |
||
7408 | 5220 |
dropObjects:aCollectionOfDropObjects in:aWidget at:position |
7990 | 5221 |
|fileEntryFieldHolder destDir dropObject fn d| |
5222 |
||
5223 |
fileEntryFieldHolder := self masterApplication notNil |
|
5224 |
ifTrue:[ self masterApplication fileEntryFieldHolder ] |
|
5225 |
ifFalse:[ self fileEntryFieldHolder ]. |
|
5226 |
||
5227 |
aWidget model == fileEntryFieldHolder ifTrue:[ |
|
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5228 |
dropObject := aCollectionOfDropObjects first. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5229 |
dropObject isFileObject ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5230 |
fn := dropObject theObject asFilename. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5231 |
dropObject isDirectory ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5232 |
d := fn. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5233 |
] ifFalse:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5234 |
d := fn directory. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5235 |
]. |
7990 | 5236 |
fileEntryFieldHolder value:d pathName. |
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5237 |
]. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5238 |
^ self. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
5239 |
]. |
6479 | 5240 |
|
5241 |
destDir := self currentDirectory. |
|
5242 |
destDir isNil ifTrue:[^ self]. |
|
5243 |
||
8601 | 5244 |
self withWaitCursorDo:[ |
5245 |
aCollectionOfDropObjects do:[:dropObject | |
|
5246 |
|fn| |
|
5247 |
||
5248 |
dropObject isFileObject ifTrue:[ |
|
5249 |
fn := dropObject theObject asFilename. |
|
5250 |
dropObject isDirectory ifTrue:[ |
|
8808
cb6476c0cd3a
oops - drop of directories was broken
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
5251 |
fn recursiveCopyTo:destDir |
8601 | 5252 |
] ifFalse:[ |
8950
48c69259d82d
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
8887
diff
changeset
|
5253 |
fn copyTo:(destDir / fn baseName ) |
8601 | 5254 |
] |
6479 | 5255 |
] |
8601 | 5256 |
]. |
5257 |
]. |
|
9268
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5258 |
self directoryContentsBrowser notNil ifTrue:[ |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5259 |
self directoryContentsBrowser |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5260 |
directoryContentsChangeFlag:true; |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5261 |
wakeUp |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
5262 |
]. |
7408 | 5263 |
|
5264 |
"Created: / 13-10-2006 / 18:26:41 / cg" |
|
3892 | 5265 |
! ! |
5266 |
||
5267 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
5268 |
||
5269 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 5270 |
"copy to" |
5271 |
||
7635 | 5272 |
^ self copyFile:aSourceFile to:aDestFile repairCorruptedFiles:false |
5273 |
||
5274 |
"Modified: / 07-02-2007 / 18:46:44 / cg" |
|
5275 |
! |
|
5276 |
||
5277 |
copyFile:aSourceFile to:aDestFile repairCorruptedFiles:repairCorruptedFiles |
|
5278 |
"copy to" |
|
5279 |
||
5280 |
|copyOperation msg| |
|
5281 |
||
5282 |
repairCorruptedFiles ifTrue:[ |
|
5283 |
copyOperation := FileOperation copyCorruptedFile:aSourceFile to:aDestFile |
|
5284 |
] ifFalse:[ |
|
5285 |
copyOperation := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
|
5286 |
]. |
|
5287 |
copyOperation result ifTrue:[ |
|
6190 | 5288 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 5289 |
] ifFalse:[ |
7635 | 5290 |
msg := copyOperation errorString. |
6190 | 5291 |
]. |
5292 |
self notify:msg. |
|
7635 | 5293 |
^ copyOperation result |
5294 |
||
5295 |
"Created: / 07-02-2007 / 18:46:34 / cg" |
|
3892 | 5296 |
! |
5297 |
||
5298 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
6374 | 5299 |
|copy result| |
3892 | 5300 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5301 |
self withActivityIndicationDo:[ |
5961 | 5302 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
6374 | 5303 |
copy result ifTrue:[ |
5304 |
result := Dictionary withKeys:(copy collectionOfCopiedFiles) andValues:(copy collectionOfNewFiles). |
|
5305 |
] ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5306 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5307 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5308 |
self updateCurrentDirectory. |
3892 | 5309 |
]. |
6374 | 5310 |
^ result |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5311 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5312 |
"Modified: / 25-07-2006 / 09:07:04 / cg" |
3892 | 5313 |
! |
5314 |
||
15569 | 5315 |
copyFromToRepairingCorruptedFiles |
5316 |
"ask for source and destination and copy the entered file. |
|
5317 |
Especially useful for raw devices to copy corrupted disks/files |
|
5318 |
" |
|
5319 |
||
5320 |
|source destination| |
|
5321 |
||
5322 |
source := Dialog |
|
5323 |
requestDirectoryName:(resources string:'Copy from:') |
|
5324 |
default:(LastMoveDestination ? self currentDirectory) |
|
5325 |
ok:(resources string:'Continue') |
|
5326 |
abort:nil. |
|
5327 |
||
5328 |
source isEmptyOrNil ifTrue:[^ self]. |
|
5329 |
source := source asFilename. |
|
5330 |
||
5331 |
destination := Dialog |
|
5332 |
requestDirectoryName:(resources string:'Copy "%1" to:' with:source) |
|
5333 |
default:(LastMoveDestination ? self currentDirectory) |
|
5334 |
ok:(resources string:'Copy') |
|
5335 |
abort:nil. |
|
5336 |
||
5337 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
5338 |
destination := destination asFilename. |
|
5339 |
||
5340 |
self copyFile:source to:destination repairCorruptedFiles:true. |
|
5341 |
! |
|
5342 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5343 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
12850 | 5344 |
|size msg answer file| |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5345 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5346 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5347 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5348 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5349 |
"/ 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
|
5350 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5351 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5352 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5353 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5354 |
"/ 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
|
5355 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5356 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5357 |
"/ 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
|
5358 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5359 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5360 |
"/ 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
|
5361 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5362 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5363 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5364 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5365 |
stringWithCRs:'Copy or move\\%1:\ %2\to:\ %3 ?' |
17762 | 5366 |
with:(resources string: |
5367 |
(file type == #regular |
|
5368 |
ifTrue:'file' |
|
5369 |
ifFalse:[ |
|
5370 |
file isDirectory |
|
5371 |
ifTrue:'directory' |
|
5372 |
ifFalse:'object'])) |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5373 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5374 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5375 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5376 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5377 |
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
|
5378 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5379 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 5380 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5381 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5382 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5383 |
request:msg |
8127 | 5384 |
label:(resources string:'Copy or Move') |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
5385 |
image:(WarningBox iconBitmap) |
8127 | 5386 |
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
|
5387 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5388 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5389 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5390 |
^ answer. |
17762 | 5391 |
|
5392 |
"Modified: / 17-11-2017 / 13:16:42 / cg" |
|
3892 | 5393 |
! |
5394 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5395 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 5396 |
"copy or move aColOfSourceFiles to aDirectory. |
5397 |
Asks the used if a move or a copy is wanted. |
|
5398 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
5399 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5400 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5401 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5402 |
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
|
5403 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5404 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5405 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5406 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5407 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5408 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5409 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5410 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5411 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5412 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5413 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5414 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 5415 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5416 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5417 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5418 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5419 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5420 |
|
4745 | 5421 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5422 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5423 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5424 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5425 |
^ true. |
3892 | 5426 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
5427 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
5428 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 5429 |
^ true. |
3892 | 5430 |
]. |
4745 | 5431 |
^ false. |
3892 | 5432 |
! |
5433 |
||
6107 | 5434 |
copySelectionTo |
5435 |
"copy the selected file(s) to another directory" |
|
5436 |
||
13704 | 5437 |
self copySelectionToRepairingCorruptedFiles:false. |
5438 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5439 |
|
5440 |
"Modified: / 07-02-2007 / 18:42:48 / cg" |
|
5441 |
! |
|
5442 |
||
5443 |
copySelectionToRepairingCorruptedFiles |
|
5444 |
"copy the selected file(s) to another directory" |
|
5445 |
||
13704 | 5446 |
self copySelectionToRepairingCorruptedFiles:true. |
5447 |
self updateCurrentDirectoryWithReread. |
|
7635 | 5448 |
|
5449 |
"Created: / 07-02-2007 / 18:42:59 / cg" |
|
5450 |
! |
|
5451 |
||
5452 |
copySelectionToRepairingCorruptedFiles:repairingCorruptedFiles |
|
5453 |
"copy the selected file(s) to another directory" |
|
5454 |
||
6299 | 5455 |
|selectedFiles msg destination directory| |
5456 |
||
7560 | 5457 |
selectedFiles := self currentSelectedObjects copy. |
6299 | 5458 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
5459 |
||
5460 |
msg := (selectedFiles size > 1) |
|
14588 | 5461 |
ifTrue:[ 'Copy Selected Items to Directory:' ] |
5462 |
ifFalse:[ 'Copy "%1" to Directory:' ]. |
|
6299 | 5463 |
|
5464 |
destination := Dialog |
|
14588 | 5465 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first baseName) |
7635 | 5466 |
default:(LastMoveDestination ? self currentDirectory) |
5467 |
ok:(resources string:'Copy') |
|
5468 |
abort:nil. |
|
5469 |
||
6299 | 5470 |
destination isEmptyOrNil ifTrue:[^ self]. |
5471 |
destination := destination asFilename. |
|
5472 |
||
5473 |
destination isDirectory ifFalse:[ |
|
5474 |
selectedFiles size == 1 ifTrue:[ |
|
5475 |
directory := destination directory. |
|
5476 |
directory isDirectory ifTrue:[ |
|
5477 |
LastMoveDestination := directory. |
|
7635 | 5478 |
self copyFile:selectedFiles first to:destination repairCorruptedFiles:repairingCorruptedFiles. |
6299 | 5479 |
^ self. |
5480 |
] |
|
5481 |
] |
|
5482 |
]. |
|
5483 |
||
5484 |
LastMoveDestination := destination. |
|
7635 | 5485 |
repairingCorruptedFiles ifTrue:[ |
5486 |
selectedFiles do:[:eachFile | |
|
5487 |
self copyFile:eachFile to:destination repairCorruptedFiles:repairingCorruptedFiles. |
|
5488 |
]. |
|
5489 |
^ self. |
|
5490 |
] ifFalse:[ |
|
5491 |
self copyFiles:selectedFiles to:destination |
|
5492 |
] |
|
5493 |
||
5494 |
"Created: / 07-02-2007 / 18:42:35 / cg" |
|
6107 | 5495 |
! |
5496 |
||
3892 | 5497 |
deleteFile:aFile |
6373 | 5498 |
"delete the selected files/directories" |
3892 | 5499 |
|
5500 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
5501 |
! |
|
5502 |
||
5503 |
deleteFiles:colOfFiles |
|
6373 | 5504 |
"delete some files/directories" |
5505 |
||
5081 | 5506 |
^ self deleteFiles:colOfFiles confirm:true. |
5507 |
! |
|
5508 |
||
5509 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 5510 |
"delete some files/directories" |
5511 |
||
5673 | 5512 |
|delete result| |
3892 | 5513 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5514 |
self withActivityIndicationDo:[ |
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5515 |
ProgressNotification handle:[:info | |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5516 |
self progressPercentageHolder value:info progressValue. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5517 |
info proceed |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5518 |
] do:[ |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5519 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5520 |
result := delete result. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5521 |
]. |
5673 | 5522 |
result notNil ifTrue:[ |
5523 |
result ifFalse:[ |
|
5524 |
self notify:delete errorString. |
|
5753 | 5525 |
] ifTrue:[ |
5526 |
self updateListAfterDelete:colOfFiles. |
|
5527 |
] |
|
4394 | 5528 |
]. |
5673 | 5529 |
]. |
5530 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5531 |
|
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5532 |
"Modified: / 11-10-2010 / 13:08:24 / cg" |
3892 | 5533 |
! |
5534 |
||
6169 | 5535 |
eraseFiles:colOfFiles |
6373 | 5536 |
"erase (clear and delete) some files/directories" |
5537 |
||
6169 | 5538 |
^ self eraseFiles:colOfFiles confirm:true. |
5539 |
! |
|
5540 |
||
5541 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 5542 |
"erase (clear and delete) some files/directories" |
5543 |
||
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5544 |
|deleteOperation result fileSize| |
6169 | 5545 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5546 |
self withActivityIndicationDo:[ |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5547 |
fileSize := colOfFiles first asFilename fileSize. |
8294 | 5548 |
deleteOperation := FileOperation eraseFiles:colOfFiles confirm:confirm. |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5549 |
(colOfFiles size == 1 and:[ fileSize < (10*1024*1024) ]) |
8294 | 5550 |
ifTrue:[ |
5551 |
result := deleteOperation result. |
|
5552 |
] ifFalse:[ |
|
5553 |
ProgressIndicator |
|
5554 |
displayProgressNotifications:'Erasing' |
|
5555 |
abortable:true |
|
5556 |
at:nil |
|
5557 |
during:[ |
|
5558 |
result := deleteOperation result. |
|
5559 |
]. |
|
5560 |
]. |
|
5561 |
||
6169 | 5562 |
result notNil ifTrue:[ |
5563 |
result ifFalse:[ |
|
8294 | 5564 |
self notify:deleteOperation errorString. |
6169 | 5565 |
] ifTrue:[ |
5566 |
self updateListAfterDelete:colOfFiles. |
|
5567 |
] |
|
5568 |
]. |
|
5569 |
]. |
|
5570 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5571 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5572 |
"Modified: / 25-07-2006 / 09:07:16 / cg" |
6169 | 5573 |
! |
5574 |
||
3892 | 5575 |
moveFile:aSourceFile to:aDestFile |
6373 | 5576 |
"move a file/directory" |
3892 | 5577 |
|
5578 |
|move| |
|
5579 |
||
5961 | 5580 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 5581 |
move result ifTrue:[ |
15346 | 5582 |
self notify:(resources string: 'move "%1" to "%2"' with:aSourceFile asString with:aDestFile asString). |
3892 | 5583 |
] ifFalse:[ |
4523 | 5584 |
self notify:move errorString. |
3892 | 5585 |
]. |
17871 | 5586 |
self updateCurrentDirectoryWithReread. |
3892 | 5587 |
^ move result |
5588 |
! |
|
5589 |
||
5590 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 5591 |
"move some files to aDirectory" |
5592 |
||
3892 | 5593 |
|move| |
5594 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5595 |
self withActivityIndicationDo:[ |
5961 | 5596 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5597 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5598 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5599 |
]. |
17871 | 5600 |
self updateCurrentDirectoryWithReread. |
3892 | 5601 |
]. |
6373 | 5602 |
^ move collectionOfMovedFiles |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5603 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5604 |
"Modified: / 25-07-2006 / 09:07:32 / cg" |
3892 | 5605 |
! |
5606 |
||
6107 | 5607 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5608 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5609 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5610 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5611 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5612 |
destinationDirectory := Dialog |
14588 | 5613 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items to Directory:') |
5789 | 5614 |
default:(LastMoveDestination ? self currentDirectory) |
6952 | 5615 |
ok:(resources string:'Move') |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5616 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5617 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5618 |
|
5789 | 5619 |
LastMoveDestination := destinationDirectory. |
13704 | 5620 |
self moveFiles:(self currentSelectedObjects copy) to:destinationDirectory asFilename. |
5621 |
self updateCurrentDirectoryWithReread. |
|
5622 |
||
7560 | 5623 |
|
5624 |
"Modified: / 04-12-2006 / 13:15:12 / cg" |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5625 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5626 |
|
3892 | 5627 |
newDirectory |
5628 |
"ask for and create a new directory" |
|
5629 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5630 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5631 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5632 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5633 |
directory isNil ifTrue:[ |
18175 | 5634 |
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
|
5635 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5636 |
]. |
4521 | 5637 |
|
5638 |
"/ 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
|
5639 |
selectedFiles := self currentSelectedFiles. |
4521 | 5640 |
selectedFiles size == 1 ifTrue:[ |
5641 |
singleSelectedFile := selectedFiles first. |
|
5642 |
||
5643 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
13714 | 5644 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5645 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
5646 |
||
5647 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
13714 | 5648 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5649 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
5650 |
]. |
|
5651 |
]. |
|
5652 |
]. |
|
5653 |
||
5961 | 5654 |
|
4521 | 5655 |
defaultAnswer notNil ifTrue:[ |
5961 | 5656 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 5657 |
] ifFalse:[ |
5961 | 5658 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 5659 |
]. |
5660 |
createOp result ifFalse:[ ^ self]. |
|
5661 |
newFile := createOp createdFile. |
|
3892 | 5662 |
newFile notNil ifTrue:[ |
17871 | 5663 |
self updateCurrentDirectoryWithReread. |
3892 | 5664 |
] |
17818 | 5665 |
|
5666 |
"Modified: / 29-11-2017 / 12:26:41 / cg" |
|
18175 | 5667 |
"Modified: / 01-06-2018 / 12:49:43 / Claus Gittinger" |
3892 | 5668 |
! |
5669 |
||
5670 |
newFile |
|
5671 |
"ask for and create a new file" |
|
5672 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5673 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5674 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5675 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5676 |
directory isNil ifTrue:[ |
18175 | 5677 |
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
|
5678 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5679 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5680 |
|
3982 | 5681 |
curFile := self firstSelectedFile. |
3892 | 5682 |
curFile notNil ifTrue:[ |
4414 | 5683 |
file := curFile. |
3892 | 5684 |
] ifFalse:[ |
4414 | 5685 |
file := directory. |
3892 | 5686 |
]. |
5961 | 5687 |
create := FileOperation createFileIn:file. |
3892 | 5688 |
create result ifFalse:[ ^ self]. |
5689 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
17818 | 5690 |
|
5691 |
"Modified: / 29-11-2017 / 12:26:51 / cg" |
|
18175 | 5692 |
"Modified: / 01-06-2018 / 12:49:50 / Claus Gittinger" |
3892 | 5693 |
! |
5694 |
||
5695 |
newHardLink |
|
5696 |
"ask for and create a hard link (unix only)" |
|
5697 |
||
6151 | 5698 |
self newLink:#hard. |
5699 |
! |
|
5700 |
||
5701 |
newLink:typeOfLink |
|
3892 | 5702 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
5703 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5704 |
| sel dir create createdFile| |
3892 | 5705 |
|
7560 | 5706 |
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
|
5707 |
(sel size ~= 1) ifTrue:[ |
18175 | 5708 |
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
|
5709 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5710 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5711 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5712 |
|
6151 | 5713 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 5714 |
create result ifFalse:[ ^ self]. |
5715 |
createdFile := create createdFile. |
|
5716 |
createdFile notNil ifTrue:[ |
|
6151 | 5717 |
typeOfLink == #soft ifTrue:[ |
17871 | 5718 |
self updateCurrentDirectoryWithReread. |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5719 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5720 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5721 |
] |
3892 | 5722 |
]. |
7560 | 5723 |
|
17818 | 5724 |
"Modified: / 29-11-2017 / 12:26:58 / cg" |
18175 | 5725 |
"Modified: / 01-06-2018 / 12:49:32 / Claus Gittinger" |
3892 | 5726 |
! |
5727 |
||
5728 |
newSoftLink |
|
5729 |
"ask for and create a soft link (unix only)" |
|
5730 |
||
6151 | 5731 |
self newLink:#soft. |
3892 | 5732 |
! |
5733 |
||
5734 |
pasteFiles |
|
6373 | 5735 |
"paste from clipBoard" |
5736 |
||
5737 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 5738 |
|
5739 |
files := self clipboard files. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
5740 |
files isEmptyOrNil ifTrue:[ ^ self ]. |
6373 | 5741 |
|
5742 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
5743 |
||
3892 | 5744 |
buffer := self clipboard copy. |
3982 | 5745 |
directories := self currentSelectedDirectories. |
5880 | 5746 |
directories size ~~ 1 ifTrue:[ |
4414 | 5747 |
|box dirStringCol| |
5880 | 5748 |
|
4414 | 5749 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
5750 |
box := ListSelectionBox new. |
|
6373 | 5751 |
box title:'Paste into which directory ?'. |
4414 | 5752 |
box list:dirStringCol. |
5753 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5754 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5755 |
box destroy. |
3892 | 5756 |
] ifFalse:[ |
5880 | 5757 |
destination := directories anElement. |
3892 | 5758 |
]. |
6373 | 5759 |
|
5760 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 5761 |
buffer files copy do:[:aFile| |
5762 |
aFile directory = destination ifTrue:[ |
|
5763 |
buffer files remove:aFile. |
|
5764 |
]. |
|
5765 |
]. |
|
5766 |
]. |
|
5767 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6374 | 5768 |
copiedFiles notEmptyOrNil ifTrue:[ |
5769 |
thisIsAFileMoveOperation ifTrue:[ |
|
5770 |
self deleteFiles:(copiedFiles keys) confirm:false. |
|
5771 |
]. |
|
5772 |
||
5773 |
"/ select those pasted files. |
|
5774 |
self updateCurrentDirectory:true. |
|
5775 |
self currentFileNameHolder value:copiedFiles values. |
|
5776 |
] |
|
3892 | 5777 |
! |
5778 |
||
5779 |
renameFile:aFile |
|
5780 |
"rename the selected file(s)" |
|
5781 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5782 |
^ self renameFiles:(Array with:aFile). |
3892 | 5783 |
! |
5784 |
||
4230 | 5785 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 5786 |
"rename filename to newFileString" |
5787 |
||
5788 |
|rename| |
|
5789 |
||
5961 | 5790 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 5791 |
rename result ifTrue:[ |
4230 | 5792 |
aBoolean ifTrue:[ |
5793 |
self updateAndSelect:(rename renamedFiles). |
|
5794 |
]. |
|
3892 | 5795 |
] ifFalse:[ |
4523 | 5796 |
self notify:rename errorString. |
3892 | 5797 |
]. |
5798 |
^ rename result |
|
5799 |
! |
|
5800 |
||
5801 |
renameFiles:aColOfFiles |
|
6373 | 5802 |
"rename some file(s)" |
3892 | 5803 |
|
5804 |
|rename| |
|
5805 |
||
5961 | 5806 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 5807 |
rename result ifFalse:[ |
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5808 |
self notify:rename errorString. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5809 |
^ nil. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5810 |
]. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5811 |
^ rename |
3892 | 5812 |
! |
5813 |
||
5814 |
renameSelection |
|
5815 |
"rename the selected file(s)" |
|
5816 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5817 |
|renamed| |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5818 |
|
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5819 |
renamed := self renameFiles:(self currentSelectedObjects copy). |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5820 |
renamed notNil ifTrue:[ |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5821 |
self updateAndSelect:renamed renamedFiles. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5822 |
]. |
7560 | 5823 |
|
5824 |
"Modified: / 04-12-2006 / 13:15:24 / cg" |
|
3892 | 5825 |
! ! |
5826 |
||
4080 | 5827 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 5828 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5829 |
bookmarksMenu |
3952 | 5830 |
<resource: #programMenu> |
5831 |
||
14941 | 5832 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec. |
5833 |
! |
|
5834 |
||
5835 |
bookmarksMenuForBaseSpec:aBaseMenuSpec |
|
5836 |
<resource: #programMenu> |
|
5837 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5838 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5839 |
|
14941 | 5840 |
menu := aBaseMenuSpec decodeAsLiteralArray. |
7763 | 5841 |
|
5842 |
"/ add the bookmark items ... |
|
5843 |
bookmarks := self class directoryBookmarks. |
|
5844 |
bookmarks notEmptyOrNil ifTrue:[ |
|
14604 | 5845 |
menu addSeparator. |
7763 | 5846 |
bookmarks do:[:dirName | |
12963 | 5847 |
menu addItem:(MenuItem |
5848 |
label:dirName asString |
|
5849 |
itemValue:[ |
|
5850 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
|
5851 |
self setCurrentFileName:dirName. |
|
5852 |
]. |
|
5853 |
]). |
|
7763 | 5854 |
]. |
5855 |
]. |
|
4080 | 5856 |
menu findGuiResourcesIn:self. |
7763 | 5857 |
^ menu |
5858 |
||
11135 | 5859 |
"Modified: / 14-01-2012 / 21:14:03 / cg" |
7763 | 5860 |
! |
5861 |
||
5862 |
canBackward |
|
5863 |
^ self directoryHistory canBackward. |
|
5864 |
||
5865 |
"Modified: / 27-03-2007 / 10:54:55 / cg" |
|
5866 |
! |
|
5867 |
||
5868 |
canForward |
|
5869 |
^ self directoryHistory canForward. |
|
5870 |
||
5871 |
"Modified: / 27-03-2007 / 10:54:57 / cg" |
|
5872 |
! |
|
5873 |
||
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5874 |
gotoBookmarksMenu |
7763 | 5875 |
<resource: #programMenu> |
5876 |
||
14941 | 5877 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec2. |
6099 | 5878 |
! |
5879 |
||
3892 | 5880 |
menuDirHistory:backOrForward |
7763 | 5881 |
"initialize the history menu" |
5882 |
||
3892 | 5883 |
<resource: #programMenu > |
5884 |
||
7763 | 5885 |
|hist menu pathList currentSel currentPath| |
5886 |
||
5887 |
hist := self directoryHistory. |
|
5888 |
hist isEmpty ifTrue:[^ nil]. |
|
5889 |
||
3892 | 5890 |
backOrForward == #back ifTrue:[ |
6725 | 5891 |
currentSel := self currentSelectedDirectories. |
4347 | 5892 |
currentSel size == 1 ifTrue:[ |
5893 |
currentPath := currentSel first asString. |
|
5894 |
] ifFalse:[ |
|
5895 |
currentPath := nil. |
|
5896 |
]. |
|
7763 | 5897 |
pathList := hist getBackCollection. |
3892 | 5898 |
] ifFalse:[ |
7763 | 5899 |
pathList := hist getForwardCollection. |
3892 | 5900 |
]. |
4022 | 5901 |
pathList isEmpty ifTrue:[ ^ nil]. |
7763 | 5902 |
|
6370 | 5903 |
pathList size > 30 ifTrue:[ |
5904 |
pathList := pathList copyTo:30 |
|
5905 |
]. |
|
7763 | 5906 |
|
5907 |
menu := Menu new. |
|
5908 |
||
3964 | 5909 |
pathList do:[:aPath| |
14593 | 5910 |
menu addItem:(MenuItem |
5911 |
label:aPath |
|
5912 |
itemValue:[ self setCurrentFileName:(aPath asFilename) ] |
|
5913 |
translateLabel:false). |
|
3952 | 5914 |
]. |
7763 | 5915 |
menu findGuiResourcesIn:self. |
3892 | 5916 |
^ menu |
7763 | 5917 |
|
11783 | 5918 |
"Modified: / 09-09-2012 / 13:07:22 / cg" |
3892 | 5919 |
! |
5920 |
||
5921 |
menuDirHistoryBack |
|
5922 |
"initialize the directory menu |
|
5923 |
" |
|
5924 |
<resource: #programMenu > |
|
5925 |
||
5926 |
^ self menuDirHistory:#back. |
|
5927 |
! |
|
5928 |
||
5929 |
menuDirHistoryForward |
|
5930 |
"initialize the directory menu |
|
5931 |
" |
|
5932 |
<resource: #programMenu > |
|
5933 |
||
5934 |
^ self menuDirHistory:#forward. |
|
3906 | 5935 |
! |
5936 |
||
5937 |
menuFileHistory |
|
5938 |
"initialize the file history menu |
|
5939 |
" |
|
5940 |
<resource: #programMenu > |
|
5941 |
||
7763 | 5942 |
|menu hist text removeItem| |
3906 | 5943 |
|
5944 |
hist := self fileHistory. |
|
5945 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5946 |
|
7763 | 5947 |
menu := Menu new. |
5948 |
||
5949 |
hist copy do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5950 |
aFileItem fileName exists ifTrue:[ |
12963 | 5951 |
menu addItem:(MenuItem |
5952 |
label: aFileItem fileName asString |
|
14593 | 5953 |
itemValue: |
5954 |
[ |
|
5955 |
self setCurrentFileName:(aFileItem fileName). |
|
5956 |
self openApplByFileItem:aFileItem |
|
5957 |
] |
|
5958 |
translateLabel:false). |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5959 |
] ifFalse:[ |
7763 | 5960 |
"/ remove all not existing history entries |
5961 |
hist remove:aFileItem. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5962 |
] |
3906 | 5963 |
]. |
7763 | 5964 |
menu addSeparator. |
5965 |
||
4080 | 5966 |
removeItem := MenuItem new. |
5967 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5968 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5969 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 5970 |
removeItem label:text. |
11783 | 5971 |
removeItem |
5972 |
itemValue:[ |
|
5973 |
self fileHistory removeAll. |
|
5974 |
self enableFileHistory value:false. |
|
5975 |
]. |
|
3906 | 5976 |
menu addItem:removeItem. |
7763 | 5977 |
menu findGuiResourcesIn:self. |
3906 | 5978 |
^ menu |
7763 | 5979 |
|
11783 | 5980 |
"Modified (format): / 09-09-2012 / 13:07:36 / cg" |
3952 | 5981 |
! |
5982 |
||
4080 | 5983 |
sortMenu |
5984 |
<resource: #programMenu > |
|
5985 |
||
5986 |
|menu| |
|
5987 |
||
7763 | 5988 |
menu := Menu decodeFromLiteralArray:self class sortMenu. |
4080 | 5989 |
menu findGuiResourcesIn:self. |
5990 |
^ menu |
|
7763 | 5991 |
|
5992 |
"Modified: / 27-03-2007 / 10:47:42 / cg" |
|
4080 | 5993 |
! |
5994 |
||
5995 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5996 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5997 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5998 |
specHere := self class viewDetailsMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5999 |
itemsHere := specHere at:2. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6000 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6001 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6002 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6003 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6004 |
spec := specHere copy. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6005 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
6006 |
^ spec |
4080 | 6007 |
! |
6008 |
||
6009 |
viewInContentsBrowserMenu |
|
5009 | 6010 |
self |
6011 |
applicationNamed:#DirectoryContentsBrowser |
|
6012 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
6013 |
||
6014 |
^ nil. |
|
4080 | 6015 |
! |
6016 |
||
3952 | 6017 |
visitedDirectoriesMenu |
6018 |
<resource: #programMenu > |
|
6019 |
||
6020 |
|menu histCopy text removeItem| |
|
6021 |
||
7763 | 6022 |
histCopy := self directoryHistory. |
6023 |
histCopy isEmpty ifTrue:[^ nil]. |
|
6024 |
||
3952 | 6025 |
menu := Menu new. |
7763 | 6026 |
|
6027 |
histCopy do:[:aFile| |
|
12963 | 6028 |
menu addItem:(MenuItem |
6029 |
label:aFile asString |
|
6030 |
itemValue:[ |
|
6031 |
self setCurrentFileName:(aFile path asFilename). |
|
6032 |
]). |
|
7763 | 6033 |
]. |
6034 |
menu addSeparator. |
|
6035 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
6036 |
"/ 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
|
6037 |
text := (resources string:'Clear History'). |
3952 | 6038 |
removeItem := MenuItem new. |
4040 | 6039 |
removeItem translateLabel:true. |
3952 | 6040 |
removeItem label:text. |
11783 | 6041 |
removeItem |
6042 |
itemValue:[ |
|
6043 |
self directoryHistory removeAll. |
|
6044 |
self enableForward value:self canForward. |
|
6045 |
self enableBack value:self canBackward. |
|
6046 |
]. |
|
7763 | 6047 |
|
3952 | 6048 |
menu addItem:removeItem. |
7763 | 6049 |
menu findGuiResourcesIn:self. |
3952 | 6050 |
^ menu |
7763 | 6051 |
|
11783 | 6052 |
"Modified: / 09-09-2012 / 13:07:45 / cg" |
3892 | 6053 |
! ! |
6054 |
||
5880 | 6055 |
!AbstractFileBrowser methodsFor:'menu actions'! |
6056 |
||
6057 |
doCompareTwoFiles |
|
6058 |
self openDiffView. |
|
6059 |
! |
|
6060 |
||
6061 |
doGoDirectoryUp |
|
18511 | 6062 |
"navigate up to the parent folder" |
6063 |
||
5960 | 6064 |
| upDir directory rootInTreeView| |
5880 | 6065 |
|
6066 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
6067 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 6068 |
directory := self currentDirectory. |
6069 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 6070 |
] ifFalse:[ |
6071 |
rootInTreeView := self |
|
6072 |
applicationNamed:#DirectoryTreeBrowser |
|
6073 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 6074 |
directory := rootInTreeView value asFilename. |
6075 |
]. |
|
6076 |
upDir := directory directory. |
|
5959 | 6077 |
self setCurrentFileName:upDir. |
5880 | 6078 |
! |
6079 |
||
6080 |
doGotoDefaultDirectory |
|
18511 | 6081 |
"navigate to the default folder (is the current directory)" |
6082 |
||
5880 | 6083 |
self gotoFile:(Filename defaultDirectory). |
6084 |
! |
|
6085 |
||
8091 | 6086 |
doGotoDesktopDirectory |
18511 | 6087 |
"navigate to the desktop folder" |
6088 |
||
18823 | 6089 |
|dir| |
6090 |
||
6091 |
(dir := Filename desktopDirectory) isNil ifTrue:[ |
|
6092 |
Dialog warn:'No desktop folder defined'. |
|
6093 |
^ self. |
|
6094 |
]. |
|
6095 |
self gotoFile:dir. |
|
6096 |
||
6097 |
"Modified: / 15-06-2019 / 08:40:25 / Claus Gittinger" |
|
8091 | 6098 |
! |
6099 |
||
18036 | 6100 |
doGotoDocumentsDirectory |
18511 | 6101 |
"navigate to the documents folder" |
6102 |
||
18823 | 6103 |
|dir| |
6104 |
||
6105 |
(dir := Filename documentsDirectory) isNil ifTrue:[ |
|
6106 |
Dialog warn:'No documents folder defined'. |
|
6107 |
^ self. |
|
6108 |
]. |
|
6109 |
self gotoFile:dir. |
|
6110 |
||
6111 |
"Modified: / 15-06-2019 / 08:40:40 / Claus Gittinger" |
|
18036 | 6112 |
! |
6113 |
||
6114 |
doGotoDownloadsDirectory |
|
18511 | 6115 |
"navigate to the downloads folder" |
6116 |
||
18823 | 6117 |
|dir| |
6118 |
||
6119 |
(dir := Filename downloadsDirectory) isNil ifTrue:[ |
|
6120 |
Dialog warn:'No downloads folder defined'. |
|
6121 |
^ self. |
|
6122 |
]. |
|
6123 |
self gotoFile:dir. |
|
6124 |
||
6125 |
"Modified: / 15-06-2019 / 08:40:53 / Claus Gittinger" |
|
18036 | 6126 |
! |
6127 |
||
5880 | 6128 |
doGotoHomeDirectory |
18511 | 6129 |
"navigate to the home folder" |
6130 |
||
18823 | 6131 |
|dir| |
6132 |
||
6133 |
(dir := Filename homeDirectory) isNil ifTrue:[ |
|
6134 |
Dialog warn:'No home folder defined'. |
|
6135 |
^ self. |
|
6136 |
]. |
|
6137 |
self gotoFile:dir. |
|
6138 |
||
6139 |
"Modified: / 15-06-2019 / 08:41:08 / Claus Gittinger" |
|
5880 | 6140 |
! |
6141 |
||
6434 | 6142 |
doGotoSmalltalkDirectory |
18511 | 6143 |
"navigate to the smalltalk bin folder (where the stx executable is)" |
6144 |
||
18823 | 6145 |
|dir| |
6146 |
||
6147 |
(dir := self smalltalkDirectory) isNil ifTrue:[ |
|
6148 |
Dialog warn:'No smalltalk folder defined'. |
|
6149 |
^ self. |
|
6150 |
]. |
|
6151 |
self gotoFile:dir. |
|
6152 |
||
6153 |
"Modified: / 15-06-2019 / 08:41:26 / Claus Gittinger" |
|
6434 | 6154 |
! |
6155 |
||
17187 | 6156 |
doGotoSmalltalkWorkspaceDirectory |
18511 | 6157 |
"navigate to the user's smalltalk workspace folder" |
6158 |
||
18823 | 6159 |
|dir| |
6160 |
||
6161 |
(dir := UserPreferences current workspaceDirectory) isNil ifTrue:[ |
|
6162 |
Dialog warn:'No smalltalk workspace folder defined'. |
|
6163 |
^ self. |
|
6164 |
]. |
|
6165 |
self gotoFile:dir. |
|
6166 |
||
6167 |
"Modified: / 15-06-2019 / 08:42:03 / Claus Gittinger" |
|
17187 | 6168 |
! |
6169 |
||
9677 | 6170 |
doGotoTempDirectory |
18823 | 6171 |
|dir| |
6172 |
||
6173 |
(dir := self tempDirectory) isNil ifTrue:[ |
|
6174 |
Dialog warn:'No temp folder defined'. |
|
6175 |
^ self. |
|
6176 |
]. |
|
6177 |
self gotoFile:dir. |
|
9677 | 6178 |
|
6179 |
"Created: / 29-12-2010 / 11:03:17 / cg" |
|
18823 | 6180 |
"Modified: / 15-06-2019 / 08:41:59 / Claus Gittinger" |
9677 | 6181 |
! |
6182 |
||
9596 | 6183 |
doMakeCurrentDirectory |
17582 | 6184 |
<resource: #obsolete> |
6185 |
||
6186 |
"/ no longer |
|
6187 |
^ self |
|
6188 |
"/ OperatingSystem setCurrentDirectory:(self currentDirectory pathName). |
|
6189 |
"/ self currentFileNameHolderChangedForCommon. |
|
9596 | 6190 |
|
6191 |
"Created: / 26-10-2010 / 17:21:19 / cg" |
|
17582 | 6192 |
"Modified (format): / 17-07-2017 / 10:09:39 / cg" |
9596 | 6193 |
! |
6194 |
||
5880 | 6195 |
fileGetInfo:longInfo |
6196 |
"get info on selected file - show it in a box" |
|
6197 |
||
6198 |
|string box updater| |
|
6199 |
||
6200 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
6201 |
string notNil ifTrue:[ |
|
6202 |
box := InfoBox title:string. |
|
6203 |
updater := [ |
|
6204 |
[true] whileTrue:[ |
|
6205 |
Delay waitForSeconds:2. |
|
6206 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
6207 |
string isNil ifTrue:[ ^ self]. |
|
6208 |
box title:string |
|
6209 |
] |
|
6210 |
] fork. |
|
6211 |
box show. |
|
6212 |
updater terminate. |
|
6213 |
box destroy |
|
6214 |
] |
|
6434 | 6215 |
! |
6216 |
||
17686 | 6217 |
showDeltaBetweenTwoImageFiles |
6218 |
|i1 i2 delta| |
|
6219 |
||
6220 |
i1 := Image fromFile:(self selectedFileNames first). |
|
6221 |
i2 := Image fromFile:(self selectedFileNames second). |
|
6222 |
delta := ImageAlgorithms new differenceImageBetween:i1 and:i2. |
|
6223 |
ImageView openOn:delta. |
|
6224 |
||
6225 |
"Created: / 10-09-2017 / 16:59:08 / cg" |
|
6226 |
! |
|
6227 |
||
6434 | 6228 |
smalltalkDirectory |
8590 | 6229 |
|stxPath| |
6434 | 6230 |
|
6231 |
stxPath := OperatingSystem pathOfSTXExecutable. |
|
8590 | 6232 |
stxPath isNil ifTrue:[ |
6233 |
^ Filename currentDirectory |
|
6234 |
]. |
|
6235 |
^ stxPath asFilename directory. |
|
9677 | 6236 |
! |
6237 |
||
6238 |
tempDirectory |
|
6239 |
^ Filename tempDirectory. |
|
6240 |
||
6241 |
"Created: / 29-12-2010 / 11:03:00 / cg" |
|
5880 | 6242 |
! ! |
6243 |
||
11139 | 6244 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
6245 |
||
14262 | 6246 |
addDirToJavaSourcePath |
6247 |
"add the current path to java's sourcePath |
|
6248 |
(only available with ST/J System" |
|
6249 |
||
6250 |
Java addToSourcePath:self currentDirectory pathName |
|
6251 |
||
6252 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
6253 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
6254 |
! |
|
6255 |
||
11139 | 6256 |
copyFiles |
6257 |
self |
|
6258 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
6259 |
! |
|
6260 |
||
6261 |
cutFiles |
|
6262 |
self |
|
6263 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
6264 |
! |
|
6265 |
||
6266 |
deleteFiles |
|
6267 |
self |
|
6268 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
6269 |
! |
|
6270 |
||
6271 |
eraseFiles |
|
6272 |
self |
|
6273 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
6274 |
! |
|
6275 |
||
14262 | 6276 |
fileAddToJavaSourcePath |
6277 |
"add the current path to java's sourcePath |
|
6278 |
(only available with ST/J System" |
|
6279 |
||
17865 | 6280 |
Java notNil ifTrue:[ |
6281 |
self currentSelectedObjects do:[:each | |
|
6282 |
Java addToSourcePath:(each pathName) |
|
6283 |
]. |
|
14262 | 6284 |
]. |
6285 |
||
6286 |
"Created: / 9.11.1998 / 05:41:34 / cg" |
|
6287 |
"Modified: / 9.11.1998 / 05:56:00 / cg" |
|
6288 |
! |
|
6289 |
||
11139 | 6290 |
openSettingsDialog |
6291 |
|dialog| |
|
6292 |
||
6293 |
dialog := FileBrowserV2SettingsDialog new. |
|
6294 |
dialog settingsDialog:self. |
|
6295 |
dialog allButOpen. |
|
6296 |
dialog doReload. |
|
6297 |
dialog openWindow |
|
6298 |
! |
|
6299 |
||
6300 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
6301 |
|files dirs| |
|
6302 |
||
6303 |
files := self currentSelectedFiles. |
|
6304 |
files notEmpty ifTrue:[ |
|
6305 |
aBlock value:files. |
|
6306 |
] ifFalse:[ |
|
6307 |
dirs := self currentSelectedDirectories. |
|
6308 |
dirs notEmpty ifTrue:[ |
|
6309 |
aBlock value:dirs. |
|
6310 |
]. |
|
6311 |
]. |
|
6312 |
! ! |
|
6313 |
||
6314 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
|
6315 |
||
6316 |
openAboutThisApplication |
|
6317 |
"opens an about box for this application." |
|
6318 |
||
6319 |
Dialog aboutClass:self class. |
|
6320 |
! |
|
6321 |
||
6322 |
openHTMLDocument:relativeDocPath |
|
6323 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
6324 |
! ! |
|
6325 |
||
6326 |
!AbstractFileBrowser methodsFor:'menu actions-scm-cvs'! |
|
3892 | 6327 |
|
15905 | 6328 |
canCvsAddAndCommit |
6329 |
||
6330 |
|selectedFiles| |
|
6331 |
||
6332 |
selectedFiles := self currentSelectedObjects. |
|
6333 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
6334 |
! |
|
6335 |
||
6336 |
canRemoveCVSContainer |
|
6337 |
^ self currentSelectedFiles |
|
6338 |
contains:[:fileName| |
|
6339 |
|dirOfFile cvsDir| |
|
6340 |
||
6341 |
dirOfFile := self getDirWithoutFileName:fileName. |
|
6342 |
cvsDir := dirOfFile construct:'CVS'. |
|
6343 |
cvsDir isDirectory |
|
6344 |
]. |
|
6345 |
! |
|
6346 |
||
12777 | 6347 |
commitFilesToCVS:files |
6348 |
|numFiles| |
|
6349 |
||
6350 |
(numFiles := files size) > 0 ifTrue:[ |
|
6351 |
self withActivityIndicationDo:[ |
|
6352 |
self cvsCommitFiles:files |
|
6353 |
] |
|
6354 |
] |
|
6355 |
! |
|
6356 |
||
3892 | 6357 |
cvsAddAndCommit |
4849 | 6358 |
self cvsAddAndCommitAsBinary:false |
6359 |
! |
|
6360 |
||
6361 |
cvsAddAndCommitAsBinary:asBinary |
|
8588 | 6362 |
|sel log logArg binArg cmd dir executionBlock nameString| |
3892 | 6363 |
|
6364 |
log := Dialog |
|
11139 | 6365 |
requestText:(resources string:'Enter initial log message:') |
4414 | 6366 |
lines:10 |
6367 |
columns:70 |
|
6368 |
initialAnswer:nil. |
|
8322
cf10f08b6164
care for cancel in #cvsAddAndCommitAsBinary:
Claus Gittinger <cg@exept.de>
parents:
8294
diff
changeset
|
6369 |
log isNil ifTrue:[^ self]. |
3892 | 6370 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6371 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6372 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6373 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6374 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6375 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6376 |
|
8588 | 6377 |
binArg := ''. |
6378 |
asBinary ifTrue:[ |
|
6379 |
binArg := '-kb '. |
|
6380 |
]. |
|
3982 | 6381 |
sel := self currentSelectedFiles. |
11139 | 6382 |
executionBlock := |
6383 |
[:stream | |
|
6384 |
log notNil ifTrue:[ |
|
17416 | 6385 |
sel notEmptyOrNil ifTrue:[ |
11139 | 6386 |
sel do:[:fn | |
6387 |
|nameArg| |
|
6388 |
||
6389 |
nameArg := '"',fn baseName,'"'. |
|
6390 |
||
6391 |
dir := self getDirWithoutFileName:fn. |
|
6392 |
cmd := 'cvs add ',logArg,' ',binArg,nameArg. |
|
6393 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6394 |
||
6395 |
cmd := ('cvs commit -l ',logArg,' ',nameArg). |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6396 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
11139 | 6397 |
"/ mhmh - it seems that only old CVS implementations (at least turqoise) |
6398 |
"/ support and need the 'admin -kb' command. |
|
6399 |
"/ newer ones use the '-kb' option in the 'cvs add' command |
|
6400 |
asBinary ifTrue:[ |
|
6401 |
cmd := ('cvs admin -kb ' , nameArg). |
|
6402 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6403 |
||
6404 |
cmd := ('cvs upd ' , nameArg). |
|
6405 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6406 |
]. |
|
6407 |
] |
|
6408 |
] |
|
6409 |
] |
|
6410 |
]. |
|
4107 | 6411 |
nameString := 'Command> cvs add and commit'. |
3892 | 6412 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
11139 | 6413 |
|
17416 | 6414 |
"Modified: / 17-02-2017 / 08:25:16 / cg" |
3892 | 6415 |
! |
6416 |
||
4849 | 6417 |
cvsAddBinaryAndCommit |
6418 |
self cvsAddAndCommitAsBinary:true |
|
6419 |
! |
|
6420 |
||
18867 | 6421 |
cvsBrowseRepositoryVersions |
6422 |
"open a diff-textView showing all versions in the repository." |
|
6423 |
||
6424 |
|sel fn| |
|
6425 |
||
6426 |
sel := self currentSelectedObjects. |
|
6427 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6428 |
sel size == 1 ifFalse:[ ^ self ]. |
|
6429 |
fn := sel first. |
|
6430 |
||
6431 |
self withWaitCursorDo:[ |
|
6432 |
FileVersionDiffBrowser openOnAllVersionsOfFile:fn |
|
6433 |
] |
|
6434 |
||
6435 |
"Created: / 07-07-2019 / 19:45:23 / Claus Gittinger" |
|
6436 |
! |
|
6437 |
||
3892 | 6438 |
cvsCommit |
12777 | 6439 |
|selectedFiles| |
3892 | 6440 |
|
3982 | 6441 |
selectedFiles:= self currentSelectedFiles. |
12777 | 6442 |
self cvsCommitFiles:selectedFiles |
6443 |
! |
|
6444 |
||
6445 |
cvsCommitFiles:files |
|
6446 |
|nFiles log logTmp s logArg msg executionBlock nameString | |
|
6447 |
||
6448 |
nFiles := files size. |
|
6449 |
nFiles == 0 ifTrue:[^ self]. |
|
6450 |
||
6451 |
nFiles == 1 ifTrue:[ |
|
6452 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(files first baseName) |
|
3892 | 6453 |
] ifFalse:[ |
12777 | 6454 |
nFiles > 1 ifTrue:[ |
6455 |
msg := resources string:'Enter log message for %1 files to checkIn' with:nFiles printString |
|
4414 | 6456 |
] ifFalse:[ |
6627 | 6457 |
msg := resources string:'Enter log message for checkIn' |
4414 | 6458 |
] |
3892 | 6459 |
]. |
6460 |
||
6461 |
log := Dialog |
|
4414 | 6462 |
requestText:msg |
6463 |
lines:10 |
|
6464 |
columns:70 |
|
6465 |
initialAnswer:nil. |
|
3892 | 6466 |
|
4663 | 6467 |
log isNil ifTrue:[^ self]. |
12777 | 6468 |
log := log replChar:$" withString:'\"'. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6469 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6470 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
12777 | 6471 |
"/ save the log message into another tempFile ... |
13121 | 6472 |
s := FileStream newTemporary. |
6473 |
logTmp := s fileName. |
|
12777 | 6474 |
s nextPutAll:log. |
6475 |
s close. |
|
6476 |
||
6477 |
logArg := '-F "', logTmp pathName, '"'. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6478 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6479 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6480 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
6481 |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
6482 |
executionBlock := [:stream | |
12777 | 6483 |
[ |
6484 |
files do:[:fn | |
|
6485 |
| dir nameArg cmd | |
|
6486 |
||
6487 |
nameArg := '"',fn baseName,'"'. |
|
6488 |
dir := fn directory. |
|
6489 |
cmd := 'cvs commit ',logArg,' ' , nameArg. |
|
6490 |
stream showCR:fn pathName. |
|
6491 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
4663 | 6492 |
] |
12777 | 6493 |
] ensure:[ |
6494 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6495 |
]. |
|
4107 | 6496 |
]. |
6497 |
nameString := 'Command> cvs commit'. |
|
6498 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 6499 |
! |
6500 |
||
14527 | 6501 |
cvsCommitFolder |
6502 |
|dir log logTmp s logArg msg executionBlock nameString | |
|
6503 |
||
6504 |
(dir := self currentDirectory) isNil ifTrue:[ ^ self ]. |
|
6505 |
||
6506 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(dir baseName). |
|
6507 |
log := Dialog |
|
6508 |
requestText:msg |
|
6509 |
lines:10 |
|
6510 |
columns:70 |
|
6511 |
initialAnswer:nil. |
|
6512 |
||
6513 |
log isNil ifTrue:[^ self]. |
|
6514 |
log := log replChar:$" withString:'\"'. |
|
6515 |
||
6516 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6517 |
"/ save the log message into another tempFile ... |
|
6518 |
s := FileStream newTemporary. |
|
6519 |
logTmp := s fileName. |
|
6520 |
s nextPutAll:log. |
|
6521 |
s close. |
|
6522 |
||
6523 |
logArg := '-F "', logTmp pathName, '"'. |
|
6524 |
] ifFalse:[ |
|
6525 |
logArg := '-m ''' , log , ''''. |
|
6526 |
]. |
|
6527 |
||
6528 |
executionBlock := [:stream | |
|
6529 |
[ |
|
6530 |
|cmd| |
|
6531 |
||
6532 |
cmd := 'cvs commit ',logArg. |
|
6533 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6534 |
] ensure:[ |
|
6535 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
6536 |
]. |
|
6537 |
]. |
|
6538 |
||
6539 |
nameString := 'Command> cvs commit'. |
|
6540 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6541 |
! |
|
6542 |
||
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6543 |
cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6544 |
|selectedFiles| |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6545 |
|
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6546 |
selectedFiles:= self currentSelectedFiles. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6547 |
selectedFiles do:[:each | |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6548 |
|out diffs| |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6549 |
|
15589 | 6550 |
out := CharacterWriteStream new:100. |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6551 |
OperatingSystem |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6552 |
executeCommand:'cvs diff -b ',each baseName |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6553 |
outputTo:out |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6554 |
inDirectory:each directoryName. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6555 |
diffs := out contents. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6556 |
TextView openWith:diffs. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6557 |
]. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6558 |
|
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
6559 |
"Modified: / 23-01-2012 / 14:08:28 / cg" |
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6560 |
! |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
6561 |
|
15211 | 6562 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
6563 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
6564 |
||
6565 |
|toRemove updateRunning executionBlock nameString| |
|
6566 |
||
6567 |
updateRunning := self backgroundProcesses value notEmpty. |
|
6568 |
self killAllRunningBackgroundProcesses. |
|
6569 |
toRemove := OrderedCollection new. |
|
6570 |
||
6571 |
executionBlock := |
|
6572 |
[:stream | |
|
6573 |
|cmd logArg prevDir prevFiles| |
|
6574 |
||
6575 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6576 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
|
6577 |
] ifFalse:[ |
|
6578 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
|
6579 |
]. |
|
6580 |
prevFiles := ''. |
|
6581 |
||
6582 |
filesToRemove do:[:fileName | |
|
6583 |
|dir file| |
|
6584 |
||
6585 |
dir := fileName directory. |
|
6586 |
(prevDir notNil and:[prevDir ~= dir]) ifTrue:[ |
|
6587 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6588 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6589 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6590 |
prevFiles := ''. |
|
6591 |
]. |
|
6592 |
||
17116 | 6593 |
OsError handle:[:ex| |
15211 | 6594 |
"was not able to remove it" |
6595 |
| lastError msg | |
|
6596 |
lastError := OperatingSystem lastErrorString. |
|
6597 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
6598 |
lastError isNil ifFalse:[ |
|
6599 |
msg := msg , '\\(' , lastError , ')' |
|
6600 |
]. |
|
6601 |
Dialog warn:msg withCRs |
|
6602 |
] do:[ |
|
6603 |
(fileName isSymbolicLink) ifFalse:[ |
|
6604 |
fileName remove. |
|
6605 |
file := fileName baseName. |
|
6606 |
cmd := ('cvs remove -f "',file,'"'). |
|
6607 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6608 |
"/ Transcript show:dir; space; showCR:cmd. |
|
6609 |
] |
|
6610 |
]. |
|
6611 |
prevDir := dir. |
|
6612 |
prevFiles := prevFiles,' ',file. |
|
6613 |
]. |
|
6614 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6615 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6616 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6617 |
]. |
|
6618 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
|
6619 |
filesToRemove size > 1 ifTrue:[ |
|
6620 |
nameString := nameString, ' ...'. |
|
6621 |
]. |
|
6622 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6623 |
! |
|
3892 | 6624 |
|
6625 |
cvsRemoveFileAndCVSContainer |
|
12493 | 6626 |
|files| |
6627 |
||
6628 |
files := self currentSelectedFiles copy. |
|
6629 |
self removeFilesAndCVSContainers:files |
|
3892 | 6630 |
! |
6631 |
||
9338 | 6632 |
cvsRevisionLog |
6633 |
| cmd sel executionBlock nameString| |
|
6634 |
||
6635 |
sel := self currentSelectedObjects. |
|
6636 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6637 |
||
6638 |
executionBlock := [:stream | |
|
6639 |
sel do:[:fn | |
|
6640 |
| dir nameArg | |
|
6641 |
||
6642 |
nameArg := '"',fn baseName,'"'. |
|
6643 |
dir := fn directory. |
|
6644 |
cmd := 'cvs log ' , nameArg. |
|
6645 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6646 |
] |
|
6647 |
]. |
|
6648 |
nameString := 'Command> cvs log'. |
|
6649 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6650 |
! |
|
6651 |
||
8562 | 6652 |
cvsTagSelection |
12856 | 6653 |
|tag tags cmd| |
6654 |
||
6655 |
tag := Dialog |
|
6656 |
request:(resources string:'Tag (possibly multiple, separated by ";"):') |
|
6657 |
initialAnswer:(CVSSourceCodeManager recentTag). |
|
6658 |
tag isEmptyOrNil ifTrue:[^ self ]. |
|
6659 |
||
6660 |
CVSSourceCodeManager recentTag:tag. |
|
8562 | 6661 |
|
6662 |
CVSSourceCodeManager notNil ifTrue:[ |
|
6663 |
cmd := CVSSourceCodeManager cvsExecutable. |
|
6664 |
] ifFalse:[ |
|
6665 |
cmd := 'cvs'. |
|
6666 |
]. |
|
6667 |
||
12856 | 6668 |
tags := tag asCollectionOfSubstringsSeparatedByAny:',;'. |
6669 |
tags do:[:eachTag | |
|
6670 |
self executeCommand:('%1 tag -F "%2" %3' |
|
6671 |
bindWith:cmd |
|
12858 | 6672 |
with:(eachTag withoutSeparators) |
12856 | 6673 |
with:(self makeFileNameArgumentString)) |
6674 |
]. |
|
8562 | 6675 |
! |
6676 |
||
3892 | 6677 |
cvsUpdateAll |
6678 |
| cmd | |
|
6679 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6680 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6681 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6682 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6683 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6684 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6685 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6686 |
self executeCommand:(cmd, ' upd -l'). |
3892 | 6687 |
! |
6688 |
||
6689 |
cvsUpdateAllRecursive |
|
6690 |
| cmd | |
|
6691 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6692 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6693 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6694 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6695 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6696 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6697 |
self executeCommand:(cmd, ' upd -d'). |
3892 | 6698 |
! |
6699 |
||
6700 |
cvsUpdateSelection |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6701 |
|stream cmd| |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6702 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6703 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6704 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6705 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6706 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6707 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6708 |
|
15589 | 6709 |
stream := CharacterWriteStream new. |
8563 | 6710 |
stream |
6711 |
nextPutAll:cmd; |
|
6712 |
nextPutAll:' upd '; |
|
6713 |
nextPutAll:(self makeFileNameArgumentString). |
|
6714 |
||
6715 |
self executeCommand:stream contents. |
|
6716 |
! |
|
6717 |
||
6718 |
makeFileNameArgumentString |
|
6719 |
|stream| |
|
6720 |
||
15589 | 6721 |
stream := CharacterWriteStream new. |
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6722 |
self currentSelectedFiles do:[: file | |
8563 | 6723 |
stream nextPut:$". |
4414 | 6724 |
stream nextPutAll:file baseName. |
8563 | 6725 |
stream nextPutAll:'" '. |
6726 |
]. |
|
6727 |
^ stream contents. |
|
12493 | 6728 |
! |
6729 |
||
6730 |
removeFilesAndCVSContainers:files |
|
6731 |
|numFiles question aswer| |
|
6732 |
||
6733 |
(numFiles := files size) > 0 ifTrue:[ |
|
6734 |
numFiles > 1 ifTrue:[ |
|
6735 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:numFiles |
|
6736 |
] ifFalse:[ |
|
6737 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(files first baseName allBold) |
|
6738 |
]. |
|
6739 |
||
6740 |
aswer := Dialog |
|
6741 |
confirm:question withCRs |
|
6742 |
yesLabel:(resources string:'Remove') |
|
6743 |
noLabel:(resources string:'Cancel'). |
|
6744 |
||
6745 |
aswer ifTrue:[ |
|
6746 |
self withActivityIndicationDo:[ |
|
6747 |
self cvsRemoveAndRemoveFromCVS:files |
|
6748 |
] |
|
6749 |
] |
|
6750 |
] |
|
3892 | 6751 |
! ! |
6752 |
||
14126 | 6753 |
|
11139 | 6754 |
!AbstractFileBrowser methodsFor:'menu actions-scm-mercurial'! |
6755 |
||
6756 |
mercurialAdd |
|
6757 |
|executionBlock sel maxCmdSize| |
|
6758 |
||
6759 |
maxCmdSize := 512. |
|
6760 |
||
6761 |
sel := self currentSelectedObjects. |
|
6762 |
sel isEmptyOrNil ifTrue:[ |
|
6763 |
^ self |
|
6764 |
]. |
|
6765 |
||
6766 |
executionBlock := |
|
6767 |
[:stream | |
|
6768 |
|prevDir cmd| |
|
6769 |
||
6770 |
prevDir := nil. |
|
6771 |
sel do:[:fn | |
|
6772 |
|nameArg dir| |
|
6773 |
||
6774 |
nameArg := '"',fn baseName,'"'. |
|
6775 |
dir := fn directory. |
|
6776 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6777 |
"/ flush |
|
6778 |
cmd notNil ifTrue:[ |
|
6779 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6780 |
cmd := nil. |
|
6781 |
] |
|
6782 |
]. |
|
6783 |
cmd isNil ifTrue:[ |
|
6784 |
cmd := 'hg add'. |
|
6785 |
]. |
|
6786 |
cmd := cmd,' ',nameArg. |
|
6787 |
prevDir := dir. |
|
6788 |
]. |
|
6789 |
cmd notNil ifTrue:[ |
|
6790 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6791 |
cmd := nil. |
|
6792 |
]. |
|
6793 |
stream nextPutLine:'Commit to finish the transaction'. |
|
6794 |
]. |
|
6795 |
||
6796 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg add'. |
|
6797 |
||
6798 |
"Created: / 15-01-2012 / 15:55:47 / cg" |
|
6799 |
! |
|
6800 |
||
6801 |
mercurialCommit |
|
6802 |
|dir executionBlock| |
|
6803 |
||
6804 |
"/ dir := self currentDirectory. |
|
6805 |
dir := self directoryContentsBrowser directory. |
|
6806 |
executionBlock := |
|
6807 |
[:stream | |
|
6808 |
(self getExecutionBlockForCommand:'hg commit' |
|
6809 |
inDirectory:dir) value:stream. |
|
6810 |
stream nextPutLine:'Push to sync other repositories'. |
|
6169 | 6811 |
]. |
11139 | 6812 |
|
6813 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg commit'. |
|
6814 |
||
6815 |
"Created: / 15-01-2012 / 16:21:27 / cg" |
|
6816 |
! |
|
6817 |
||
11144 | 6818 |
mercurialInit |
6819 |
|dir executionBlock| |
|
6820 |
||
6821 |
dir := self directoryContentsBrowser directory. |
|
6822 |
||
6823 |
(Dialog confirm:(resources |
|
6824 |
string:'Initialize new Mercurial Repository in %1?' |
|
6825 |
with:dir baseName)) ifFalse:[^ self]. |
|
6826 |
||
6827 |
executionBlock := |
|
6828 |
[:stream | |
|
6829 |
(self getExecutionBlockForCommand:('hg init') |
|
6830 |
inDirectory:dir) value:stream. |
|
6831 |
]. |
|
6832 |
||
6833 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg init'. |
|
6834 |
||
6835 |
"Created: / 17-01-2012 / 15:58:46 / cg" |
|
6836 |
! |
|
6837 |
||
11139 | 6838 |
mercurialPush |
6839 |
|destination dir executionBlock| |
|
6840 |
||
6841 |
destination := Dialog request:'Mercurial Repository' |
|
6842 |
initialAnswer:(LastMercurialRepository ? MercurialSourceCodeManager repositoryName). |
|
6843 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
6844 |
||
6845 |
LastMercurialRepository := destination. |
|
6846 |
||
6847 |
dir := self directoryContentsBrowser directory. |
|
6848 |
executionBlock := |
|
6849 |
[:stream | |
|
6850 |
(self getExecutionBlockForCommand:('hg push "%1"' bindWith:destination) |
|
6851 |
inDirectory:dir) value:stream. |
|
6852 |
]. |
|
6853 |
||
6854 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg push'. |
|
6855 |
||
6856 |
"Created: / 15-01-2012 / 16:29:41 / cg" |
|
6857 |
! |
|
6858 |
||
6859 |
mercurialStatus |
|
6860 |
|executionBlock sel maxCmdSize| |
|
6861 |
||
6862 |
maxCmdSize := 512. |
|
6863 |
||
6864 |
sel := self currentSelectedObjects. |
|
6865 |
sel isEmptyOrNil ifTrue:[ |
|
6866 |
^ self |
|
6867 |
]. |
|
6868 |
||
6869 |
executionBlock := |
|
6870 |
[:stream | |
|
6871 |
|prevDir cmd| |
|
6872 |
||
6873 |
prevDir := nil. |
|
6874 |
sel do:[:fn | |
|
6875 |
|nameArg dir| |
|
6876 |
||
6877 |
nameArg := '"',fn baseName,'"'. |
|
6878 |
dir := fn directory. |
|
6879 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6880 |
"/ flush |
|
6881 |
cmd notNil ifTrue:[ |
|
6882 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6883 |
cmd := nil. |
|
6884 |
] |
|
6885 |
]. |
|
6886 |
cmd isNil ifTrue:[ |
|
6887 |
cmd := 'hg status'. |
|
6888 |
]. |
|
6889 |
cmd := cmd,' ',nameArg. |
|
6890 |
prevDir := dir. |
|
6891 |
]. |
|
6892 |
cmd notNil ifTrue:[ |
|
6893 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6894 |
cmd := nil. |
|
6895 |
]. |
|
6896 |
]. |
|
6897 |
||
6898 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg status'. |
|
6899 |
||
6900 |
"Created: / 15-01-2012 / 19:43:08 / cg" |
|
3892 | 6901 |
! ! |
6902 |
||
4849 | 6903 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
3892 | 6904 |
|
8510 | 6905 |
allFilesInSelectedDirectoriesForWhich:aBlock |
17868 | 6906 |
^ self class allFilesInDirectories:(self currentSelectedDirectories) forWhich:aBlock |
8510 | 6907 |
! |
6908 |
||
18426 | 6909 |
changeSetFromGSTSource |
6910 |
GSTFileReader isNil ifTrue:[ Smalltalk loadPackage:'stx:libbasic2']. |
|
6911 |
||
6912 |
self withWaitCursorDo:[ |
|
6913 |
self currentSelectedFiles do:[:fn | |
|
6914 |
|changeSet| |
|
6915 |
||
18746 | 6916 |
(fn suffix sameAs:'st') ifTrue:[ |
18426 | 6917 |
changeSet := GSTFileReader new changeSetFromStream:fn readStream. |
6918 |
(Tools::ChangeSetBrowser2 |
|
6919 |
on: changeSet |
|
6920 |
label: fn baseName) |
|
6921 |
beTwoColumn; |
|
6922 |
targetNamespace:nil; |
|
6923 |
targetPackage:nil; |
|
6924 |
open |
|
6925 |
] |
|
6926 |
] |
|
6927 |
] |
|
6928 |
||
6929 |
"Created: / 23-09-2018 / 01:32:46 / Claus Gittinger" |
|
18746 | 6930 |
"Modified: / 01-05-2019 / 11:21:34 / Claus Gittinger" |
18426 | 6931 |
! |
6932 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6933 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6934 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6935 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6936 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6937 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6938 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6939 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6940 |
"/ 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
|
6941 |
"/ 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
|
6942 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6943 |
conv := OrderedCollection new. |
4722 | 6944 |
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
|
6945 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6946 |
outSuffix = 'png' ifTrue:[ |
4722 | 6947 |
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
|
6948 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6949 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6950 |
outSuffix = 'gif' ifTrue:[ |
4722 | 6951 |
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
|
6952 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6953 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6954 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 6955 |
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
|
6956 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6957 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6958 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 6959 |
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
|
6960 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6961 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6962 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6963 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6964 |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6965 |
convertImageFrom:fileName to:outFile onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6966 |
|writer image outSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6967 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6968 |
outSuffix := outFile suffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6969 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6970 |
((writer := MIMETypes imageReaderForSuffix:outSuffix) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6971 |
and:[ (image := Image fromFile:fileName) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6972 |
and:[ writer canRepresent:image ]]) ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6973 |
"/ can do it with Smalltalk tools |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6974 |
writer save:image onFile:outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6975 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6976 |
"/ use external tools (pbm-package, if available) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6977 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6978 |
convertImageUsingExternalFileToolsFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6979 |
toSuffix:outSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6980 |
onError:exceptionBlock. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6981 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6982 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6983 |
"Created: / 20-05-2010 / 11:12:36 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6984 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6985 |
|
4367 | 6986 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6987 |
self convertImageToSuffix:'gif' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6988 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6989 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6990 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6991 |
self convertImageToSuffix:'jpg' |
4531 | 6992 |
! |
6993 |
||
6994 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6995 |
self convertImageToSuffix:'png' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6996 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6997 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6998 |
convertImageToSuffix:outSuffix |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6999 |
|outFile filesToConvert| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7000 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7001 |
self withActivityIndicationDo:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7002 |
filesToConvert := self currentSelectedObjects copy. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7003 |
filesToConvert do:[:fileName | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7004 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7005 |
|
18453 | 7006 |
fileName isRegularFile ifTrue:[ |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7007 |
|skip| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7008 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7009 |
skip := false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7010 |
outFile := fileName withSuffix:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7011 |
outFile exists ifTrue:[ |
4722 | 7012 |
|answer| |
7013 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7014 |
answer := Dialog |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7015 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7016 |
default:false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7017 |
answer isNil ifTrue:[AbortSignal raise]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7018 |
answer ifFalse:[ skip := true ]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7019 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7020 |
skip ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7021 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7022 |
convertImageFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7023 |
to:outFile |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7024 |
onError:[:errMsg | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7025 |
filesToConvert size == 1 ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7026 |
Dialog warn:errMsg |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7027 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7028 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7029 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7030 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7031 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7032 |
]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7033 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7034 |
self updateAndSelect:nil. |
4367 | 7035 |
] |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7036 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7037 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7038 |
self notify:nil. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7039 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7040 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7041 |
"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
|
7042 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7043 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7044 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
7045 |
self convertImageToSuffix:'xpm' |
4367 | 7046 |
! |
7047 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7048 |
convertImageUsingExternalFileToolsFrom:fileName toSuffix:outSuffix onError:exceptionBlock |
13121 | 7049 |
|inFile outFile chainOfConversions conversionStream |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7050 |
eachConversionSuffixCommandPair eachConversionCommand eachConversionSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7051 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7052 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7053 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7054 |
chainOfConversions isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7055 |
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
|
7056 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7057 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7058 |
conversionStream := chainOfConversions readStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7059 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7060 |
inFile := fileName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7061 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7062 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7063 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7064 |
eachConversionCommand == #readToXPM ifTrue:[ |
13121 | 7065 |
|image tempStreamXPM| |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7066 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7067 |
image := Image fromFile:(inFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7068 |
image isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7069 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7070 |
^ false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7071 |
]. |
13121 | 7072 |
tempStreamXPM := FileStream newTemporaryWithSuffix:'xpm'. |
7073 |
XPMReader save:image onStream:tempStreamXPM. |
|
7074 |
tempStreamXPM close. |
|
7075 |
inFile := tempStreamXPM fileName. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7076 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7077 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7078 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7079 |
[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7080 |
|command errOutput errMsg| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7081 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7082 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7083 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7084 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7085 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7086 |
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
|
7087 |
|
13121 | 7088 |
outFile := (FileStream newTemporaryWithSuffix:eachConversionSuffix) close pathName. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7089 |
command := eachConversionCommand |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7090 |
bindWith:(inFile pathName) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7091 |
with:(outFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7092 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7093 |
errOutput := String writeStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7094 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7095 |
(OperatingSystem executeCommand:command errorTo:errOutput) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7096 |
errMsg := resources |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7097 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7098 |
with:inFile baseName allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7099 |
with:eachConversionSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7100 |
with:eachConversionCommand allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7101 |
with:errOutput contents. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7102 |
exceptionBlock value:errMsg. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7103 |
|
18024 | 7104 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
7105 |
outFile remove. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7106 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7107 |
]. |
18024 | 7108 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7109 |
inFile := outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7110 |
eachConversionSuffixCommandPair := conversionStream next |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7111 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7112 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7113 |
] ifCurtailed:[ |
18024 | 7114 |
(inFile ~= fileName) ifTrue:[inFile remove]. |
7115 |
outFile remove. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7116 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7117 |
^ true. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7118 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7119 |
"Created: / 20-05-2010 / 11:05:50 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7120 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
7121 |
|
3892 | 7122 |
createProjectAndOpenProjectBrowser |
7123 |
|nm f s directory| |
|
7124 |
||
7125 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 7126 |
directory := self currentDirectory. |
3892 | 7127 |
nm := directory baseName. |
7128 |
f := (directory construct:nm) withSuffix:'prj'. |
|
7129 |
f exists ifTrue:[ |
|
4414 | 7130 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
7131 |
^ self. |
|
3892 | 7132 |
]. |
7133 |
s := f writeStream. |
|
7134 |
s nextPutAll:' |
|
7135 |
name ''' , nm , ''' |
|
7136 |
type #classLibrary |
|
7137 |
package #''private:' , nm , ''' |
|
7138 |
prerequisites nil |
|
7139 |
||
7140 |
classes #( ) |
|
7141 |
'. |
|
7142 |
s close. |
|
7143 |
ProjectBrowser openOnFile:f. |
|
7144 |
! |
|
7145 |
||
5880 | 7146 |
doExecuteCommand |
7147 |
"execute an OperatingSystem-command" |
|
7148 |
||
7149 |
| action fileName| |
|
7150 |
||
7151 |
fileName := self firstSelectedFile. |
|
7152 |
action := [:command | |
|
7153 |
self addToCommandHistory:command for:fileName. |
|
7154 |
self executeCommand:command. |
|
7155 |
]. |
|
7156 |
self askForCommandFor:fileName thenDo:action |
|
7157 |
! |
|
7158 |
||
7159 |
doExecuteScript |
|
16941 | 7160 |
"execute a Smalltalk script" |
5880 | 7161 |
|
7162 |
|textHolder dialog template dummyClass dummyInstance| |
|
7163 |
||
7164 |
template := |
|
7165 |
'"/ Smalltalk script: |
|
7166 |
||
16084 | 7167 |
"/ the following variables are accessible: |
5880 | 7168 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
7169 |
"/ selectedFiles (= ...) |
|
7170 |
"/ |
|
7171 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
7172 |
"/ |
|
7173 |
"/ Useful operations are: |
|
7174 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
7175 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
7176 |
"/ directory directory |
|
7177 |
"/ |
|
7178 |
"/ example: move all files which match a aarticular pattern to |
|
7179 |
"/ a separate directory: |
|
7180 |
"/ |
|
7181 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
7182 |
"/ |
|
7183 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
7184 |
"/ |
|
7185 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
7186 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
7187 |
"/ idx := eachBaseNameString indexOf:$_. |
|
7188 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
7189 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
7190 |
"/ newDir := directory construct:prefix. |
|
7191 |
"/ newDir exists ifFalse:[ |
|
7192 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
7193 |
"/ newDir makeDirectory. |
|
7194 |
"/ ]. |
|
7195 |
"/ ]. |
|
7196 |
"/ newDir exists ifTrue:[ |
|
7197 |
"/ oldFile := directory construct:eachBaseNameString. |
|
7198 |
"/ newFile := newDir construct:rest. |
|
7199 |
"/ oldFile moveTo:newFile |
|
7200 |
"/ ] |
|
7201 |
"/ ] |
|
7202 |
"/ ] |
|
7203 |
'. |
|
7204 |
||
7205 |
LastScriptBlockString isNil ifTrue:[ |
|
7206 |
LastScriptBlockString := template. |
|
7207 |
]. |
|
7208 |
||
7209 |
textHolder := ValueHolder new. |
|
7210 |
dialog := Dialog |
|
7211 |
forRequestText:(resources string:'Enter script') |
|
7212 |
editViewClass:CodeView |
|
7213 |
lines:25 |
|
7214 |
columns:70 |
|
7215 |
initialAnswer:LastScriptBlockString |
|
7216 |
model:textHolder. |
|
7217 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
7218 |
dialog open. |
|
7219 |
dialog accepted ifFalse:[^ self]. |
|
7220 |
||
7221 |
LastScriptBlockString := textHolder value. |
|
7222 |
||
7223 |
Class classConventionViolationConfirmationQuerySignal |
|
7224 |
answer:true |
|
7225 |
do:[ |
|
7226 |
dummyClass := Object class |
|
7227 |
name:#Dummy |
|
7228 |
inEnvironment:nil |
|
7229 |
subclassOf:Object |
|
7230 |
instanceVariableNames:'directory selectedFiles' |
|
7231 |
variable:false |
|
7232 |
words:true |
|
7233 |
pointers:true |
|
7234 |
classVariableNames:'' |
|
7235 |
poolDictionaries:'' |
|
7236 |
category:#dummyCategory |
|
7237 |
comment:nil |
|
7238 |
changed:true. |
|
7239 |
]. |
|
7240 |
||
7241 |
dummyInstance := dummyClass basicNew. |
|
7242 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
7243 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
7244 |
||
7245 |
Compiler |
|
7246 |
evaluate:textHolder value |
|
7247 |
in:nil |
|
7248 |
receiver:dummyInstance |
|
7249 |
notifying:nil |
|
7250 |
logged:false |
|
7251 |
ifFail:[] |
|
7252 |
compile:true. |
|
7253 |
||
7254 |
"/ fileName := self firstSelectedFile. |
|
7255 |
"/ action := [:command | |
|
7256 |
"/ self addToCommandHistory:command for:fileName. |
|
7257 |
"/ self executeCommand:command. |
|
7258 |
"/ ]. |
|
7259 |
"/ self askForCommandFor:fileName thenDo:action |
|
7260 |
! |
|
7261 |
||
4230 | 7262 |
doMake |
7938 | 7263 |
|dir cmd| |
4230 | 7264 |
|
13856 | 7265 |
cmd := self makeCommandHolder value. |
7266 |
||
7267 |
"Make" |
|
7268 |
cmd = 'make' ifTrue:[ |
|
7269 |
dir := self theSingleSelectedDirectoryOrNil. |
|
7270 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
7271 |
dir notNil ifTrue:[ |
|
7272 |
(dir construct:'bmake.bat') exists ifTrue:[ |
|
7273 |
cmd := 'bmake.bat'. |
|
7274 |
] |
|
7938 | 7275 |
] |
13856 | 7276 |
]. |
7277 |
self executeCommand:cmd. |
|
7278 |
^self. |
|
7279 |
]. |
|
7280 |
||
7281 |
"Apache ant" |
|
7282 |
cmd = 'ant' ifTrue:[ |
|
7283 |
self executeCommand:cmd. |
|
7284 |
^self. |
|
7285 |
]. |
|
7286 |
||
7287 |
"Add more here..." |
|
7288 |
||
7289 |
"Modified (comment): / 13-04-2012 / 17:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4230 | 7290 |
! |
7291 |
||
8256 | 7292 |
doOpenCBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7293 |
"the CBrowser is an eXept-internal C-language IDE tool. |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7294 |
(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
|
7295 |
20 years ago ;-)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7296 |
|
8256 | 7297 |
|destDir| |
7298 |
||
18433 | 7299 |
((Smalltalk at:#'CBrowser') isNil or:[ (Smalltalk at:#'CBrowser::Browser') isNil ]) ifTrue:[ |
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7300 |
Smalltalk loadPackage:'exept:CC' |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7301 |
]. |
8256 | 7302 |
destDir := self currentDirectory. |
18433 | 7303 |
(Smalltalk at:#'CBrowser::Browser') openIn:destDir pathName |
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7304 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
7305 |
"Modified: / 04-10-2011 / 13:41:31 / cg" |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7306 |
"Modified (comment): / 27-07-2012 / 20:41:40 / cg" |
18433 | 7307 |
"Modified: / 26-09-2018 / 12:37:34 / Claus Gittinger" |
8256 | 7308 |
! |
7309 |
||
7829 | 7310 |
doOpenExplorer |
18433 | 7311 |
"corresponding menu item is visible on a windows machine only" |
7312 |
||
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7313 |
self currentDirectory asFilename openExplorer |
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7314 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7315 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
18433 | 7316 |
"Modified (comment): / 26-09-2018 / 12:38:08 / Claus Gittinger" |
7829 | 7317 |
! |
7318 |
||
12473 | 7319 |
doOpenFinder |
18433 | 7320 |
"corresponding menu item is visible on a mac only" |
7321 |
||
12473 | 7322 |
self currentDirectory asFilename openFinder |
7323 |
||
7324 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
|
18433 | 7325 |
"Modified (comment): / 26-09-2018 / 12:38:00 / Claus Gittinger" |
12473 | 7326 |
! |
7327 |
||
18432 | 7328 |
doOpenGDBApplication |
7329 |
"the GDBApplication is a cg-private debugging tool" |
|
7330 |
||
7331 |
|destDir| |
|
7332 |
||
7333 |
(Smalltalk at:#'GDBApplication') isNil ifTrue:[ |
|
7334 |
Smalltalk loadPackage:'cg:tools' |
|
7335 |
]. |
|
7336 |
destDir := self currentDirectory. |
|
7337 |
(Smalltalk at:#'GDBApplication') openOn:destDir |
|
7338 |
||
7339 |
"Created: / 26-09-2018 / 12:09:32 / Claus Gittinger" |
|
7340 |
! |
|
7341 |
||
12811 | 7342 |
doOpenMonticelloBrowser |
18433 | 7343 |
(Smalltalk at:#'MCMczReader') isNil ifTrue:[ |
7344 |
Smalltalk loadPackage:'stx:goodies/monticello'. |
|
7345 |
(Smalltalk at:#'MCMczReader') isNil ifTrue:[ |
|
7346 |
Dialog warn:'Failed to load the monticello package'. |
|
7347 |
^ self. |
|
7348 |
]. |
|
7349 |
]. |
|
12874
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
7350 |
|
12811 | 7351 |
self withWaitCursorDo:[ |
7352 |
self currentSelectedFiles do:[:fn | |
|
7353 |
|version snapshot| |
|
7354 |
||
18746 | 7355 |
(fn suffix sameAs:'mcz') ifTrue:[ |
18433 | 7356 |
version := (Smalltalk at:#'MCMczReader') versionFromFile:fn. |
12811 | 7357 |
snapshot := version snapshot. |
7358 |
(Tools::ChangeSetBrowser2 |
|
7359 |
on: snapshot asChangeSet |
|
7360 |
label: version info name) |
|
7361 |
beTwoColumn; |
|
7362 |
targetNamespace:nil; |
|
7363 |
targetPackage:nil; |
|
7364 |
open |
|
7365 |
] |
|
7366 |
] |
|
7367 |
] |
|
18433 | 7368 |
|
18746 | 7369 |
"Modified: / 01-05-2019 / 11:23:23 / Claus Gittinger" |
12811 | 7370 |
! |
7371 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7372 |
doOpenSettings |
8168 | 7373 |
self openSettingsDialog |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7374 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
7375 |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7376 |
doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7377 |
"open using win32-shell" |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7378 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7379 |
|fileName| |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7380 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7381 |
fileName := self firstSelectedFile. |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7382 |
fileName notNil ifTrue:[ |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7383 |
OperatingSystem |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7384 |
openApplicationForDocument:fileName pathName |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7385 |
operation:#open |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
7386 |
] |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7387 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
7388 |
"Modified: / 21-07-2012 / 12:26:10 / cg" |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7389 |
! |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
7390 |
|
7104 | 7391 |
editMode:aSymbol |
7392 |
self |
|
7393 |
applicationNamed:#FileApplicationNoteBook |
|
7394 |
ifPresentDo:[:appl | |
|
7395 |
|subApp| |
|
7396 |
||
7397 |
subApp := appl selectedApplication. |
|
7398 |
subApp notNil ifTrue:[ |
|
7399 |
^ subApp perform:aSymbol |
|
7400 |
] |
|
7401 |
]. |
|
7402 |
||
7403 |
"Created: / 11-09-2006 / 12:42:08 / cg" |
|
7404 |
! |
|
7405 |
||
7406 |
editModeInsert |
|
7407 |
self editMode:#editModeInsert |
|
7408 |
||
7409 |
"Created: / 11-09-2006 / 12:40:36 / cg" |
|
7410 |
! |
|
7411 |
||
7412 |
editModeInsertAndSelect |
|
7413 |
self editMode:#editModeInsertAndSelect |
|
7414 |
||
7415 |
"Created: / 11-09-2006 / 12:40:45 / cg" |
|
7416 |
! |
|
7417 |
||
7418 |
editModeOverwrite |
|
7419 |
self editMode:#editModeOverwrite |
|
7420 |
||
7421 |
"Modified: / 11-09-2006 / 12:42:26 / cg" |
|
7422 |
! |
|
7423 |
||
15528 | 7424 |
fetchFileByURL |
7425 |
|url destinationFilename| |
|
7426 |
||
17818 | 7427 |
url := Dialog request:(resources string:'URL to Fetch:') initialAnswer:'http://host/path'. |
15528 | 7428 |
url isEmptyOrNil ifTrue:[^ self]. |
7429 |
url := url asURL. |
|
7430 |
||
17818 | 7431 |
destinationFilename := Dialog request:(resources string:'Download As:') initialAnswer:(UnixFilename named:url path) baseName. |
15528 | 7432 |
destinationFilename isEmptyOrNil ifTrue:[^ self]. |
7433 |
||
7434 |
destinationFilename := self currentDirectory asFilename / destinationFilename. |
|
7435 |
destinationFilename exists ifTrue:[ |
|
7436 |
|answer| |
|
7437 |
||
7438 |
answer := Dialog |
|
7439 |
confirm:(resources string:'Overwrite existing %1 ?' with:destinationFilename baseName allBold) |
|
7440 |
default:false. |
|
7441 |
answer ~~ true ifTrue:[^ self]. |
|
7442 |
]. |
|
7443 |
self withActivityIndicationDo:[ |
|
7444 |
self notify:(resources string:'Fetching %1' with:url). |
|
7445 |
HTTPInterface get:url destinationFile:destinationFilename. |
|
7446 |
self notify:nil. |
|
7447 |
] |
|
7448 |
||
17818 | 7449 |
"Modified: / 29-11-2017 / 12:26:13 / cg" |
15528 | 7450 |
! |
7451 |
||
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7452 |
fileContentsAsByteArray |
17769 | 7453 |
|file fileSize| |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7454 |
|
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7455 |
file := self firstSelectedFile. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7456 |
file isNil ifTrue:[^ self ]. |
17769 | 7457 |
|
7458 |
file := file asFilename. |
|
7459 |
||
7460 |
(fileSize := file fileSize) > (1024*1024) ifTrue:[ |
|
7461 |
fileSize > (128*1024*1024) ifTrue:[ |
|
11889 | 7462 |
Dialog warn:(resources string:'File is too big'). |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7463 |
^ self. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7464 |
]. |
17769 | 7465 |
(Dialog confirm:(resources |
7466 |
string:'File is big (%1) - proceed?' |
|
7467 |
with:(UnitConverter fileSizeStringFor:fileSize)) |
|
7468 |
) ifFalse:[^ self]. |
|
7469 |
]. |
|
7470 |
file binaryContentsOfEntireFile inspect |
|
7471 |
||
7472 |
"Modified: / 19-11-2017 / 14:58:43 / cg" |
|
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7473 |
! |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
7474 |
|
3892 | 7475 |
fileFileIn |
7476 |
"fileIn the selected file(s)" |
|
7477 |
||
7478 |
self fileFileInLazy:false |
|
7479 |
! |
|
7480 |
||
7324 | 7481 |
fileFileIn:aFilename lazy:lazy |
7482 |
"fileIn a file" |
|
7483 |
||
7484 |
self withActivityIndicationDo:[ |
|
7485 |
self notify:('File in:', aFilename asFilename baseName). |
|
7486 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7487 |
self notify:nil. |
|
7488 |
] |
|
7489 |
||
7490 |
"Created: / 20-09-2006 / 14:28:35 / cg" |
|
7491 |
! |
|
7492 |
||
3892 | 7493 |
fileFileInLazy |
7494 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
7495 |
||
7496 |
self fileFileInLazy:true |
|
7497 |
! |
|
7498 |
||
7499 |
fileFileInLazy:lazy |
|
7500 |
"fileIn the selected file(s)" |
|
7501 |
||
7324 | 7502 |
self currentSelectedFiles do:[:fileName | |
7503 |
self fileIn:fileName lazy:lazy |
|
7504 |
]. |
|
7505 |
||
7506 |
"Modified: / 20-09-2006 / 14:29:24 / cg" |
|
3892 | 7507 |
! |
7508 |
||
12497 | 7509 |
fileFileInPackage |
7510 |
"assuming the current directory is a package directory, load it" |
|
7511 |
||
7512 |
|packageDir dir path top packageID| |
|
7513 |
||
7514 |
"/ find a reasonable package-id (walk up until we find stx) |
|
7515 |
path := ''. |
|
7516 |
dir := packageDir := self currentDirectory. |
|
7517 |
||
7518 |
top := (Smalltalk projectDirectoryForPackage:'stx') asFilename. |
|
7519 |
[ (dir / 'stx') = top ] whileFalse:[ |
|
7520 |
path := dir baseName , '/' , path. |
|
7521 |
dir := dir directory. |
|
7522 |
dir isNil ifTrue:[ |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7523 |
Dialog warn:'Could not find a path from "stx" to the current directory.'. |
12497 | 7524 |
"/ should ask the user for a packageID and proceed... |
7525 |
^ self. |
|
7526 |
]. |
|
7527 |
]. |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
7528 |
packageID := path copyButLast:1. |
12497 | 7529 |
Smalltalk loadPackage:packageID fromDirectory:packageDir asAutoloaded:true |
7530 |
! |
|
7531 |
||
3892 | 7532 |
fileFileInToNameSpace |
7533 |
"fileIn the selected file(s)<into a nameSpace" |
|
7534 |
||
7535 |
|ns listOfKnownNameSpaces| |
|
7536 |
||
7537 |
listOfKnownNameSpaces := Set new. |
|
7538 |
NameSpace |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
7539 |
allNameSpaces |
4414 | 7540 |
do:[:eachNameSpace | |
7541 |
listOfKnownNameSpaces add:eachNameSpace name |
|
7542 |
]. |
|
3892 | 7543 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
7544 |
||
7545 |
ns := Dialog |
|
4414 | 7546 |
request:'During fileIn, new classes are created in nameSpace:' |
7547 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
7548 |
list:listOfKnownNameSpaces. |
|
3892 | 7549 |
ns isEmptyOrNil ifTrue:[^ self]. |
7550 |
||
7551 |
LastEnforcedNameSpace := ns. |
|
7552 |
ns := NameSpace name:ns. |
|
7553 |
||
7554 |
Class nameSpaceQuerySignal |
|
4414 | 7555 |
answer:ns |
7556 |
do:[ |
|
7557 |
self fileFileInLazy:false |
|
7558 |
] |
|
3892 | 7559 |
! |
7560 |
||
7561 |
fileFindAllDuplicates |
|
7562 |
"scan directory and all subdirs for duplicate files" |
|
7563 |
||
7564 |
|fileNames dir infoDir filesBySize |
|
18856 | 7565 |
result info dirPrefix stream textBox maxLength directories| |
3892 | 7566 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7567 |
self withActivityIndicationDo:[ |
4414 | 7568 |
result := Dictionary new. |
7569 |
directories := self currentSelectedDirectories. |
|
7570 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 7571 |
|
4414 | 7572 |
dir := directories first. |
3892 | 7573 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7574 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7575 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7576 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 7577 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
7578 |
with:ex pathName |
|
7579 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7580 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
7581 |
]. |
4765 | 7582 |
fileNames := fileNames |
7583 |
collect:[:fn | dir construct:fn] |
|
18453 | 7584 |
thenSelect:[:fn | fn isRegularFile]. |
3892 | 7585 |
|
7586 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 7587 |
infoDir := Dictionary new. |
7588 |
fileNames do:[:fn | |
|
7589 |
infoDir at:fn put:(fn fileSize) |
|
7590 |
]. |
|
7591 |
||
14497 | 7592 |
"/ for each, get the file's size. |
4414 | 7593 |
"/ in a first pass, look for files of the same size and |
7594 |
"/ compare them ... |
|
3892 | 7595 |
|
7596 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 7597 |
filesBySize := Dictionary new. |
7598 |
infoDir keysAndValuesDo:[:fn :sz | |
|
7599 |
|entry| |
|
7600 |
||
7601 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7602 |
entry add:fn. |
|
7603 |
]. |
|
7604 |
||
7605 |
"/ any of same size ? |
|
3892 | 7606 |
|
7607 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 7608 |
filesBySize do:[:entry | |
7609 |
|files| |
|
7610 |
||
7611 |
entry size > 1 ifTrue:[ |
|
7612 |
files := entry asArray. |
|
7613 |
1 to:files size-1 do:[:idx1 | |
|
7614 |
idx1+1 to:files size do:[:idx2 | |
|
7615 |
|fn1 fn2| |
|
7616 |
||
7617 |
fn1 := files at:idx1. |
|
7618 |
fn2 := files at:idx2. |
|
3892 | 7619 |
|
7620 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 7621 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
7622 |
"/ compare the files |
|
7623 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7624 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 7625 |
result at:fn1 put:fn2. |
7626 |
] |
|
7627 |
] |
|
7628 |
] |
|
7629 |
] |
|
7630 |
] |
|
7631 |
]. |
|
3892 | 7632 |
|
7633 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 7634 |
dirPrefix := dir pathName. |
7635 |
result := result associations. |
|
7636 |
result := result collect:[:assoc | |
|
7637 |
|f1 f2| |
|
7638 |
||
7639 |
f1 := assoc key name. |
|
7640 |
f2 := assoc value name. |
|
7641 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
7642 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
7643 |
]. |
|
7644 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
7645 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
7646 |
]. |
|
7647 |
f1 < f2 ifTrue:[ |
|
7648 |
f2 -> f1 |
|
7649 |
] ifFalse:[ |
|
7650 |
f1 -> f2 |
|
7651 |
] |
|
7652 |
]. |
|
7653 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
7654 |
||
7655 |
info := OrderedCollection new. |
|
7656 |
result do:[:assoc | |
|
7657 |
info add:(assoc key , ' same as ' , assoc value) |
|
7658 |
]. |
|
7659 |
info isEmpty ifTrue:[ |
|
11889 | 7660 |
Dialog information:(resources string:'No duplicate files found.'). |
5543 | 7661 |
^ self. |
4414 | 7662 |
]. |
3892 | 7663 |
]. |
7664 |
||
15589 | 7665 |
stream := CharacterWriteStream new. |
11688 | 7666 |
stream nextPutAllLines:info. |
5542 | 7667 |
|
3892 | 7668 |
textBox := TextBox new. |
7669 |
textBox initialText:(stream contents). |
|
5542 | 7670 |
stream close. |
11889 | 7671 |
textBox title:(resources string:'File duplicates in directory: %1' with:dir asString). |
3892 | 7672 |
textBox readOnly:true. |
7673 |
textBox noCancel. |
|
11889 | 7674 |
textBox label:(resources string:'Duplicates in %1' with:dir asString). |
3892 | 7675 |
maxLength := 10. |
7676 |
info do:[: el | |
|
4414 | 7677 |
maxLength := maxLength max:(el size). |
3892 | 7678 |
]. |
7679 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 7680 |
textBox maxExtent:Screen current extent. |
7681 |
textBox openModeless. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7682 |
|
11688 | 7683 |
"Modified: / 27-07-2012 / 09:29:00 / cg" |
18856 | 7684 |
"Modified (format): / 28-06-2019 / 08:37:14 / Claus Gittinger" |
3892 | 7685 |
! |
7686 |
||
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7687 |
fileFindDuplicateFile |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7688 |
"scan directory for duplicates of the selected files" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7689 |
|
10306 | 7690 |
|files filesBySize samePerFile stream textBox mustHaveMatches| |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7691 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7692 |
files := self currentSelectedFiles. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7693 |
files isEmpty ifTrue:[^ self]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7694 |
|
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7695 |
self withWaitCursorDo:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7696 |
filesBySize := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7697 |
files do:[:fn | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7698 |
|sz entry| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7699 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7700 |
sz := fn asFilename fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7701 |
(filesBySize at:sz ifAbsentPut:[Set new]) add:fn. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7702 |
]. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7703 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7704 |
samePerFile := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7705 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7706 |
self currentSelectedDirectories do:[:eachDir | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7707 |
eachDir recursiveDirectoryContentsAsFilenamesDo:[:eachFile | |
18453 | 7708 |
eachFile isRegularFile ifTrue:[ |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7709 |
|sz possibleMatches| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7710 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7711 |
sz := eachFile fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7712 |
possibleMatches := filesBySize at:sz ifAbsent:nil. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7713 |
possibleMatches notNil ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7714 |
possibleMatches do:[:eachFileWithSameSize | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7715 |
eachFileWithSameSize ~= eachFile ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7716 |
(eachFileWithSameSize sameContentsAs:eachFile) ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7717 |
(samePerFile at:eachFileWithSameSize ifAbsentPut:[Set new]) add:eachFile |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7718 |
] |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7719 |
] |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7720 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7721 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7722 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7723 |
] |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7724 |
]. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7725 |
]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7726 |
|
15589 | 7727 |
stream := CharacterWriteStream with:'Duplicates:'. |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7728 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7729 |
do:[:origFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7730 |
|sameFiles| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7731 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7732 |
sameFiles := samePerFile at:origFile. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7733 |
stream nextPutLine:origFile baseName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7734 |
(sameFiles asOrderedCollection collect:[:each | each baseName]) sort do:[:eachSameName | |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7735 |
stream nextPutAll:' '; nextPutLine:eachSameName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7736 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7737 |
]. |
10306 | 7738 |
stream nextPutLine:'Files without duplicates:'. |
7739 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7740 |
do:[:origFile | |
|
7741 |
|sameFiles| |
|
7742 |
||
7743 |
sameFiles := samePerFile at:origFile. |
|
7744 |
sameFiles isEmpty ifTrue:[ |
|
7745 |
stream nextPutLine:origFile baseName. |
|
7746 |
]. |
|
7747 |
]. |
|
7748 |
||
7749 |
mustHaveMatches := Dialog request:'Must have for duplicates matching ?:' initialAnswer:(LastMustMatchPattern ? '[a-z][a-z][a-z]_[0-9][0-9][0-9].*'). |
|
7750 |
mustHaveMatches notEmptyOrNil ifTrue:[ |
|
7751 |
LastMustMatchPattern := mustHaveMatches. |
|
7752 |
||
7753 |
stream nextPutLine:'Files without duplicates in xxx_nnn.jpg:'. |
|
7754 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7755 |
do:[:origFile | |
|
7756 |
|sameFiles| |
|
7757 |
||
7758 |
sameFiles := samePerFile at:origFile. |
|
7759 |
sameFiles notEmpty ifTrue:[ |
|
7760 |
(sameFiles contains:[:file | mustHaveMatches match:file baseName]) ifFalse:[ |
|
7761 |
stream nextPutLine:origFile baseName. |
|
7762 |
] |
|
7763 |
]. |
|
7764 |
]. |
|
7765 |
]. |
|
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7766 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7767 |
textBox := TextBox new. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7768 |
textBox initialText:(stream contents). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7769 |
textBox title:'Files with same contents'. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7770 |
textBox readOnly:true. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7771 |
textBox noCancel. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7772 |
textBox extent:(350@400). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7773 |
textBox maxExtent:Screen current extent. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7774 |
textBox openModeless. "/ showAtPointer. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7775 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7776 |
"Created: / 11-07-2011 / 12:39:44 / cg" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7777 |
! |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7778 |
|
3892 | 7779 |
fileFindDuplicates |
7780 |
"scan directory for duplicate files" |
|
7781 |
||
17869 | 7782 |
|directories duplicates info |
7783 |
commonDir prefixSize stream titleStream textBox maxLength| |
|
8510 | 7784 |
|
7785 |
directories := self currentSelectedDirectories. |
|
17869 | 7786 |
duplicates := self class fileFindDuplicatesIn:directories. |
7787 |
duplicates isEmpty ifTrue:[ |
|
17868 | 7788 |
Dialog information:'No duplicate files found.'. |
7789 |
^ self. |
|
7790 |
]. |
|
7791 |
||
7792 |
info := OrderedCollection new. |
|
17869 | 7793 |
commonDir := self getBestDirectory. |
7794 |
prefixSize := commonDir asString size. |
|
7795 |
duplicates do:[:assoc | |
|
17871 | 7796 |
|dup orig| |
7797 |
||
7798 |
dup := assoc key. |
|
7799 |
orig := assoc value. |
|
17868 | 7800 |
prefixSize > 1 ifTrue:[ |
17871 | 7801 |
dup := dup pathNameRelativeFrom:commonDir. |
7802 |
orig := orig pathNameRelativeFrom:commonDir. |
|
17869 | 7803 |
"/ fn1 := ('..', (fn1 name copyFrom:(prefixSize + 1))). |
7804 |
"/ fn2 := ('..', (fn2 copyFrom:(prefixSize + 1))). |
|
17868 | 7805 |
]. |
17871 | 7806 |
(dup includes:Character space) ifTrue:[ |
7807 |
dup := '"' , dup , '"' |
|
7808 |
]. |
|
7809 |
(orig includes:Character space) ifTrue:[ |
|
7810 |
orig := '"' , orig , '"' |
|
7811 |
]. |
|
7812 |
info add:(dup , ' duplicate of ' , orig) |
|
17868 | 7813 |
]. |
7814 |
||
15589 | 7815 |
stream := CharacterWriteStream new. |
11688 | 7816 |
stream nextPutAllLines:info. |
7817 |
||
17869 | 7818 |
titleStream := CharacterWriteStream with:'File duplicates in director'. |
3892 | 7819 |
directories size == 1 ifTrue:[ |
12602 | 7820 |
titleStream nextPutAll:'y: '; nextPutAll: directories first asString. |
3892 | 7821 |
] ifFalse:[ |
4535 | 7822 |
titleStream nextPutLine:'ies: '. |
4355 | 7823 |
directories do:[:dir| |
17868 | 7824 |
prefixSize > 1 ifTrue:[ |
4355 | 7825 |
titleStream nextPutAll:'..'. |
17868 | 7826 |
titleStream nextPutLine:((dir asString) copyFrom:(prefixSize + 1)). |
4355 | 7827 |
] ifFalse:[ |
4535 | 7828 |
titleStream nextPutLine:(dir asString). |
4355 | 7829 |
]. |
7830 |
] |
|
3892 | 7831 |
]. |
5543 | 7832 |
|
3892 | 7833 |
textBox := TextBox new. |
7834 |
textBox initialText:(stream contents). |
|
7835 |
textBox title:(titleStream contents). |
|
7836 |
textBox readOnly:true. |
|
7837 |
textBox noCancel. |
|
14715 | 7838 |
stream := WriteStream on:''. |
7839 |
stream nextPutAll:'Duplicates in '. |
|
4170 | 7840 |
directories do:[ :aDirectory | |
4355 | 7841 |
stream nextPutAll:aDirectory baseName. |
7842 |
stream space. |
|
4050 | 7843 |
]. |
4170 | 7844 |
textBox label:stream contents. |
3892 | 7845 |
maxLength := 10. |
7846 |
info do:[: el | |
|
4355 | 7847 |
maxLength := maxLength max:(el size). |
3892 | 7848 |
]. |
5092 | 7849 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
7850 |
textBox maxExtent:Screen current extent. |
|
17869 | 7851 |
textBox addButton:(Button |
7852 |
label:(resources string:'Remove Duplicates') |
|
7853 |
action:[ |
|
7854 |
(Dialog confirm:(resources string:'Remove %1 duplicate files?' with:duplicates size)) ifTrue:[ |
|
7855 |
duplicates do:[:eachAssoc | |
|
17871 | 7856 |
eachAssoc key remove |
17869 | 7857 |
]. |
17871 | 7858 |
]. |
7859 |
textBox close. |
|
7860 |
self updateCurrentDirectoryWithReread. |
|
17869 | 7861 |
]). |
4355 | 7862 |
textBox openModeless. "/ showAtPointer. |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7863 |
|
11688 | 7864 |
"Modified: / 27-07-2012 / 09:29:14 / cg" |
3892 | 7865 |
! |
7866 |
||
7867 |
fileFindFile |
|
5961 | 7868 |
|filename| |
7869 |
||
7870 |
filename := self firstSelectedFileName. |
|
7871 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7872 |
filename := Filename homeDirectory. |
3892 | 7873 |
]. |
4101 | 7874 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 7875 |
! |
7876 |
||
8510 | 7877 |
fileFindSimilarImages |
7878 |
"scan directory for similar image files" |
|
7879 |
||
8512 | 7880 |
|result stream textBox directories imageFiles histogramsV histogramsH |
7881 |
similarV similarH similar alreadyPrinted| |
|
8510 | 7882 |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7883 |
self withWaitCursorDo:[ |
8510 | 7884 |
self withActivityIndicationDo:[ |
7885 |
result := Dictionary new. |
|
7886 |
||
7887 |
directories := self currentSelectedDirectories. |
|
7888 |
directories isEmpty ifTrue:[^ self]. |
|
7889 |
||
13714 | 7890 |
imageFiles := self allFilesInSelectedDirectoriesForWhich:[:f | f mimeTypeFromName isImageType]. |
8511 | 7891 |
"/ imageFiles := imageFiles select:[:f | f baseName startsWith:'foo']. |
7892 |
imageFiles sort:[:a :b | a pathName < b pathName]. |
|
7893 |
||
8510 | 7894 |
"/ for each, get the color histogram |
7895 |
histogramsV := Dictionary new. |
|
7896 |
histogramsH := Dictionary new. |
|
7897 |
imageFiles do:[:fn | |
|
7898 |
|hist image| |
|
7899 |
||
7900 |
image := Image fromFile:fn. |
|
7901 |
Transcript showCR:'generating histogram for ',fn baseName. |
|
7902 |
hist := ImageColorHistogram new forImage:image. |
|
7903 |
histogramsV at:fn put:(hist histogramVectorV). |
|
7904 |
histogramsH at:fn put:(hist histogramVectorH). |
|
7905 |
]. |
|
7906 |
||
7907 |
similarH := Dictionary new. |
|
7908 |
similarV := Dictionary new. |
|
7909 |
similar := Dictionary new. |
|
7910 |
||
8512 | 7911 |
(self firstSelectedFile notNil |
7912 |
ifTrue:[ Array with:self firstSelectedFile ] |
|
7913 |
ifFalse:[ imageFiles ]) |
|
7914 |
do:[:eachFile1 | |
|
8510 | 7915 |
|setOfSimilar distancesV distancesH| |
7916 |
||
7917 |
distancesV := OrderedCollection new. |
|
7918 |
distancesH := OrderedCollection new. |
|
7919 |
setOfSimilar := OrderedCollection new. |
|
7920 |
||
7921 |
imageFiles do:[:eachFile2 | |
|
7922 |
|v1 v2 dV dH| |
|
7923 |
||
7924 |
eachFile1 ~= eachFile2 ifTrue:[ |
|
7925 |
v1 := histogramsV at:eachFile1. |
|
7926 |
v2 := histogramsV at:eachFile2. |
|
7927 |
dV := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7928 |
distancesV add:(eachFile2 -> dV). |
|
7929 |
v1 := histogramsH at:eachFile1. |
|
7930 |
v2 := histogramsH at:eachFile2. |
|
7931 |
dH := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7932 |
distancesH add:(eachFile2 -> dH). |
|
7933 |
(dV < 10000 and:[dH < 10000]) ifTrue:[ |
|
8512 | 7934 |
setOfSimilar add:eachFile2->(dV + dH). |
8510 | 7935 |
]. |
7936 |
] |
|
7937 |
]. |
|
7938 |
distancesV sort:[:a1 :a2 | a1 value < a2 value]. |
|
7939 |
distancesH sort:[:a1 :a2 | a1 value < a2 value]. |
|
7940 |
similarV at:eachFile1 put:distancesV. |
|
7941 |
similarH at:eachFile1 put:distancesH. |
|
7942 |
setOfSimilar notEmpty ifTrue:[ similar at:eachFile1 put:setOfSimilar ]. |
|
7943 |
]. |
|
7944 |
||
7945 |
similar isEmpty ifTrue:[ |
|
7946 |
Dialog information:'No similarities found.'. |
|
7947 |
^ self. |
|
7948 |
]. |
|
7949 |
]. |
|
7950 |
||
15589 | 7951 |
stream := CharacterWriteStream new. |
8512 | 7952 |
alreadyPrinted := Set new. |
7953 |
||
7954 |
imageFiles do:[:eachFile | |
|
7955 |
|eachSet| |
|
7956 |
||
7957 |
(alreadyPrinted includes:eachFile) ifFalse:[ |
|
7958 |
eachSet := similar at:eachFile ifAbsent:nil. |
|
7959 |
eachSet notNil ifTrue:[ |
|
7960 |
stream nextPutLine:eachFile pathName. |
|
7961 |
eachSet do:[:info | |
|
7962 |
|fn2 dist| |
|
7963 |
||
7964 |
fn2 := info key. |
|
7965 |
dist := info value. |
|
7966 |
stream nextPutAll:' '. |
|
7967 |
stream nextPutAll:fn2 pathName. |
|
7968 |
stream nextPutLine:' (',dist printString,')'. |
|
7969 |
alreadyPrinted add:fn2. |
|
7970 |
]. |
|
7971 |
stream cr. |
|
7972 |
]. |
|
8510 | 7973 |
]. |
7974 |
]. |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7975 |
]. |
8510 | 7976 |
|
7977 |
textBox := TextBox new. |
|
7978 |
textBox initialText:(stream contents). |
|
7979 |
textBox title:'File similarities:'. |
|
7980 |
textBox readOnly:true. |
|
7981 |
textBox noCancel. |
|
7982 |
||
7983 |
textBox label:'File similarities'. |
|
7984 |
textBox extent:(400@((similar size max:40)* 10)). |
|
7985 |
textBox maxExtent:Screen current extent. |
|
7986 |
textBox openModeless. "/ showAtPointer. |
|
7987 |
||
7988 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
|
7989 |
! |
|
7990 |
||
4618 | 7991 |
fileHexDump |
17744 | 7992 |
|file item| |
4618 | 7993 |
|
7994 |
file := self firstSelectedFile. |
|
7995 |
file notNil ifTrue:[ |
|
7996 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 7997 |
self |
7998 |
applicationNamed:#FileApplicationNoteBook |
|
7999 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 8000 |
]. |
17744 | 8001 |
|
8002 |
"Modified (format): / 12-11-2017 / 11:19:56 / cg" |
|
4618 | 8003 |
! |
8004 |
||
7324 | 8005 |
fileIn:aFilename |
8006 |
"fileIn a file" |
|
8007 |
||
8008 |
self fileIn:aFilename lazy:false |
|
8009 |
||
8010 |
"Created: / 20-09-2006 / 14:30:06 / cg" |
|
8011 |
! |
|
8012 |
||
8013 |
fileIn:aFilename lazy:lazy |
|
8014 |
"fileIn a file" |
|
8015 |
||
8016 |
self withActivityIndicationDo:[ |
|
8017 |
self notify:('File in:', aFilename asFilename baseName). |
|
8018 |
self singleFileFileIn:aFilename lazy:lazy. |
|
8019 |
self notify:nil. |
|
8020 |
] |
|
8021 |
||
8022 |
"Created: / 20-09-2006 / 14:29:21 / cg" |
|
8023 |
! |
|
8024 |
||
4930 | 8025 |
filterSelectedFiles:whichFilter |
8026 |
|selectedFiles numFiles msg filterBlock| |
|
8027 |
||
7560 | 8028 |
selectedFiles := self currentSelectedObjects. |
4930 | 8029 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
8030 |
||
8031 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
8032 |
numFiles > 1 ifTrue:[ |
|
8033 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
8034 |
]. |
|
8035 |
||
8036 |
(Dialog |
|
6352 | 8037 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 8038 |
initialAnswer:false |
8039 |
) ifFalse:[ |
|
8040 |
^ self |
|
8041 |
]. |
|
8042 |
||
8043 |
whichFilter == #rot13 ifTrue:[ |
|
8044 |
filterBlock := [:charIn | charIn rot13 ]. |
|
8045 |
]. |
|
8046 |
"/ add more here... |
|
8047 |
||
8048 |
filterBlock isNil ifTrue:[ |
|
8049 |
self information:'No such filter: ' , whichFilter. |
|
8050 |
^ self. |
|
8051 |
]. |
|
8052 |
||
8053 |
selectedFiles do:[:fileName | |
|
8054 |
|s| |
|
8055 |
||
8056 |
self notify:('Processing:', fileName baseName). |
|
18453 | 8057 |
fileName isRegularFile ifTrue:[ |
4930 | 8058 |
[ |
8059 |
|inFile outFile in out| |
|
8060 |
||
8061 |
inFile := fileName asFilename. |
|
8062 |
outFile := (fileName pathName , '.filter') asFilename. |
|
8063 |
||
8064 |
[ |
|
8065 |
|charIn charOut| |
|
8066 |
||
8067 |
in := inFile readStream. |
|
8068 |
out := outFile writeStream. |
|
8069 |
[in atEnd] whileFalse:[ |
|
8070 |
charIn := in next. |
|
8071 |
charOut := filterBlock value:charIn. |
|
8072 |
out nextPut:charOut. |
|
8073 |
]. |
|
13683 | 8074 |
out close. out:= nil. |
4930 | 8075 |
outFile renameTo:inFile. |
8076 |
] ensure:[ |
|
8077 |
out notNil ifTrue:[ out close ]. |
|
8078 |
in notNil ifTrue:[ in close ]. |
|
18024 | 8079 |
outFile remove. |
4930 | 8080 |
] |
8081 |
] on:FileStream openErrorSignal do:[:ex| |
|
8082 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
8083 |
]. |
|
8084 |
] |
|
8085 |
]. |
|
6190 | 8086 |
self notify:nil. |
7560 | 8087 |
|
8088 |
"Modified: / 04-12-2006 / 13:14:48 / cg" |
|
4930 | 8089 |
! |
8090 |
||
9784 | 8091 |
forEachParsedXmlFileDo:aBlock |
8092 |
"parse all selected XML files, for each dom-tree, evaluate aBlock" |
|
8093 |
||
8094 |
self withActivityIndicationDo:[ |
|
8095 |
| selectedFiles xmlDocument | |
|
8096 |
||
8097 |
selectedFiles:= self currentSelectedFiles. |
|
8098 |
selectedFiles do:[:fileName | |
|
8099 |
XML::XMLSignal handle:[:ex | |
|
14551 | 8100 |
Dialog |
8101 |
information:('Error while reading XML:\ %1' bindWith:ex description) withCRs |
|
8102 |
title:'XML Error'. |
|
9784 | 8103 |
^ self. |
8104 |
] do:[ |
|
8105 |
|s d magic encoder document| |
|
8106 |
||
8107 |
s := fileName asFilename readStream. |
|
14012 | 8108 |
[ |
8109 |
s binary. |
|
8110 |
magic := (s next:2). |
|
8111 |
magic = #[254 255] ifTrue:[ |
|
8112 |
"/ UTF16BE |
|
8113 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16be. |
|
8114 |
] ifFalse:[ |
|
8115 |
magic = #[255 254] ifTrue:[ |
|
8116 |
"/ UTF16LE |
|
8117 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16le. |
|
8118 |
]. |
|
8119 |
]. |
|
8120 |
] ensure:[ |
|
8121 |
s close. |
|
8122 |
]. |
|
9784 | 8123 |
document notNil ifTrue:[ |
8124 |
xmlDocument := XML::XMLParser |
|
8125 |
processDocumentString:document |
|
8126 |
beforeScanDo:[:parse| parse validate:false]. |
|
8127 |
] ifFalse:[ |
|
8128 |
xmlDocument := XML::XMLParser |
|
8129 |
processDocumentInFilename:fileName |
|
8130 |
beforeScanDo:[:parse| parse validate:false]. |
|
8131 |
] |
|
8132 |
]. |
|
8133 |
aBlock value:xmlDocument. |
|
8134 |
]. |
|
8135 |
] |
|
8136 |
||
8137 |
"Created: / 17-02-2011 / 13:58:21 / cg" |
|
8138 |
! |
|
8139 |
||
8832 | 8140 |
forEachSelectedFileIgnoringDirectories:ignoreDirs do:aBlock |
8141 |
|numItems path files| |
|
8142 |
||
18834 | 8143 |
files := ignoreDirs |
8144 |
ifTrue:[self currentSelectedFiles] |
|
8145 |
ifFalse:[self currentSelectedObjects]. |
|
8832 | 8146 |
|
8147 |
(numItems := files size) > 2 ifTrue:[ |
|
8148 |
(self |
|
8149 |
confirm:(resources string:'Open for each of the %1 items ?' |
|
8150 |
with:numItems)) ifFalse:[^ self]. |
|
8151 |
]. |
|
8152 |
||
8153 |
self withActivityIndicationDo:[ |
|
8154 |
files do:[:fileName | |
|
8155 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
8156 |
fileName isAbsolute ifTrue:[ |
|
17239 | 8157 |
path := fileName name. |
8832 | 8158 |
] ifFalse:[ |
8159 |
path := fileName pathName. |
|
8160 |
]. |
|
8161 |
aBlock value:path |
|
8162 |
] |
|
8163 |
]. |
|
8164 |
]. |
|
17239 | 8165 |
|
8166 |
"Modified: / 19-01-2017 / 16:57:03 / stefan" |
|
18834 | 8167 |
"Modified: / 23-06-2019 / 13:19:05 / Claus Gittinger" |
8832 | 8168 |
! |
8169 |
||
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8170 |
generateDetachedSignaturesForSelectedFiles |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8171 |
"generate detached signature (pkcs7) files from the contents of the selected files. |
16941 | 8172 |
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
|
8173 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8174 |
self withActivityIndicationDo:[ |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8175 |
self currentSelectedFiles do:[:fn | |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8176 |
|data hash signature signatureFile| |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8177 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8178 |
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
|
8179 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8180 |
data := fn contentsAsString. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8181 |
hash := SHA1Stream hashValueOf:data. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8182 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8183 |
signature := Expecco::KeyFileGenerator new signExpeccoCode:hash. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8184 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8185 |
signatureFile := fn addSuffix:'sig'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8186 |
signatureFile contents:signature. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8187 |
]. |
13677 | 8188 |
self updateCurrentDirectoryWithReread. |
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8189 |
self notify:nil. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8190 |
] |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8191 |
! |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
8192 |
|
15211 | 8193 |
generatePatchInstallerForSelectedFiles |
8194 |
"generate an expecco patch, which installs the selected file(s). |
|
8195 |
Opens a dialog asking for the target directory and if the patch should be signed" |
|
8196 |
||
8197 |
|dialog targetDirHolder targetDir |
|
8198 |
generateSignedPatchHolder patchFileNameHolder patchFileName| |
|
8199 |
||
8200 |
targetDirHolder := '.' asValue. |
|
8201 |
generateSignedPatchHolder := true asValue. |
|
8202 |
patchFileNameHolder := '/tmp/00nn_patchFile.st' asValue. |
|
8203 |
||
8204 |
dialog := Dialog new. |
|
8205 |
dialog label:(resources string:'Patch Installer for File(s)'). |
|
8206 |
dialog addTextLabel:'Patchfile Name' adjust:#left. |
|
8207 |
dialog addInputFieldOn:patchFileNameHolder tabable:true. |
|
8208 |
dialog addTextLabel:'Target directory (relative to executable''s directory at execution time)' adjust:#left. |
|
8209 |
dialog addInputFieldOn:targetDirHolder tabable:true. |
|
8210 |
dialog addCheckBox:'Generate Signed Patch' on:generateSignedPatchHolder. |
|
8211 |
dialog addAbortAndOkButtons. |
|
8212 |
dialog open. |
|
8213 |
||
8214 |
dialog accepted ifFalse:[^ self]. |
|
8215 |
||
8216 |
targetDir := targetDirHolder value asFilename. |
|
8217 |
patchFileName := patchFileNameHolder value asFilename. |
|
8218 |
||
8219 |
self withActivityIndicationDo:[ |
|
8220 |
|outStream zipArchive pkcs7SignedData signatureFilename| |
|
8221 |
||
8222 |
self notify:'Generating self extracting st script: ', patchFileName name, '...'. |
|
8223 |
outStream := patchFileName writeStream. |
|
8224 |
outStream nextPutAll:' |
|
8225 |
|patchStream zipArchive| |
|
8226 |
patchStream := Expecco::Browser::CurrentPatchStreamQuery query. |
|
8227 |
patchStream isNil ifTrue:[ self error:''sorry, this patch can only be installed in expecco 2.6.2 and newer (missing CurrentPatchStreamQuery)'']. |
|
8228 |
zipArchive := ZipArchive readingFrom:patchStream. |
|
8229 |
zipArchive members do:[:each | zipArchive extract:each fileName]. |
|
8230 |
patchStream setToEnd. "/ to force fileIn to finish |
|
8231 |
!! |
|
8232 |
||
8233 |
!! !! |
|
8234 |
||
8235 |
'. |
|
8236 |
zipArchive := ZipArchive writingTo:outStream. "/ newFileNamed:(patchFileName). |
|
8237 |
||
8238 |
self currentSelectedFiles do:[:fn | |
|
8239 |
|inStream signatureFilename| |
|
8240 |
||
8241 |
inStream := fn asFilename readStream. |
|
8242 |
zipArchive addFile: (targetDir construct:fn asFilename baseName) name fromStream:inStream. |
|
8243 |
inStream close. |
|
8244 |
]. |
|
8245 |
||
16975 | 8246 |
zipArchive close. |
15211 | 8247 |
|
8248 |
generateSignedPatchHolder value ifTrue:[ |
|
8249 |
self notify:'Generating signed file from: ', patchFileName name, '...'. |
|
8250 |
||
8251 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:patchFileName contentsOfEntireFile. |
|
8252 |
signatureFilename := patchFileName withSuffix:'expeccoPatch'. |
|
8253 |
signatureFilename contents:pkcs7SignedData. |
|
8254 |
]. |
|
8255 |
self notify:nil. |
|
8256 |
] |
|
8257 |
! |
|
13783 | 8258 |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8259 |
generateSignaturesForSelectedFiles |
13783 | 8260 |
"generate signed pkcs7 files from the contents of the selected files. |
8261 |
These can be delivered as expeccoPatch files" |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8262 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8263 |
self withActivityIndicationDo:[ |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8264 |
self currentSelectedFiles do:[:fn | |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8265 |
|pkcs7SignedData signatureFilename| |
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8266 |
|
8646 | 8267 |
self notify:'Generating signed file from: ', (fn baseName), '...'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8268 |
|
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8269 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:fn contentsOfEntireFile. |
12094 | 8270 |
signatureFilename := fn withSuffix:'expeccoPatch'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8271 |
signatureFilename contents:pkcs7SignedData. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8272 |
]. |
13677 | 8273 |
self updateCurrentDirectoryWithReread. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8274 |
self notify:nil. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8275 |
] |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8276 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8277 |
|
9784 | 8278 |
inspectXmlFile |
8279 |
"Show an XML file - either in an XMLInspector or fall back to |
|
8280 |
a plain inspector on the XML tree" |
|
8281 |
||
8282 |
self forEachParsedXmlFileDo:[:xmlDocument | |
|
8283 |
XML::XMLInspector notNil ifTrue:[ |
|
8284 |
XML::XMLInspector openOn:xmlDocument. |
|
8285 |
] ifFalse:[ |
|
8286 |
"fall back..." |
|
8287 |
xmlDocument inspect. |
|
8288 |
] |
|
8289 |
]. |
|
8290 |
||
8291 |
"Modified: / 17-02-2011 / 13:58:16 / cg" |
|
8292 |
! |
|
8293 |
||
3892 | 8294 |
installAllAsAutoloaded |
8295 |
"install all classes found here as autoloaded classes" |
|
8296 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8297 |
self installAllAsAutoloadedRecursive:false |
3892 | 8298 |
! |
8299 |
||
6521 | 8300 |
installAllAsAutoloadedRecursive |
8301 |
"install all classes found here and in subdirectories as autoloaded classes" |
|
8302 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8303 |
self installAllAsAutoloadedRecursive:true |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8304 |
! |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8305 |
|
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8306 |
installAllAsAutoloadedRecursive:aBoolean |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8307 |
"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
|
8308 |
|
6521 | 8309 |
[ |
15507 | 8310 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
8311 |
|installAction| |
|
8312 |
||
8313 |
installAction := |
|
8314 |
[:fn | |
|
8315 |
(fn suffix = 'st') ifTrue:[ |
|
8316 |
self notify:('Install as autoloaded: ', fn baseName). |
|
8317 |
self installAsAutoloaded:fn. |
|
8318 |
] |
|
8319 |
]. |
|
8320 |
||
8321 |
self withActivityIndicationDo:[ |
|
8322 |
self currentSelectedDirectories do:[:dir| |
|
8323 |
aBoolean ifTrue:[ |
|
8324 |
dir recursiveDirectoryContentsAsFilenamesDo:installAction |
|
8325 |
] ifFalse:[ |
|
8326 |
dir directoryContentsAsFilenamesDo:installAction |
|
15152 | 8327 |
]. |
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
8328 |
]. |
15507 | 8329 |
self notify:nil. |
8330 |
]. |
|
8331 |
] |
|
6521 | 8332 |
] fork. |
8333 |
! |
|
8334 |
||
3892 | 8335 |
installAsAutoloaded:aFilename |
8336 |
"install aFilename as autoloaded class" |
|
8337 |
||
13292 | 8338 |
Smalltalk installAutoloadedClassFromSourceFile:aFilename |
8339 |
||
8340 |
"Modified: / 01-08-2013 / 16:58:09 / cg" |
|
3892 | 8341 |
! |
8342 |
||
15211 | 8343 |
joinSelectedFiles |
8344 |
|selectedFiles numFiles msg outFileName outFile outStream| |
|
8345 |
||
8346 |
selectedFiles := self currentSelectedObjects. |
|
8347 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
8348 |
||
8349 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
8350 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
8351 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
|
8352 |
outFile := selectedFiles first directory construct:outFileName. |
|
8353 |
||
8354 |
outStream := outFile writeStream. |
|
8355 |
||
8356 |
selectedFiles do:[:fileName | |
|
8357 |
self notify:('Adding:', fileName baseName). |
|
17997 | 8358 |
fileName readingFileDo:[:inStream | |
8359 |
inStream copyToEndInto:outStream. |
|
8360 |
]. |
|
15211 | 8361 |
]. |
8362 |
outStream close. |
|
8363 |
self notify:nil. |
|
8364 |
||
8365 |
"Modified: / 04-12-2006 / 13:15:10 / cg" |
|
8366 |
! |
|
4558 | 8367 |
|
6292 | 8368 |
loadImageThenDo:aBlock |
3892 | 8369 |
|img path files| |
8370 |
||
3982 | 8371 |
files := self currentSelectedFiles. |
3892 | 8372 |
files isEmpty ifTrue:[ ^ self]. |
8373 |
files do:[:fileName | |
|
4414 | 8374 |
path := fileName. |
18453 | 8375 |
path isRegularFile ifTrue:[ |
4414 | 8376 |
img := Image fromFile:(path pathName). |
8377 |
img notNil ifTrue:[ |
|
6292 | 8378 |
aBlock value:img |
4414 | 8379 |
] ifFalse:[ |
15346 | 8380 |
Dialog warn:(resources string:'Unknown image format: "%1"' with:fileName asString) |
4414 | 8381 |
] |
8382 |
] |
|
3892 | 8383 |
]. |
8384 |
! |
|
8385 |
||
13089 | 8386 |
loadSignatureSupport |
8387 |
Expecco::KeyFileGenerator isNil ifTrue:[ |
|
14047 | 8388 |
Smalltalk loadPackage:'exept:expecco/license' |
13089 | 8389 |
]. |
8390 |
! |
|
8391 |
||
3892 | 8392 |
openASN1Browser |
8393 |
||
8394 |
self openTool:OSI::ASN1Browser |
|
8395 |
! |
|
8396 |
||
8397 |
openAppletViewer |
|
8398 |
|numItems files| |
|
8399 |
||
3982 | 8400 |
files := self currentSelectedFiles. |
3892 | 8401 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 8402 |
(self |
8403 |
confirm:(resources string:'open for each of the %1 items ?' |
|
8404 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 8405 |
]. |
8406 |
||
8407 |
Java startupJavaSystem. |
|
8408 |
"/ Java markAllClassesUninitialized. |
|
8409 |
"/ Java initAllStaticFields. |
|
8410 |
"/ Java initAllClasses. |
|
8411 |
||
8412 |
files do:[:fileName | |
|
4414 | 8413 |
|p path| |
8414 |
||
8415 |
path := fileName. |
|
18453 | 8416 |
path isRegularFile ifTrue:[ |
4414 | 8417 |
p := Java |
8418 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
8419 |
argumentString:path pathName. |
|
8420 |
p resume. |
|
8421 |
] |
|
3892 | 8422 |
]. |
8423 |
! |
|
8424 |
||
8425 |
openCBrowser |
|
6031 | 8426 |
|dir files| |
5880 | 8427 |
|
8428 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8429 |
dir isNil ifTrue:[ ^ self]. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8430 |
self withActivityIndicationDo:[ |
7560 | 8431 |
files := self currentSelectedObjects. |
6031 | 8432 |
files notEmptyOrNil ifTrue:[ |
8433 |
CBrowser::Browser openOn:files first. |
|
8434 |
] ifFalse:[ |
|
8435 |
CBrowser::Browser openIn:dir. |
|
8436 |
] |
|
3892 | 8437 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8438 |
|
7560 | 8439 |
"Modified: / 04-12-2006 / 13:15:19 / cg" |
3892 | 8440 |
! |
8441 |
||
4230 | 8442 |
openChangeSetBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8443 |
"open a changeSet browser on the selected file(s)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8444 |
|
4230 | 8445 |
self |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8446 |
openTool:(UserPreferences current changeSetBrowserClass) |
4230 | 8447 |
with:#openOnFile: |
18834 | 8448 |
ignoreDirectories:false |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8449 |
|
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
8450 |
"Modified (comment): / 27-07-2012 / 20:42:55 / cg" |
18834 | 8451 |
"Modified: / 23-06-2019 / 13:17:07 / Claus Gittinger" |
4230 | 8452 |
! |
8453 |
||
3892 | 8454 |
openChangesBrowser |
8455 |
"open a change browser on the selected file(s)" |
|
8456 |
||
18774 | 8457 |
|files remaining| |
18775 | 8458 |
|
8459 |
files := self currentSelectedFiles. |
|
8460 |
remaining := files copy. |
|
8461 |
||
8462 |
"/ special for github-downloaded package&class folders (one method per file) |
|
8463 |
"/ these are named .package and .class |
|
18774 | 8464 |
GitHubSmalltalkPackageReader notNil ifTrue:[ |
8465 |
files do:[:fn | |
|
8466 |
fn isDirectory ifTrue:[ |
|
18248 | 8467 |
(fn suffix = 'package') ifTrue:[ |
8468 |
ChangeSetBrowser openOn:(GitHubSmalltalkPackageReader readPackageFrom:fn). |
|
18774 | 8469 |
remaining remove:fn. |
8470 |
] ifFalse:[ |
|
8471 |
(fn suffix = 'class') ifTrue:[ |
|
8472 |
ChangeSetBrowser openOn:(GitHubSmalltalkClassReader readClassFrom:fn). |
|
8473 |
remaining remove:fn. |
|
8474 |
]. |
|
8475 |
]. |
|
18248 | 8476 |
]. |
18774 | 8477 |
]. |
8478 |
remaining isEmpty ifTrue:[^ self]. |
|
18246 | 8479 |
]. |
8480 |
||
18775 | 8481 |
"/ special for new github-downloaded source files |
8482 |
"/ these are named *.class.st, *.extension.st and *.trait.st |
|
8483 |
remaining copy do:[:fn | |
|
8484 |
#( '.class' '.extension' '.trait') contains:[:suff | |
|
8485 |
|changeSet| |
|
8486 |
||
8487 |
(fn withoutSuffix baseName endsWith:suff) ifTrue:[ |
|
8488 |
fn readingFileDo:[:in | |
|
8489 |
changeSet := ChangeSet fromGithubPharoSmalltalkStream:in. |
|
8490 |
]. |
|
8491 |
ChangeSetBrowser openOn:changeSet. |
|
8492 |
remaining remove:fn. |
|
8493 |
]. |
|
8494 |
]. |
|
8495 |
remaining isEmpty ifTrue:[^ self]. |
|
8496 |
]. |
|
8497 |
||
3892 | 8498 |
self openTool:(UserPreferences current changesBrowserClass) |
18246 | 8499 |
|
18775 | 8500 |
"Modified: / 26-05-2019 / 02:58:27 / Claus Gittinger" |
3892 | 8501 |
! |
8502 |
||
8503 |
openDiffView |
|
15215 | 8504 |
"open a diff-view on the two selected files" |
8505 |
||
8506 |
|name1 name2 files title |
|
8507 |
defaultName defaultDir| |
|
6460 | 8508 |
|
8509 |
files := self currentSelectedObjects. |
|
3892 | 8510 |
files isEmpty ifTrue:[ |
6460 | 8511 |
Dialog warn:(resources string:'You have to select a file first'). |
4414 | 8512 |
^ self. |
3892 | 8513 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8514 |
|
3892 | 8515 |
(files size == 2) ifTrue:[ |
4414 | 8516 |
name1 := files last. |
8517 |
name2 := files first. |
|
3892 | 8518 |
] ifFalse:[ |
4414 | 8519 |
LastFileDiffFile notNil ifTrue:[ |
11052 | 8520 |
LastFileDiffFile exists ifTrue:[ |
8521 |
name1 := LastFileDiffFile. |
|
8522 |
]. |
|
8523 |
"/ | directory | |
|
8524 |
"/ directory := self currentDirectory. |
|
8525 |
"/ directory notNil ifTrue:[ |
|
8526 |
"/ lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
8527 |
"/ (lastFile exists and:[lastFile isReadable]) ifTrue:[ |
|
8528 |
"/ name1 := lastFile. |
|
8529 |
"/ ] |
|
8530 |
"/ ] |
|
4414 | 8531 |
]. |
8532 |
name2 := files first. |
|
6460 | 8533 |
title := resources string:'Show differences between "%1" and:' with:name2 baseName. |
4414 | 8534 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
11052 | 8535 |
defaultDir := name1 notNil ifTrue:[name1 directory] ifFalse:[self currentDirectory]. |
4414 | 8536 |
name1 := DialogBox |
8537 |
requestFileName:title |
|
8538 |
default:defaultName |
|
6460 | 8539 |
ok:(resources string:'OK') |
8540 |
abort:(resources string:'Compare against File List') |
|
4414 | 8541 |
pattern:'*' |
11052 | 8542 |
fromDirectory:defaultDir. |
3892 | 8543 |
]. |
15215 | 8544 |
self openDiffViewOn:name1 and:name2 |
8545 |
||
8546 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
|
8547 |
! |
|
8548 |
||
8549 |
openDiffViewOn:fileArg1 and:fileArg2 |
|
8550 |
"open a diff-view on two files" |
|
8551 |
||
17769 | 8552 |
|file1 file2 file1Size file2Size text1 text2 d err nm l1 sameContents msg| |
15215 | 8553 |
|
8554 |
file1 := fileArg1. |
|
8555 |
file2 := fileArg2. |
|
3892 | 8556 |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8557 |
self withWaitCursorDo:[ |
15215 | 8558 |
(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
|
8559 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
14126 | 8560 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l string]]. |
15215 | 8561 |
file1 := nil. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8562 |
l1 := 'browser contents' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8563 |
] ifFalse:[ |
15215 | 8564 |
file1 := file1 asFilename. |
8565 |
LastFileDiffFile := file1. |
|
8566 |
file1 isReadable ifFalse:[ |
|
8567 |
nm := file1. |
|
8568 |
file1 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8569 |
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
|
8570 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8571 |
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
|
8572 |
]. |
4414 | 8573 |
]. |
15215 | 8574 |
l1 := file1 pathName |
4414 | 8575 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8576 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8577 |
err isNil ifTrue:[ |
15215 | 8578 |
file2 isReadable ifFalse:[ |
8579 |
nm := file2. |
|
8580 |
file2 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8581 |
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
|
8582 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8583 |
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
|
8584 |
]. |
4414 | 8585 |
]. |
8586 |
]. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8587 |
err notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8588 |
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
|
8589 |
^ self |
6176 | 8590 |
]. |
8591 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8592 |
self withActivityIndicationDo:[ |
17769 | 8593 |
file1Size := file1 isNil ifTrue:[0] ifFalse:[file1 fileSize]. |
8594 |
file2Size := file2 isNil ifTrue:[0] ifFalse:[file2 fileSize]. |
|
8595 |
||
8596 |
((file1Size > (1024*1024*32)) or:[ file2Size > (1024*1024*32) ]) ifTrue:[ |
|
8597 |
file1Size = file2Size ifTrue:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8598 |
ProgressIndicator |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8599 |
displayBusyIndicator:'Comparing...' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8600 |
at:(Screen default center) |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8601 |
during:[ |
15215 | 8602 |
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
|
8603 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8604 |
sameContents ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8605 |
self information:'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8606 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8607 |
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
|
8608 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8609 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8610 |
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
|
8611 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8612 |
^ self. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8613 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8614 |
|
15215 | 8615 |
file1 notNil ifTrue:[ |
8616 |
file1 isDirectory ifTrue:[ |
|
8617 |
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
|
8618 |
] ifFalse:[ |
15215 | 8619 |
text1 := file1 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8620 |
] |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8621 |
]. |
15215 | 8622 |
file2 isDirectory ifTrue:[ |
8623 |
text2 := file2 directoryContents asString. |
|
6460 | 8624 |
] ifFalse:[ |
15215 | 8625 |
text2 := file2 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8626 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8627 |
text1 = text2 ifTrue:[ |
15215 | 8628 |
(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
|
8629 |
msg := 'Same filename lists.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8630 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8631 |
msg := 'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8632 |
]. |
16911 | 8633 |
self information:msg |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8634 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8635 |
d := DiffTextView |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8636 |
openOn:text1 label:l1 |
15215 | 8637 |
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
|
8638 |
d topView label:(resources string:'File Differences'). |
6460 | 8639 |
] |
4414 | 8640 |
] |
3892 | 8641 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8642 |
|
17769 | 8643 |
"Modified: / 19-11-2017 / 15:00:47 / cg" |
3892 | 8644 |
! |
8645 |
||
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8646 |
openDirectoryDiffView |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8647 |
"open a directory diff-view" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8648 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8649 |
|name1 name2 files| |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8650 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8651 |
files := self currentSelectedObjects. |
11108 | 8652 |
files notEmpty ifTrue:[ |
8653 |
name1 := files first asFilename. |
|
18453 | 8654 |
name1 asFilename isRegularFile ifTrue:[ |
11108 | 8655 |
name1 := name1 directory |
8656 |
]. |
|
8657 |
]. |
|
8658 |
||
8659 |
(files size == 2) ifTrue:[ |
|
8660 |
name2 := files second. |
|
8661 |
] ifFalse:[ |
|
8662 |
(files size ~= 1) ifTrue:[ |
|
8663 |
Dialog warn:(resources string:'Please select one or two directories.'). |
|
8664 |
^ self. |
|
8665 |
]. |
|
8666 |
name2 := Dialog |
|
8667 |
requestDirectoryName:(resources |
|
8668 |
string:'Recursive compare "%1" with folder:' |
|
8669 |
with:name1 asFilename baseName) |
|
8670 |
default:(LastFileDiffDirectory ? self currentDirectory). |
|
8671 |
name2 isEmptyOrNil ifTrue:[^ self]. |
|
8672 |
LastFileDiffDirectory := name2. |
|
8673 |
]. |
|
8674 |
name2 := name2 asFilename. |
|
8675 |
||
18453 | 8676 |
name2 asFilename isRegularFile ifTrue:[ |
11108 | 8677 |
name2 := name2 directory |
8678 |
]. |
|
8679 |
||
8680 |
self |
|
8681 |
applicationNamed:#FileApplicationNoteBook |
|
8682 |
ifPresentDo:[:appl | ^ appl openCompareDirectory:name1 with:name2]. |
|
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8683 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8684 |
"Created: / 20-05-2010 / 15:01:17 / cg" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8685 |
! |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8686 |
|
3892 | 8687 |
openEditor |
8688 |
self openTool:EditTextView |
|
8689 |
! |
|
8690 |
||
4957 | 8691 |
openGV |
8692 |
self openOSCommandWithFiles:'gv' |
|
8693 |
! |
|
8694 |
||
3892 | 8695 |
openHTMLReader |
8696 |
||
8697 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
8698 |
! |
|
8699 |
||
8700 |
openImageEditor |
|
6292 | 8701 |
[ |
8702 |
self loadImageThenDo:[:img | img edit] |
|
8703 |
] fork |
|
3892 | 8704 |
! |
8705 |
||
8706 |
openImageInspector |
|
6292 | 8707 |
[ |
8708 |
self loadImageThenDo:[:img | img inspect] |
|
8709 |
] fork |
|
3892 | 8710 |
! |
8711 |
||
8712 |
openImagePreview |
|
5778 | 8713 |
[ |
8714 |
self |
|
6292 | 8715 |
loadImageThenDo: |
5778 | 8716 |
[:img | |
8717 |
|i top viewer| |
|
8718 |
||
8719 |
top := StandardSystemView new. |
|
8720 |
||
8721 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8722 |
i := img. |
|
8723 |
top extent:200@200. |
|
8724 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
8725 |
top openAndWait. |
|
8726 |
||
8727 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
8728 |
i := i magnifiedPreservingRatioTo:200@200. |
|
8729 |
]. |
|
8730 |
viewer image:i. |
|
8731 |
]. |
|
3892 | 8732 |
] fork |
8733 |
! |
|
8734 |
||
8735 |
openMP3Player |
|
8736 |
|file| |
|
8737 |
||
3982 | 8738 |
file := self currentSelectedFiles. |
3892 | 8739 |
(file isEmpty) ifTrue:[ |
4414 | 8740 |
^ self. |
3892 | 8741 |
]. |
8742 |
file := file first. |
|
8743 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
8744 |
! |
|
8745 |
||
4957 | 8746 |
openOSCommandWithFiles:command |
8747 |
|files fileNames| |
|
8748 |
||
8749 |
files := self currentSelectedFiles. |
|
8750 |
(files isEmpty) ifTrue:[ |
|
8751 |
^ self. |
|
8752 |
]. |
|
8753 |
||
8754 |
fileNames := files collect:[:each | |
|
8755 |
'"' , each asFilename pathName , '"' |
|
8756 |
]. |
|
8757 |
||
8758 |
[ |
|
8759 |
OperatingSystem |
|
4959 | 8760 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
8761 |
inDirectory:(files first asFilename directory). |
|
4957 | 8762 |
] fork |
8763 |
! |
|
8764 |
||
4820 | 8765 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8766 |
|files fileNames cmd arg| |
4820 | 8767 |
|
8768 |
files := self currentSelectedFiles. |
|
8769 |
(files isEmpty) ifTrue:[ |
|
8770 |
^ self. |
|
8771 |
]. |
|
12972 | 8772 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'. |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8773 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8774 |
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
|
8775 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8776 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8777 |
|
4820 | 8778 |
fileNames := |
8779 |
files |
|
8780 |
collect: |
|
8781 |
[:each | |
|
8782 |
'"' , each asFilename pathName , '"' |
|
8783 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8784 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8785 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8786 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8787 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8788 |
]. |
4820 | 8789 |
|
4950 | 8790 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8791 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 8792 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8793 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8794 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 8795 |
! |
8796 |
||
4958 | 8797 |
openRP |
8798 |
self openOSCommandWithFiles:'realplay' |
|
8799 |
! |
|
8800 |
||
8426 | 8801 |
openResourceFileEditor |
8802 |
||
8803 |
self |
|
8804 |
openTool: Tools::InternationalLanguageTranslationEditor |
|
8805 |
with: #openOnFile: |
|
8806 |
! |
|
8807 |
||
3892 | 8808 |
openSlideShow |
5880 | 8809 |
|dir| |
8810 |
||
8811 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8812 |
dir isNil ifTrue:[^ self]. |
|
8813 |
||
3892 | 8814 |
CodingExamples_GUI::SlideShow openIn:dir. |
8815 |
! |
|
8816 |
||
8817 |
openSnapshotImageBrowser |
|
4491 | 8818 |
"Sorry, for now, only the old browser can handle snapShotImages." |
8819 |
||
3892 | 8820 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
8821 |
! |
|
8822 |
||
8823 |
openTerminal |
|
5880 | 8824 |
|dir| |
8825 |
||
8826 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 8827 |
|
5300 | 8828 |
TerminalApplication notNil ifTrue:[ |
8829 |
TerminalApplication openIn:dir |
|
8830 |
] ifFalse:[ |
|
8831 |
VT100TerminalView openShellIn:dir. |
|
8832 |
]. |
|
3892 | 8833 |
! |
8834 |
||
8835 |
openTool:aToolClass |
|
8836 |
"open a tool on the selected file(s)" |
|
8837 |
||
8838 |
^ self openTool:aToolClass ignoreDirectories:true |
|
8839 |
! |
|
8840 |
||
8841 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
8842 |
"open a tool on the selected file(s)" |
|
8843 |
||
8844 |
^ self |
|
4414 | 8845 |
openTool:aToolClass |
8846 |
with:#openOn: |
|
8847 |
ignoreDirectories:ignoreDirs |
|
3892 | 8848 |
! |
8849 |
||
8426 | 8850 |
openTool:aToolClass with:aSelector |
8851 |
"open a tool on the selected file(s)" |
|
8852 |
||
8853 |
^ self openTool:aToolClass with:aSelector ignoreDirectories:true |
|
8854 |
! |
|
8855 |
||
3892 | 8856 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
8857 |
"open a tool on the selected file(s)" |
|
8858 |
||
8832 | 8859 |
|tool| |
3892 | 8860 |
|
8861 |
aToolClass isNil ifTrue:[ |
|
4414 | 8862 |
Dialog warn:'Sorry, that tool seems to be not available'. |
8863 |
^ nil. |
|
3892 | 8864 |
]. |
8832 | 8865 |
self forEachSelectedFileIgnoringDirectories:ignoreDirs do:[:path | |
8866 |
tool := aToolClass perform:aSelector with:path. |
|
3892 | 8867 |
]. |
8868 |
^ tool |
|
8832 | 8869 |
! |
8870 |
||
8871 |
openWebBrowser |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8872 |
self |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8873 |
forEachSelectedFileIgnoringDirectories:true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8874 |
do:[:path | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8875 |
Error |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8876 |
handle:[:ex | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8877 |
Dialog warn:'Shell execution failed: ',ex description |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8878 |
] do:[ |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8879 |
OperatingSystem openApplicationForDocument:path operation:#open. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8880 |
^ self. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8881 |
] |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8882 |
]. |
3892 | 8883 |
! |
8884 |
||
6022 | 8885 |
openWorkspace |
8886 |
self |
|
8887 |
openTool:WorkspaceApplication |
|
8888 |
with:#openOnFile: |
|
8889 |
ignoreDirectories:true |
|
8890 |
! |
|
8891 |
||
4950 | 8892 |
openXV |
4957 | 8893 |
self openOSCommandWithFiles:'xv' |
4950 | 8894 |
! |
8895 |
||
3892 | 8896 |
openZipTool |
5880 | 8897 |
|zipTool| |
3892 | 8898 |
|
8899 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 8900 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 8901 |
]. |
8902 |
! |
|
8903 |
||
8904 |
readAbbrevFile |
|
8905 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
8906 |
||
5880 | 8907 |
|directories| |
3892 | 8908 |
|
3982 | 8909 |
directories := self currentSelectedDirectories. |
3892 | 8910 |
directories isEmpty ifTrue:[^ self]. |
8911 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8912 |
self withActivityIndicationDo:[ |
5880 | 8913 |
directories do:[:eachDir | |
8914 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
8915 |
] |
|
5828 | 8916 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8917 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8918 |
"Modified: / 25-07-2006 / 09:07:43 / cg" |
3892 | 8919 |
! |
8920 |
||
6460 | 8921 |
readAndShowResources |
8922 |
self withActivityIndicationDo:[ |
|
8923 |
| selectedFiles| |
|
8924 |
||
8925 |
selectedFiles:= self currentSelectedFiles. |
|
8926 |
selectedFiles do:[:fileName | |
|
8927 |
resources := ResourcePack fromFile:fileName. |
|
8928 |
resources inspect. |
|
8929 |
]. |
|
8930 |
] |
|
8931 |
! |
|
8932 |
||
17831 | 8933 |
removeBakAndSavFiles |
8934 |
"remove all .sav and .bak files (after confirmation)" |
|
8935 |
||
8936 |
|filesToRemove directories| |
|
8937 |
||
8938 |
directories := self currentSelectedDirectories. |
|
8939 |
directories isEmptyOrNil ifTrue:[ |
|
8940 |
directories := Array with:self currentDirectory |
|
8941 |
]. |
|
8942 |
||
8943 |
self withActivityIndicationDo:[ |
|
8944 |
filesToRemove := OrderedCollection new. |
|
8945 |
directories do:[:eachDirectoryToScan | |
|
8946 |
eachDirectoryToScan filesDo:[:fn | |
|
8947 |
(#('sav' 'bak') includes:fn suffix) ifTrue:[ |
|
8948 |
filesToRemove add:fn. |
|
8949 |
] |
|
8950 |
] |
|
8951 |
]. |
|
8952 |
filesToRemove isEmpty ifTrue:[ |
|
8953 |
Dialog information:(resources string:'Nothing to remove'). |
|
8954 |
^ self. |
|
8955 |
]. |
|
8956 |
(Dialog confirm:(resources string:'Remove %1 file(s) ?' with:filesToRemove size)) ifFalse:[ |
|
8957 |
^ self |
|
8958 |
]. |
|
8959 |
filesToRemove do:[:each | |
|
8960 |
each remove |
|
8961 |
]. |
|
17871 | 8962 |
self updateCurrentDirectoryWithReread |
17831 | 8963 |
]. |
8964 |
! |
|
8965 |
||
3892 | 8966 |
singleFileFileIn:fileName lazy:lazy |
8967 |
"fileIn the selected file(s)" |
|
8968 |
||
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8969 |
|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
|
8970 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8971 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8972 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8973 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8974 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8975 |
[ |
4345 | 8976 |
(ObjectFileLoader notNil |
5491 | 8977 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 8978 |
AbortOperationRequest catch:[ |
8979 |
|p| |
|
8980 |
||
8981 |
"/ |
|
8982 |
"/ look if already loaded ... then unload first |
|
8983 |
"/ |
|
8984 |
p := fileName pathName. |
|
8985 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
8986 |
(Dialog confirm:(resources |
|
8987 |
string:'%1 is already loaded; load anyway ?' |
|
8988 |
with:p)) ifFalse:[ |
|
8989 |
^ self |
|
8990 |
]. |
|
8991 |
notifyString := 'unloading old ' , p , ' ...'. |
|
8992 |
Transcript showCR:notifyString. |
|
4523 | 8993 |
self notify:notifyString. |
4345 | 8994 |
ObjectFileLoader unloadObjectFile:p. |
8995 |
]. |
|
8996 |
||
8997 |
notifyString := 'loading ' , p , ' ...'. |
|
8998 |
Transcript showCR:notifyString. |
|
4523 | 8999 |
self notify:notifyString. |
12426 | 9000 |
(ObjectFileLoader loadObjectFile:p) isNil ifTrue:[ |
9001 |
notifyString := 'Error: could not load ' , p. |
|
9002 |
Transcript showCR:notifyString. |
|
9003 |
self notify:notifyString. |
|
9004 |
] ifFalse:[ |
|
9005 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
9006 |
]. |
|
4345 | 9007 |
] |
9008 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
9009 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
9010 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9011 |
aStream := fileName readStreamOrNil. |
4345 | 9012 |
aStream notNil ifTrue:[ |
9013 |
aStream fileInBinary. |
|
9014 |
] |
|
9015 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9016 |
((fileName hasSuffix:'class') or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 9017 |
"/ loading a java class file |
9018 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 9019 |
JavaClassReader loadFile:fileName |
4345 | 9020 |
] |
9021 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
9022 |
"/ loading a sif (smalltalk interchange format) file |
|
9023 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
9024 |
SmalltalkInterchangeFileManager newForFileIn |
|
9025 |
fileName: fileName pathName; |
|
9026 |
fileIn. |
|
9027 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
|
9028 |
Parcel isNil ifTrue:[ |
|
9029 |
Dialog warn:'Parcel support not loaded.' |
|
9030 |
] ifFalse:[ |
|
9031 |
Parcel loadParcelFrom: fileName pathName |
|
9032 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9033 |
] ifFalse:[ (fileName hasSuffix:'jar') ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9034 |
JavaVM isNil ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9035 |
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
|
9036 |
^ self. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9037 |
] ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9038 |
JavaVM booted ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9039 |
(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
|
9040 |
JavaVM boot. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9041 |
]. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9042 |
JavaVM loadClassesIn: fileName. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9043 |
] |
4345 | 9044 |
] ifFalse:[ |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9045 |
"/ ask programming languages... |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9046 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
14360 | 9047 |
(lang isNil and:[(fileName hasSuffix:'js')]) ifTrue:[ |
14362 | 9048 |
Smalltalk loadPackage:'stx:libjavascript'. |
14360 | 9049 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
9050 |
]. |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9051 |
(lang notNil and:[lang ~= SmalltalkLanguage]) ifTrue:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9052 |
lang fileIn:fileName. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9053 |
] ifFalse:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9054 |
"/ loading a regular (chunk) or xml source file |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9055 |
Error handle:[:ex | |
15675 | 9056 |
self errorNotify:'Error during file in: ', ex description. |
15981 | 9057 |
ex resume. |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9058 |
] do:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9059 |
aStream := fileName readStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9060 |
[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9061 |
Class withoutUpdatingChangesDo:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9062 |
wasLazy := Compiler compileLazy:lazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9063 |
Smalltalk fileInStream:aStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9064 |
]. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9065 |
Class addInfoRecord:('fileIn ' , fileName asString) |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9066 |
] ensure:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9067 |
Compiler compileLazy:wasLazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9068 |
aStream close |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
9069 |
] |
4345 | 9070 |
] |
9071 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
9072 |
]]]] |
4345 | 9073 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9074 |
] 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
|
9075 |
|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
|
9076 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9077 |
isRedef := false. |
12684 | 9078 |
sig := ex creator. |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9079 |
(dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9080 |
action := #continue |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9081 |
] ifFalse:[ |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9082 |
(sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9083 |
ex reject |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9084 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9085 |
sig == Class methodRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9086 |
msg := 'trying to overwrite method:\\ ' , ex oldMethod whoString , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9087 |
, ex oldPackage , ''' with method from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9088 |
label := 'Method redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9089 |
redefKind := 'method'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9090 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9091 |
] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9092 |
msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9093 |
, ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9094 |
label := 'Class redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9095 |
redefKind := 'class'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9096 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9097 |
] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender| |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9098 |
label := msg := 'Breakpoint/Halt in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9099 |
sender := ex suspendedContext. |
18867 | 9100 |
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
|
9101 |
] ifFalse:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9102 |
label := 'Error in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9103 |
msg := 'error in fileIn: %1' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9104 |
]]]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9105 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9106 |
msg := msg bindWith:ex description. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9107 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9108 |
labels := #('Cancel' 'Skip' 'Debug' 'Compare Sources'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9109 |
values := #(abort skip debug compareSources). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9110 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9111 |
isRedef ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9112 |
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
|
9113 |
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
|
9114 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9115 |
labels := labels , #('Keep Package' ). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9116 |
values := values , #(keep). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9117 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9118 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9119 |
labels := labels , #( 'Continue' 'ContinueForAll'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9120 |
values := values , #( continue continueForAll). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9121 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9122 |
AbortAllOperationWantedQuery query ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9123 |
labels := #('Cancel All') , labels. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9124 |
values := #(cancelAll) , values. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9125 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9126 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9127 |
action := Dialog |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9128 |
choose:(msg withCRs) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9129 |
label:label |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9130 |
image:(WarningBox iconBitmap) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9131 |
labels:labels |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9132 |
values:values |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9133 |
default:#continue |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9134 |
onCancel:#abort. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9135 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9136 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9137 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9138 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9139 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9140 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9141 |
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
|
9142 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9143 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9144 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9145 |
(action == #compareSources) ifTrue:[ |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9146 |
DiffCodeView |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9147 |
openOn:(ex oldMethod source) label:'Old Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9148 |
and:(ex newMethod source) label:'New Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9149 |
title:ex description. |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9150 |
ex resignalAs:ex |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
9151 |
]. |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
9152 |
(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
|
9153 |
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
|
9154 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9155 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9156 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9157 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9158 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9159 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9160 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9161 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9162 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9163 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9164 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9165 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9166 |
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
|
9167 |
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
|
9168 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9169 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9170 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9171 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9172 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
9173 |
] |
7040 | 9174 |
|
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
9175 |
"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
|
9176 |
"Modified: / 19-02-2014 / 12:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4531 | 9177 |
! |
9178 |
||
4558 | 9179 |
splitFile:infile intoPiecesOfSize:kiloBytes |
9180 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
9181 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
9182 |
||
9183 |
bufferSize := 32*1024. |
|
9184 |
||
9185 |
inStream := infile readStream. |
|
9186 |
||
9187 |
bytesPerSplit := kiloBytes * 1024. |
|
9188 |
||
9189 |
remaining := infile fileSize. |
|
9190 |
splitIndex := 1. |
|
9191 |
[remaining > 0] whileTrue:[ |
|
9192 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
9193 |
outStream := outFile asFilename writeStream. |
|
9194 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
9195 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
9196 |
buffer := ByteArray new:bufferSize. |
|
9197 |
n := inStream |
|
9198 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
9199 |
into:buffer |
|
9200 |
startingAt:1. |
|
9201 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
9202 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
9203 |
remaining := remaining - n. |
|
9204 |
]. |
|
9205 |
outStream close. |
|
9206 |
splitIndex := splitIndex + 1. |
|
9207 |
]. |
|
9208 |
inStream close. |
|
9209 |
! |
|
9210 |
||
15906 | 9211 |
splitFile:infile intoPiecesWithNumberOfLines:numberOfLines |
9212 |
|splitIndex line |
|
9213 |
inStream outFile outStream remainingLinesInThisOutfile| |
|
9214 |
||
9215 |
inStream := infile readStream. |
|
9216 |
||
9217 |
splitIndex := 1. |
|
9218 |
[inStream atEnd] whileFalse:[ |
|
9219 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
9220 |
outStream := outFile asFilename writeStream. |
|
9221 |
remainingLinesInThisOutfile := numberOfLines. |
|
9222 |
[(remainingLinesInThisOutfile > 0) and:[inStream atEnd not]] whileTrue:[ |
|
9223 |
line := inStream nextLine. |
|
15910 | 9224 |
outStream nextPutLine:line. |
15906 | 9225 |
remainingLinesInThisOutfile := remainingLinesInThisOutfile - 1. |
9226 |
]. |
|
9227 |
outStream close. |
|
9228 |
splitIndex := splitIndex + 1. |
|
9229 |
]. |
|
9230 |
inStream close. |
|
9231 |
! |
|
9232 |
||
4558 | 9233 |
splitSelectedFiles |
6264 | 9234 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 9235 |
|
12871 | 9236 |
selectedFiles := self currentSelectedFiles. |
4558 | 9237 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
9238 |
||
6265 | 9239 |
msg := (numFiles > 1) |
9240 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
9241 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 9242 |
|
6352 | 9243 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 9244 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
9245 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 9246 |
kiloBytes isNil ifTrue:[^ self]. |
9247 |
||
9248 |
selectedFiles do:[:fileName | |
|
18453 | 9249 |
fileName isRegularFile ifTrue:[ |
9250 |
self notify:('Splitting:', fileName baseName). |
|
4558 | 9251 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
9252 |
] |
|
9253 |
]. |
|
6190 | 9254 |
self notify:nil. |
6265 | 9255 |
|
7560 | 9256 |
"Modified: / 04-12-2006 / 13:15:26 / cg" |
4558 | 9257 |
! |
9258 |
||
15906 | 9259 |
splitSelectedFilesByLines |
9260 |
|selectedFiles numFiles msg numLinesString numLines| |
|
9261 |
||
9262 |
selectedFiles := self currentSelectedFiles. |
|
9263 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
9264 |
||
9265 |
msg := (numFiles > 1) |
|
9266 |
ifTrue:'Split each of the %1 files into pieces with number of lines:' |
|
9267 |
ifFalse:'Split %2 into pieces with number of lines:'. |
|
9268 |
||
9269 |
numLinesString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
9270 |
numLinesString isEmptyOrNil ifTrue:[^ self]. |
|
9271 |
||
9272 |
numLines := Integer readFrom:numLinesString onError:nil. |
|
9273 |
numLines isNil ifTrue:[^ self]. |
|
9274 |
||
9275 |
selectedFiles do:[:fileName | |
|
18453 | 9276 |
fileName isRegularFile ifTrue:[ |
9277 |
self notify:('Splitting:', fileName baseName). |
|
15906 | 9278 |
self splitFile:fileName intoPiecesWithNumberOfLines:numLines |
9279 |
] |
|
9280 |
]. |
|
9281 |
self notify:nil. |
|
9282 |
! |
|
9283 |
||
15211 | 9284 |
truncateSelectedFilesToZeroSize |
9285 |
|selectedFiles numFiles msg| |
|
9286 |
||
9287 |
selectedFiles := self currentSelectedObjects. |
|
9288 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
9289 |
||
9290 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
|
9291 |
numFiles > 1 ifTrue:[ |
|
9292 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
|
9293 |
]. |
|
9294 |
||
9295 |
(Dialog |
|
9296 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
|
9297 |
initialAnswer:false |
|
9298 |
) ifFalse:[ |
|
9299 |
^ self |
|
9300 |
]. |
|
9301 |
||
9302 |
selectedFiles do:[:fileName | |
|
9303 |
|s| |
|
9304 |
||
18453 | 9305 |
fileName isRegularFile ifTrue:[ |
9306 |
self notify:('Truncating:', fileName baseName). |
|
15211 | 9307 |
[ |
9308 |
s := fileName writeStream. |
|
9309 |
s close. |
|
9310 |
] on:FileStream openErrorSignal do:[:ex| |
|
9311 |
self warn:('Cannot truncate "%1".' bindWith:fileName baseName allBold). |
|
9312 |
]. |
|
9313 |
] |
|
9314 |
]. |
|
9315 |
self notify:nil. |
|
9316 |
||
9317 |
"Modified: / 04-12-2006 / 13:15:28 / cg" |
|
9318 |
! ! |
|
3892 | 9319 |
|
4849 | 9320 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 9321 |
|
9322 |
anySTFilesPresent |
|
9323 |
^ self anyFilesPresentWithSuffix:'st' |
|
9324 |
! |
|
9325 |
||
9326 |
canCreateNewProject |
|
9327 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
17865 | 9328 |
^ self currentSelectedFiles |
9329 |
contains:[:fileName| |
|
9330 |
| suffix| |
|
9331 |
suffix := fileName suffix asLowercase. |
|
9332 |
(suffix = 'prj' or:[suffix = 'st']) |
|
9333 |
] |
|
3892 | 9334 |
! |
9335 |
||
9336 |
canDoTerminal |
|
9337 |
||
9338 |
^ OperatingSystem isUNIXlike |
|
9339 |
or:[OperatingSystem isMSWINDOWSlike] |
|
9340 |
! |
|
9341 |
||
9342 |
canDoTerminalAndSystemIsDOS |
|
9343 |
||
9344 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
9345 |
! |
|
9346 |
||
9347 |
canDoTerminalAndSystemIsUnix |
|
9348 |
||
9349 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
9350 |
! |
|
9351 |
||
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9352 |
canGenerateSignatureFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
9353 |
"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
|
9354 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9355 |
Expecco::KeyFileGenerator isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9356 |
Expecco::KeyFile isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9357 |
|
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
9358 |
^ self currentSelectedFiles notEmptyOrNil |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9359 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
9360 |
|
12811 | 9361 |
canOpenMonticelloBrowser |
9362 |
^ self currentSelectedFiles |
|
9363 |
contains:[:fileName| |
|
18746 | 9364 |
fileName suffix sameAs:'mcz' |
12811 | 9365 |
] |
18746 | 9366 |
|
9367 |
"Modified: / 01-05-2019 / 11:21:16 / Claus Gittinger" |
|
12811 | 9368 |
! |
9369 |
||
3892 | 9370 |
canReadAbbrevFile |
9371 |
||
5960 | 9372 |
|currentDirectory| |
3892 | 9373 |
|
9374 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 9375 |
currentDirectory := self currentDirectory. |
9376 |
^ currentDirectory notNil |
|
9377 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 9378 |
! |
9379 |
||
9380 |
canRemoveFromSourcePath |
|
9381 |
||
9382 |
^ false |
|
9383 |
! |
|
9384 |
||
13089 | 9385 |
cannotGenerateSignatureFiles |
9386 |
^ self canGenerateSignatureFiles not |
|
9387 |
! |
|
9388 |
||
3892 | 9389 |
hasASN1 |
9390 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 9391 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 9392 |
|
9393 |
! |
|
9394 |
||
9395 |
hasASN1AndSelection |
|
9396 |
^ [ self hasSelection value |
|
17416 | 9397 |
and:[self currentSelectedFiles notEmptyOrNil |
4414 | 9398 |
and:[OSI::ASN1Parser notNil |
9399 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
17416 | 9400 |
|
9401 |
"Modified: / 17-02-2017 / 08:25:09 / cg" |
|
3892 | 9402 |
! |
9403 |
||
9404 |
hasCBrowser |
|
9405 |
^ [ CBrowser::Browser notNil ] |
|
9406 |
! |
|
9407 |
||
9408 |
hasJava |
|
9409 |
||
14298 | 9410 |
^ [ JavaVM notNil |
9411 |
and:[JavaClassReader notNil |
|
9412 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 9413 |
! |
9414 |
||
9415 |
hasJavaAndSelection |
|
9416 |
||
12871 | 9417 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 9418 |
and:[JavaClassReader notNil |
9419 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 9420 |
! |
9421 |
||
9422 |
hasMP3Player |
|
9423 |
||
9424 |
^ [ MP3PlayerApplication notNil |
|
4414 | 9425 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 9426 |
! |
9427 |
||
9428 |
hasMP3PlayerAndSelection |
|
9429 |
||
12871 | 9430 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 9431 |
and:[ self hasMP3Player value]] |
3892 | 9432 |
! |
9433 |
||
8426 | 9434 |
hasResourceFileSelected |
12871 | 9435 |
^ (self currentSelectedFiles) |
9436 |
contains:[:fn | |
|
18746 | 9437 |
fn suffix sameAs:'rs' |
9438 |
]. |
|
9439 |
||
9440 |
"Modified: / 01-05-2019 / 11:23:30 / Claus Gittinger" |
|
8426 | 9441 |
! |
9442 |
||
3892 | 9443 |
hasSlideShow |
9444 |
||
9445 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
9446 |
! |
|
9447 |
||
9448 |
hasSnapshotSelection |
|
9449 |
||
9450 |
^ [ |
|
4414 | 9451 |
| files | |
8426 | 9452 |
|
4414 | 9453 |
files := self currentSelectedFiles. |
9454 |
((files size == 1) |
|
9455 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 9456 |
] |
9457 |
! |
|
9458 |
||
7869 | 9459 |
hasXml |
9206 | 9460 |
^ [ XML::XMLParser notNil ] |
7869 | 9461 |
! |
9462 |
||
9463 |
hasXmlFileSelected |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
9464 |
"/ 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
|
9465 |
"/ then handle the error when it ever fails during xml-parsing. |
7869 | 9466 |
|
8426 | 9467 |
^ [ |
9468 |
|sel fileName| |
|
7869 | 9469 |
|
9470 |
sel := self currentSelectedFiles. |
|
9471 |
sel size == 1 ifTrue:[ |
|
9472 |
fileName := sel first. |
|
9473 |
fileName notNil ifTrue:[ |
|
15936 | 9474 |
#('xml' 'xsd' 'vdx') includes:fileName suffix asLowercase |
7869 | 9475 |
] ifFalse:[ |
9476 |
false |
|
9477 |
] |
|
9478 |
] ifFalse:[ |
|
9479 |
false |
|
9480 |
] |
|
9481 |
] |
|
9482 |
! |
|
9483 |
||
3892 | 9484 |
hasZipFileSelected |
17982 | 9485 |
|sel fileName suff mime| |
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9486 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9487 |
sel := self currentSelectedFiles. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9488 |
sel size == 1 ifFalse:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9489 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9490 |
fileName := sel first. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9491 |
fileName isNil ifTrue:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9492 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9493 |
suff := fileName suffix asLowercase. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9494 |
(suff = 'zip' or:[suff = 'jar']) ifTrue:[^ true]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9495 |
|
17982 | 9496 |
mime := fileName mimeTypeOfContents. |
9497 |
"/ prepare for change (iana has obsoleted the x- types) |
|
9498 |
^ (mime = 'application/x-zip-compressed') or:[mime = 'application/zip'] |
|
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9499 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9500 |
"Modified: / 14-02-2011 / 17:17:03 / cg" |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9501 |
! |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9502 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9503 |
hasZipFileSelectedHolder |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9504 |
^ [ self hasZipFileSelected ] |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9505 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
9506 |
"Created: / 14-02-2011 / 17:16:08 / cg" |
3892 | 9507 |
! |
9508 |
||
9509 |
javaSupportLoaded |
|
9510 |
||
9511 |
^ false |
|
9512 |
! ! |
|
9513 |
||
14126 | 9514 |
|
9515 |
||
3906 | 9516 |
!AbstractFileBrowser methodsFor:'presentation'! |
9517 |
||
9518 |
getModeString:modeBits |
|
9519 |
"convert file-mode bits into a more user-friendly string. |
|
9520 |
This is wrong here - should be moved into OperatingSystem." |
|
9521 |
||
9522 |
^ self getModeString:modeBits |
|
4414 | 9523 |
with:#( 'owner:' $r $w $x |
9524 |
' group:' $r $w $x |
|
9525 |
' others:' $r $w $x ) |
|
3906 | 9526 |
! |
9527 |
||
9528 |
getModeString:modeBits with:texts |
|
9529 |
"convert file-mode bits into a more user-friendly string. |
|
9530 |
This is wrong here - should be moved into OperatingSystem." |
|
9531 |
||
9532 |
|bits modeString| |
|
9533 |
||
9534 |
bits := modeBits bitAnd:8r777. |
|
9535 |
modeString := ''. |
|
9536 |
||
9537 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
9538 |
with: texts do:[:bitMask :access | |
|
4414 | 9539 |
|ch| |
9540 |
||
9541 |
bitMask isNil ifTrue:[ |
|
9542 |
modeString := modeString , access |
|
9543 |
] ifFalse:[ |
|
9544 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
9545 |
ch := $- |
|
9546 |
] ifFalse:[ |
|
9547 |
ch := access |
|
9548 |
]. |
|
9549 |
modeString := modeString copyWith:ch |
|
9550 |
] |
|
3906 | 9551 |
]. |
9552 |
^ modeString |
|
9553 |
! ! |
|
9554 |
||
5880 | 9555 |
!AbstractFileBrowser methodsFor:'private'! |
9556 |
||
9557 |
theSingleSelectedDirectoryOrHomeDir |
|
9558 |
|dir| |
|
9559 |
||
5888 | 9560 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 9561 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
9562 |
^ dir. |
|
9563 |
! |
|
9564 |
||
9565 |
theSingleSelectedDirectoryOrNil |
|
9566 |
|dirs| |
|
9567 |
||
9568 |
dirs := self currentSelectedDirectories. |
|
9569 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
9570 |
^ dirs anElement. |
|
14577 | 9571 |
! |
9572 |
||
9573 |
theSingleSelectedFileOrNil |
|
9574 |
|dirs| |
|
9575 |
||
9576 |
dirs := self currentSelectedFiles. |
|
9577 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
9578 |
^ dirs anElement. |
|
18751 | 9579 |
! |
9580 |
||
9581 |
theSingleSelectedItemOrNil |
|
9582 |
|items| |
|
9583 |
||
9584 |
items := self selectedItems. |
|
9585 |
items size ~= 1 ifTrue:[ ^ nil]. |
|
9586 |
^ items anElement. |
|
9587 |
||
9588 |
"Created: / 02-05-2019 / 18:53:06 / Claus Gittinger" |
|
5880 | 9589 |
! ! |
9590 |
||
3892 | 9591 |
!AbstractFileBrowser methodsFor:'queries'! |
9592 |
||
8256 | 9593 |
cBrowserLoaded |
18432 | 9594 |
^ (Smalltalk at:#'CBrowser::Browser') notNil |
9595 |
||
9596 |
"Modified: / 26-09-2018 / 12:06:32 / Claus Gittinger" |
|
8256 | 9597 |
! |
9598 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9599 |
cBrowserMenuItemVisible |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9600 |
^ self cBrowserLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9601 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9602 |
"Created: / 04-10-2011 / 13:40:38 / cg" |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9603 |
! |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
9604 |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9605 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9606 |
"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
|
9607 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9608 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9609 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
9610 |
|
3906 | 9611 |
getFileInfoStringForFirstSelectedFile:longInfo |
9612 |
"get stat info on selected file - return a string which can be |
|
9613 |
shown in a box" |
|
9614 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
9615 |
|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
|
9616 |
sizeString fileSize tAccess tModification buffer| |
3906 | 9617 |
|
7560 | 9618 |
selFiles := self currentSelectedObjects. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9619 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 9620 |
filename := selFiles first. |
9621 |
||
8364 | 9622 |
info := filename linkInfo. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9623 |
info isNil ifTrue:[ |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9624 |
^ 'Cannot get fileInfo'. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9625 |
^ nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9626 |
]. |
8364 | 9627 |
|
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
9628 |
buffer := Text writeStream. |
4765 | 9629 |
|
9630 |
buffer |
|
9631 |
nextPutAll:'filename: '; |
|
9632 |
nextPutLine:filename asString. |
|
9633 |
||
8364 | 9634 |
OperatingSystem isMSDOSlike ifTrue: [ |
9635 |
(info alternativeName notNil |
|
9636 |
and:[ info alternativeName ~= info fullName ]) ifTrue:[ |
|
9637 |
buffer nextPutAll:'shortname: '. |
|
9638 |
buffer nextPutLine:info alternativeName. |
|
9639 |
] |
|
9640 |
]. |
|
9641 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9642 |
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
|
9643 |
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
|
9644 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9645 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9646 |
]. |
4765 | 9647 |
buffer |
9648 |
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
|
9649 |
nextPutLine:(info path ? '???'). |
3906 | 9650 |
] 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
|
9651 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9652 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9653 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9654 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9655 |
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
|
9656 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9657 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9658 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9659 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9660 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9661 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
9662 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9663 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9664 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9665 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9666 |
fileSize > 1024 ifTrue:[ |
8172 | 9667 |
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
|
9668 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
9669 |
]. |
4765 | 9670 |
buffer nextPutLine:sizeString. |
3906 | 9671 |
|
9672 |
modeBits := info mode. |
|
9673 |
modeString := self getModeString:modeBits. |
|
4765 | 9674 |
|
9675 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 9676 |
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
|
9677 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 9678 |
]. |
4765 | 9679 |
buffer |
9680 |
cr; |
|
9681 |
nextPutAll:'owner: '; |
|
9682 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
9683 |
||
3906 | 9684 |
longInfo ifTrue:[ |
4765 | 9685 |
buffer |
9686 |
nextPutAll:'group: '; |
|
9687 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
9688 |
||
9689 |
tAccess := info accessTime. |
|
9690 |
buffer |
|
9691 |
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
|
9692 |
nextPutAll:tAccess asDate printString; |
4765 | 9693 |
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
|
9694 |
nextPutLine:tAccess asTime printString. |
4765 | 9695 |
|
9696 |
tModification := info modificationTime. |
|
9697 |
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
|
9698 |
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
|
9699 |
nextPutAll:tModification asDate printString; |
4765 | 9700 |
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
|
9701 |
nextPutLine:tModification asTime printString. |
3906 | 9702 |
]. |
4765 | 9703 |
^ buffer contents |
7560 | 9704 |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
9705 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
3906 | 9706 |
! |
9707 |
||
8510 | 9708 |
hasImageColorHistogram |
9709 |
^ ImageColorHistogram notNil |
|
9710 |
! |
|
9711 |
||
17686 | 9712 |
hasImageHistogram |
9713 |
^ ImageAlgorithms notNil |
|
9714 |
||
9715 |
"Created: / 10-09-2017 / 16:50:34 / cg" |
|
9716 |
! |
|
9717 |
||
10258 | 9718 |
hasSubversionSupport |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
9719 |
^ ConfigurableFeatures includesFeature: #SubversionSupport |
10258 | 9720 |
|
9721 |
"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
|
9722 |
"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
|
9723 |
"Modified: / 19-01-2012 / 10:43:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10258 | 9724 |
! |
9725 |
||
3892 | 9726 |
initialCommandFor:fileName into:aBox |
9727 |
"set a useful initial command for execute box." |
|
9728 |
||
18734 | 9729 |
self class |
9730 |
initialCommandFor:fileName |
|
9731 |
in:self "Filename" currentDirectory |
|
9732 |
intoBox:aBox |
|
9733 |
||
9734 |
"Modified: / 10-04-2019 / 05:55:21 / Claus Gittinger" |
|
3892 | 9735 |
! |
9736 |
||
9737 |
isAbstractFileBrowser |
|
9738 |
||
9739 |
^ true |
|
9740 |
! |
|
9741 |
||
18432 | 9742 |
stxgdbLoaded |
9743 |
^ (Smalltalk at:#GDBApplication) notNil |
|
9744 |
||
9745 |
"Created: / 26-09-2018 / 12:06:23 / Claus Gittinger" |
|
9746 |
! |
|
9747 |
||
9748 |
stxgdbMenuItemVisible |
|
9749 |
^ self stxgdbLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
|
9750 |
||
9751 |
"Created: / 26-09-2018 / 12:05:45 / Claus Gittinger" |
|
9752 |
! |
|
9753 |
||
3892 | 9754 |
systemIsDOS |
9755 |
^ OperatingSystem isMSDOSlike |
|
9756 |
! |
|
9757 |
||
12473 | 9758 |
systemIsOSX |
9759 |
^ OperatingSystem isOSXlike |
|
9760 |
! |
|
9761 |
||
3892 | 9762 |
systemIsUnix |
9763 |
^ OperatingSystem isUNIXlike |
|
14980 | 9764 |
! |
9765 |
||
9766 |
systemSupportsVolumes |
|
9767 |
^ OperatingSystem supportsVolumes |
|
3892 | 9768 |
! ! |
9769 |
||
9770 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
9771 |
||
9772 |
allItemsOfCurrentDirectory |
|
5009 | 9773 |
self |
4774 | 9774 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 9775 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
9776 |
||
9777 |
^ nil |
|
3892 | 9778 |
! |
9779 |
||
9780 |
anyFilesPresentWithSuffix:suffix |
|
6725 | 9781 |
self currentSelectedDirectories do:[:dir| |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9782 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
9783 |
(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
|
9784 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 9785 |
]. |
9786 |
^ false. |
|
9787 |
! |
|
9788 |
||
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9789 |
commonPrefixOfSelectedFiles |
4773 | 9790 |
|selFiles stringCol firstPre| |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9791 |
|
7560 | 9792 |
selFiles := self currentSelectedObjects. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9793 |
selFiles isEmpty ifTrue:[^ nil]. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9794 |
|
17865 | 9795 |
stringCol := selFiles collect:#asString. |
4773 | 9796 |
firstPre := stringCol at:1. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9797 |
stringCol from:2 do:[:el| |
4773 | 9798 |
firstPre := firstPre commonPrefixWith:el. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9799 |
]. |
4773 | 9800 |
^ firstPre asFilename |
7560 | 9801 |
|
9802 |
"Modified: / 04-12-2006 / 13:14:25 / cg" |
|
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9803 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9804 |
|
12481 | 9805 |
compressTabsOnSave |
9806 |
"if true, compress leading spaces (multiples of 8) with a tab character |
|
9807 |
when saving. |
|
9808 |
Default is true" |
|
9809 |
||
9810 |
^ true |
|
9811 |
! |
|
9812 |
||
3892 | 9813 |
currentFilesAreInSameDirectory |
9814 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9815 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 9816 |
! |
9817 |
||
9818 |
currentFilesHasDirectories |
|
9819 |
||
6725 | 9820 |
^ self currentSelectedDirectories notEmpty. |
3892 | 9821 |
! |
9822 |
||
3982 | 9823 |
directoriesForFiles:aFileCol |
11743 | 9824 |
^ aFileCol collect:[:file| self getDirWithoutFileName:file] as:Set. |
3982 | 9825 |
! |
9826 |
||
3892 | 9827 |
fileListIsEmpty |
5009 | 9828 |
self |
9829 |
applicationNamed:#DirectoryContentsBrowser |
|
9830 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
9831 |
||
9832 |
^ nil. |
|
3892 | 9833 |
! |
9834 |
||
9835 |
fileListIsNotEmpty |
|
9836 |
||
9837 |
^ self fileListIsEmpty not. |
|
9838 |
! |
|
9839 |
||
9840 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 9841 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 9842 |
|
9843 |
| file1 file2 | |
|
9844 |
||
6284 | 9845 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 9846 |
file1 := aFilename1 asFilename. |
9847 |
file2 := aFilename2 asFilename. |
|
6284 | 9848 |
|
3892 | 9849 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 9850 |
|
3892 | 9851 |
((file1 isDirectory) |
9852 |
and:[(file2 isDirectory) |
|
9853 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 9854 |
^ file1 baseName = file2 baseName |
3892 | 9855 |
]. |
3982 | 9856 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 9857 |
! |
9858 |
||
9859 |
getAllFilesAsStringCollection |
|
5009 | 9860 |
self |
9861 |
applicationNamed:#DirectoryContentsBrowser |
|
9862 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
9863 |
||
9864 |
^ nil |
|
3892 | 9865 |
! |
9866 |
||
9867 |
getBestDirectory |
|
17868 | 9868 |
"from a set of directories, return the common parent directory" |
9869 |
||
9870 |
^ self class getBestDirectoryFrom:(self currentSelectedDirectories) |
|
3892 | 9871 |
! |
9872 |
||
9873 |
getDirWithoutFileName:aFileName |
|
9874 |
||
9875 |
| dir | |
|
9876 |
aFileName isNil ifTrue:[ |
|
4414 | 9877 |
^ aFileName. |
3892 | 9878 |
]. |
9879 |
dir := aFileName asFilename. |
|
9880 |
dir isDirectory ifFalse:[ |
|
4414 | 9881 |
dir := dir directory. |
3892 | 9882 |
]. |
9883 |
^ dir. |
|
9884 |
! |
|
9885 |
||
9886 |
getInfoItem |
|
9887 |
"get filename of a description-file (.dir.info, README etc.); |
|
16778 | 9888 |
This file is automatically shown when a directory is entered. |
3892 | 9889 |
You can add more names below if you like." |
9890 |
||
5880 | 9891 |
|dir| |
9892 |
||
9893 |
dir := self theSingleSelectedDirectoryOrNil. |
|
9894 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 9895 |
|
16778 | 9896 |
#( |
3892 | 9897 |
'.dir.info' |
9898 |
'README' |
|
9899 |
'ReadMe' |
|
9900 |
'Readme' |
|
9901 |
'readme' |
|
9902 |
'read.me' |
|
9903 |
'Read.me' |
|
9904 |
'READ.ME' |
|
9905 |
'README.TXT' |
|
15915 | 9906 |
'README.txt' |
3892 | 9907 |
'readme.txt' |
9908 |
'Readme.txt' |
|
9909 |
'Info.txt' |
|
9910 |
'info.txt' |
|
9911 |
'INFO.TXT' |
|
15915 | 9912 |
'INFO.txt' |
16778 | 9913 |
) do:[:f | |
5883 | 9914 |
|n| |
4414 | 9915 |
|
5880 | 9916 |
n := dir construct:f. |
18453 | 9917 |
(n isReadable and:[n isRegularFile]) ifTrue:[ |
4414 | 9918 |
^ DirectoryContentsBrowser itemClass fileName:n |
9919 |
] |
|
3892 | 9920 |
]. |
9921 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9922 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9923 |
|
12497 | 9924 |
hasPackageDirectorySelected |
9925 |
|dir| |
|
9926 |
||
9927 |
dir := self currentDirectory. |
|
9928 |
^ dir notNil |
|
9929 |
and:[ dir exists |
|
9930 |
and:[ (dir / 'abbrev.stc') exists ]] |
|
9931 |
! |
|
9932 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9933 |
parentDirectoriesOfCurrentFiles |
11743 | 9934 |
^ self currentSelectedObjects |
9935 |
collect:[:file | file directory] as:Set |
|
7560 | 9936 |
|
9937 |
"Modified: / 04-12-2006 / 13:15:21 / cg" |
|
6521 | 9938 |
! |
9939 |
||
9940 |
recursiveAnyFilesPresentWithSuffix:suffix |
|
6652 | 9941 |
^ true. "/ the code below is too slow for a menu enabling operation |
9942 |
||
9943 |
"/ |directories| |
|
9944 |
"/ |
|
9945 |
"/ directories := self currentDirectories value. |
|
9946 |
"/ directories do:[:dir| |
|
9947 |
"/ [ |
|
9948 |
"/ dir recursiveDirectoryContentsDo:[:f | |
|
9949 |
"/ (f asFilename suffix = suffix) ifTrue:[ ^ true] |
|
9950 |
"/ ] |
|
9951 |
"/ ] on:FileStream openErrorSignal do:[:ex|]. |
|
9952 |
"/ ]. |
|
9953 |
"/ ^ false. |
|
6586 | 9954 |
! |
9955 |
||
9956 |
recursiveAnySTFilesPresent |
|
9957 |
^ self recursiveAnyFilesPresentWithSuffix:'st' |
|
3982 | 9958 |
! ! |
9959 |
||
9960 |
!AbstractFileBrowser methodsFor:'selection'! |
|
9961 |
||
9962 |
currentSelectedDirectories |
|
6725 | 9963 |
^ self currentDirectoriesValue. |
3982 | 9964 |
! |
9965 |
||
9966 |
currentSelectedFiles |
|
17865 | 9967 |
^ self currentSelectedObjects reject:#isDirectory. |
7560 | 9968 |
|
9969 |
"Modified: / 04-12-2006 / 13:14:39 / cg" |
|
3982 | 9970 |
! |
9971 |
||
6460 | 9972 |
currentSelectedObjects |
9973 |
^ self currentFileNameHolder value |
|
9974 |
! |
|
9975 |
||
3982 | 9976 |
firstSelectedFile |
7560 | 9977 |
^ self currentSelectedObjects |
12102 | 9978 |
detect:[:file | (file ? '') asFilename isDirectory not] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9979 |
ifNone:[]. |
7560 | 9980 |
|
9981 |
"Modified: / 04-12-2006 / 13:14:50 / cg" |
|
4414 | 9982 |
! |
9983 |
||
9490 | 9984 |
hasOnlyDirectoriesSelected |
9985 |
^ self currentSelectedObjects conform:[:file | file isDirectory]. |
|
9986 |
||
9987 |
"Created: / 20-05-2010 / 10:45:03 / cg" |
|
9988 |
! |
|
9989 |
||
4414 | 9990 |
hasOnlyFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9991 |
|
7560 | 9992 |
^ self currentSelectedObjects conform:[:file | file isDirectory not]. |
9993 |
||
9994 |
"Modified: / 04-12-2006 / 13:15:01 / cg" |
|
4414 | 9995 |
! |
9996 |
||
9490 | 9997 |
hasTwoDirectoriesSelected |
9998 |
||
9999 |
^ self currentSelectedObjects size == 2 |
|
10000 |
and:[self hasOnlyDirectoriesSelected] |
|
10001 |
||
10002 |
"Created: / 20-05-2010 / 10:45:18 / cg" |
|
10003 |
! |
|
10004 |
||
4414 | 10005 |
hasTwoFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
10006 |
|
7560 | 10007 |
^ self currentSelectedObjects size == 2 |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
10008 |
and:[self hasOnlyFilesSelected] |
7560 | 10009 |
|
10010 |
"Modified: / 04-12-2006 / 13:15:04 / cg" |
|
14577 | 10011 |
! |
10012 |
||
18751 | 10013 |
selectFiles:aCollectionOfFiles |
10014 |
self subclassResponsibility |
|
10015 |
||
10016 |
"Created: / 02-05-2019 / 18:40:04 / Claus Gittinger" |
|
10017 |
! |
|
10018 |
||
14577 | 10019 |
selectNextFile |
10020 |
self |
|
10021 |
applicationNamed:#DirectoryContentsBrowser |
|
10022 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectNextFile ]]. |
|
10023 |
! |
|
10024 |
||
10025 |
selectPreviousFile |
|
10026 |
self |
|
10027 |
applicationNamed:#DirectoryContentsBrowser |
|
10028 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectPreviousFile ]]. |
|
18751 | 10029 |
! |
10030 |
||
10031 |
selectedItems |
|
10032 |
self subclassResponsibility |
|
10033 |
||
10034 |
"Created: / 02-05-2019 / 21:27:38 / Claus Gittinger" |
|
3892 | 10035 |
! ! |
10036 |
||
3964 | 10037 |
!AbstractFileBrowser methodsFor:'sorting'! |
10038 |
||
3989 | 10039 |
currentSortOrder |
17790 | 10040 |
^ self |
10041 |
aspectFor:#currentSortOrder |
|
10042 |
ifAbsent:[ |
|
10043 |
(Dictionary new |
|
10044 |
at:#column put:nil; |
|
10045 |
at:#reverse put:false; |
|
10046 |
at:#sortCaseless put:false; |
|
10047 |
yourself |
|
10048 |
) asValue |
|
10049 |
]. |
|
10050 |
||
10051 |
"Modified: / 25-11-2017 / 17:43:00 / cg" |
|
3989 | 10052 |
! |
10053 |
||
10054 |
sortBlockHolder |
|
10055 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 10056 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
10057 |
selector:#fileName |
|
10058 |
sortCaseless:self sortCaseless value |
|
10059 |
sortReverse:false) asValue. |
|
3989 | 10060 |
]. |
10061 |
! |
|
10062 |
||
10063 |
sortBlockProperty |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
10064 |
|v| |
4027 | 10065 |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
10066 |
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
|
10067 |
v addDependent:self. |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
10068 |
^ v. |
3989 | 10069 |
! |
10070 |
||
10071 |
sortCaseless |
|
4201 | 10072 |
" aspect for sort caseless " |
3989 | 10073 |
|
13000 | 10074 |
^ self |
10075 |
aspectFor:#sortCaseless |
|
10076 |
ifAbsent:[ (Filename isCaseSensitive not) asValue ] |
|
3989 | 10077 |
! |
10078 |
||
4074 | 10079 |
sortDirectoriesBeforeFiles |
10080 |
||
4201 | 10081 |
" aspect for sort directories always before files" |
4074 | 10082 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
10083 |
! |
|
10084 |
||
3989 | 10085 |
sortFileListsBy:instanceName |
10086 |
||
10087 |
self sortFileListsBy:instanceName withReverse:true |
|
10088 |
! |
|
10089 |
||
10090 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
10091 |
| aSymbol sortCaselessLocal currentSortOrder sorter isReverse| |
3964 | 10092 |
|
10093 |
aSymbol := instanceName asSymbol. |
|
4027 | 10094 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 10095 |
sortCaselessLocal := self sortCaseless value. |
4027 | 10096 |
currentSortOrder := self currentSortOrder value. |
17790 | 10097 |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
10098 |
currentSortOrder isEmptyOrNil ifTrue:[ |
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
10099 |
self currentSortOrder value:(currentSortOrder := Dictionary new). |
4343 | 10100 |
currentSortOrder at:#column put:aSymbol. |
10101 |
currentSortOrder at:#reverse put:false. |
|
10102 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 10103 |
] ifFalse:[ |
4343 | 10104 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
10105 |
"/ sort caseless changed |
|
10106 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
10107 |
] ifFalse:[ |
|
10108 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
10109 |
"/ same column like before - change sort order ifReverse is true |
|
10110 |
aBoolean ifTrue:[ |
|
10111 |
isReverse := currentSortOrder at:#reverse. |
|
10112 |
currentSortOrder at:#reverse put:(isReverse not). |
|
10113 |
]. |
|
10114 |
] ifFalse:[ |
|
10115 |
"/ another column - remark column |
|
10116 |
currentSortOrder at:#column put:aSymbol. |
|
10117 |
] |
|
10118 |
] |
|
3964 | 10119 |
]. |
4027 | 10120 |
self currentSortOrder changed. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
10121 |
|
5383 | 10122 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
10123 |
selector:instanceName |
|
10124 |
sortCaseless:sortCaselessLocal |
|
10125 |
sortReverse:(currentSortOrder at:#reverse). |
|
10126 |
self sortBlockHolder value:sorter. |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
10127 |
|
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
10128 |
"Modified: / 18-09-2007 / 09:42:47 / cg" |
17790 | 10129 |
"Modified (format): / 25-11-2017 / 17:43:31 / cg" |
3964 | 10130 |
! ! |
10131 |
||
3892 | 10132 |
!AbstractFileBrowser methodsFor:'startup & release'! |
10133 |
||
16720 | 10134 |
initializeAspects |
10135 |
aspects := IdentityDictionary new. |
|
10136 |
aspects at:#applications put:(IdentityDictionary new). |
|
10137 |
! |
|
10138 |
||
3892 | 10139 |
makeDependent |
4074 | 10140 |
self filterModel addDependent:self. |
4004 | 10141 |
self currentFileNameHolder addDependent:self. |
4074 | 10142 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 10143 |
self sortCaseless addDependent:self. |
4011 | 10144 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
10145 |
self rootHolder addDependent:self. |
3892 | 10146 |
! |
10147 |
||
10148 |
masterApplication:anApplication |
|
10149 |
||
10150 |
masterApplication isNil ifTrue:[ |
|
4414 | 10151 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
10152 |
aspects := anApplication aspects |
|
10153 |
] ifFalse:[ |
|
10154 |
aspects isNil ifTrue:[ |
|
16721 | 10155 |
self initializeAspects. |
4414 | 10156 |
] |
10157 |
]. |
|
10158 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10159 |
"/ self makeDependent. |
3892 | 10160 |
]. |
3952 | 10161 |
^ super masterApplication:anApplication. |
3892 | 10162 |
! |
10163 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10164 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10165 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10166 |
super postBuildWith:aBuilder. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10167 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
10168 |
|
3892 | 10169 |
postOpenWith:aBuilder |
10170 |
||
10171 |
super postOpenWith:aBuilder. |
|
14655 | 10172 |
"/ now done for all windowGroups by the group itself |
10173 |
"/ self windowGroup showWaitCursorWhenBusyForMillis:100. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
10174 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
10175 |
"Modified: / 25-07-2006 / 09:12:45 / cg" |
3892 | 10176 |
! ! |
10177 |
||
10178 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
10179 |
||
10180 |
files |
|
10181 |
"return the value of the instance variable 'files' (automatically generated)" |
|
10182 |
||
10183 |
^ files |
|
10184 |
! |
|
10185 |
||
10186 |
files:something |
|
10187 |
"set the value of the instance variable 'files' (automatically generated)" |
|
10188 |
||
10189 |
files := something. |
|
10190 |
! |
|
10191 |
||
10192 |
method |
|
10193 |
"return the value of the instance variable 'method' (automatically generated)" |
|
10194 |
||
10195 |
^ method |
|
10196 |
! |
|
10197 |
||
10198 |
method:something |
|
10199 |
"set the value of the instance variable 'method' (automatically generated)" |
|
10200 |
||
10201 |
method := something. |
|
10202 |
! ! |
|
10203 |
||
10204 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
10205 |
||
10206 |
locked |
|
10207 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
10208 |
||
10209 |
locked isNil ifTrue:[ |
|
4414 | 10210 |
locked := false. |
3892 | 10211 |
]. |
10212 |
^ locked |
|
10213 |
! ! |
|
10214 |
||
10215 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
10216 |
||
10217 |
doIfUnLocked:aBlock |
|
10218 |
||
10219 |
self locked ifFalse:[ |
|
4414 | 10220 |
aBlock value. |
3892 | 10221 |
]. |
10222 |
! |
|
10223 |
||
10224 |
doLocked:aBlock |
|
10225 |
||
10226 |
locked := true. |
|
4004 | 10227 |
aBlock ensure:[ |
4414 | 10228 |
locked := false. |
4004 | 10229 |
] |
3892 | 10230 |
! ! |
10231 |
||
3952 | 10232 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
10233 |
||
6369 | 10234 |
defaultHistorySize |
10235 |
^ 50 |
|
3892 | 10236 |
! ! |
10237 |
||
6371 | 10238 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 10239 |
|
10240 |
new |
|
6371 | 10241 |
^ (super new) initializeHistory. |
6369 | 10242 |
! ! |
10243 |
||
10244 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
10245 |
||
10246 |
historySize |
|
10247 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
10248 |
^ historySize |
|
10249 |
! |
|
10250 |
||
10251 |
historySize:aNumber |
|
10252 |
historySize := aNumber |
|
4032 | 10253 |
! ! |
10254 |
||
3892 | 10255 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
10256 |
||
3952 | 10257 |
addToHistory:aPath |
15803 | 10258 |
| item pathToAdd sep| |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10259 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10260 |
pathToAdd := aPath. |
15803 | 10261 |
(pathToAdd endsWith:(sep := Filename separator)) ifTrue:[ |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10262 |
pathToAdd asFilename isRootDirectory ifFalse:[ |
15803 | 10263 |
pathToAdd := pathToAdd copyButLast:(sep asString size). |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10264 |
] |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10265 |
]. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10266 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10267 |
item := self getItemFor:pathToAdd. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10268 |
self backForwardListAdd:pathToAdd. |
3952 | 10269 |
item isNil ifTrue:[ |
4347 | 10270 |
" not already in history" |
6369 | 10271 |
self size >= self historySize ifTrue:[ |
4347 | 10272 |
self removeLast. |
10273 |
]. |
|
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
10274 |
item := DirectoryHistoryItem path:pathToAdd. |
3952 | 10275 |
] ifFalse:[ |
4347 | 10276 |
"already been there before; move the entry to |
10277 |
the beginning, so it will fall out later." |
|
10278 |
self remove:item. |
|
10381
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10279 |
]. |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10280 |
self addFirst:item |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10281 |
|
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
10282 |
"Modified: / 24-07-2011 / 07:12:54 / cg" |
3952 | 10283 |
! |
10284 |
||
4347 | 10285 |
backForwardListAdd:aPath |
10286 |
|pathIndex| |
|
10287 |
||
10288 |
pathIndex := backForwardList indexOf:aPath. |
|
10289 |
pathIndex == 0 ifTrue:[ |
|
10290 |
" a new path comes in remove forward paths " |
|
10291 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
10292 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
10293 |
]. |
|
10294 |
] ifFalse:[ |
|
10295 |
backForwardList remove:aPath. |
|
10296 |
pathIndex <= backForwardIndex ifTrue:[ |
|
10297 |
backForwardIndex := backForwardIndex - 1. |
|
10298 |
] |
|
4022 | 10299 |
]. |
4347 | 10300 |
backForwardList add:aPath afterIndex:backForwardIndex. |
10301 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 10302 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 10303 |
backForwardList removeFirst. |
10304 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 10305 |
]. |
4347 | 10306 |
! |
10307 |
||
10308 |
goBackward |
|
4288 | 10309 |
"return the first path of the backward list; |
10310 |
remove it from the back list and add it ti the forward list." |
|
4022 | 10311 |
|
4347 | 10312 |
|retPath| |
10313 |
||
10314 |
self canBackward ifTrue:[ |
|
10315 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
10316 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 10317 |
]. |
4022 | 10318 |
^ retPath. |
10319 |
! |
|
10320 |
||
10321 |
goForward |
|
4288 | 10322 |
"return the first path of the forward list; |
10323 |
remove it from the list." |
|
4022 | 10324 |
|
4347 | 10325 |
|retPath| |
10326 |
||
10327 |
self canForward ifTrue:[ |
|
10328 |
retPath := backForwardList at:backForwardIndex + 1. |
|
10329 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 10330 |
]. |
4022 | 10331 |
^ retPath. |
10332 |
! |
|
10333 |
||
10334 |
resetForwardBackward |
|
10335 |
||
4347 | 10336 |
self initialize |
4022 | 10337 |
! |
10338 |
||
10339 |
setPosition:aPosition for:aPath |
|
10340 |
||
10341 |
self do:[:item| |
|
4414 | 10342 |
item path = aPath ifTrue:[ |
10343 |
item position:aPosition. |
|
10344 |
] |
|
4022 | 10345 |
]. |
3892 | 10346 |
! ! |
10347 |
||
4870 | 10348 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 10349 |
|
6371 | 10350 |
initializeHistory |
4032 | 10351 |
|
4347 | 10352 |
backForwardList := OrderedCollection new. |
10353 |
self reverseDo:[:el| |
|
10354 |
backForwardList add:el path. |
|
10355 |
]. |
|
10356 |
backForwardIndex := backForwardList size. |
|
4032 | 10357 |
! ! |
10358 |
||
3892 | 10359 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
10360 |
||
4288 | 10361 |
canBackward |
4347 | 10362 |
|
10363 |
^ backForwardIndex > 1 |
|
4288 | 10364 |
! |
10365 |
||
3892 | 10366 |
canForward |
4347 | 10367 |
|
10368 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
10369 |
! |
|
10370 |
||
10371 |
getBackCollection |
|
10372 |
||
10373 |
| backCol | |
|
10374 |
||
10375 |
backCol := OrderedCollection new. |
|
10376 |
self canBackward ifTrue:[ |
|
10377 |
| tmpCol | |
|
10378 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
10379 |
tmpCol reverseDo:[ :el| |
|
10380 |
backCol add:el. |
|
10381 |
] |
|
10382 |
]. |
|
10383 |
^ backCol |
|
3952 | 10384 |
! |
10385 |
||
10386 |
getForwardCollection |
|
10387 |
||
4347 | 10388 |
| forwCol | |
10389 |
||
10390 |
forwCol := OrderedCollection new. |
|
10391 |
self canForward ifTrue:[ |
|
10392 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
10393 |
]. |
|
10394 |
^ forwCol |
|
3952 | 10395 |
! |
10396 |
||
10397 |
getItemFor:aPath |
|
6627 | 10398 |
^ self detect:[:item| item path = aPath] ifNone:nil. |
10399 |
"/ self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
10400 |
"/ ^ nil. |
|
3952 | 10401 |
! |
10402 |
||
10403 |
getPositionFor:aPath |
|
10404 |
||
10405 |
|item| |
|
10406 |
||
10407 |
item := self getItemFor:aPath. |
|
10408 |
||
10409 |
item notNil ifTrue:[ |
|
4414 | 10410 |
^ item position. |
3952 | 10411 |
]. |
10412 |
^ nil |
|
10413 |
! |
|
10414 |
||
10415 |
includesPath:aPath |
|
6627 | 10416 |
^ self contains:[:item | item path = aPath]. |
10417 |
||
10418 |
"/ self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
10419 |
"/ ^ false. |
|
4347 | 10420 |
! |
10421 |
||
10422 |
nextBackwardItem |
|
10423 |
"return the first path of the backward list" |
|
10424 |
||
10425 |
|retPath| |
|
10426 |
||
10427 |
self canBackward ifTrue:[ |
|
10428 |
retPath := backForwardList at:backForwardIndex. |
|
10429 |
]. |
|
10430 |
^ retPath. |
|
10431 |
! |
|
10432 |
||
10433 |
nextForwardItem |
|
10434 |
"return the first path of the forward list" |
|
10435 |
||
10436 |
|retPath| |
|
10437 |
||
10438 |
self canForward ifTrue:[ |
|
10439 |
retPath := backForwardList at:backForwardIndex + 1. |
|
10440 |
]. |
|
10441 |
^ retPath. |
|
3952 | 10442 |
! ! |
10443 |
||
10444 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
10445 |
||
10446 |
path:aPath |
|
10447 |
||
10448 |
^ self new path:aPath |
|
10449 |
! ! |
|
10450 |
||
10451 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
10452 |
||
6433 | 10453 |
asFilename |
10454 |
^ path asFilename |
|
10455 |
! |
|
10456 |
||
3952 | 10457 |
path |
10458 |
"return the value of the instance variable 'path' (automatically generated)" |
|
10459 |
||
10460 |
^ path |
|
10461 |
! |
|
10462 |
||
10463 |
path:something |
|
10464 |
"set the value of the instance variable 'path' (automatically generated)" |
|
10465 |
||
10466 |
path := something. |
|
10467 |
! |
|
10468 |
||
10469 |
position |
|
10470 |
"return the value of the instance variable 'position' (automatically generated)" |
|
10471 |
||
10472 |
^ position |
|
10473 |
! |
|
10474 |
||
10475 |
position:something |
|
10476 |
"set the value of the instance variable 'position' (automatically generated)" |
|
10477 |
||
10478 |
position := something. |
|
10479 |
! |
|
10480 |
||
10481 |
printString |
|
10482 |
||
10483 |
^ self path asString |
|
3892 | 10484 |
! ! |
10485 |
||
10486 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
10487 |
||
10488 |
withValue:aValue isHolder:aBoolean |
|
10489 |
||
10490 |
| instance | |
|
10491 |
||
10492 |
instance := self basicNew. |
|
10493 |
instance value:aValue. |
|
10494 |
instance isHolder:aBoolean. |
|
10495 |
^ instance |
|
10496 |
! ! |
|
10497 |
||
10498 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
10499 |
||
10500 |
isHolder |
|
10501 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
10502 |
||
10503 |
^ isHolder |
|
10504 |
! |
|
10505 |
||
10506 |
isHolder:something |
|
10507 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
|
10508 |
||
10509 |
isHolder := something. |
|
10510 |
! |
|
10511 |
||
10512 |
value |
|
10513 |
"return the value of the instance variable 'value' (automatically generated)" |
|
10514 |
||
10515 |
^ value |
|
10516 |
! |
|
10517 |
||
10518 |
value:something |
|
10519 |
"set the value of the instance variable 'value' (automatically generated)" |
|
10520 |
||
10521 |
value := something. |
|
10522 |
! ! |
|
10523 |
||
10524 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
10525 |
||
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10526 |
version |
15803 | 10527 |
^ '$Header$' |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10528 |
! |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
10529 |
|
8832 | 10530 |
version_CVS |
15803 | 10531 |
^ '$Header$' |
3892 | 10532 |
! ! |
12094 | 10533 |