author | Claus Gittinger <cg@exept.de> |
Wed, 13 Sep 2017 16:21:45 +0200 | |
changeset 17689 | 3aab8c42049c |
parent 17686 | c6fc2da19287 |
child 17715 | 72492b5581af |
permissions | -rw-r--r-- |
5140 | 1 |
" |
2 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
15211 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
14 |
"{ NameSpace: Smalltalk }" |
|
15 |
||
16 |
ApplicationModel subclass:#AbstractFileBrowser |
|
17 |
instanceVariableNames:'aspects' |
|
16720 | 18 |
classVariableNames:'CommandHistory CommandHistorySize DefaultCommandPerSuffix |
19 |
DefaultFilters DirectoryBookmarks LastEnforcedNameSpace |
|
20 |
LastFileDiffDirectory LastFileDiffFile LastFileSelection |
|
21 |
LastMercurialRepository LastMoveDestination LastMustMatchPattern |
|
22 |
LastScriptBlockString RootHolder RuntimeAspects |
|
23 |
VisitedDirectories' |
|
15211 | 24 |
poolDictionaries:'' |
25 |
category:'Interface-Tools-File' |
|
26 |
! |
|
3892 | 27 |
|
28 |
AbstractFileBrowser class instanceVariableNames:'DisabledCursorImage EnabledCursorImage' |
|
29 |
||
30 |
" |
|
31 |
The following class instance variables are inherited by this class: |
|
32 |
||
14126 | 33 |
ApplicationModel - ClassResources |
34 |
Model - |
|
35 |
Object - |
|
3892 | 36 |
" |
37 |
! |
|
38 |
||
39 |
Object subclass:#Clipboard |
|
14126 | 40 |
instanceVariableNames:'method files' |
41 |
classVariableNames:'' |
|
42 |
poolDictionaries:'' |
|
43 |
privateIn:AbstractFileBrowser |
|
3892 | 44 |
! |
45 |
||
46 |
Object subclass:#CodeExecutionLock |
|
14126 | 47 |
instanceVariableNames:'locked' |
48 |
classVariableNames:'' |
|
49 |
poolDictionaries:'' |
|
50 |
privateIn:AbstractFileBrowser |
|
3892 | 51 |
! |
52 |
||
4366 | 53 |
List subclass:#DirectoryHistory |
14126 | 54 |
instanceVariableNames:'forwardList backList lastWasForwardPath lastBackPath lastAddPath |
55 |
backForwardList backForwardIndex historySize' |
|
56 |
classVariableNames:'HistorySize' |
|
57 |
poolDictionaries:'' |
|
58 |
privateIn:AbstractFileBrowser |
|
3952 | 59 |
! |
60 |
||
61 |
Object subclass:#DirectoryHistoryItem |
|
14126 | 62 |
instanceVariableNames:'path position' |
63 |
classVariableNames:'' |
|
64 |
poolDictionaries:'' |
|
65 |
privateIn:AbstractFileBrowser::DirectoryHistory |
|
3892 | 66 |
! |
67 |
||
68 |
Object subclass:#SaveAspectItem |
|
14126 | 69 |
instanceVariableNames:'value isHolder' |
70 |
classVariableNames:'' |
|
71 |
poolDictionaries:'' |
|
72 |
privateIn:AbstractFileBrowser |
|
3892 | 73 |
! |
74 |
||
5140 | 75 |
!AbstractFileBrowser class methodsFor:'documentation'! |
76 |
||
77 |
copyright |
|
78 |
" |
|
79 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
80 |
All Rights Reserved |
|
81 |
||
82 |
This software is furnished under a license and may be used |
|
83 |
only in accordance with the terms of that license and with the |
|
84 |
inclusion of the above copyright notice. This software may not |
|
85 |
be provided or otherwise made available to, or used by, any |
|
86 |
other person. No title to or ownership of the software is |
|
87 |
hereby transferred. |
|
88 |
" |
|
5967 | 89 |
! |
90 |
||
91 |
documentation |
|
92 |
" |
|
93 |
[Author:] |
|
94 |
Christian Penk |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
95 |
|
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
96 |
Notice: this certainly needs a redesign - all those abstract-abstract classes which |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
97 |
define stuff which is only needed in some parts makes this hard to understand. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
98 |
Especially the fact, that AbstractFileBrowser defines things both as abstract superclass |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
99 |
and as a container is almost incomprehensable... |
5967 | 100 |
" |
5140 | 101 |
! ! |
3892 | 102 |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
103 |
!AbstractFileBrowser class methodsFor:'accessing'! |
3952 | 104 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
105 |
currentSelection |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
106 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
107 |
LastFileSelection isNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
108 |
LastFileSelection := #(). |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
109 |
]. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
110 |
^ LastFileSelection |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
111 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
112 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
113 |
currentSelection:aFilenameCol |
6589 | 114 |
aFilenameCol notEmptyOrNil ifTrue:[ |
12102 | 115 |
LastFileSelection := aFilenameCol collect:[:file | (file ? '') asFilename] |
6589 | 116 |
] |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
117 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
118 |
|
3952 | 119 |
directoryHistory |
120 |
||
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
121 |
VisitedDirectories isNil ifTrue:[ |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
122 |
VisitedDirectories := self directoryHistoryClass new. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
123 |
"/ VisitedDirectories inspect. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
124 |
]. |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
125 |
^ VisitedDirectories |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
126 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
127 |
"Modified: / 21-11-2012 / 08:45:49 / cg" |
3952 | 128 |
! |
129 |
||
130 |
resetClassVars |
|
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
131 |
VisitedDirectories := nil. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
132 |
LastFileSelection := nil. |
5936 | 133 |
|
134 |
" |
|
135 |
AbstractFileBrowser resetClassVars |
|
136 |
" |
|
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
137 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
138 |
"Modified: / 21-11-2012 / 08:45:53 / cg" |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
139 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
140 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
141 |
rootHolder |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
142 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
143 |
^ RootHolder |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
144 |
! |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
145 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
146 |
rootHolder:aRoot |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
147 |
|
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
148 |
RootHolder := aRoot |
3952 | 149 |
! ! |
150 |
||
4915 | 151 |
!AbstractFileBrowser class methodsFor:'accessing-bookmarks'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
152 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
153 |
addBookmark:aDirectoryPath |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
154 |
"add aDirectoryPath to the list of our known bookmarks. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
155 |
Do not add duplicates." |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
156 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
157 |
|bookmarks| |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
158 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
159 |
bookmarks := self directoryBookmarks. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
160 |
(bookmarks includes:aDirectoryPath) ifFalse:[ |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
161 |
bookmarks add:aDirectoryPath asFilename. |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
162 |
]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
163 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
164 |
|
8013 | 165 |
bookmarksFrom:aFileNameOrString |
12390 | 166 |
|bookmarks s fileName line| |
8013 | 167 |
|
168 |
fileName := aFileNameOrString asFilename. |
|
169 |
[ |
|
170 |
s := fileName readStream. |
|
171 |
] on:OpenError do:[:ex| |
|
172 |
^ nil. |
|
173 |
]. |
|
174 |
||
175 |
bookmarks := OrderedCollection new. |
|
176 |
[s atEnd] whileFalse:[ |
|
12390 | 177 |
line := s nextLine. |
178 |
(line startsWith:';') ifFalse:[ |
|
179 |
bookmarks add:(Base64Coder decode:line) asString. |
|
180 |
] |
|
8013 | 181 |
]. |
182 |
s close. |
|
183 |
||
184 |
^ bookmarks |
|
185 |
! |
|
186 |
||
4679 | 187 |
defaultBookMarksFileDirectory |
12390 | 188 |
"the directory, where the default bookmarks are stored (as defaultBookMarksFilename)" |
189 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
190 |
^ Filename homeDirectory |
4679 | 191 |
! |
192 |
||
193 |
defaultBookMarksFilename |
|
12390 | 194 |
"the filename, in which the default bookmarks are stored (in defaultBookMarksDirectory)" |
195 |
||
4679 | 196 |
^ '.fileBrowserBookmarks' |
197 |
! |
|
198 |
||
199 |
directoryBookmarks |
|
200 |
DirectoryBookmarks isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
201 |
self loadBookmarksFrom:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename). |
4679 | 202 |
|
203 |
DirectoryBookmarks isEmptyOrNil ifTrue:[ |
|
204 |
DirectoryBookmarks := OrderedCollection new. |
|
205 |
DirectoryBookmarks add:Filename homeDirectory asAbsoluteFilename. |
|
206 |
DirectoryBookmarks add:Filename currentDirectory asAbsoluteFilename. |
|
207 |
] |
|
208 |
]. |
|
209 |
^ DirectoryBookmarks |
|
210 |
||
211 |
" |
|
5438
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
212 |
DirectoryBookmarks := nil. |
fa19d526d85d
directoryBookmarks must be stored without lineLimit (see base64 encoder)
Claus Gittinger <cg@exept.de>
parents:
5437
diff
changeset
|
213 |
self directoryBookmarks. |
4679 | 214 |
" |
215 |
! |
|
216 |
||
8013 | 217 |
directoryBookmarks: collectionOfFilenames |
218 |
||
219 |
DirectoryBookmarks := collectionOfFilenames. |
|
220 |
self saveBookmarksInDefaultBookmarksFile. |
|
221 |
! |
|
222 |
||
223 |
editBookmarksWithDefault: aFilenameOrNil |
|
224 |
| oldBookmarks newBookmarks | |
|
225 |
||
226 |
oldBookmarks := self directoryBookmarks copy. |
|
227 |
newBookmarks := BookmarksEditDialog openWith: oldBookmarks defaultBookmark: aFilenameOrNil. |
|
228 |
newBookmarks isNil ifTrue:[^ self]. |
|
229 |
self directoryBookmarks: newBookmarks. |
|
9681
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
230 |
|
00195b8c6cf6
comment/format in: #editBookmarksWithDefault:
Claus Gittinger <cg@exept.de>
parents:
9677
diff
changeset
|
231 |
"Modified: / 13-01-2011 / 12:52:28 / cg" |
8013 | 232 |
! |
233 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
234 |
hasBookmarks |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
235 |
^ self directoryBookmarks notEmptyOrNil |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
236 |
! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
237 |
|
4679 | 238 |
loadBookmarksFrom:aFileNameOrString |
8013 | 239 |
|bookmarks| |
240 |
||
241 |
bookmarks := self bookmarksFrom: aFileNameOrString. |
|
242 |
bookmarks isNil ifTrue:[^ self]. |
|
4679 | 243 |
|
244 |
DirectoryBookmarks := OrderedCollection new. |
|
245 |
bookmarks do:[:eachPath | |
|
246 |
self addBookmark:eachPath asFilename |
|
247 |
]. |
|
248 |
! |
|
249 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
250 |
removeBookmark:aDirectoryPath |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
251 |
|bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
252 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
253 |
bookmarks := self directoryBookmarks. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
254 |
bookmarks isEmptyOrNil ifTrue:[ ^ self]. |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
255 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
256 |
bookmarks remove:aDirectoryPath ifAbsent:[]. |
4679 | 257 |
! |
258 |
||
259 |
saveBookmarks |
|
260 |
|fn| |
|
261 |
||
262 |
fn := Dialog |
|
9607 | 263 |
requestFileNameForSave:(self resources string:'Save Bookmarks') |
4679 | 264 |
default:(self defaultBookMarksFilename) |
265 |
fromDirectory:(self defaultBookMarksFileDirectory). |
|
266 |
fn isEmptyOrNil ifTrue:[^ self]. |
|
267 |
||
268 |
self saveBookmarksIn:fn |
|
9607 | 269 |
|
270 |
"Modified: / 27-10-2010 / 11:27:09 / cg" |
|
4679 | 271 |
! |
272 |
||
8013 | 273 |
saveBookmarks: bookmarks in:aFileNameOrString |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
274 |
"save the bokmarks in aFileNameOrString. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
275 |
Use Base64 coding" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
276 |
|
13683 | 277 |
|bookmarkStream fileName coder| |
4679 | 278 |
|
279 |
fileName := aFileNameOrString asFilename. |
|
280 |
fileName exists ifTrue:[ |
|
13683 | 281 |
fileName renameTo:(fileName addSuffix:'sav'). |
4679 | 282 |
]. |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
283 |
bookmarkStream := fileName writeStream. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
284 |
|
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
285 |
"save each bookmark in one line" |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
286 |
coder := (Base64Coder on:bookmarkStream) lineLimit:nil. |
4679 | 287 |
bookmarks do:[:eachPath | |
6114
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
288 |
eachPath asFilename pathName acceptVisitor:coder. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
289 |
coder flush. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
290 |
bookmarkStream cr. |
36fb19194510
Rename Base64Coder>>#decodingOf: to #decode:
Stefan Vogel <sv@exept.de>
parents:
6113
diff
changeset
|
291 |
]. |
12391 | 292 |
bookmarkStream syncData; close. |
5960 | 293 |
! |
294 |
||
8013 | 295 |
saveBookmarksIn:aFileNameOrString |
296 |
"save the bokmarks in aFileNameOrString. |
|
297 |
Use Base64 coding" |
|
298 |
||
299 |
| bookmarks | |
|
300 |
||
301 |
bookmarks := self directoryBookmarks. |
|
302 |
self saveBookmarks: bookmarks in:aFileNameOrString |
|
303 |
! |
|
304 |
||
5960 | 305 |
saveBookmarksInDefaultBookmarksFile |
306 |
self saveBookmarksIn:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename) |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
307 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
308 |
|
4915 | 309 |
!AbstractFileBrowser class methodsFor:'accessing-classes'! |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
310 |
|
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
311 |
directoryHistoryClass |
12062
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
312 |
^ DirectoryHistory |
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
313 |
|
0056d17cf012
conflict classVar vs. private class
Claus Gittinger <cg@exept.de>
parents:
11996
diff
changeset
|
314 |
"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
|
315 |
! ! |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
316 |
|
3892 | 317 |
!AbstractFileBrowser class methodsFor:'defaults'! |
318 |
||
319 |
commandHistory |
|
320 |
||
321 |
CommandHistory isNil ifTrue:[ |
|
4414 | 322 |
CommandHistory := OrderedCollection new. |
3892 | 323 |
]. |
324 |
^ CommandHistory |
|
325 |
! |
|
326 |
||
327 |
commandHistorySize |
|
4190 | 328 |
"max no of entries in the HistoryList " |
6369 | 329 |
|
3892 | 330 |
CommandHistorySize isNil ifTrue:[ |
6369 | 331 |
CommandHistorySize := 150 |
3892 | 332 |
]. |
333 |
^ CommandHistorySize |
|
334 |
! |
|
335 |
||
336 |
defaultFilterList |
|
337 |
||
338 |
DefaultFilters isNil ifTrue:[ |
|
4414 | 339 |
DefaultFilters := #( '*' |
340 |
'*.st' |
|
341 |
'*.[h,c]*' |
|
12760 | 342 |
'*.txt; *.htm*' |
343 |
'*.gif; *.xpm; *.jpg; *.png' |
|
344 |
'~*o; ~*.obj; ~*.dll;' |
|
4414 | 345 |
) |
3892 | 346 |
]. |
347 |
^ DefaultFilters. |
|
12760 | 348 |
|
349 |
" |
|
350 |
DefaultFilters := nil |
|
351 |
" |
|
3892 | 352 |
! |
353 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
354 |
initialCommandFor:fileName in:aDirectory intoBox:aBox |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
355 |
"set a useful initial command in an execute box." |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
356 |
|
4523 | 357 |
|mime cmd select path suffix baseName pathName| |
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
358 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
359 |
path := aDirectory filenameFor:fileName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
360 |
baseName := path baseName. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
361 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
362 |
|
16160 | 363 |
cmd := UserPreferences current defaultFileOpenCommandFor:suffix. |
364 |
cmd notNil ifTrue:[ |
|
365 |
aBox initialText:(cmd bindWith:fileName pathName). |
|
366 |
^ self |
|
367 |
]. |
|
368 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
369 |
mime := MIMETypes mimeTypeForSuffix:suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
370 |
"/ mime notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
371 |
"/ cmd := self initialCommandForMIME:mime file:path |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
372 |
"/ ]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
373 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
374 |
"/ 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
|
375 |
"/ XXX or from resources. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
376 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
377 |
(path type == #regular) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
378 |
path isExecutableProgram ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
379 |
aBox initialText:(path pathName , ' <arguments>'). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
380 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
381 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
382 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
383 |
select := true. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
384 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
385 |
"some heuristics - my personal preferences ... |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
386 |
(actually this should come from a configfile)" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
387 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
388 |
(baseName endsWith:'akefile') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
389 |
aBox initialText:'make target' selectFrom:6 to:11. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
390 |
^ self |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
391 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
392 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
393 |
cmd := MIMETypes defaultCommandPerMIME at:mime ifAbsent:nil. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
394 |
cmd notNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
395 |
select := false |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
396 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
397 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
398 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
399 |
suffix := path suffix. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
400 |
(suffix = 'C') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
401 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
402 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
403 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
404 |
suffix := suffix asLowercase. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
405 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
406 |
(suffix = 'taz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
407 |
aBox initialText:'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
408 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
409 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
410 |
(suffix = 'tar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
411 |
cmd := 'tar tvf %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
412 |
select := 7. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
413 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
414 |
(suffix = 'zoo') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
415 |
cmd := 'zoo -list %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
416 |
select := 9. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
417 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
418 |
(suffix = 'zip') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
419 |
cmd := 'unzip -l %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
420 |
select := 8. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
421 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
422 |
(suffix = 'jar') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
423 |
cmd := 'unzip -l %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
424 |
select := 8. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
425 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
426 |
(suffix = 'z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
427 |
(baseName asLowercase endsWith:'tar.z') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
428 |
cmd := 'zcat %1 | tar tvf -'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
429 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
430 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
431 |
cmd := 'uncompress %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
432 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
433 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
434 |
(suffix = 'gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
435 |
(baseName asLowercase endsWith:'tar.gz') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
436 |
cmd := ('gunzip < %1 | tar tvf -' ). |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
437 |
select := false. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
438 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
439 |
cmd := 'gunzip %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
440 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
441 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
442 |
(suffix = 'html') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
443 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
444 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
445 |
(suffix = 'htm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
446 |
cmd := 'netscape %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
447 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
448 |
(suffix = 'uue') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
449 |
cmd := 'uudecode %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
450 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
451 |
(suffix = 'c') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
452 |
cmd := 'cc -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
453 |
select := 5. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
454 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
455 |
(suffix = 'cc') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
456 |
cmd := 'g++ -c %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
457 |
select := 6. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
458 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
459 |
(suffix = 'xbm') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
460 |
cmd := 'bitmap %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
461 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
462 |
(suffix = 'ps') ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
463 |
cmd := 'ghostview %1' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
464 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
465 |
((suffix = '1') or:[suffix = 'man']) ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
466 |
cmd := 'nroff -man %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
467 |
select := 10. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
468 |
]. |
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 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
472 |
cmd isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
473 |
DefaultCommandPerSuffix isNil ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
474 |
cmd := '<cmd>' |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
475 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
476 |
cmd := DefaultCommandPerSuffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
477 |
at:suffix |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
478 |
ifAbsent:'<cmd>'. |
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 |
cmd := cmd , ' %1'. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
481 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
482 |
|
4523 | 483 |
pathName := path pathName. |
484 |
OperatingSystem isUNIXlike ifTrue:[ |
|
485 |
pathName includesSeparator ifTrue:[ |
|
486 |
pathName := '"' , pathName , '"' |
|
487 |
] |
|
488 |
]. |
|
489 |
||
490 |
cmd := cmd bindWith:pathName. |
|
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
491 |
select == false ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
492 |
aBox initialText:cmd |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
493 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
494 |
select class == Interval ifTrue:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
495 |
aBox initialText:cmd selectFrom:select start to:select stop |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
496 |
] ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
497 |
select isInteger ifFalse:[ |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
498 |
select := (cmd indexOf:Character space ifAbsent:[cmd size + 1]) - 1. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
499 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
500 |
aBox initialText:cmd selectFrom:1 to:select |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
501 |
]. |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
502 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
503 |
] |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
504 |
|
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
505 |
"Modified: / 24.9.1997 / 16:34:52 / stefan" |
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
506 |
"Modified: / 9.4.1998 / 17:15:57 / cg" |
3892 | 507 |
! |
508 |
||
5941 | 509 |
listOfRuntimeValuesToRemember |
510 |
" list of all aspects that will be remembered after closing a FileBrowserV2" |
|
511 |
||
512 |
^ #( |
|
513 |
"/ #filterModel |
|
514 |
#enableFileHistory |
|
515 |
#fileHistory |
|
516 |
#currentSortOrder |
|
517 |
#sortBlockProperty |
|
518 |
) |
|
3892 | 519 |
! |
520 |
||
521 |
resetAspects |
|
522 |
||
523 |
RuntimeAspects := nil. |
|
524 |
||
5941 | 525 |
" |
526 |
self resetAspects |
|
527 |
" |
|
3892 | 528 |
! |
529 |
||
530 |
runtimeAspects |
|
531 |
||
532 |
RuntimeAspects isNil ifTrue:[ |
|
4414 | 533 |
RuntimeAspects := Dictionary new. |
3892 | 534 |
]. |
535 |
^ RuntimeAspects |
|
536 |
! |
|
537 |
||
4201 | 538 |
userPreferencesAspectList |
539 |
" list of all aspects that will be saved with save settings |
|
540 |
that aspects will be image consistent if the settings are saved in Launcher |
|
11501 | 541 |
don't forget to add a access methods in UserPreferences if you add a aspect here |
4201 | 542 |
" |
543 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
544 |
^ Dictionary |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
545 |
withKeysAndValues:#( |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
546 |
viewDirsInContentsBrowser true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
547 |
showDirectoryTree true |
11501 | 548 |
showHiddenFiles true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
549 |
viewDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
550 |
viewDetails true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
551 |
viewDirectoryDescription false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
552 |
viewFilesInDirectoryTree false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
553 |
viewGroup false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
554 |
viewOwner false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
555 |
viewPermissions false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
556 |
viewPreview false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
557 |
viewSize true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
558 |
viewSizeInKiloBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
559 |
viewSizeInBytes false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
560 |
viewTime true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
561 |
viewType false |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
562 |
openMultipleApplicationsForType false |
7788 | 563 |
filenameEntryFieldVisibleHolder true |
564 |
toolBarVisibleHolder true |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
565 |
sortDirectoriesBeforeFiles true |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
566 |
openAlwaysInTextEditor false |
15111 | 567 |
alwaysUseSmalltalkTools true |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
568 |
sortCaseless false |
13011 | 569 |
"/ 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
|
570 |
showDirectoriesOnTop false |
4201 | 571 |
) |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
572 |
|
11501 | 573 |
"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
|
574 |
"Modified: / 12-08-2014 / 13:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3892 | 575 |
! ! |
576 |
||
17202 | 577 |
!AbstractFileBrowser class methodsFor:'drag & drop'! |
578 |
||
579 |
doStartDrag:aDropSource in:aView |
|
580 |
"set the cursors before starting the drag & drop operation" |
|
581 |
||
582 |
|hdl| |
|
583 |
||
584 |
hdl := DragAndDropManager new. |
|
585 |
||
586 |
hdl disabledCursor:self disabledCursorIcon. |
|
587 |
hdl enabledCursor:self enabledCursorIcon. |
|
588 |
hdl alienCursor:nil. |
|
589 |
||
590 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft. |
|
591 |
||
592 |
"Modified: / 23-07-2007 / 23:00:38 / cg" |
|
593 |
! ! |
|
594 |
||
5398 | 595 |
!AbstractFileBrowser class methodsFor:'help specs'! |
596 |
||
8261 | 597 |
basicFlyByHelpSpec |
6099 | 598 |
<resource: #help> |
599 |
||
8261 | 600 |
^ super flyByHelpSpec addPairsFrom:#( |
6099 | 601 |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
602 |
#lockFileEncoding |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
603 |
'Do not guess the encoding from the file''s contents.' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
604 |
|
6100 | 605 |
#closeTabButton |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
606 |
'Close this tab' |
6100 | 607 |
|
6099 | 608 |
#addTerminal |
17182 | 609 |
'Add a shell terminal page' |
6099 | 610 |
|
611 |
#make |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
612 |
'Call the make command' |
6099 | 613 |
|
614 |
#searchFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
615 |
'Search a file' |
6099 | 616 |
|
617 |
#directoryUp |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
618 |
'Directory up' |
6099 | 619 |
|
620 |
#directoryBack |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
621 |
'Directory back' |
6099 | 622 |
|
623 |
#directoryForward |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
624 |
'Directory forward' |
6099 | 625 |
|
626 |
#directoryHistory |
|
627 |
'Directory' |
|
628 |
||
629 |
#copyFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
630 |
'Copy the selected file(s)' |
6099 | 631 |
|
632 |
#cutFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
633 |
'Cut the selected file(s)' |
6099 | 634 |
|
635 |
#editFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
636 |
'Edit the selected file' |
6099 | 637 |
|
638 |
#fileHome |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
639 |
'Goto home directory' |
6099 | 640 |
|
8093 | 641 |
#fileDesktop |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
642 |
'Goto desktop directory' |
8093 | 643 |
|
6099 | 644 |
#fileGotoDefault |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
645 |
'Goto default directory (ST/X start directory)' |
6099 | 646 |
|
6454 | 647 |
#fileGotoSmalltalkDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
648 |
'Goto Smalltalk directory (ST/X application)' |
6454 | 649 |
|
6456 | 650 |
#fileGotoDefaultDirectory |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
651 |
'Goto current directory' |
6456 | 652 |
|
6099 | 653 |
#pasteFile |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
654 |
'Paste file(s)' |
6099 | 655 |
|
656 |
#deleteFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
657 |
'Delete the selected file(s)' |
6099 | 658 |
|
659 |
#fileIn |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
660 |
'File in' |
6099 | 661 |
|
662 |
#fileHistory |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
663 |
'File history' |
6099 | 664 |
|
665 |
#fileGotoBookmark |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
666 |
'Goto bookmarked directory' |
6099 | 667 |
|
668 |
#hideToolBar |
|
13910 | 669 |
'Hide the toolbar (show again via "View"-menu)' |
6099 | 670 |
|
671 |
#hideFilenameEntryField |
|
13910 | 672 |
'Hide filename & filter fields (show again via "View"-menu)' |
673 |
||
674 |
#hideBookmarks |
|
675 |
'Hide the bookmarks (show again via "View"-menu)' |
|
6099 | 676 |
|
677 |
#openChangeBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
678 |
'Open a Changebrowser on file' |
6099 | 679 |
|
680 |
#showFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
681 |
'Show file details' |
6099 | 682 |
|
683 |
#hideFileDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
684 |
'Hide file details' |
6099 | 685 |
|
686 |
#toggleDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
687 |
'Show/hide file details' |
6099 | 688 |
|
689 |
#viewDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
690 |
'Show/hide file details' |
6099 | 691 |
|
692 |
#selectDetails |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
693 |
'Select file details to be shown' |
6099 | 694 |
|
8088 | 695 |
#showDifferences |
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
696 |
'Show differences between file and editor versions' |
8088 | 697 |
|
698 |
#toggleHexDisplay |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
699 |
'Toggle between hexadecimal and textual representation' |
8088 | 700 |
|
701 |
#findInBrowser |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
702 |
'Navigate the browser''s file list to the edited file' |
8088 | 703 |
|
704 |
#saveFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
705 |
'Save the editor''s contents into the file' |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
706 |
|
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
707 |
#saveFileAs |
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
708 |
'Save the editor''s contents into another file' |
8088 | 709 |
|
710 |
#reloadFile |
|
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
711 |
'Reload from the file' |
8088 | 712 |
|
713 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
714 |
'Send to the printer' |
8088 | 715 |
|
6099 | 716 |
). |
717 |
||
8261 | 718 |
" |
719 |
self flyByHelpSpec |
|
720 |
" |
|
721 |
||
10775
d5be49adfc5e
changed: #basicFlyByHelpSpec
Claus Gittinger <cg@exept.de>
parents:
10762
diff
changeset
|
722 |
"Modified: / 06-10-2011 / 14:55:27 / cg" |
8261 | 723 |
! |
724 |
||
725 |
flyByHelpSpec |
|
726 |
<resource: #programHelp> |
|
727 |
||
728 |
|spec hist resources| |
|
729 |
||
730 |
spec := self basicFlyByHelpSpec. |
|
731 |
||
732 |
"/ add help items for the history |
|
6099 | 733 |
hist := self directoryHistory. |
734 |
hist notNil ifTrue:[ |
|
735 |
resources := self classResources. |
|
736 |
hist canForward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
737 |
spec at:#directoryForward put:[ resources string:'Forward to: %1' with:hist nextForwardItem ]. |
6099 | 738 |
]. |
739 |
hist canBackward ifTrue:[ |
|
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
740 |
spec at:#directoryBack put:[ resources string:'Back to: %1' with:hist nextBackwardItem ]. |
6099 | 741 |
]. |
742 |
]. |
|
743 |
^ spec. |
|
744 |
||
745 |
" |
|
746 |
self flyByHelpSpec |
|
747 |
" |
|
748 |
||
7879
9c64dea1b14a
block as a flyByHelpText item.
Claus Gittinger <cg@exept.de>
parents:
7869
diff
changeset
|
749 |
"Modified: / 03-11-2007 / 12:05:01 / cg" |
5398 | 750 |
! ! |
751 |
||
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
752 |
!AbstractFileBrowser class methodsFor:'image specs'! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
753 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
754 |
clearHistoryIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
755 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
756 |
|
17413 | 757 |
^ ToolbarIconLibrary deleteIcon |
758 |
"/ ^ Icon deleteIcon |
|
759 |
||
760 |
"Modified: / 15-02-2017 / 19:45:24 / cg" |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
761 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
762 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
763 |
copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
764 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
765 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
766 |
^ ToolbarIconLibrary copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
767 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
768 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
769 |
cutIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
770 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
771 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
772 |
^ ToolbarIconLibrary cut20x20Icon2 "cut28x28Icon" |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
773 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
774 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
775 |
deleteIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
776 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
777 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
778 |
^ ToolbarIconLibrary erase20x20Icon "/ delete28x28Icon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
779 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
780 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
781 |
directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
782 |
<resource: #programImage> |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
783 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
784 |
^ ToolbarIconLibrary directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
785 |
! |
3892 | 786 |
|
15211 | 787 |
disabledCursorIcon |
788 |
"This resource specification was automatically generated |
|
789 |
by the ImageEditor of ST/X." |
|
790 |
||
791 |
"Do not manually edit this!! If it is corrupted, |
|
792 |
the ImageEditor may not be able to read the specification." |
|
793 |
||
794 |
" |
|
17202 | 795 |
self disabledCursorIcon inspect |
796 |
ImageEditor openOnClass:self andSelector:#disabledCursorIcon |
|
15211 | 797 |
Icon flushCachedIcons |
798 |
" |
|
799 |
||
800 |
<resource: #image> |
|
801 |
||
802 |
^Icon |
|
803 |
constantNamed:#'AbstractFileBrowser class disabledCursorIcon' |
|
804 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
805 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@XF@@@H@P@@DOB@@BLLP@AA@"@@RHD @H1AD@BRHI@@$QBP@IBH$@BPQI@@"BLP@D QH@ADBB@@H0Q@@AC |
|
806 |
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:' |
|
807 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@_>@@@O?0@@G?>@@C<O0@A?@>@@_8G @O?A<@C38O@@<_C0@OC8<@C0_O@@>C?0@G _8@A<C>@@O0_@@A? |
|
808 |
? @@O?0@@A?8@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
809 |
! |
|
6337 | 810 |
|
15211 | 811 |
enabledCursorIcon |
812 |
"This resource specification was automatically generated |
|
813 |
by the ImageEditor of ST/X." |
|
814 |
||
815 |
"Do not manually edit this!! If it is corrupted, |
|
816 |
the ImageEditor may not be able to read the specification." |
|
817 |
||
818 |
" |
|
17202 | 819 |
self enabledCursorIcon inspect |
820 |
ImageEditor openOnClass:self andSelector:#enabledCursorIcon |
|
15211 | 821 |
Icon flushCachedIcons |
822 |
" |
|
823 |
||
824 |
<resource: #image> |
|
825 |
||
826 |
^Icon |
|
827 |
constantNamed:#'AbstractFileBrowser class enabledCursorIcon' |
|
828 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
829 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@@@@@?0_0@@@@@@C?A?@@@@@@@@AP@@@@T@@@@E@@@@A |
|
830 |
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:' |
|
831 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@?8?0@O>O<@C?#?@@@G@@@@A0@@@@\@@@@G@@@@A |
|
832 |
0@@@@\@@@@G@@@@A0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
833 |
! |
|
6337 | 834 |
|
3892 | 835 |
fileInIcon |
836 |
<resource: #programImage> |
|
837 |
||
6116 | 838 |
^ ToolbarIconLibrary fileInIcon |
3892 | 839 |
! |
840 |
||
6079 | 841 |
historyBackIcon |
842 |
<resource: #programImage> |
|
843 |
||
844 |
^ ToolbarIconLibrary historyBackIcon |
|
845 |
! |
|
846 |
||
847 |
historyForwardIcon |
|
848 |
<resource: #programImage> |
|
849 |
||
850 |
^ ToolbarIconLibrary historyForwardIcon |
|
851 |
! |
|
852 |
||
3892 | 853 |
homeIcon |
854 |
<resource: #programImage> |
|
855 |
||
6079 | 856 |
^ ToolbarIconLibrary homeIcon |
3892 | 857 |
! |
858 |
||
6074 | 859 |
homeIcon2 |
6079 | 860 |
<resource: #programImage> |
861 |
||
862 |
^ ToolbarIconLibrary homeIcon2 |
|
6074 | 863 |
! |
864 |
||
865 |
htmlReloadIcon |
|
866 |
<resource: #programImage> |
|
867 |
||
868 |
^ ToolbarIconLibrary reload22x22Icon |
|
869 |
! |
|
870 |
||
15211 | 871 |
leftDownIcon |
872 |
<resource: #image> |
|
873 |
"This resource specification was automatically generated |
|
874 |
by the ImageEditor of ST/X." |
|
875 |
"Do not manually edit this!! If it is corrupted, |
|
876 |
the ImageEditor may not be able to read the specification." |
|
877 |
" |
|
878 |
self leftDownIcon inspect |
|
879 |
ImageEditor openOnClass:self andSelector:#leftDownIcon" |
|
880 |
||
881 |
^ Icon constantNamed:#'AbstractFileBrowser class leftDownIcon' |
|
882 |
ifAbsentPut:[ |
|
883 |
(Depth2Image new) |
|
884 |
width:28; |
|
885 |
height:28; |
|
886 |
photometric:(#palette); |
|
887 |
bitsPerSample:(#( 2 )); |
|
888 |
samplesPerPixel:(1); |
|
889 |
bits:(ByteArray |
|
890 |
fromPackedString:' |
|
891 |
UUUUUUUUUUUPAUUUUUUUP@UUUUUUUPB!!UUUUUU@B*AUUUUU@B*(UUUUUPB** UUUUPB***AUUUTB***(EUUUB****%UUUR*****UUUUU@*%UUUUUUPJ)UUUU |
|
892 |
UUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*$@@@@AUPJ*****)UTB******UU@******%UPJ*****)UTAUUUU |
|
893 |
UUUU@@@@@@@AUUUUUUUUUP@a'); |
|
894 |
colorMapFromArray:#[ 255 255 255 0 0 0 40 40 100 255 0 0 ]; |
|
895 |
mask:((ImageMask new) |
|
896 |
width:28; |
|
897 |
height:28; |
|
898 |
bits:(ByteArray |
|
899 |
fromPackedString:' |
|
900 |
@@@@@@@@@@@@ @@@@\@@@@O @@@G<@@@C? @@A?<@@@?? @@_?<@@G?? @@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C??? @???8@O? |
|
901 |
?>@C??? @???8@O??>@@@@@@@@@@@@@a'); |
|
902 |
yourself); |
|
903 |
yourself |
|
904 |
] |
|
905 |
! |
|
906 |
||
907 |
menuHistoryList9x20Icon |
|
908 |
<resource: #image> |
|
909 |
"This resource specification was automatically generated |
|
910 |
by the ImageEditor of ST/X." |
|
911 |
"Do not manually edit this!! If it is corrupted, |
|
912 |
the ImageEditor may not be able to read the specification." |
|
913 |
" |
|
914 |
self menuHistoryList9x20Icon inspect |
|
915 |
ImageEditor openOnClass:self andSelector:#menuHistoryList9x20Icon |
|
916 |
Icon flushCachedIcons" |
|
917 |
||
918 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryList9x20Icon' |
|
919 |
ifAbsentPut:[ |
|
920 |
(Depth1Image new) |
|
921 |
width:9; |
|
922 |
height:20; |
|
923 |
photometric:(#palette); |
|
924 |
bitsPerSample:(#( 1 )); |
|
925 |
samplesPerPixel:(1); |
|
926 |
bits:(ByteArray |
|
927 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
928 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
929 |
mask:((ImageMask new) |
|
930 |
width:9; |
|
931 |
height:20; |
|
932 |
bits:(ByteArray |
|
933 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
934 |
yourself); |
|
935 |
yourself |
|
936 |
] |
|
937 |
! |
|
938 |
||
939 |
menuHistoryListIcon |
|
940 |
<resource: #image> |
|
941 |
"This resource specification was automatically generated |
|
942 |
by the ImageEditor of ST/X." |
|
943 |
"Do not manually edit this!! If it is corrupted, |
|
944 |
the ImageEditor may not be able to read the specification." |
|
945 |
" |
|
946 |
self menuHistoryListIcon inspect |
|
947 |
ImageEditor openOnClass:self andSelector:#menuHistoryListIcon" |
|
948 |
||
949 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryListIcon' |
|
950 |
ifAbsentPut:[ |
|
951 |
(Depth1Image new) |
|
952 |
width:12; |
|
953 |
height:12; |
|
954 |
photometric:(#palette); |
|
955 |
bitsPerSample:(#( 1 )); |
|
956 |
samplesPerPixel:(1); |
|
957 |
bits:(ByteArray fromPackedString:'??S?<O?0??C?<O?0??/?=_?0??C?<O?0'); |
|
958 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
959 |
mask:((ImageMask new) |
|
960 |
width:12; |
|
961 |
height:12; |
|
962 |
bits:(ByteArray fromPackedString:'@@@O@@<@C0A?8C?@G8@O@@X@@@A?8@@@'); |
|
963 |
yourself); |
|
964 |
yourself |
|
965 |
] |
|
966 |
! |
|
3892 | 967 |
|
6087 | 968 |
newDirectoryIcon |
6074 | 969 |
<resource: #programImage> |
970 |
||
6087 | 971 |
^ ToolbarIconLibrary newDirectoryIcon |
3923 | 972 |
! |
973 |
||
6091 | 974 |
removeTabIcon |
975 |
<resource: #programImage> |
|
976 |
||
977 |
^ ToolbarIconLibrary removeTabIcon |
|
978 |
! |
|
979 |
||
3892 | 980 |
vt100Terminal |
981 |
<resource: #programImage> |
|
982 |
||
983 |
^ ToolbarIconLibrary shell20x20Icon |
|
984 |
! ! |
|
985 |
||
5528 | 986 |
!AbstractFileBrowser class methodsFor:'interface specs'! |
987 |
||
15211 | 988 |
encodingDialogSpec |
989 |
"This resource specification was automatically generated |
|
990 |
by the UIPainter of ST/X." |
|
991 |
||
992 |
"Do not manually edit this!! If it is corrupted, |
|
993 |
the UIPainter may not be able to read the specification." |
|
994 |
||
995 |
" |
|
996 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#encodingDialogSpec |
|
997 |
AbstractFileBrowser new openInterface:#encodingDialogSpec |
|
998 |
" |
|
999 |
||
1000 |
<resource: #canvas> |
|
1001 |
||
1002 |
^ |
|
1003 |
#(FullSpec |
|
1004 |
name: encodingDialogSpec |
|
1005 |
window: |
|
1006 |
(WindowSpec |
|
1007 |
label: 'File Encoding' |
|
1008 |
name: 'File Encoding' |
|
1009 |
min: (Point 10 10) |
|
1010 |
bounds: (Rectangle 0 0 379 590) |
|
1011 |
) |
|
1012 |
component: |
|
1013 |
(SpecCollection |
|
1014 |
collection: ( |
|
1015 |
(LabelSpec |
|
1016 |
label: 'Select the External (File-) Encoding:' |
|
1017 |
name: 'Label1' |
|
1018 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1019 |
translateLabel: true |
|
1020 |
adjust: left |
|
1021 |
) |
|
1022 |
(DataSetSpec |
|
1023 |
name: 'Table1' |
|
1024 |
layout: (LayoutFrame 0 0 30 0 0 1 -60 1) |
|
1025 |
model: selectedEncoding |
|
1026 |
hasHorizontalScrollBar: true |
|
1027 |
hasVerticalScrollBar: true |
|
1028 |
dataList: encodingList |
|
1029 |
has3Dseparators: true |
|
1030 |
columns: |
|
1031 |
(Array |
|
1032 |
||
1033 |
(DataSetColumnSpec |
|
1034 |
label: 'Encoding' |
|
1035 |
labelButtonType: Button |
|
1036 |
height: heightOfFirstRow |
|
1037 |
model: at: |
|
1038 |
canSelect: false |
|
1039 |
isResizeable: false |
|
1040 |
showRowSeparator: false |
|
1041 |
showColSeparator: false |
|
1042 |
) |
|
1043 |
(DataSetColumnSpec |
|
1044 |
label: 'Description' |
|
1045 |
labelButtonType: Button |
|
1046 |
height: heightOfFirstRow |
|
1047 |
model: at: |
|
1048 |
canSelect: false |
|
1049 |
isResizeable: false |
|
1050 |
showRowSeparator: false |
|
1051 |
showColSeparator: false |
|
1052 |
) |
|
1053 |
) |
|
1054 |
doubleClickChannel: accept |
|
1055 |
) |
|
1056 |
(CheckBoxSpec |
|
1057 |
label: 'Lock Encoding' |
|
1058 |
name: 'LockEncodingCheckBox' |
|
1059 |
layout: (LayoutFrame 3 0 -60 1 217 0 -30 1) |
|
1060 |
activeHelpKey: lockFileEncoding |
|
1061 |
model: lockFileEncoding |
|
1062 |
translateLabel: true |
|
1063 |
) |
|
1064 |
(HorizontalPanelViewSpec |
|
1065 |
name: 'ButtonPanel' |
|
1066 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1067 |
horizontalLayout: fitSpace |
|
1068 |
verticalLayout: center |
|
1069 |
horizontalSpace: 3 |
|
1070 |
verticalSpace: 3 |
|
1071 |
reverseOrderIfOKAtLeft: true |
|
1072 |
component: |
|
1073 |
(SpecCollection |
|
1074 |
collection: ( |
|
1075 |
(ActionButtonSpec |
|
1076 |
label: 'Cancel' |
|
1077 |
name: 'Button2' |
|
1078 |
translateLabel: true |
|
1079 |
model: cancel |
|
1080 |
extent: (Point 183 22) |
|
1081 |
) |
|
1082 |
(ActionButtonSpec |
|
1083 |
label: 'OK' |
|
1084 |
name: 'Button1' |
|
1085 |
translateLabel: true |
|
1086 |
model: accept |
|
1087 |
isDefault: true |
|
1088 |
extent: (Point 184 22) |
|
1089 |
) |
|
1090 |
) |
|
1091 |
||
1092 |
) |
|
1093 |
) |
|
1094 |
) |
|
1095 |
||
1096 |
) |
|
1097 |
) |
|
1098 |
! |
|
1099 |
||
1100 |
lineEndConventionDialogSpec |
|
1101 |
"This resource specification was automatically generated |
|
1102 |
by the UIPainter of ST/X." |
|
1103 |
||
1104 |
"Do not manually edit this!! If it is corrupted, |
|
1105 |
the UIPainter may not be able to read the specification." |
|
1106 |
||
1107 |
" |
|
1108 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#lineEndConventionDialogSpec |
|
1109 |
AbstractFileBrowser new openInterface:#lineEndConventionDialogSpec |
|
1110 |
" |
|
1111 |
||
1112 |
<resource: #canvas> |
|
1113 |
||
1114 |
^ |
|
15212 | 1115 |
#(FullSpec |
1116 |
name: lineEndConventionDialogSpec |
|
1117 |
window: |
|
1118 |
(WindowSpec |
|
1119 |
label: 'Line-End Convention' |
|
1120 |
name: 'Line-End Convention' |
|
1121 |
min: (Point 10 10) |
|
1122 |
bounds: (Rectangle 0 0 379 239) |
|
1123 |
) |
|
1124 |
component: |
|
1125 |
(SpecCollection |
|
1126 |
collection: ( |
|
1127 |
(LabelSpec |
|
1128 |
label: 'Select the Line-End Convention (used when saving files):' |
|
1129 |
name: 'Label1' |
|
1130 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1131 |
translateLabel: true |
|
1132 |
adjust: left |
|
1133 |
) |
|
1134 |
(VerticalPanelViewSpec |
|
1135 |
name: 'VerticalPanel1' |
|
1136 |
layout: (LayoutFrame 20 0 40 0 0 1 -30 1) |
|
1137 |
horizontalLayout: fit |
|
1138 |
verticalLayout: topSpace |
|
1139 |
horizontalSpace: 3 |
|
1140 |
verticalSpace: 3 |
|
1141 |
component: |
|
1142 |
(SpecCollection |
|
1143 |
collection: ( |
|
1144 |
(RadioButtonSpec |
|
1145 |
label: 'NL (Unix)' |
|
1146 |
name: 'RadioButton1' |
|
1147 |
translateLabel: true |
|
1148 |
model: lineEndConvention |
|
1149 |
isTriggerOnDown: true |
|
1150 |
select: nl |
|
1151 |
extent: (Point 359 22) |
|
1152 |
) |
|
1153 |
(RadioButtonSpec |
|
1154 |
label: 'CR-NL (MSDOS)' |
|
1155 |
name: 'RadioButton4' |
|
1156 |
translateLabel: true |
|
1157 |
model: lineEndConvention |
|
1158 |
isTriggerOnDown: true |
|
1159 |
select: crlf |
|
1160 |
extent: (Point 359 22) |
|
1161 |
) |
|
1162 |
(RadioButtonSpec |
|
1163 |
label: 'CR (VMS and pre OSX mac)' |
|
1164 |
name: 'RadioButton5' |
|
1165 |
translateLabel: true |
|
1166 |
model: lineEndConvention |
|
1167 |
isTriggerOnDown: true |
|
1168 |
select: cr |
|
1169 |
extent: (Point 359 22) |
|
15211 | 1170 |
) |
15212 | 1171 |
(RadioButtonSpec |
1172 |
label: 'ETX (some modem protocols and mainframe files)' |
|
1173 |
name: 'RadioButton6' |
|
1174 |
translateLabel: true |
|
1175 |
model: lineEndConvention |
|
1176 |
isTriggerOnDown: true |
|
1177 |
select: etx |
|
1178 |
extent: (Point 359 22) |
|
1179 |
) |
|
1180 |
(RadioButtonSpec |
|
1181 |
label: 'EOT (some modem protocols and mainframe files)' |
|
1182 |
name: 'RadioButton7' |
|
1183 |
translateLabel: true |
|
1184 |
model: lineEndConvention |
|
1185 |
isTriggerOnDown: true |
|
1186 |
select: eot |
|
1187 |
extent: (Point 359 22) |
|
15211 | 1188 |
) |
15212 | 1189 |
) |
1190 |
||
1191 |
) |
|
15211 | 1192 |
) |
15212 | 1193 |
(HorizontalPanelViewSpec |
1194 |
name: 'ButtonPanel' |
|
1195 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1196 |
horizontalLayout: fitSpace |
|
1197 |
verticalLayout: center |
|
1198 |
horizontalSpace: 3 |
|
1199 |
verticalSpace: 3 |
|
1200 |
reverseOrderIfOKAtLeft: true |
|
1201 |
component: |
|
1202 |
(SpecCollection |
|
1203 |
collection: ( |
|
1204 |
(ActionButtonSpec |
|
1205 |
label: 'Cancel' |
|
1206 |
name: 'Button2' |
|
1207 |
translateLabel: true |
|
1208 |
model: cancel |
|
1209 |
extent: (Point 185 22) |
|
1210 |
) |
|
1211 |
(ActionButtonSpec |
|
1212 |
label: 'OK' |
|
1213 |
name: 'Button1' |
|
1214 |
translateLabel: true |
|
1215 |
model: accept |
|
1216 |
isDefault: true |
|
1217 |
extent: (Point 185 22) |
|
1218 |
) |
|
1219 |
) |
|
1220 |
||
1221 |
) |
|
1222 |
) |
|
1223 |
) |
|
1224 |
||
1225 |
) |
|
1226 |
) |
|
15211 | 1227 |
! |
1228 |
||
1229 |
tabStopConversionDialogSpec |
|
1230 |
"This resource specification was automatically generated |
|
1231 |
by the UIPainter of ST/X." |
|
1232 |
||
1233 |
"Do not manually edit this!! If it is corrupted, |
|
1234 |
the UIPainter may not be able to read the specification." |
|
1235 |
||
1236 |
" |
|
1237 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#tabStopConversionDialogSpec |
|
1238 |
AbstractFileBrowser new openInterface:#tabStopConversionDialogSpec |
|
1239 |
" |
|
1240 |
||
1241 |
<resource: #canvas> |
|
1242 |
||
1243 |
^ |
|
1244 |
#(FullSpec |
|
1245 |
name: 'tabStopConversionDialogSpec' |
|
1246 |
window: |
|
1247 |
(WindowSpec |
|
1248 |
label: 'Tab-Stop Conversion' |
|
1249 |
name: 'Tab-Stop Conversion' |
|
1250 |
min: (Point 10 10) |
|
1251 |
bounds: (Rectangle 0 0 379 239) |
|
1252 |
) |
|
1253 |
component: |
|
1254 |
(SpecCollection |
|
1255 |
collection: ( |
|
1256 |
(LabelSpec |
|
1257 |
label: 'Select the Tab-Stop Conversion (used when saving files):' |
|
1258 |
name: 'Label1' |
|
1259 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1260 |
translateLabel: true |
|
1261 |
adjust: left |
|
1262 |
) |
|
1263 |
(VerticalPanelViewSpec |
|
1264 |
name: 'VerticalPanel1' |
|
1265 |
layout: (LayoutFrame 0 0 30 0 0 1 -30 1) |
|
1266 |
horizontalLayout: center |
|
1267 |
verticalLayout: center |
|
1268 |
horizontalSpace: 3 |
|
1269 |
verticalSpace: 3 |
|
1270 |
component: |
|
1271 |
(SpecCollection |
|
1272 |
collection: ( |
|
1273 |
(RadioButtonSpec |
|
1274 |
label: '4' |
|
1275 |
name: 'RadioButton1' |
|
1276 |
translateLabel: true |
|
1277 |
model: tabStops |
|
1278 |
isTriggerOnDown: true |
|
1279 |
select: 4 |
|
1280 |
extent: (Point 136 22) |
|
1281 |
) |
|
1282 |
(RadioButtonSpec |
|
1283 |
label: '8' |
|
1284 |
name: 'RadioButton4' |
|
1285 |
translateLabel: true |
|
1286 |
model: tabStops |
|
1287 |
isTriggerOnDown: true |
|
1288 |
select: 8 |
|
1289 |
extent: (Point 136 22) |
|
1290 |
) |
|
1291 |
) |
|
1292 |
||
1293 |
) |
|
1294 |
) |
|
1295 |
(HorizontalPanelViewSpec |
|
1296 |
name: 'ButtonPanel' |
|
1297 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1298 |
horizontalLayout: fitSpace |
|
1299 |
verticalLayout: center |
|
1300 |
horizontalSpace: 3 |
|
1301 |
verticalSpace: 3 |
|
1302 |
reverseOrderIfOKAtLeft: true |
|
1303 |
component: |
|
1304 |
(SpecCollection |
|
1305 |
collection: ( |
|
1306 |
(ActionButtonSpec |
|
1307 |
label: 'Cancel' |
|
1308 |
name: 'Button2' |
|
1309 |
translateLabel: true |
|
1310 |
model: cancel |
|
1311 |
extent: (Point 185 22) |
|
1312 |
) |
|
1313 |
(ActionButtonSpec |
|
1314 |
label: 'OK' |
|
1315 |
name: 'Button1' |
|
1316 |
translateLabel: true |
|
1317 |
model: accept |
|
1318 |
isDefault: true |
|
1319 |
extent: (Point 185 22) |
|
1320 |
) |
|
1321 |
) |
|
1322 |
||
1323 |
) |
|
1324 |
) |
|
1325 |
) |
|
1326 |
||
1327 |
) |
|
1328 |
) |
|
1329 |
||
1330 |
"Modified: / 28-02-2012 / 11:12:38 / cg" |
|
1331 |
! ! |
|
5528 | 1332 |
|
3892 | 1333 |
!AbstractFileBrowser class methodsFor:'menu specs'! |
1334 |
||
15211 | 1335 |
baseBookmarksMenuSpec |
1336 |
"This resource specification was automatically generated |
|
1337 |
by the MenuEditor of ST/X." |
|
1338 |
||
1339 |
"Do not manually edit this!! If it is corrupted, |
|
1340 |
the MenuEditor may not be able to read the specification." |
|
1341 |
||
1342 |
" |
|
1343 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec |
|
1344 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec)) startUp |
|
1345 |
" |
|
1346 |
||
1347 |
<resource: #menu> |
|
1348 |
||
1349 |
^ |
|
1350 |
#(Menu |
|
1351 |
( |
|
1352 |
(MenuItem |
|
1353 |
enabled: currentFilesHasDirectories |
|
1354 |
label: 'Add Bookmark' |
|
1355 |
itemValue: addBookmark |
|
1356 |
translateLabel: true |
|
1357 |
) |
|
1358 |
(MenuItem |
|
1359 |
enabled: hasBookmarksToRemove |
|
1360 |
label: 'Remove Bookmark' |
|
1361 |
itemValue: removeBookmark |
|
1362 |
translateLabel: true |
|
1363 |
) |
|
1364 |
(MenuItem |
|
1365 |
label: 'Save Bookmarks In...' |
|
1366 |
itemValue: saveBookmarks |
|
1367 |
translateLabel: true |
|
1368 |
) |
|
1369 |
) |
|
1370 |
nil |
|
1371 |
nil |
|
1372 |
) |
|
1373 |
! |
|
1374 |
||
1375 |
baseBookmarksMenuSpec2 |
|
1376 |
"This resource specification was automatically generated |
|
1377 |
by the MenuEditor of ST/X." |
|
1378 |
||
1379 |
"Do not manually edit this!! If it is corrupted, |
|
1380 |
the MenuEditor may not be able to read the specification." |
|
1381 |
||
1382 |
" |
|
1383 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec2 |
|
1384 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec2)) startUp |
|
1385 |
" |
|
1386 |
||
1387 |
<resource: #menu> |
|
1388 |
||
1389 |
^ |
|
1390 |
#(Menu |
|
1391 |
( |
|
1392 |
(MenuItem |
|
1393 |
label: 'Edit Bookmarks' |
|
1394 |
itemValue: editBookmarks |
|
1395 |
translateLabel: true |
|
1396 |
) |
|
1397 |
(MenuItem |
|
1398 |
label: '-' |
|
1399 |
) |
|
1400 |
(MenuItem |
|
1401 |
enabled: currentFilesHasDirectories |
|
1402 |
label: 'Add Bookmark' |
|
1403 |
itemValue: addBookmark |
|
1404 |
translateLabel: true |
|
1405 |
) |
|
1406 |
) |
|
1407 |
nil |
|
1408 |
nil |
|
1409 |
) |
|
1410 |
! |
|
1411 |
||
1412 |
browserMenu |
|
1413 |
"This resource specification was automatically generated |
|
1414 |
by the MenuEditor of ST/X." |
|
1415 |
||
1416 |
"Do not manually edit this!! If it is corrupted, |
|
1417 |
the MenuEditor may not be able to read the specification." |
|
1418 |
||
1419 |
||
1420 |
" |
|
1421 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#browserMenu |
|
1422 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser browserMenu)) startUp |
|
1423 |
" |
|
1424 |
||
1425 |
<resource: #menu> |
|
1426 |
||
1427 |
^ |
|
1428 |
#(Menu |
|
1429 |
( |
|
1430 |
(MenuItem |
|
1431 |
label: 'Spawn Filebrowser' |
|
1432 |
itemValue: doSpawn |
|
1433 |
translateLabel: true |
|
1434 |
shortcutKey: Ctrln |
|
1435 |
) |
|
1436 |
(MenuItem |
|
1437 |
label: 'Windows Explorer' |
|
1438 |
itemValue: doOpenExplorer |
|
1439 |
translateLabel: true |
|
1440 |
isVisible: systemIsDOS |
|
1441 |
) |
|
1442 |
(MenuItem |
|
1443 |
label: 'Open Finder' |
|
1444 |
itemValue: doOpenFinder |
|
1445 |
translateLabel: true |
|
1446 |
isVisible: systemIsOSX |
|
1447 |
) |
|
1448 |
(MenuItem |
|
1449 |
label: 'C Browser' |
|
1450 |
itemValue: doOpenCBrowser |
|
1451 |
translateLabel: true |
|
1452 |
isVisible: cBrowserMenuItemVisible |
|
1453 |
) |
|
1454 |
(MenuItem |
|
1455 |
label: '-' |
|
1456 |
) |
|
1457 |
(MenuItem |
|
1458 |
label: 'Add Text Editor Page' |
|
1459 |
itemValue: newTextEditor |
|
1460 |
translateLabel: true |
|
1461 |
shortcutKey: Ctrlt |
|
1462 |
) |
|
1463 |
(MenuItem |
|
1464 |
label: 'Add Shell Terminal Page' |
|
1465 |
itemValue: doAddTerminal |
|
1466 |
translateLabel: true |
|
1467 |
) |
|
1468 |
(MenuItem |
|
1469 |
label: 'Add Archiver Page' |
|
1470 |
itemValue: doAddArchiver |
|
1471 |
translateLabel: true |
|
1472 |
) |
|
1473 |
(MenuItem |
|
1474 |
label: 'Add Search Page' |
|
1475 |
itemValue: doOpenSearchFile |
|
1476 |
translateLabel: true |
|
1477 |
) |
|
1478 |
(MenuItem |
|
1479 |
label: '-' |
|
1480 |
isVisible: false |
|
1481 |
) |
|
1482 |
(MenuItem |
|
1483 |
label: 'Settings...' |
|
1484 |
itemValue: doOpenSettings |
|
1485 |
translateLabel: true |
|
1486 |
isVisible: false |
|
1487 |
) |
|
1488 |
(MenuItem |
|
1489 |
label: 'Encoding...' |
|
1490 |
itemValue: fileEncodingDialog |
|
1491 |
translateLabel: true |
|
1492 |
isVisible: false |
|
1493 |
) |
|
1494 |
(MenuItem |
|
1495 |
label: 'Line End Convention...' |
|
1496 |
itemValue: lineEndConventionDialog |
|
1497 |
translateLabel: true |
|
1498 |
isVisible: false |
|
1499 |
) |
|
1500 |
(MenuItem |
|
1501 |
label: 'Tab Stop Conversion...' |
|
1502 |
itemValue: tabStopConversionDialog |
|
1503 |
translateLabel: true |
|
1504 |
isVisible: false |
|
1505 |
) |
|
1506 |
(MenuItem |
|
1507 |
label: '-' |
|
1508 |
) |
|
1509 |
(MenuItem |
|
1510 |
label: 'Exit' |
|
1511 |
itemValue: closeRequest |
|
1512 |
translateLabel: true |
|
1513 |
) |
|
1514 |
) |
|
1515 |
nil |
|
1516 |
nil |
|
1517 |
) |
|
1518 |
||
1519 |
"Modified: / 07-01-2012 / 12:51:20 / cg" |
|
1520 |
! |
|
1521 |
||
1522 |
directoryMenu |
|
1523 |
"This resource specification was automatically generated |
|
1524 |
by the MenuEditor of ST/X." |
|
1525 |
||
1526 |
"Do not manually edit this!! If it is corrupted, |
|
1527 |
the MenuEditor may not be able to read the specification." |
|
1528 |
||
1529 |
||
1530 |
" |
|
1531 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#directoryMenu |
|
1532 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser directoryMenu)) startUp |
|
1533 |
" |
|
1534 |
||
1535 |
<resource: #menu> |
|
1536 |
||
1537 |
^ |
|
1538 |
#(Menu |
|
1539 |
( |
|
1540 |
(MenuItem |
|
1541 |
label: 'Bookmarks' |
|
1542 |
submenuChannel: bookmarksMenu |
|
1543 |
) |
|
1544 |
(MenuItem |
|
1545 |
label: 'Visited Directories' |
|
1546 |
submenuChannel: visitedDirectoriesMenu |
|
1547 |
) |
|
1548 |
(MenuItem |
|
1549 |
label: '-' |
|
1550 |
) |
|
1551 |
(MenuItem |
|
1552 |
label: 'Up' |
|
1553 |
itemValue: doGoDirectoryUp |
|
1554 |
) |
|
1555 |
(MenuItem |
|
1556 |
activeHelpKey: directoryBack |
|
1557 |
enabled: enableBack |
|
1558 |
label: 'Back' |
|
1559 |
itemValue: doBack |
|
1560 |
) |
|
1561 |
(MenuItem |
|
1562 |
activeHelpKey: directoryBack |
|
1563 |
enabled: enableForward |
|
1564 |
label: 'Forward' |
|
1565 |
itemValue: doForward |
|
1566 |
) |
|
1567 |
(MenuItem |
|
1568 |
label: '-' |
|
1569 |
) |
|
1570 |
(MenuItem |
|
1571 |
enabled: enableHome |
|
1572 |
label: 'Home Directory' |
|
1573 |
itemValue: doGotoHomeDirectory |
|
1574 |
) |
|
1575 |
(MenuItem |
|
1576 |
enabled: enableGotoDesktopDirectory |
|
1577 |
label: 'Desktop' |
|
1578 |
itemValue: doGotoDesktopDirectory |
|
1579 |
) |
|
1580 |
(MenuItem |
|
1581 |
enabled: enableGotoDefaultDirectory |
|
1582 |
label: 'Default (Current) Directory' |
|
1583 |
itemValue: doGotoDefaultDirectory |
|
1584 |
) |
|
1585 |
(MenuItem |
|
1586 |
enabled: enableGotoSmalltalkDirectory |
|
1587 |
label: 'Smalltalk (Application) Directory' |
|
1588 |
itemValue: doGotoSmalltalkDirectory |
|
1589 |
) |
|
1590 |
(MenuItem |
|
17187 | 1591 |
enabled: enableGotoSmalltalkWorkspaceDirectory |
1592 |
label: 'Smalltalk Workspace Directory' |
|
1593 |
itemValue: doGotoSmalltalkWorkspaceDirectory |
|
1594 |
) |
|
1595 |
(MenuItem |
|
15211 | 1596 |
enabled: enableGotoTempDirectory |
1597 |
label: 'Smalltalk Temp Directory' |
|
1598 |
itemValue: doGotoTempDirectory |
|
1599 |
) |
|
1600 |
(MenuItem |
|
1601 |
label: '-' |
|
17582 | 1602 |
isVisible: false |
15211 | 1603 |
) |
1604 |
(MenuItem |
|
1605 |
enabled: enableMakeCurrentDirectory |
|
1606 |
label: 'Make this the Default (Current) Directory' |
|
1607 |
itemValue: doMakeCurrentDirectory |
|
17582 | 1608 |
isVisible: false |
15211 | 1609 |
) |
1610 |
) |
|
1611 |
nil |
|
1612 |
nil |
|
1613 |
) |
|
17582 | 1614 |
|
1615 |
"Modified: / 17-07-2017 / 10:08:31 / cg" |
|
15211 | 1616 |
! |
1617 |
||
1618 |
editMenu |
|
1619 |
"This resource specification was automatically generated |
|
1620 |
by the MenuEditor of ST/X." |
|
1621 |
||
1622 |
"Do not manually edit this!! If it is corrupted, |
|
1623 |
the MenuEditor may not be able to read the specification." |
|
1624 |
||
1625 |
" |
|
1626 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#editMenu |
|
1627 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser editMenu)) startUp |
|
1628 |
" |
|
1629 |
||
1630 |
<resource: #menu> |
|
1631 |
||
1632 |
^ |
|
1633 |
#(Menu |
|
1634 |
( |
|
1635 |
(MenuItem |
|
1636 |
enabled: hasFileSelection |
|
1637 |
label: 'Copy Selected Filenames to Clipboard' |
|
1638 |
itemValue: copySelectedFilenames |
|
1639 |
translateLabel: true |
|
1640 |
) |
|
1641 |
(MenuItem |
|
1642 |
enabled: fileListIsNotEmpty |
|
1643 |
label: 'Copy all Filenames to Clipboard' |
|
1644 |
itemValue: copyFileList |
|
1645 |
translateLabel: true |
|
1646 |
) |
|
1647 |
) |
|
1648 |
nil |
|
1649 |
nil |
|
1650 |
) |
|
1651 |
! |
|
1652 |
||
1653 |
emptyMenuSpec |
|
1654 |
"This resource specification was automatically generated |
|
1655 |
by the MenuEditor of ST/X." |
|
1656 |
||
1657 |
"Do not manually edit this!! If it is corrupted, |
|
1658 |
the MenuEditor may not be able to read the specification." |
|
1659 |
||
1660 |
" |
|
1661 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#emptyMenuSpec |
|
1662 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser emptyMenuSpec)) startUp |
|
1663 |
" |
|
1664 |
||
1665 |
<resource: #menu> |
|
1666 |
||
1667 |
^ |
|
1668 |
#(#Menu |
|
1669 |
#( |
|
1670 |
) |
|
1671 |
nil |
|
1672 |
nil |
|
1673 |
) |
|
1674 |
! |
|
1675 |
||
1676 |
extraMenu |
|
1677 |
"This resource specification was automatically generated |
|
1678 |
by the MenuEditor of ST/X." |
|
1679 |
||
1680 |
"Do not manually edit this!! If it is corrupted, |
|
1681 |
the MenuEditor may not be able to read the specification." |
|
1682 |
||
1683 |
||
1684 |
" |
|
1685 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#extraMenu |
|
1686 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser extraMenu)) startUp |
|
1687 |
" |
|
1688 |
||
1689 |
<resource: #menu> |
|
1690 |
||
1691 |
^ |
|
1692 |
#(Menu |
|
1693 |
( |
|
1694 |
(MenuItem |
|
1695 |
label: 'Encoding...' |
|
1696 |
itemValue: fileEncodingDialog |
|
1697 |
translateLabel: true |
|
1698 |
) |
|
1699 |
(MenuItem |
|
1700 |
label: 'Line End Convention...' |
|
1701 |
itemValue: lineEndConventionDialog |
|
1702 |
translateLabel: true |
|
1703 |
) |
|
1704 |
(MenuItem |
|
1705 |
label: 'Tab Stop Conversion...' |
|
1706 |
itemValue: tabStopConversionDialog |
|
1707 |
translateLabel: true |
|
1708 |
) |
|
1709 |
(MenuItem |
|
1710 |
label: '-' |
|
1711 |
) |
|
1712 |
(MenuItem |
|
1713 |
label: 'Settings...' |
|
1714 |
itemValue: doOpenSettings |
|
1715 |
translateLabel: true |
|
1716 |
labelImage: (ResourceRetriever ToolbarIconLibrary settings16x16Icon 'Settings...') |
|
1717 |
) |
|
1718 |
) |
|
1719 |
nil |
|
1720 |
nil |
|
1721 |
) |
|
1722 |
! |
|
1723 |
||
1724 |
fileMenu |
|
1725 |
"This resource specification was automatically generated |
|
1726 |
by the MenuEditor of ST/X." |
|
1727 |
||
1728 |
"Do not manually edit this!! If it is corrupted, |
|
1729 |
the MenuEditor may not be able to read the specification." |
|
1730 |
||
1731 |
||
1732 |
" |
|
1733 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileMenu |
|
1734 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileMenu)) startUp |
|
1735 |
" |
|
1736 |
||
1737 |
<resource: #menu> |
|
1738 |
||
1739 |
^ |
|
1740 |
#(Menu |
|
1741 |
( |
|
1742 |
(MenuItem |
|
1743 |
enabled: enableFileHistory |
|
1744 |
label: 'File History' |
|
1745 |
submenuChannel: menuFileHistory |
|
1746 |
) |
|
1747 |
(MenuItem |
|
1748 |
label: '-' |
|
1749 |
) |
|
1750 |
(MenuItem |
|
1751 |
label: 'Open' |
|
1752 |
itemValue: doShowFileContents |
|
1753 |
) |
|
1754 |
(MenuItem |
|
1755 |
label: '-' |
|
1756 |
) |
|
1757 |
(MenuItem |
|
1758 |
enabled: hasFileSelection |
|
1759 |
label: 'FileIn' |
|
1760 |
itemValue: fileFileIn |
|
1761 |
) |
|
1762 |
(MenuItem |
|
1763 |
enabled: hasFileSelection |
|
1764 |
label: 'FileIn to Namespace...' |
|
1765 |
itemValue: fileFileInToNameSpace |
|
1766 |
) |
|
1767 |
(MenuItem |
|
1768 |
enabled: hasPackageDirectorySelected |
|
1769 |
label: 'Load Package from Here' |
|
1770 |
itemValue: fileFileInPackage |
|
1771 |
) |
|
1772 |
(MenuItem |
|
1773 |
label: '-' |
|
1774 |
) |
|
1775 |
(MenuItem |
|
1776 |
label: 'New' |
|
1777 |
submenuChannel: newMenu |
|
1778 |
keepLinkedMenu: true |
|
1779 |
) |
|
1780 |
(MenuItem |
|
1781 |
label: '-' |
|
1782 |
) |
|
1783 |
(MenuItem |
|
1784 |
enabled: hasSelection |
|
1785 |
label: 'Cut' |
|
1786 |
itemValue: cutFiles |
|
1787 |
) |
|
1788 |
(MenuItem |
|
1789 |
enabled: hasSelection |
|
1790 |
label: 'Copy' |
|
1791 |
itemValue: copyFiles |
|
1792 |
) |
|
1793 |
(MenuItem |
|
1794 |
enabled: canPaste |
|
1795 |
label: 'Paste' |
|
1796 |
itemValue: pasteFiles |
|
1797 |
) |
|
1798 |
(MenuItem |
|
1799 |
enabled: hasSelection |
|
1800 |
label: 'Delete' |
|
1801 |
itemValue: deleteFiles |
|
1802 |
) |
|
1803 |
(MenuItem |
|
1804 |
enabled: hasSelection |
|
1805 |
label: 'Erase' |
|
1806 |
itemValue: eraseFiles |
|
1807 |
) |
|
1808 |
(MenuItem |
|
1809 |
label: '-' |
|
1810 |
) |
|
1811 |
(MenuItem |
|
1812 |
enabled: hasSelection |
|
1813 |
label: 'Rename...' |
|
1814 |
itemValue: renameSelection |
|
1815 |
shortcutKey: Rename |
|
1816 |
) |
|
1817 |
(MenuItem |
|
1818 |
enabled: hasSelection |
|
1819 |
label: 'Move To...' |
|
1820 |
itemValue: moveSelectionTo |
|
1821 |
) |
|
1822 |
(MenuItem |
|
1823 |
enabled: hasSelection |
|
1824 |
label: 'Copy To...' |
|
1825 |
itemValue: copySelectionTo |
|
1826 |
) |
|
1827 |
(MenuItem |
|
1828 |
enabled: hasSelection |
|
1829 |
label: 'Properties...' |
|
1830 |
itemValue: doShowProperties |
|
1831 |
) |
|
1832 |
(MenuItem |
|
1833 |
label: '-' |
|
1834 |
isVisible: javaSupportLoaded |
|
1835 |
) |
|
1836 |
(MenuItem |
|
1837 |
enabled: canAddToClassPath |
|
1838 |
label: 'Add to Java Class Path' |
|
1839 |
isVisible: javaSupportLoaded |
|
1840 |
) |
|
1841 |
(MenuItem |
|
1842 |
enabled: canRemoveFromClassPath |
|
1843 |
label: 'Remove from Java Class Path' |
|
1844 |
isVisible: javaSupportLoaded |
|
1845 |
) |
|
1846 |
(MenuItem |
|
1847 |
enabled: canAddToSourcePath |
|
1848 |
label: 'Add to Java Source Path' |
|
1849 |
isVisible: javaSupportLoaded |
|
1850 |
) |
|
1851 |
(MenuItem |
|
1852 |
enabled: canRemoveFromSourcePath |
|
1853 |
label: 'Remove from Java Source Path' |
|
1854 |
isVisible: javaSupportLoaded |
|
1855 |
) |
|
1856 |
) |
|
1857 |
nil |
|
1858 |
nil |
|
1859 |
) |
|
1860 |
! |
|
1861 |
||
1862 |
fileOpMenu |
|
1863 |
"This resource specification was automatically generated |
|
1864 |
by the MenuEditor of ST/X." |
|
1865 |
||
1866 |
"Do not manually edit this!! If it is corrupted, |
|
1867 |
the MenuEditor may not be able to read the specification." |
|
1868 |
||
1869 |
||
1870 |
" |
|
1871 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileOpMenu |
|
1872 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileOpMenu)) startUp |
|
1873 |
" |
|
1874 |
||
1875 |
<resource: #menu> |
|
1876 |
||
1877 |
^ |
|
1878 |
#(Menu |
|
1879 |
( |
|
1880 |
(MenuItem |
|
1881 |
enabled: hasFileSelection |
|
15906 | 1882 |
label: 'Split (by size)...' |
15211 | 1883 |
itemValue: splitSelectedFiles |
1884 |
) |
|
1885 |
(MenuItem |
|
1886 |
enabled: hasFileSelection |
|
15906 | 1887 |
label: 'Split (by #lines)...' |
1888 |
itemValue: splitSelectedFilesByLines |
|
1889 |
) |
|
1890 |
(MenuItem |
|
1891 |
enabled: hasFileSelection |
|
15211 | 1892 |
label: 'Join...' |
1893 |
itemValue: joinSelectedFiles |
|
1894 |
) |
|
1895 |
(MenuItem |
|
1896 |
enabled: hasFileSelection |
|
1897 |
label: 'Copy Corrupted File To...' |
|
1898 |
itemValue: copySelectionToRepairingCorruptedFiles |
|
1899 |
) |
|
1900 |
(MenuItem |
|
15569 | 1901 |
label: 'Copy Corrupted File From -> To...' |
1902 |
itemValue: copyFromToRepairingCorruptedFiles |
|
1903 |
) |
|
1904 |
(MenuItem |
|
15211 | 1905 |
label: '-' |
1906 |
) |
|
1907 |
(MenuItem |
|
1908 |
enabled: hasFileSelection |
|
1909 |
label: 'Rot13...' |
|
1910 |
itemValue: filterSelectedFiles: |
|
1911 |
argument: rot13 |
|
1912 |
) |
|
1913 |
(MenuItem |
|
1914 |
label: '-' |
|
1915 |
) |
|
1916 |
(MenuItem |
|
1917 |
enabled: hasFileSelection |
|
1918 |
label: 'Truncate...' |
|
1919 |
itemValue: truncateSelectedFilesToZeroSize |
|
1920 |
) |
|
1921 |
(MenuItem |
|
1922 |
label: '-' |
|
1923 |
) |
|
1924 |
(MenuItem |
|
1925 |
label: 'Load Signature Support Package' |
|
1926 |
itemValue: loadSignatureSupport |
|
1927 |
isVisible: cannotGenerateSignatureFiles |
|
1928 |
) |
|
1929 |
(MenuItem |
|
1930 |
enabled: canGenerateSignatureFiles |
|
1931 |
label: 'Generate Signed Files' |
|
1932 |
itemValue: generateSignaturesForSelectedFiles |
|
1933 |
) |
|
1934 |
(MenuItem |
|
1935 |
enabled: canGenerateSignatureFiles |
|
1936 |
label: 'Generate Detached Signature Files (use for dll)' |
|
1937 |
itemValue: generateDetachedSignaturesForSelectedFiles |
|
1938 |
) |
|
1939 |
(MenuItem |
|
1940 |
enabled: canGenerateSignatureFiles |
|
1941 |
label: 'Generate Patch Installer for File(s)' |
|
1942 |
itemValue: generatePatchInstallerForSelectedFiles |
|
1943 |
) |
|
1944 |
(MenuItem |
|
1945 |
label: '-' |
|
1946 |
) |
|
1947 |
(MenuItem |
|
1948 |
enabled: hasFileSelection |
|
1949 |
label: 'File Differences' |
|
1950 |
itemValue: openDiffView |
|
1951 |
isVisible: hasTwoFilesSelectedHolder |
|
1952 |
) |
|
1953 |
(MenuItem |
|
1954 |
enabled: hasFileSelection |
|
1955 |
label: 'File Differences...' |
|
1956 |
itemValue: openDiffView |
|
1957 |
isVisible: hasNotTwoFilesSelectedHolder |
|
1958 |
) |
|
1959 |
(MenuItem |
|
1960 |
enabled: hasSelection |
|
1961 |
label: 'Directory Differences' |
|
1962 |
itemValue: openDirectoryDiffView |
|
1963 |
isVisible: hasTwoDirectoriesSelectedHolder |
|
1964 |
) |
|
1965 |
(MenuItem |
|
1966 |
enabled: hasSelection |
|
1967 |
label: 'Directory Differences...' |
|
1968 |
itemValue: openDirectoryDiffView |
|
1969 |
isVisible: hasNotTwoDirectoriesSelectedHolder |
|
1970 |
) |
|
1971 |
) |
|
1972 |
nil |
|
1973 |
nil |
|
1974 |
) |
|
1975 |
! |
|
1976 |
||
1977 |
newMenu |
|
1978 |
"This resource specification was automatically generated |
|
1979 |
by the MenuEditor of ST/X." |
|
1980 |
||
1981 |
"Do not manually edit this!! If it is corrupted, |
|
1982 |
the MenuEditor may not be able to read the specification." |
|
1983 |
||
1984 |
" |
|
1985 |
MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#newMenu |
|
1986 |
(Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser newMenu)) startUp |
|
1987 |
" |
|
1988 |
||
1989 |
<resource: #menu> |
|
1990 |
||
1991 |
^ |
|
1992 |
#(#Menu |
|
1993 |
#( |
|
1994 |
#(#MenuItem |
|
1995 |
#label: 'Directory...' |
|
1996 |
#translateLabel: true |
|
1997 |
#value: #newDirectory |
|
1998 |
) |
|
1999 |
#(#MenuItem |
|
2000 |
#label: 'File...' |
|
2001 |
#translateLabel: true |
|
2002 |
#value: #newFile |
|
2003 |
) |
|
2004 |
#(#MenuItem |
|
2005 |
#label: 'Hard Link...' |
|
2006 |
#translateLabel: true |
|
2007 |
#value: #newHardLink |
|
2008 |
) |
|
2009 |
#(#MenuItem |
|
2010 |
#label: 'Symbolic Link...' |
|
2011 |
#translateLabel: true |
|
2012 |
#value: #newSoftLink |
|
2013 |
) |
|
2014 |
) |
|
2015 |
nil |
|
2016 |
nil |
|
2017 |
) |
|
2018 |
! |
|
2019 |
||
2020 |
scmMenuSlice |
|
2021 |
"This resource specification was automatically generated |
|
2022 |
by the MenuEditor of ST/X." |
|
2023 |
||
2024 |
"Do not manually edit this!! If it is corrupted, |
|
2025 |
the MenuEditor may not be able to read the specification." |
|
2026 |
||
2027 |
||
2028 |
" |
|
2029 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#scmMenuSlice |
|
2030 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser scmMenuSlice)) startUp |
|
2031 |
" |
|
2032 |
||
2033 |
<resource: #menu> |
|
2034 |
||
2035 |
^ |
|
2036 |
#(Menu |
|
2037 |
( |
|
2038 |
(MenuItem |
|
2039 |
label: 'CVS' |
|
2040 |
isVisible: cvsMenusAreShown |
|
2041 |
submenuChannel: cvsMenu |
|
2042 |
) |
|
2043 |
(MenuItem |
|
2044 |
label: 'SVN' |
|
2045 |
isVisible: svnMenusAreShown |
|
2046 |
submenuChannel: svnMenu |
|
2047 |
) |
|
2048 |
(MenuItem |
|
2049 |
label: 'Mercurial' |
|
2050 |
isVisible: mercurialMenusAreShown |
|
2051 |
submenuChannel: mercurialMenu |
|
2052 |
) |
|
2053 |
(MenuItem |
|
2054 |
label: 'HG' |
|
2055 |
isVisible: hgMenusAreShown |
|
2056 |
submenuChannel: hgMenu |
|
2057 |
) |
|
2058 |
(MenuItem |
|
2059 |
label: 'Perforce' |
|
2060 |
isVisible: perforceMenusAreShown |
|
2061 |
submenuChannel: perforceMenu |
|
2062 |
) |
|
2063 |
) |
|
2064 |
nil |
|
2065 |
nil |
|
2066 |
) |
|
2067 |
! |
|
2068 |
||
2069 |
showMenuSpec |
|
2070 |
"This resource specification was automatically generated |
|
2071 |
by the MenuEditor of ST/X." |
|
2072 |
||
2073 |
"Do not manually edit this!! If it is corrupted, |
|
2074 |
the MenuEditor may not be able to read the specification." |
|
2075 |
||
2076 |
" |
|
2077 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpec |
|
2078 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpec)) startUp |
|
2079 |
" |
|
2080 |
||
2081 |
<resource: #menu> |
|
2082 |
||
2083 |
^ |
|
2084 |
#(Menu |
|
2085 |
( |
|
2086 |
(MenuItem |
|
2087 |
label: 'Hidden Files' |
|
2088 |
translateLabel: true |
|
2089 |
hideMenuOnActivated: false |
|
2090 |
indication: showHiddenFiles |
|
2091 |
) |
|
2092 |
(MenuItem |
|
2093 |
label: '-' |
|
2094 |
) |
|
2095 |
(MenuItem |
|
2096 |
label: 'Directory Tree' |
|
2097 |
translateLabel: true |
|
2098 |
hideMenuOnActivated: false |
|
2099 |
indication: showDirectoryTree |
|
2100 |
) |
|
2101 |
(MenuItem |
|
2102 |
label: 'Regular Files in TreeView (Left)' |
|
2103 |
translateLabel: true |
|
2104 |
hideMenuOnActivated: false |
|
2105 |
indication: viewFilesInDirectoryTree |
|
2106 |
) |
|
2107 |
(MenuItem |
|
2108 |
label: 'Directories in ContentsView (Right)' |
|
2109 |
translateLabel: true |
|
2110 |
hideMenuOnActivated: false |
|
2111 |
indication: viewDirsInContentsBrowser |
|
2112 |
) |
|
2113 |
(MenuItem |
|
2114 |
enabled: enableViewNoteBookApplication |
|
2115 |
label: 'File Applications' |
|
2116 |
translateLabel: true |
|
2117 |
hideMenuOnActivated: false |
|
2118 |
indication: viewNoteBookApplicationHolder |
|
2119 |
) |
|
2120 |
(MenuItem |
|
2121 |
label: '-' |
|
2122 |
) |
|
2123 |
(MenuItem |
|
2124 |
label: 'DiskUsage' |
|
2125 |
translateLabel: true |
|
2126 |
hideMenuOnActivated: false |
|
2127 |
indication: showDiskUsageHolder |
|
2128 |
) |
|
2129 |
) |
|
2130 |
nil |
|
2131 |
nil |
|
2132 |
) |
|
2133 |
! |
|
2134 |
||
2135 |
showMenuSpecForDialog |
|
2136 |
"This resource specification was automatically generated |
|
2137 |
by the MenuEditor of ST/X." |
|
2138 |
||
2139 |
"Do not manually edit this!! If it is corrupted, |
|
2140 |
the MenuEditor may not be able to read the specification." |
|
2141 |
||
2142 |
" |
|
2143 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpecForDialog |
|
2144 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpecForDialog)) startUp |
|
2145 |
" |
|
2146 |
||
2147 |
<resource: #menu> |
|
2148 |
||
2149 |
^ |
|
2150 |
#(Menu |
|
2151 |
( |
|
2152 |
(MenuItem |
|
2153 |
label: 'Hidden Files' |
|
2154 |
translateLabel: true |
|
2155 |
hideMenuOnActivated: false |
|
2156 |
indication: showHiddenFiles |
|
2157 |
) |
|
2158 |
) |
|
2159 |
nil |
|
2160 |
nil |
|
2161 |
) |
|
2162 |
! |
|
2163 |
||
2164 |
sortMenu |
|
2165 |
"This resource specification was automatically generated |
|
2166 |
by the MenuEditor of ST/X." |
|
2167 |
||
2168 |
"Do not manually edit this!! If it is corrupted, |
|
2169 |
the MenuEditor may not be able to read the specification." |
|
2170 |
||
2171 |
" |
|
2172 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#sortMenu |
|
2173 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser sortMenu)) startUp |
|
2174 |
" |
|
2175 |
||
2176 |
<resource: #menu> |
|
2177 |
||
2178 |
^ |
|
2179 |
#(#Menu |
|
2180 |
#( |
|
2181 |
#(#MenuItem |
|
2182 |
#label: 'By Filename' |
|
2183 |
#translateLabel: true |
|
2184 |
#hideMenuOnActivated: false |
|
2185 |
#choice: #sortBlockProperty |
|
2186 |
#choiceValue: #baseName |
|
2187 |
) |
|
2188 |
#(#MenuItem |
|
2189 |
#label: 'By Extension' |
|
2190 |
#translateLabel: true |
|
2191 |
#hideMenuOnActivated: false |
|
2192 |
#choice: #sortBlockProperty |
|
2193 |
#choiceValue: #suffix |
|
2194 |
) |
|
2195 |
#(#MenuItem |
|
2196 |
#label: 'By Permissions' |
|
2197 |
#translateLabel: true |
|
2198 |
#hideMenuOnActivated: false |
|
2199 |
#choice: #sortBlockProperty |
|
2200 |
#choiceValue: #permissions |
|
2201 |
) |
|
2202 |
#(#MenuItem |
|
2203 |
#label: 'By Owner' |
|
2204 |
#translateLabel: true |
|
2205 |
#isVisible: #viewOwner |
|
2206 |
#hideMenuOnActivated: false |
|
2207 |
#choice: #sortBlockProperty |
|
2208 |
#choiceValue: #owner |
|
2209 |
) |
|
2210 |
#(#MenuItem |
|
2211 |
#label: 'By Group' |
|
2212 |
#translateLabel: true |
|
2213 |
#isVisible: #viewOwner |
|
2214 |
#hideMenuOnActivated: false |
|
2215 |
#choice: #sortBlockProperty |
|
2216 |
#choiceValue: #group |
|
2217 |
) |
|
2218 |
#(#MenuItem |
|
2219 |
#label: 'By Size' |
|
2220 |
#translateLabel: true |
|
2221 |
#hideMenuOnActivated: false |
|
2222 |
#choice: #sortBlockProperty |
|
2223 |
#choiceValue: #fileSize |
|
2224 |
) |
|
2225 |
#(#MenuItem |
|
2226 |
#label: 'By Date && Time' |
|
2227 |
#translateLabel: true |
|
2228 |
#hideMenuOnActivated: false |
|
2229 |
#choice: #sortBlockProperty |
|
2230 |
#choiceValue: #modificationTime |
|
2231 |
) |
|
2232 |
#(#MenuItem |
|
2233 |
#label: '-' |
|
2234 |
) |
|
2235 |
#(#MenuItem |
|
2236 |
#label: 'Ignore Case in Sort' |
|
2237 |
#translateLabel: true |
|
2238 |
#hideMenuOnActivated: false |
|
2239 |
#indication: #sortCaseless |
|
2240 |
) |
|
2241 |
#(#MenuItem |
|
2242 |
#label: 'Directories before Files' |
|
2243 |
#translateLabel: true |
|
2244 |
#hideMenuOnActivated: false |
|
2245 |
#indication: #sortDirectoriesBeforeFiles |
|
2246 |
) |
|
2247 |
) |
|
2248 |
nil |
|
2249 |
nil |
|
2250 |
) |
|
2251 |
! |
|
2252 |
||
2253 |
toolsMenuSpec |
|
2254 |
"This resource specification was automatically generated |
|
2255 |
by the MenuEditor of ST/X." |
|
2256 |
||
2257 |
"Do not manually edit this!! If it is corrupted, |
|
2258 |
the MenuEditor may not be able to read the specification." |
|
2259 |
||
2260 |
||
2261 |
" |
|
2262 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec |
|
2263 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp |
|
2264 |
" |
|
2265 |
||
2266 |
<resource: #menu> |
|
2267 |
||
2268 |
^ |
|
2269 |
#(Menu |
|
2270 |
( |
|
2271 |
(MenuItem |
|
2272 |
label: 'Open (Win32-Shell)' |
|
2273 |
itemValue: doOpenWithShellCommand |
|
2274 |
isVisible: systemIsDOS |
|
2275 |
) |
|
2276 |
(MenuItem |
|
2277 |
label: 'Execute UNIX Command...' |
|
2278 |
itemValue: doExecuteCommand |
|
2279 |
isVisible: systemIsUnix |
|
2280 |
) |
|
2281 |
(MenuItem |
|
2282 |
label: 'Execute DOS Command...' |
|
2283 |
itemValue: doExecuteCommand |
|
2284 |
isVisible: systemIsDOS |
|
2285 |
) |
|
2286 |
(MenuItem |
|
2287 |
label: 'Execute Script...' |
|
2288 |
itemValue: doExecuteScript |
|
2289 |
) |
|
2290 |
(MenuItem |
|
2291 |
enabled: canDoTerminal |
|
2292 |
label: 'Shell Terminal' |
|
2293 |
itemValue: openTerminal |
|
2294 |
isVisible: canDoTerminalAndSystemIsUnix |
|
2295 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'Shell Terminal') |
|
2296 |
) |
|
2297 |
(MenuItem |
|
2298 |
enabled: canDoTerminal |
|
2299 |
label: 'DOS Terminal' |
|
2300 |
itemValue: openTerminal |
|
2301 |
isVisible: canDoTerminalAndSystemIsDOS |
|
2302 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'DOS Terminal') |
|
2303 |
) |
|
2304 |
(MenuItem |
|
2305 |
label: '-' |
|
2306 |
) |
|
2307 |
(MenuItem |
|
2308 |
enabled: hasFileSelection |
|
2309 |
label: 'Changes Browser' |
|
2310 |
itemValue: openChangesBrowser |
|
2311 |
) |
|
2312 |
(MenuItem |
|
2313 |
enabled: hasFileSelection |
|
2314 |
label: 'ChangeSet Browser' |
|
2315 |
itemValue: openChangeSetBrowser |
|
2316 |
isVisible: changeSetBrowserItemVisible |
|
2317 |
) |
|
2318 |
(MenuItem |
|
2319 |
enabled: hasFileSelection |
|
2320 |
label: 'Workspace' |
|
2321 |
itemValue: openWorkspace |
|
2322 |
) |
|
2323 |
(MenuItem |
|
2324 |
label: '-' |
|
2325 |
) |
|
2326 |
(MenuItem |
|
2327 |
enabled: canReadAbbrevFile |
|
2328 |
label: 'Install Autoloaded' |
|
2329 |
itemValue: readAbbrevFile |
|
2330 |
) |
|
2331 |
(MenuItem |
|
2332 |
enabled: anySTFilesPresent |
|
2333 |
label: 'Install all ST-Files as Autoloaded' |
|
2334 |
itemValue: installAllAsAutoloaded |
|
2335 |
) |
|
2336 |
(MenuItem |
|
2337 |
enabled: recursiveAnySTFilesPresent |
|
2338 |
label: 'Recursive Install all ST-Files as Autoloaded' |
|
2339 |
itemValue: installAllAsAutoloadedRecursive |
|
2340 |
) |
|
2341 |
(MenuItem |
|
2342 |
label: '-' |
|
2343 |
) |
|
2344 |
(MenuItem |
|
2345 |
enabled: hasJava |
|
2346 |
label: 'Add Directory to Java Source Path (stx:libjava)' |
|
2347 |
itemValue: addDirToJavaSourcePath |
|
2348 |
) |
|
2349 |
(MenuItem |
|
2350 |
enabled: hasJava |
|
2351 |
label: 'Add Selected Files to Java Source Path (stx:libjava)' |
|
2352 |
itemValue: fileAddToJavaSourcePath |
|
2353 |
) |
|
2354 |
(MenuItem |
|
2355 |
label: '-' |
|
2356 |
) |
|
2357 |
(MenuItem |
|
2358 |
label: 'File Operations' |
|
2359 |
submenuChannel: fileOpMenu |
|
2360 |
) |
|
2361 |
(MenuItem |
|
2362 |
label: 'File Utilities' |
|
2363 |
submenu: |
|
2364 |
(Menu |
|
2365 |
( |
|
2366 |
(MenuItem |
|
2367 |
enabled: hasFileSelection |
|
2368 |
label: 'Editor' |
|
2369 |
itemValue: openEditor |
|
2370 |
) |
|
2371 |
(MenuItem |
|
2372 |
enabled: hasFileSelection |
|
2373 |
label: 'HTML Reader' |
|
2374 |
itemValue: openHTMLReader |
|
2375 |
) |
|
2376 |
(MenuItem |
|
2377 |
enabled: hasFileSelection |
|
2378 |
label: 'Web Browser' |
|
2379 |
itemValue: openWebBrowser |
|
2380 |
) |
|
2381 |
(MenuItem |
|
2382 |
label: 'XML Inspector' |
|
2383 |
itemValue: inspectXmlFile |
|
2384 |
isVisible: hasXml |
|
2385 |
showBusyCursorWhilePerforming: true |
|
2386 |
) |
|
2387 |
(MenuItem |
|
2388 |
enabled: hasFileSelection |
|
2389 |
label: 'Acroread (PDF Viewer)' |
|
2390 |
itemValue: openPDFViewer |
|
2391 |
) |
|
2392 |
(MenuItem |
|
2393 |
enabled: hasASN1AndSelection |
|
2394 |
label: 'ASN1 Browser' |
|
2395 |
itemValue: openASN1Browser |
|
2396 |
isVisible: hasASN1 |
|
2397 |
) |
|
2398 |
(MenuItem |
|
2399 |
enabled: hasCBrowser |
|
2400 |
label: 'C Browser' |
|
2401 |
itemValue: openCBrowser |
|
2402 |
isVisible: hasCBrowser |
|
2403 |
) |
|
2404 |
(MenuItem |
|
2405 |
enabled: canOpenMonticelloBrowser |
|
2406 |
label: 'Monticello Browser' |
|
2407 |
itemValue: doOpenMonticelloBrowser |
|
2408 |
) |
|
2409 |
(MenuItem |
|
2410 |
enabled: hasJavaAndSelection |
|
2411 |
label: 'Applet Viewer' |
|
2412 |
itemValue: openAppletViewer |
|
2413 |
isVisible: hasJava |
|
2414 |
) |
|
2415 |
(MenuItem |
|
2416 |
enabled: hasMP3PlayerAndSelection |
|
2417 |
label: 'MP3 Player' |
|
2418 |
itemValue: openMP3Player |
|
2419 |
isVisible: hasMP3Player |
|
2420 |
) |
|
2421 |
(MenuItem |
|
2422 |
enabled: hasFileSelection |
|
2423 |
label: 'xv (Image Viewer)' |
|
2424 |
itemValue: openXV |
|
2425 |
isVisible: systemIsUnix |
|
2426 |
) |
|
2427 |
(MenuItem |
|
2428 |
enabled: currentFilesAreInSameDirectory |
|
2429 |
label: 'Slide Show' |
|
2430 |
itemValue: openSlideShow |
|
2431 |
isVisible: hasSlideShow |
|
2432 |
) |
|
2433 |
(MenuItem |
|
2434 |
enabled: hasFileSelection |
|
2435 |
label: 'gv (Postscript Viewer)' |
|
2436 |
itemValue: openGV |
|
2437 |
isVisible: systemIsUnix |
|
2438 |
) |
|
2439 |
(MenuItem |
|
2440 |
enabled: hasMP3PlayerAndSelection |
|
2441 |
label: 'MP3 Player' |
|
2442 |
itemValue: openMP3Player |
|
2443 |
isVisible: hasMP3Player |
|
2444 |
) |
|
2445 |
(MenuItem |
|
2446 |
enabled: hasFileSelection |
|
2447 |
label: 'Realplay (avi viewer)' |
|
2448 |
itemValue: openRP |
|
2449 |
isVisible: systemIsUnix |
|
2450 |
) |
|
2451 |
(MenuItem |
|
2452 |
label: '-' |
|
2453 |
) |
|
2454 |
(MenuItem |
|
2455 |
label: 'Smalltalk' |
|
2456 |
submenu: |
|
2457 |
(Menu |
|
2458 |
( |
|
2459 |
(MenuItem |
|
2460 |
enabled: hasSnapshotSelection |
|
2461 |
label: 'Snapshot Image Browser' |
|
2462 |
itemValue: openSnapshotImageBrowser |
|
2463 |
) |
|
2464 |
(MenuItem |
|
2465 |
enabled: canCreateNewProject |
|
2466 |
label: 'Create Smalltalk Project' |
|
2467 |
itemValue: createProjectAndOpenProjectBrowser |
|
2468 |
) |
|
2469 |
(MenuItem |
|
2470 |
label: '-' |
|
2471 |
) |
|
2472 |
(MenuItem |
|
2473 |
enabled: hasResourceFileSelected |
|
2474 |
label: 'Show Contents of Resourcefile' |
|
2475 |
itemValue: readAndShowResources |
|
2476 |
) |
|
2477 |
(MenuItem |
|
2478 |
enabled: hasResourceFileSelected |
|
2479 |
label: 'Resource File Editor' |
|
2480 |
itemValue: openResourceFileEditor |
|
2481 |
showBusyCursorWhilePerforming: true |
|
2482 |
) |
|
2483 |
(MenuItem |
|
2484 |
label: '-' |
|
2485 |
) |
|
2486 |
(MenuItem |
|
2487 |
enabled: hasFileSelection |
|
2488 |
label: 'Contents as ByteArray' |
|
2489 |
itemValue: fileContentsAsByteArray |
|
2490 |
) |
|
2491 |
) |
|
2492 |
nil |
|
2493 |
nil |
|
2494 |
) |
|
2495 |
) |
|
2496 |
(MenuItem |
|
2497 |
label: 'Image' |
|
2498 |
submenu: |
|
2499 |
(Menu |
|
2500 |
( |
|
2501 |
(MenuItem |
|
2502 |
enabled: hasFileSelection |
|
2503 |
label: 'Image Editor' |
|
2504 |
itemValue: openImageEditor |
|
2505 |
) |
|
2506 |
(MenuItem |
|
2507 |
enabled: hasFileSelection |
|
2508 |
label: 'Image Preview' |
|
2509 |
itemValue: openImagePreview |
|
2510 |
) |
|
2511 |
(MenuItem |
|
2512 |
enabled: hasFileSelection |
|
2513 |
label: 'Image Inspector' |
|
2514 |
itemValue: openImageInspector |
|
2515 |
) |
|
2516 |
(MenuItem |
|
2517 |
label: '-' |
|
2518 |
) |
|
2519 |
(MenuItem |
|
2520 |
enabled: hasFileSelection |
|
2521 |
label: 'Convert to GIF' |
|
2522 |
itemValue: convertImageToGIF |
|
2523 |
) |
|
2524 |
(MenuItem |
|
2525 |
enabled: hasFileSelection |
|
2526 |
label: 'Convert to PNG' |
|
2527 |
itemValue: convertImageToPNG |
|
2528 |
) |
|
2529 |
(MenuItem |
|
2530 |
enabled: hasFileSelection |
|
2531 |
label: 'Convert to XPM' |
|
2532 |
itemValue: convertImageToXPM |
|
2533 |
) |
|
2534 |
(MenuItem |
|
2535 |
enabled: hasFileSelection |
|
2536 |
label: 'Convert to JPG' |
|
2537 |
itemValue: convertImageToJPG |
|
2538 |
) |
|
2539 |
) |
|
2540 |
nil |
|
2541 |
nil |
|
2542 |
) |
|
2543 |
) |
|
2544 |
(MenuItem |
|
15528 | 2545 |
label: 'Web' |
2546 |
submenu: |
|
2547 |
(Menu |
|
2548 |
( |
|
2549 |
(MenuItem |
|
2550 |
label: 'Fetch File by URL...' |
|
2551 |
itemValue: fetchFileByURL |
|
2552 |
) |
|
2553 |
) |
|
2554 |
nil |
|
2555 |
nil |
|
2556 |
) |
|
2557 |
) |
|
2558 |
(MenuItem |
|
15211 | 2559 |
enabled: hasZipFileSelectedHolder |
2560 |
label: 'ZipFile Tool' |
|
2561 |
itemValue: openZipTool |
|
2562 |
) |
|
2563 |
(MenuItem |
|
2564 |
enabled: hasFileSelection |
|
2565 |
label: 'Hex Dump' |
|
2566 |
itemValue: fileHexDump |
|
2567 |
) |
|
2568 |
) |
|
2569 |
nil |
|
2570 |
nil |
|
2571 |
) |
|
2572 |
) |
|
2573 |
(MenuItem |
|
2574 |
label: 'Find' |
|
2575 |
submenu: |
|
2576 |
(Menu |
|
2577 |
( |
|
2578 |
(MenuItem |
|
2579 |
label: 'File...' |
|
2580 |
itemValue: fileFindFile |
|
2581 |
) |
|
2582 |
(MenuItem |
|
2583 |
enabled: hasFileSelection |
|
2584 |
label: 'Same Contents as Selected...' |
|
2585 |
itemValue: fileFindDuplicateFile |
|
2586 |
) |
|
2587 |
(MenuItem |
|
2588 |
label: 'Duplicate Files' |
|
2589 |
itemValue: fileFindDuplicates |
|
2590 |
) |
|
2591 |
(MenuItem |
|
2592 |
enabled: hasSelection |
|
2593 |
label: 'All Duplicate Files (Recursive)' |
|
2594 |
itemValue: fileFindAllDuplicates |
|
2595 |
) |
|
2596 |
(MenuItem |
|
17686 | 2597 |
label: 'Similar Image Files (by Colors)' |
15211 | 2598 |
itemValue: fileFindSimilarImages |
2599 |
isVisible: hasImageColorHistogram |
|
2600 |
) |
|
17686 | 2601 |
(MenuItem |
2602 |
label: 'Similar Image Files (by Form)' |
|
2603 |
itemValue: fileFindSimilarImagesByForm |
|
2604 |
isVisible: hasImageHistogram |
|
2605 |
) |
|
15211 | 2606 |
) |
2607 |
nil |
|
2608 |
nil |
|
2609 |
) |
|
2610 |
) |
|
2611 |
) |
|
2612 |
nil |
|
2613 |
nil |
|
2614 |
) |
|
17686 | 2615 |
|
2616 |
"Modified: / 10-09-2017 / 16:50:09 / cg" |
|
15211 | 2617 |
! |
2618 |
||
2619 |
viewDetailsMenuSpec |
|
2620 |
"This resource specification was automatically generated |
|
2621 |
by the MenuEditor of ST/X." |
|
2622 |
||
2623 |
"Do not manually edit this!! If it is corrupted, |
|
2624 |
the MenuEditor may not be able to read the specification." |
|
2625 |
||
2626 |
" |
|
2627 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#viewDetailsMenuSpec |
|
2628 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser viewDetailsMenuSpec)) startUp |
|
2629 |
" |
|
2630 |
||
2631 |
<resource: #menu> |
|
2632 |
||
2633 |
^ |
|
2634 |
#(#Menu |
|
2635 |
#( |
|
2636 |
#(#MenuItem |
|
2637 |
#label: '-' |
|
2638 |
) |
|
2639 |
#(#MenuItem |
|
2640 |
#label: 'Hidden Files' |
|
2641 |
#translateLabel: true |
|
2642 |
#indication: #showHiddenFiles |
|
2643 |
) |
|
2644 |
) |
|
2645 |
nil |
|
2646 |
nil |
|
2647 |
) |
|
2648 |
! ! |
|
3892 | 2649 |
|
11144 | 2650 |
!AbstractFileBrowser class methodsFor:'menu specs-scm'! |
2651 |
||
15211 | 2652 |
cvsMenu |
2653 |
"This resource specification was automatically generated |
|
2654 |
by the MenuEditor of ST/X." |
|
2655 |
||
2656 |
"Do not manually edit this!! If it is corrupted, |
|
2657 |
the MenuEditor may not be able to read the specification." |
|
2658 |
||
2659 |
||
2660 |
" |
|
2661 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#cvsMenu |
|
2662 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser cvsMenu)) startUp |
|
2663 |
" |
|
2664 |
||
2665 |
<resource: #menu> |
|
2666 |
||
2667 |
^ |
|
2668 |
#(Menu |
|
2669 |
( |
|
2670 |
(MenuItem |
|
2671 |
label: 'Commit (CVS)...' |
|
2672 |
itemValue: cvsCommit |
|
2673 |
translateLabel: true |
|
2674 |
) |
|
2675 |
(MenuItem |
|
2676 |
enabled: canCvsAddAndCommit |
|
2677 |
label: 'Add && Commit...' |
|
2678 |
itemValue: cvsAddAndCommit |
|
2679 |
translateLabel: true |
|
2680 |
) |
|
2681 |
(MenuItem |
|
2682 |
enabled: canCvsAddAndCommit |
|
2683 |
label: 'Add as Binary && Commit...' |
|
2684 |
itemValue: cvsAddBinaryAndCommit |
|
2685 |
translateLabel: true |
|
2686 |
) |
|
2687 |
(MenuItem |
|
2688 |
label: 'Commit Folder (CVS)...' |
|
2689 |
itemValue: cvsCommitFolder |
|
2690 |
translateLabel: true |
|
2691 |
) |
|
2692 |
(MenuItem |
|
2693 |
label: '-' |
|
2694 |
) |
|
2695 |
(MenuItem |
|
2696 |
enabled: hasSelection |
|
2697 |
label: 'Update selected Files/Directories' |
|
2698 |
itemValue: cvsUpdateSelection |
|
2699 |
translateLabel: true |
|
2700 |
) |
|
2701 |
(MenuItem |
|
2702 |
label: 'Update Directory Local' |
|
2703 |
itemValue: cvsUpdateAll |
|
2704 |
translateLabel: true |
|
2705 |
) |
|
2706 |
(MenuItem |
|
2707 |
label: 'Update Directory Recursive' |
|
2708 |
itemValue: cvsUpdateAllRecursive |
|
2709 |
translateLabel: true |
|
2710 |
) |
|
2711 |
(MenuItem |
|
2712 |
label: '-' |
|
2713 |
) |
|
2714 |
(MenuItem |
|
2715 |
enabled: hasSelection |
|
2716 |
label: 'Tag...' |
|
2717 |
itemValue: cvsTagSelection |
|
2718 |
translateLabel: true |
|
2719 |
) |
|
2720 |
(MenuItem |
|
2721 |
enabled: hasSelection |
|
2722 |
label: 'Revision Log' |
|
2723 |
itemValue: cvsRevisionLog |
|
2724 |
translateLabel: true |
|
2725 |
) |
|
2726 |
(MenuItem |
|
2727 |
enabled: hasSelection |
|
2728 |
label: 'Compare with newest in Repository' |
|
2729 |
itemValue: cvsCompareWithNewest |
|
2730 |
translateLabel: true |
|
2731 |
) |
|
2732 |
(MenuItem |
|
2733 |
label: '-' |
|
2734 |
) |
|
2735 |
(MenuItem |
|
2736 |
enabled: canRemoveCVSContainer |
|
2737 |
label: 'Remove File && CVS Container...' |
|
2738 |
itemValue: cvsRemoveFileAndCVSContainer |
|
2739 |
translateLabel: true |
|
2740 |
) |
|
2741 |
) |
|
2742 |
nil |
|
2743 |
nil |
|
2744 |
) |
|
2745 |
! |
|
2746 |
||
2747 |
mercurialMenu |
|
2748 |
"This resource specification was automatically generated |
|
2749 |
by the MenuEditor of ST/X." |
|
2750 |
||
2751 |
"Do not manually edit this!! If it is corrupted, |
|
2752 |
the MenuEditor may not be able to read the specification." |
|
2753 |
||
2754 |
||
2755 |
" |
|
2756 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#mercurialMenu |
|
2757 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser mercurialMenu)) startUp |
|
2758 |
" |
|
2759 |
||
2760 |
<resource: #menu> |
|
2761 |
||
2762 |
^ |
|
2763 |
#(Menu |
|
2764 |
( |
|
2765 |
(MenuItem |
|
2766 |
label: 'Add' |
|
2767 |
itemValue: mercurialAdd |
|
2768 |
translateLabel: true |
|
2769 |
) |
|
2770 |
(MenuItem |
|
2771 |
label: 'Commit Changes' |
|
2772 |
itemValue: mercurialCommit |
|
2773 |
translateLabel: true |
|
2774 |
) |
|
2775 |
(MenuItem |
|
2776 |
label: 'Push...' |
|
2777 |
itemValue: mercurialPush |
|
2778 |
translateLabel: true |
|
2779 |
) |
|
2780 |
(MenuItem |
|
2781 |
label: 'Status' |
|
2782 |
itemValue: mercurialStatus |
|
2783 |
translateLabel: true |
|
2784 |
) |
|
2785 |
(MenuItem |
|
2786 |
label: '-' |
|
2787 |
) |
|
2788 |
(MenuItem |
|
2789 |
label: 'Init' |
|
2790 |
itemValue: mercurialInit |
|
2791 |
translateLabel: true |
|
2792 |
) |
|
2793 |
) |
|
2794 |
nil |
|
2795 |
nil |
|
2796 |
) |
|
2797 |
||
2798 |
"Modified: / 17-01-2012 / 15:57:40 / cg" |
|
2799 |
! |
|
2800 |
||
2801 |
perforceMenu |
|
2802 |
"This resource specification was automatically generated |
|
2803 |
by the MenuEditor of ST/X." |
|
2804 |
||
2805 |
"Do not manually edit this!! If it is corrupted, |
|
2806 |
the MenuEditor may not be able to read the specification." |
|
2807 |
||
2808 |
||
2809 |
" |
|
2810 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#perforceMenu |
|
2811 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser perforceMenu)) startUp |
|
2812 |
" |
|
2813 |
||
2814 |
<resource: #menu> |
|
2815 |
||
2816 |
^ |
|
2817 |
#(Menu |
|
2818 |
( |
|
2819 |
(MenuItem |
|
2820 |
label: 'Commit' |
|
2821 |
itemValue: perforceCommit |
|
2822 |
translateLabel: true |
|
2823 |
) |
|
2824 |
) |
|
2825 |
nil |
|
2826 |
nil |
|
2827 |
) |
|
2828 |
||
2829 |
"Created: / 15-01-2012 / 13:12:30 / cg" |
|
2830 |
! ! |
|
11144 | 2831 |
|
3892 | 2832 |
!AbstractFileBrowser class methodsFor:'misc'! |
2833 |
||
2834 |
newLock |
|
2835 |
^ CodeExecutionLock new |
|
2836 |
! ! |
|
2837 |
||
17288 | 2838 |
!AbstractFileBrowser class methodsFor:'queries'! |
2839 |
||
2840 |
isAbstract |
|
2841 |
^ self == AbstractFileBrowser |
|
2842 |
! ! |
|
2843 |
||
5644
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2844 |
!AbstractFileBrowser class methodsFor:'resources'! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2845 |
|
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2846 |
classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2847 |
^ FileBrowser classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2848 |
! ! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2849 |
|
4610 | 2850 |
!AbstractFileBrowser class methodsFor:'utilities'! |
2851 |
||
11262 | 2852 |
contentsOfBytesAsHexDump:data numberOfAddressDigits:addrDigits addressStart:virtualStart |
2853 |
"utility helper: generate a hexDump with addresses" |
|
2854 |
||
17252 | 2855 |
|lines nHexLines replacementForUnprintable| |
2856 |
||
2857 |
"/ used to be: |
|
2858 |
"/ replacementForUnprintable := $. |
|
2859 |
replacementForUnprintable := Character value:16rB7. "/ a centered dot. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2860 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2861 |
"generate a virtual collection which evaluates and returns lines on-demand" |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2862 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2863 |
nHexLines := (data size + 15) // 16. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2864 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2865 |
lines := VirtualArray new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2866 |
lines setSize:nHexLines + (nHexLines // 16). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2867 |
lines |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2868 |
generator:[:lineNr | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2869 |
|blockNr lineNrInBlock startOffset lineStream asciiLineStream byte line| |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2870 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2871 |
blockNr := (lineNr - 1) // 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2872 |
lineNrInBlock := (lineNr - 1) \\ 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2873 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2874 |
lineNrInBlock == 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2875 |
line := '' |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2876 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2877 |
startOffset := ((blockNr * 16) + lineNrInBlock) * 16. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2878 |
lineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2879 |
asciiLineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2880 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2881 |
lineStream nextPutAll:((startOffset+virtualStart) hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2882 |
lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2883 |
1 to:16 do:[:i | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2884 |
i ~~ 1 ifTrue:[ lineStream space ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2885 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2886 |
(startOffset + i) > data size ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2887 |
asciiLineStream nextPut:(Character space). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2888 |
lineStream nextPutAll:' '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2889 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2890 |
byte := data at:startOffset + i. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2891 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2892 |
lineStream nextPutAll:(byte hexPrintString:2). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2893 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2894 |
(byte between:32 and:127) ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2895 |
asciiLineStream nextPut:(Character value:byte) |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2896 |
] ifFalse:[ |
16188 | 2897 |
(byte between:0 and:31) ifTrue:[ |
2898 |
"/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400 |
|
17252 | 2899 |
"/ are perfect here, but usually not available in the font |
2900 |
"/ and we have currently no way of knowing if they are... |
|
2901 |
"/ (could let the font draw into abitmap and check if there is something...) |
|
2902 |
"/ therefore, for now, write a dot.· |
|
16188 | 2903 |
"/ asciiLineStream nextPut:(Character value:(byte + 16r2400)) |
17252 | 2904 |
asciiLineStream nextPut:replacementForUnprintable. |
16188 | 2905 |
] ifFalse:[ |
17252 | 2906 |
asciiLineStream nextPut:replacementForUnprintable. |
16188 | 2907 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2908 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2909 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2910 |
]. |
12421 | 2911 |
line := (lineStream contents paddedTo:(addrDigits + 1 + (3*16)+ 8)) |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2912 |
, asciiLineStream contents. |
11262 | 2913 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2914 |
line |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2915 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2916 |
^ lines. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2917 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2918 |
"/ |offs |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2919 |
"/ col line lineStream asciiLineStream lines| |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2920 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2921 |
"/ col := 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2922 |
"/ offs := virtualStart. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2923 |
"/ lines := StringCollection new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2924 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2925 |
"/ lineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2926 |
"/ asciiLineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2927 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2928 |
"/ lineStream nextPutAll:(offs hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2929 |
"/ lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2930 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2931 |
"/ data do:[:byte | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2932 |
"/ lineStream nextPutAll:(byte hexPrintString:2). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2933 |
"/ (byte between:32 and:127) ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2934 |
"/ asciiLineStream nextPut:(Character value:byte) |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2935 |
"/ ] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2936 |
"/ asciiLineStream nextPut:$. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2937 |
"/ ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2938 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2939 |
"/ offs := offs + 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2940 |
"/ col := col + 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2941 |
"/ col > 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2942 |
"/ lineStream nextPutAll:' '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2943 |
"/ lineStream nextPutAll:asciiLineStream contents. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2944 |
"/ lines add:(lineStream contents). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2945 |
"/ (offs bitAnd:16rFF) == 0 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2946 |
"/ lines add:nil |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2947 |
"/ ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2948 |
"/ lineStream reset. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2949 |
"/ asciiLineStream reset. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2950 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2951 |
"/ lineStream nextPutAll:(offs hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2952 |
"/ lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2953 |
"/ col := 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2954 |
"/ ] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2955 |
"/ lineStream space |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2956 |
"/ ] |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2957 |
"/ ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2958 |
"/ line := lineStream contents paddedTo:(3*16 + addrDigits + 1). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2959 |
"/ lines add:(line , ' ' , asciiLineStream contents). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2960 |
"/ ^ lines |
11262 | 2961 |
|
2962 |
"Created: / 13-02-2012 / 15:01:46 / cg" |
|
2963 |
! |
|
2964 |
||
4610 | 2965 |
contentsOfFileAsHexDump:f |
8472 | 2966 |
^ self contentsOfFileAsHexDump:f withLimit:nil lastPart:nil |
2967 |
! |
|
2968 |
||
2969 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil |
|
4610 | 2970 |
|resources fileName stream data offs |
11262 | 2971 |
addrDigits col lines answer sizeLimit showLastPart| |
4610 | 2972 |
|
2973 |
resources := self classResources. |
|
2974 |
||
2975 |
fileName := f baseName. |
|
2976 |
f isDirectory ifTrue:[ |
|
2977 |
Dialog warn:(resources string:'%1 is a directory.' with:fileName). |
|
2978 |
^ nil |
|
2979 |
]. |
|
2980 |
f exists ifFalse:[ |
|
2981 |
Dialog warn:(resources string:'oops, ''%1'' is gone or unreadable.' with:fileName). |
|
2982 |
^ nil |
|
2983 |
]. |
|
2984 |
f isReadable ifFalse:[ |
|
2985 |
Dialog warn:(resources string:'''%1'' is unreadable.' with:fileName). |
|
2986 |
^ nil |
|
2987 |
]. |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
2988 |
f fileSize > (1024*1024) ifTrue:[ |
8472 | 2989 |
limitOrNil notNil ifTrue:[ |
2990 |
sizeLimit := limitOrNil. |
|
2991 |
showLastPart := showLastPartOrNil |
|
2992 |
] ifFalse:[ |
|
2993 |
answer := Dialog |
|
2994 |
confirmWithCancel:(resources |
|
2995 |
stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' |
|
2996 |
with:(fileName contractTo:40) allBold |
|
2997 |
with:(UnitConverter fileSizeStringFor:f fileSize)) |
|
2998 |
labels:#('Cancel' 'Show All' 'Show First Part' ). |
|
2999 |
||
3000 |
answer isNil ifTrue:[^ nil]. |
|
3001 |
answer ifTrue:[ |
|
3002 |
sizeLimit := 4 * 1024 * 1024 |
|
3003 |
]. |
|
8436 | 3004 |
]. |
4610 | 3005 |
]. |
3006 |
||
3007 |
stream := f readStream binary. |
|
8436 | 3008 |
sizeLimit notNil ifTrue:[ |
8472 | 3009 |
showLastPart == true ifTrue:[ |
3010 |
stream position:(f fileSize - sizeLimit). |
|
3011 |
]. |
|
8436 | 3012 |
data := stream nextBytes:sizeLimit. |
3013 |
] ifFalse:[ |
|
3014 |
data := stream contents. |
|
3015 |
]. |
|
4610 | 3016 |
stream close. |
3017 |
||
3018 |
col := 1. |
|
3019 |
offs := 0. |
|
3020 |
lines := StringCollection new. |
|
3021 |
||
3022 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
3023 |
||
11262 | 3024 |
^ self |
3025 |
contentsOfBytesAsHexDump:data |
|
3026 |
numberOfAddressDigits:addrDigits |
|
3027 |
addressStart:0 |
|
3028 |
||
3029 |
"Modified: / 13-02-2012 / 15:01:19 / cg" |
|
4610 | 3030 |
! ! |
3031 |
||
3892 | 3032 |
!AbstractFileBrowser methodsFor:'actions'! |
3033 |
||
3034 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 3035 |
"setup and launch a querybox to ask for a unix command. |
3892 | 3036 |
Then evaluate aBlock passing the command-string as argument." |
3037 |
||
16160 | 3038 |
|box osName commandString alwaysOpenLikeThisHolder openCmd suffix| |
3892 | 3039 |
|
3040 |
osName := OperatingSystem platformName. |
|
3041 |
||
3042 |
box := FilenameEnterBox |
|
4414 | 3043 |
title:(resources string:'Execute %1 command:' with:osName) |
3044 |
okText:(resources string:'Execute') |
|
4523 | 3045 |
action:[:cmd | commandString := cmd]. |
3892 | 3046 |
|
3047 |
fileName notNil ifTrue:[ |
|
4414 | 3048 |
self initialCommandFor:fileName into:box. |
3892 | 3049 |
]. |
16160 | 3050 |
alwaysOpenLikeThisHolder := false asValue. |
3051 |
box verticalPanel add:((CheckBox label:'Always use this command for this file type') model:alwaysOpenLikeThisHolder). |
|
3892 | 3052 |
box directory:(self getDirWithoutFileName:fileName). |
16160 | 3053 |
box open. |
3054 |
||
3055 |
"/ box destroy. |
|
3056 |
alwaysOpenLikeThisHolder value ifTrue:[ |
|
3057 |
openCmd := commandString upTo:$". |
|
3058 |
suffix := fileName suffix. |
|
16306 | 3059 |
UserPreferences current |
3060 |
defaultFileOpenCommandFor:suffix put:(openCmd,' "%1"'); |
|
3061 |
beModified. |
|
3062 |
self breakPoint:#cg. |
|
16160 | 3063 |
]. |
3064 |
||
4523 | 3065 |
commandString notNil ifTrue:[ |
3066 |
aBlock value:commandString |
|
3067 |
]. |
|
3068 |
||
3892 | 3069 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
3070 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
3071 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
3072 |
! |
|
3073 |
||
3074 |
changeFileBrowserTitleTo:aString |
|
4774 | 3075 |
self |
3076 |
applicationNamed:#FileBrowserV2 |
|
5009 | 3077 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 3078 |
! |
3079 |
||
3080 |
copyFileList |
|
4774 | 3081 |
"copy the fileList to the clipBoard" |
3082 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3083 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3084 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3085 |
fileList := self |
4774 | 3086 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3087 |
ifPresentDo:[:app | app browserFileList]. |
3088 |
||
3089 |
fileList notNil ifTrue:[ |
|
3090 |
self copyFileListToClipBoard:fileList. |
|
3091 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3092 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3093 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3094 |
copyFileListToClipBoard:fileList |
4774 | 3095 |
"copy the itemList to the clipBoard" |
3096 |
||
3097 |
|stream| |
|
3098 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3099 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 3100 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3101 |
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
|
3102 |
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
|
3103 |
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
|
3104 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3105 |
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
|
3106 |
(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
|
3107 |
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
|
3108 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3109 |
]. |
3892 | 3110 |
]. |
6034 | 3111 |
self window setClipboardText:stream contents. |
3892 | 3112 |
! |
3113 |
||
3114 |
copySelectedFilenames |
|
4774 | 3115 |
"copy the selected fileNames to the clipBoard" |
3116 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3117 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3118 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3119 |
fileList := self |
4774 | 3120 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3121 |
ifPresentDo:[:appl | appl selectedFileNames]. |
3122 |
fileList notNil ifTrue:[ |
|
3123 |
self copyFileListToClipBoard:fileList. |
|
3124 |
]. |
|
3892 | 3125 |
! |
3126 |
||
10923 | 3127 |
doAddArchiver |
3128 |
|files| |
|
3129 |
||
3130 |
files := self currentSelectedFiles. |
|
3131 |
files size == 1 ifFalse:[ |
|
3132 |
Dialog information:'Select exactly one archive.'. |
|
3133 |
^ self |
|
3134 |
]. |
|
3135 |
||
3136 |
self |
|
3137 |
applicationNamed:#FileApplicationNoteBook |
|
3138 |
ifPresentDo:[:appl | appl doAddArchiverOn:files first]. |
|
3139 |
||
3140 |
"Created: / 29-11-2011 / 19:01:31 / cg" |
|
3141 |
! |
|
3142 |
||
3892 | 3143 |
doAddTerminal |
5960 | 3144 |
|dir| |
3145 |
||
3146 |
dir := self currentDirectory. |
|
3892 | 3147 |
|
5960 | 3148 |
dir isNil ifTrue:[ |
4414 | 3149 |
dir := Filename homeDirectory |
3892 | 3150 |
]. |
4774 | 3151 |
|
5009 | 3152 |
self |
3153 |
applicationNamed:#FileApplicationNoteBook |
|
3154 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
3892 | 3155 |
! |
3156 |
||
3157 |
doOpenSearchFile |
|
5961 | 3158 |
|item file| |
3159 |
||
3160 |
file := self firstSelectedFileName. |
|
3161 |
file isNil ifTrue:[ |
|
3162 |
file := Filename homeDirectory asAbsoluteFilename. |
|
3163 |
]. |
|
3164 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 3165 |
self openSearchFileOn:item. |
3166 |
! |
|
3167 |
||
3168 |
doShowFileContents |
|
5009 | 3169 |
self |
3170 |
applicationNamed:#DirectoryContentsBrowser |
|
3171 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
3172 |
||
3173 |
^ nil |
|
3892 | 3174 |
! |
3175 |
||
3176 |
doShowProperties |
|
3177 |
"show long stat (file)-info" |
|
3178 |
||
3179 |
self fileGetInfo:true |
|
3180 |
! |
|
3181 |
||
14577 | 3182 |
enterAction |
3183 |
self |
|
3184 |
applicationNamed:#DirectoryContentsBrowser |
|
3185 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl enterAction ]]. |
|
3186 |
! |
|
3187 |
||
5528 | 3188 |
fileEncodingDialog |
14497 | 3189 |
"open a dialog to allow change of the file's character encoding. |
5528 | 3190 |
Files are converted to internal encoding when read, and converted back |
3191 |
to this encoding when saved. |
|
3192 |
Notice: currently, not too many encodings are supported by the system." |
|
3193 |
||
3194 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
3195 |
||
3196 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
3197 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
3198 |
||
3199 |
bindings := IdentityDictionary new. |
|
3200 |
bindings at:#encodingList put:encodingDescr. |
|
3201 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 3202 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
3203 |
||
5528 | 3204 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
3205 |
ifTrue:[ |
|
3206 |
idx := (bindings at:#selectedEncoding) value. |
|
3207 |
selectedEncoding := encodings at:idx. |
|
3208 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 3209 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 3210 |
]. |
5737 | 3211 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 3212 |
]. |
3213 |
||
3214 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
3215 |
! |
|
3216 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3217 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3218 |
"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
|
3219 |
|
5959 | 3220 |
|currentFileNameHolder currentSel| |
3221 |
||
3222 |
currentFileNameHolder := self currentFileNameHolder. |
|
3223 |
||
3224 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3225 |
(currentSel includes:aFilename) ifFalse:[ |
9677 | 3226 |
self withWaitCursorDo:[ |
3227 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
|
3228 |
] |
|
3229 |
]. |
|
3230 |
||
3231 |
"Modified: / 29-12-2010 / 11:04:29 / cg" |
|
3892 | 3232 |
! |
3233 |
||
11053 | 3234 |
lineEndConventionDialog |
3235 |
"open a dialog to allow change of the line end conventions |
|
3236 |
(when writing files)" |
|
3237 |
||
3238 |
|bindings| |
|
3239 |
||
3240 |
bindings := IdentityDictionary new. |
|
3241 |
bindings at:#lineEndConvention put:(self lineEndConvention asValue). |
|
3242 |
||
3243 |
(self openDialogInterface:#lineEndConventionDialogSpec withBindings:bindings) |
|
3244 |
ifTrue:[ |
|
15208 | 3245 |
self lineEndConventionHolder value:(bindings at:#lineEndConvention) value asSymbol |
11053 | 3246 |
]. |
3247 |
||
3248 |
"Created: / 06-01-2012 / 15:34:51 / cg" |
|
3249 |
! |
|
3250 |
||
4392 | 3251 |
newTextEditor |
5009 | 3252 |
self |
3253 |
applicationNamed:#FileApplicationNoteBook |
|
15936 | 3254 |
ifPresentDo:[:appl | |
3255 |
|editor files item| |
|
3256 |
||
3257 |
editor := appl newTextEditor. |
|
3258 |
(files := self currentSelectedFiles) size == 1 ifTrue:[ |
|
3259 |
item := DirectoryContentsBrowser itemClass fileName:files first. |
|
3260 |
editor item:item. |
|
3261 |
]. |
|
3262 |
^ editor |
|
3263 |
]. |
|
5009 | 3264 |
|
3265 |
^ nil. |
|
3266 |
! |
|
3267 |
||
3268 |
openApplByFileItem:anItem |
|
8490 | 3269 |
"/ q: is the following always wanted ? |
9267 | 3270 |
self window sensor shiftDown ifFalse:[ |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3271 |
"/ cg: no - batch and shell scripts are to be |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3272 |
"/ anItem fileName isExecutableProgram ifTrue:[ |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3273 |
"/ self executeCommand:anItem fileName pathName. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3274 |
"/ ^ self. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3275 |
"/ ]. |
9267 | 3276 |
|
8490 | 3277 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
3278 |
"/ Error handle:[:ex | |
|
3279 |
"/ ] do:[ |
|
3280 |
"/ OperatingSystem |
|
3281 |
"/ shellExecute:nil |
|
3282 |
"/ lpOperation:'open' |
|
3283 |
"/ lpFile:(anItem fileName pathName) |
|
3284 |
"/ lpParameters:nil |
|
3285 |
"/ lpDirectory:(self directory pathName) |
|
3286 |
"/ nShowCmd:#SW_SHOWNORMAL. |
|
3287 |
"/ ^ self. |
|
3288 |
"/ ] |
|
3289 |
"/ ] |
|
9267 | 3290 |
]. |
5306 | 3291 |
^ self |
5009 | 3292 |
applicationNamed:#FileApplicationNoteBook |
5306 | 3293 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3294 |
|
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3295 |
"Modified: / 06-09-2011 / 11:11:15 / cg" |
3892 | 3296 |
! |
3297 |
||
4392 | 3298 |
openApplForFile:aFilename |
5306 | 3299 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 3300 |
! |
3301 |
||
3892 | 3302 |
openCommandResultApplication |
3303 |
||
5009 | 3304 |
self |
3305 |
applicationNamed:#FileApplicationNoteBook |
|
3306 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
3307 |
||
3308 |
^ nil |
|
3892 | 3309 |
! |
3310 |
||
5010 | 3311 |
openNewTextEditorOn:anItem |
5009 | 3312 |
self |
3313 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3314 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 3315 |
|
3316 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3317 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3318 |
|
5010 | 3319 |
openSearchFileOn:anItem |
5009 | 3320 |
self |
3321 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3322 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 3323 |
|
3324 |
^ nil. |
|
3892 | 3325 |
! |
3326 |
||
5162 | 3327 |
openTextEditorForFile:aFilename |
3328 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
3329 |
! |
|
3330 |
||
5010 | 3331 |
openTextEditorOn:anItem |
5009 | 3332 |
self |
3333 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3334 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 3335 |
|
3336 |
^ nil. |
|
3892 | 3337 |
! |
3338 |
||
5010 | 3339 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 3340 |
self |
3341 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3342 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 3343 |
|
3344 |
^ nil. |
|
4618 | 3345 |
! |
3346 |
||
5959 | 3347 |
setCurrentFileName:aFilename |
3348 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
3349 |
! |
|
3350 |
||
3351 |
setCurrentFileNames:aCollectionOfFilenames |
|
3352 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
3353 |
! |
|
3354 |
||
11053 | 3355 |
tabStopConversionDialog |
3356 |
"open a dialog to allow change of the tab stop conversion (when reading/writing files)" |
|
3357 |
||
3358 |
|bindings| |
|
3359 |
||
3360 |
bindings := IdentityDictionary new. |
|
3361 |
bindings at:#tabStops put:(self inputTabColumnConversion asValue). |
|
3362 |
||
3363 |
(self openDialogInterface:#tabStopConversionDialogSpec withBindings:bindings) |
|
3364 |
ifTrue:[ |
|
3365 |
self inputTabColumnConversionHolder value:(bindings at:#tabStops) value |
|
3366 |
]. |
|
3367 |
||
3368 |
"Created: / 06-01-2012 / 15:36:06 / cg" |
|
3369 |
! |
|
3370 |
||
3892 | 3371 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3372 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3373 |
aColOfFiles notNil ifTrue:[ |
5959 | 3374 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3375 |
]. |
3892 | 3376 |
! |
3377 |
||
3378 |
updateCurrentDirectory |
|
5739 | 3379 |
self updateCurrentDirectory:false |
3380 |
! |
|
3381 |
||
3382 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3383 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3384 |
|
5009 | 3385 |
self |
3386 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 3387 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 3388 |
self |
3389 |
applicationNamed:#DirectoryTreeBrowser |
|
3390 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 3391 |
! |
3392 |
||
5739 | 3393 |
updateCurrentDirectoryWithReread |
3394 |
self updateCurrentDirectory:true |
|
3395 |
! |
|
3396 |
||
4345 | 3397 |
withActivityIndicationDo:aBlock |
3398 |
||
3399 |
self activityVisibilityChannel value:true. |
|
3400 |
[ |
|
9361 | 3401 |
self withWaitCursorDo:[ |
3402 |
aBlock value. |
|
3403 |
] |
|
4345 | 3404 |
] ensure:[ |
3405 |
self activityVisibilityChannel value:false. |
|
3406 |
] |
|
3892 | 3407 |
! ! |
3408 |
||
3409 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
3410 |
||
3411 |
addBookmark |
|
3412 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
6725 | 3413 |
self addBookmarks:(self currentSelectedDirectories). |
5960 | 3414 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 3415 |
! |
3416 |
||
3417 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3418 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3419 |
self class addBookmark:path |
3892 | 3420 |
]. |
3421 |
! |
|
3422 |
||
8013 | 3423 |
editBookmarks |
3424 |
||
3425 |
| default selectedDirectories | |
|
3426 |
||
3427 |
selectedDirectories := self currentSelectedDirectories. |
|
3428 |
selectedDirectories notEmpty ifTrue:[default := selectedDirectories first]. |
|
3429 |
self class editBookmarksWithDefault: default. |
|
3430 |
! |
|
3431 |
||
3892 | 3432 |
hasBookmarks |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3433 |
^ self class hasBookmarks |
3892 | 3434 |
! |
3435 |
||
3436 |
hasBookmarksToRemove |
|
3437 |
|bookmarks directories| |
|
3438 |
||
3982 | 3439 |
directories := self currentSelectedDirectories. |
3892 | 3440 |
bookmarks := self class directoryBookmarks. |
17416 | 3441 |
^ (bookmarks notEmptyOrNil and:[directories notEmpty]) |
3442 |
||
3443 |
"Modified: / 17-02-2017 / 08:25:22 / cg" |
|
3892 | 3444 |
! |
3445 |
||
3446 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3447 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3448 |
self class removeBookmark:dir |
3892 | 3449 |
]. |
4679 | 3450 |
! |
3451 |
||
3452 |
saveBookmarks |
|
3453 |
self class saveBookmarks |
|
3892 | 3454 |
! ! |
3455 |
||
3456 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
3457 |
||
3458 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 3459 |
|cmd suffix cmdHist historySize| |
3892 | 3460 |
|
3461 |
cmdHist := self class commandHistory. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
3462 |
(aCommandString notEmptyOrNil) ifTrue:[ |
4414 | 3463 |
cmdHist notNil ifTrue:[ |
3464 |
cmdHist addFirst:aCommandString. |
|
6369 | 3465 |
historySize := self class commandHistorySize. |
3466 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 3467 |
cmdHist removeLast |
3468 |
] |
|
3469 |
]. |
|
3470 |
aFilename notNil ifTrue:[ |
|
3471 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
3472 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
3473 |
DefaultCommandPerSuffix := Dictionary new. |
|
3474 |
]. |
|
3475 |
suffix := aFilename asFilename suffix. |
|
3476 |
suffix notNil ifTrue:[ |
|
3477 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
3478 |
] |
|
3479 |
] |
|
3892 | 3480 |
] |
3481 |
! |
|
3482 |
||
3483 |
doBack |
|
6286 | 3484 |
"go backward in the history" |
3892 | 3485 |
|
4022 | 3486 |
| fileName| |
3487 |
||
6369 | 3488 |
fileName := self directoryHistory goBackward. |
3892 | 3489 |
fileName notNil ifTrue:[ |
4347 | 3490 |
self gotoFile:(fileName asFilename). |
3892 | 3491 |
] |
3492 |
! |
|
3493 |
||
3494 |
doForward |
|
6286 | 3495 |
"go forward in the history" |
3892 | 3496 |
|
3964 | 3497 |
| fileName| |
3498 |
||
6369 | 3499 |
fileName := self directoryHistory goForward. |
3892 | 3500 |
fileName notNil ifTrue:[ |
4414 | 3501 |
self gotoFile:(fileName asFilename). |
4022 | 3502 |
] ifFalse:[ |
4414 | 3503 |
self enableForward value:false. |
4022 | 3504 |
|
3505 |
]. |
|
3892 | 3506 |
! ! |
3507 |
||
3508 |
!AbstractFileBrowser methodsFor:'applications'! |
|
3509 |
||
5009 | 3510 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
3511 |
|appl| |
|
3512 |
||
3513 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
3514 |
appl notNil ifTrue:[ |
|
3515 |
^ aBlock value:appl |
|
3516 |
]. |
|
3517 |
^ nil. |
|
3518 |
! |
|
3519 |
||
4004 | 3520 |
directoryContentsBrowser |
3521 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 3522 |
! ! |
3523 |
||
3524 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
3525 |
||
3526 |
applications |
|
3527 |
^ aspects at:#applications |
|
3528 |
! |
|
3529 |
||
3530 |
backgroundProcesses |
|
3531 |
||
3532 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
3533 |
! |
|
3534 |
||
4230 | 3535 |
canMake |
15259 | 3536 |
^ self aspectFor:#canMake ifAbsent:[ ValueHolder with:false ]. |
4230 | 3537 |
! |
3538 |
||
3892 | 3539 |
currentDirectories |
6725 | 3540 |
" returns a holder on a Collection of all currently selected directories |
3541 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3892 | 3542 |
" |
3543 |
||
3544 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
3545 |
! |
|
3546 |
||
6725 | 3547 |
currentDirectoriesValue |
3548 |
" returns a Collection of all currently selected directories |
|
3549 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3550 |
" |
|
3551 |
||
3552 |
^ self currentDirectories value |
|
3553 |
! |
|
3554 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3555 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3556 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3557 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3558 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3559 |
|
6725 | 3560 |
directories := self currentSelectedDirectories. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3561 |
(directories size ~= 1) ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3562 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3563 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3564 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3565 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3566 |
|
13856 | 3567 |
currentDirectoryDisplayed |
3568 |
"Return a directory as Filename that is currently displayed in the browser" |
|
3569 |
||
3570 |
^self subclassResponsibility |
|
3571 |
||
3572 |
"Created: / 14-01-2013 / 11:57:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3573 |
! |
|
3574 |
||
3892 | 3575 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3576 |
"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
|
3577 |
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
|
3578 |
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
|
3579 |
|
6589 | 3580 |
^ self aspectFor:#currentFileNameHolder |
3581 |
ifAbsent:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3582 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3583 |
|
4692 | 3584 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3585 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3586 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3587 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3588 |
currentSel asValue |
6589 | 3589 |
] |
3590 |
notPresentDo:[:holder| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3591 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3592 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3593 |
newFilenames := Set new. |
6589 | 3594 |
filenames do:[:eachFilename| |
3595 |
|existingFilename| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3596 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3597 |
existingFilename notNil ifTrue:[ |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3598 |
[existingFilename isRootDirectory or:[existingFilename exists]] whileFalse:[ |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3599 |
existingFilename := existingFilename directory. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3600 |
]. |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3601 |
existingFilename exists ifTrue:[ |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3602 |
newFilenames add:existingFilename. |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3603 |
]. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3604 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3605 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3606 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3607 |
] |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3608 |
|
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3609 |
"Modified: / 27-11-2010 / 15:42:45 / cg" |
3892 | 3610 |
! |
3611 |
||
5528 | 3612 |
defaultFileEncoding |
3613 |
^ #'iso8859-1' "/ #'utf-8' |
|
3614 |
! |
|
3615 |
||
3892 | 3616 |
enableDirectoryUp |
3617 |
||
15259 | 3618 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[ValueHolder with:false] |
3892 | 3619 |
! |
3620 |
||
6456 | 3621 |
enableGotoDefaultDirectory |
15259 | 3622 |
^ self aspectFor:#enableGotoDefaultDirectory ifAbsent:[ ValueHolder with:true ]. |
4593 | 3623 |
! |
3624 |
||
8168 | 3625 |
enableGotoDesktop |
14308 | 3626 |
"/ backward compatibility |
3627 |
^ self enableGotoDesktopDirectory. |
|
8168 | 3628 |
! |
3629 |
||
9572 | 3630 |
enableGotoDesktopDirectory |
15259 | 3631 |
^ self aspectFor:#enableGotoDesktopDirectory ifAbsent:[ ValueHolder with:true ]. |
9572 | 3632 |
|
3633 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3634 |
! |
|
3635 |
||
6434 | 3636 |
enableGotoSmalltalkDirectory |
6456 | 3637 |
^ self aspectFor:#enableGotoSmalltalkDirectory ifAbsent:[ true asValue ]. |
6434 | 3638 |
! |
3639 |
||
17187 | 3640 |
enableGotoSmalltalkWorkspaceDirectory |
3641 |
^ self aspectFor:#enableGotoSmalltalkWorkspaceDirectory ifAbsent:[ true asValue ]. |
|
3642 |
! |
|
3643 |
||
9677 | 3644 |
enableGotoTempDirectory |
3645 |
^ self aspectFor:#enableGotoTempDirectory ifAbsent:[ true asValue ]. |
|
3646 |
||
3647 |
"Created: / 29-12-2010 / 11:01:17 / cg" |
|
3648 |
! |
|
3649 |
||
3892 | 3650 |
enableHome |
3651 |
||
3652 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
3653 |
! |
|
3654 |
||
9596 | 3655 |
enableMakeCurrentDirectory |
3656 |
^ self aspectFor:#enableMakeCurrentDirectory ifAbsent:[ true asValue ]. |
|
3657 |
||
3658 |
"Created: / 26-10-2010 / 17:17:58 / cg" |
|
3659 |
! |
|
3660 |
||
3892 | 3661 |
enableViewNoteBookApplication |
3662 |
||
3663 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
3664 |
! |
|
3665 |
||
5528 | 3666 |
fileEncoding |
3667 |
^ self fileEncodingHolder value |
|
3668 |
! |
|
3669 |
||
3670 |
fileEncoding:newEncoding |
|
5533 | 3671 |
self fileEncodingHolder value:newEncoding. |
3672 |
||
3673 |
self |
|
3674 |
applicationNamed:#FileApplicationNoteBook |
|
3675 |
ifPresentDo:[:nb | |
|
3676 |
|appl| |
|
3677 |
||
3678 |
appl := nb selectedApplication. |
|
5535 | 3679 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 3680 |
appl fileEncoding:newEncoding |
3681 |
] |
|
3682 |
]. |
|
5528 | 3683 |
! |
3684 |
||
5737 | 3685 |
fileEncodingHolder |
3686 |
^ self |
|
3687 |
aspectFor:#fileEncodingHolder |
|
3688 |
ifAbsent:[ |
|
3689 |
self |
|
3690 |
applicationNamed:#FileApplicationNoteBook |
|
3691 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
3692 |
] |
|
3693 |
! |
|
3694 |
||
17485 | 3695 |
fileEntryFieldHolder |
3696 |
^ self subclassResponsibility. |
|
3697 |
||
3698 |
"Created: / 31-03-2017 / 11:36:49 / stefan" |
|
3699 |
! |
|
3700 |
||
5961 | 3701 |
firstSelectedFileName |
3702 |
|files| |
|
3703 |
||
7560 | 3704 |
files := self currentSelectedObjects. |
5961 | 3705 |
files notEmpty ifTrue:[ |
3706 |
^ files first |
|
3707 |
]. |
|
3708 |
^ nil |
|
7560 | 3709 |
|
3710 |
"Modified: / 04-12-2006 / 13:14:53 / cg" |
|
5961 | 3711 |
! |
3712 |
||
6456 | 3713 |
gotoDefaultDirectoryIsVisible |
9596 | 3714 |
^ true. |
3715 |
"/ ^ (Filename defaultDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
3716 |
||
3717 |
"Modified: / 26-10-2010 / 17:23:51 / cg" |
|
6456 | 3718 |
! |
3719 |
||
9572 | 3720 |
gotoDesktopDirectoryIsVisible |
3721 |
Filename desktopDirectory = Filename homeDirectory ifTrue:[^ false]. |
|
3722 |
||
3723 |
^ (Filename desktopDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
3724 |
||
3725 |
"Created: / 01-10-2010 / 16:26:27 / cg" |
|
3726 |
! |
|
3727 |
||
4618 | 3728 |
hasFileSelection |
3729 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
3730 |
! |
|
3731 |
||
9490 | 3732 |
hasNotTwoDirectoriesSelectedHolder |
3733 |
^ self |
|
3734 |
aspectFor:#hasNotTwoDirectoriesSelectedHolder |
|
3735 |
ifAbsent:[ |
|
3736 |
BlockValue |
|
3737 |
with:[:m | self hasTwoDirectoriesSelected not] |
|
3738 |
argument:self currentFileNameHolder |
|
3739 |
]. |
|
3740 |
||
3741 |
"Created: / 20-05-2010 / 10:45:50 / cg" |
|
3742 |
! |
|
3743 |
||
5830 | 3744 |
hasNotTwoFilesSelectedHolder |
9490 | 3745 |
^ self |
3746 |
aspectFor:#hasNotTwoFilesSelectedHolder |
|
5830 | 3747 |
ifAbsent:[ |
3748 |
BlockValue |
|
3749 |
with:[:m | self hasTwoFilesSelected not] |
|
3750 |
argument:self currentFileNameHolder |
|
3751 |
]. |
|
9490 | 3752 |
|
3753 |
"Modified: / 20-05-2010 / 10:46:01 / cg" |
|
5830 | 3754 |
! |
3755 |
||
3892 | 3756 |
hasSelection |
3757 |
||
3758 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
3759 |
! |
|
3760 |
||
9490 | 3761 |
hasTwoDirectoriesSelectedHolder |
3762 |
^ self |
|
3763 |
aspectFor:#hasTwoDirectoriesSelectedHolder |
|
3764 |
ifAbsent:[ |
|
3765 |
BlockValue |
|
3766 |
with:[:m | self hasTwoDirectoriesSelected] |
|
3767 |
argument:self currentFileNameHolder |
|
3768 |
]. |
|
3769 |
||
3770 |
"Created: / 20-05-2010 / 10:45:41 / cg" |
|
3771 |
! |
|
3772 |
||
4414 | 3773 |
hasTwoFilesSelectedHolder |
9490 | 3774 |
^ self |
3775 |
aspectFor:#hasTwoFilesSelectedHolder |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3776 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3777 |
BlockValue |
5830 | 3778 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3779 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3780 |
]. |
9490 | 3781 |
|
3782 |
"Modified: / 20-05-2010 / 10:46:08 / cg" |
|
4414 | 3783 |
! |
3784 |
||
11053 | 3785 |
inputTabColumnConversion |
3786 |
^ self inputTabColumnConversionHolder value |
|
3787 |
||
3788 |
"Created: / 06-01-2012 / 15:25:56 / cg" |
|
3789 |
! |
|
3790 |
||
3791 |
inputTabColumnConversionHolder |
|
3792 |
^ self |
|
3793 |
aspectFor:#inputTabColumnConversionHolder |
|
3794 |
ifAbsent:[ |
|
3795 |
self |
|
3796 |
applicationNamed:#FileApplicationNoteBook |
|
3797 |
ifPresentDo:[:appl | appl inputTabColumnConversionHolder]. |
|
3798 |
] |
|
3799 |
||
3800 |
"Created: / 06-01-2012 / 15:26:16 / cg" |
|
3801 |
! |
|
3802 |
||
3803 |
lineEndConvention |
|
15208 | 3804 |
^ self lineEndConventionHolder value asSymbol |
11053 | 3805 |
|
3806 |
"Created: / 06-01-2012 / 13:05:14 / cg" |
|
3807 |
! |
|
3808 |
||
11591 | 3809 |
lineEndConvention: aSymbol |
15208 | 3810 |
self lineEndConventionHolder value: aSymbol asSymbol |
11591 | 3811 |
|
3812 |
"Created: / 11-07-2012 / 19:51:58 / cg" |
|
3813 |
! |
|
3814 |
||
11053 | 3815 |
lineEndConventionHolder |
3816 |
^ self |
|
3817 |
aspectFor:#lineEndConventionHolder |
|
3818 |
ifAbsent:[ |
|
3819 |
self |
|
3820 |
applicationNamed:#FileApplicationNoteBook |
|
3821 |
ifPresentDo:[:appl | appl lineEndConventionHolder]. |
|
3822 |
] |
|
3823 |
||
3824 |
"Created: / 06-01-2012 / 13:02:51 / cg" |
|
3825 |
! |
|
3826 |
||
5737 | 3827 |
lockFileEncoding:aBoolean |
3828 |
self lockFileEncodingHolder value:aBoolean. |
|
3829 |
||
3830 |
self |
|
3831 |
applicationNamed:#FileApplicationNoteBook |
|
3832 |
ifPresentDo:[:nb | |
|
3833 |
|appl| |
|
3834 |
||
3835 |
appl := nb selectedApplication. |
|
3836 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
3837 |
appl lockFileEncoding:aBoolean |
|
3838 |
] |
|
3839 |
]. |
|
3840 |
! |
|
3841 |
||
3842 |
lockFileEncodingHolder |
|
3843 |
^ self |
|
3844 |
aspectFor:#lockFileEncodingHolder |
|
3845 |
ifAbsent:[ |
|
3846 |
self |
|
3847 |
applicationNamed:#FileApplicationNoteBook |
|
3848 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
3849 |
] |
|
3850 |
! |
|
3851 |
||
13856 | 3852 |
makeCommandHolder |
3853 |
^ self aspectFor:#makeCommandHolder ifAbsent:[ nil asValue ]. |
|
3854 |
||
3855 |
"Created: / 13-04-2012 / 17:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3856 |
! |
|
3857 |
||
4523 | 3858 |
notify:aString |
11108 | 3859 |
"aString is shown in the lower pane" |
3860 |
||
4523 | 3861 |
self notifyChannel value:aString |
11108 | 3862 |
|
3863 |
"Modified (comment): / 11-01-2012 / 21:46:55 / cg" |
|
4523 | 3864 |
! |
3865 |
||
3892 | 3866 |
notifyChannel |
3867 |
||
3868 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 3869 |
! |
3870 |
||
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3871 |
progressPercentageHolder |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3872 |
^ self aspectFor:#progressPercentageHolder ifAbsent:[ nil asValue ]. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3873 |
|
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3874 |
"Created: / 11-10-2010 / 12:54:46 / cg" |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3875 |
! |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3876 |
|
4071 | 3877 |
rootHolder |
3878 |
"holder, which keeps the rootHolder of the treeView |
|
3879 |
" |
|
3880 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3881 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3882 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3883 |
]. |
8192
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3884 |
! |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3885 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3886 |
rootHolder:aHolder |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3887 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3888 |
self aspectFor:#rootHolder put:aHolder |
3892 | 3889 |
! ! |
3890 |
||
3891 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
3892 |
||
3893 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 3894 |
"returns the model for an aspect; these are stored in a common dictionary" |
3895 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3896 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 3897 |
! |
3898 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3899 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 3900 |
"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
|
3901 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3902 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3903 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3904 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3905 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3906 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3907 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3908 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3909 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3910 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3911 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3912 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3913 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3914 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3915 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3916 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3917 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3918 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3919 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3920 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3921 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3922 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3923 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3924 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3925 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3926 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3927 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3928 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3929 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3930 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3931 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3932 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3933 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3934 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3935 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3936 |
aspectFor:something put:aValueHolder |
6284 | 3937 |
"stores the model for an aspect; these are stored in a common dictionary" |
3938 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3939 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3940 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3941 |
|
3892 | 3942 |
aspects |
6284 | 3943 |
"returns the common aspect dictionary" |
3944 |
||
3892 | 3945 |
^ aspects |
3946 |
! |
|
3947 |
||
3948 |
runtimeAspectValueFor:something |
|
3949 |
"returns the default aspect item from the class variable RuntimeAspects |
|
3950 |
" |
|
3951 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
3952 |
! |
|
3953 |
||
4201 | 3954 |
saveAspectValues |
16306 | 3955 |
|prefs saveAspects aspectValue| |
3956 |
||
3957 |
prefs := UserPreferences current. |
|
3958 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3959 |
saveAspects := self class userPreferencesAspectList keys. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3960 |
saveAspects do:[ :aspectKey | |
4201 | 3961 |
aspectValue := (self perform:aspectKey) value. |
16306 | 3962 |
prefs |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3963 |
at: ('fileBrowser_',aspectKey asString) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3964 |
put: aspectValue. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3965 |
]. |
16306 | 3966 |
prefs beModified. |
3967 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3968 |
"Modified: / 04-09-2006 / 10:02:41 / cg" |
4201 | 3969 |
! |
3970 |
||
3892 | 3971 |
saveRuntimeAspectValues |
3972 |
|savedAspects dictionary value isHolder aspect| |
|
3973 |
||
5941 | 3974 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 3975 |
dictionary := Dictionary new. |
5941 | 3976 |
savedAspects do:[:aspectKey | |
4414 | 3977 |
aspect := self perform:aspectKey. |
3978 |
isHolder := aspect isValueModel. |
|
5941 | 3979 |
isHolder ifTrue:[ |
3980 |
value := aspect value |
|
3981 |
] ifFalse:[ |
|
3982 |
value := aspect |
|
3983 |
]. |
|
3984 |
dictionary at:aspectKey |
|
3985 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
3986 |
]. |
|
3987 |
RuntimeAspects := dictionary. |
|
3892 | 3988 |
! |
3989 |
||
4201 | 3990 |
userPreferencesAspectValueFor:something |
3991 |
"returns the default aspect from the Userpreferences |
|
3892 | 3992 |
" |
4201 | 3993 |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3994 |
(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
|
3995 |
^ UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3996 |
at:('fileBrowser_',something) asSymbol |
9579
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
3997 |
ifAbsent:nil "(self class userPreferencesAspectList at:something)". |
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
3998 |
|
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
3999 |
"Modified: / 14-10-2010 / 19:16:38 / cg" |
3892 | 4000 |
! ! |
4001 |
||
4011 | 4002 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
4003 |
||
9015 | 4004 |
filter:aString |
4005 |
self filterModel value:aString |
|
4006 |
! |
|
4007 |
||
4018 | 4008 |
filterBackgroundColor |
4009 |
||
4010 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
4011 |
! |
|
4012 |
||
4011 | 4013 |
filterBlockHolder |
4014 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4015 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 4016 |
! |
4017 |
||
4018 |
filterListModel |
|
4019 |
||
4020 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
4021 |
! |
|
4022 |
||
4023 |
filterModel |
|
5941 | 4024 |
|m| |
4025 |
||
4026 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
4027 |
^ m |
|
4011 | 4028 |
! |
4029 |
||
8185
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4030 |
filterModel:aHolder |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4031 |
self aspectFor:#filterModel put:aHolder. |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4032 |
! |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4033 |
|
4018 | 4034 |
filterValueBox |
4035 |
||
4036 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
4037 |
! |
|
4038 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4039 |
makeFilterBlock |
14497 | 4040 |
"return a two-arg filterblock on the file's path- and base-name. This block should return true for files |
9102 | 4041 |
to be shown" |
4042 |
||
17481 | 4043 |
| filterString filterStrings filters notFilters showHidden filterBlock caseSensitive| |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4044 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4045 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4046 |
filterString = '' ifTrue:[filterString := '*']. |
17481 | 4047 |
caseSensitive := "ignoreCaseInPattern ?" Filename isCaseSensitive. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4048 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4049 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
12760 | 4050 |
filterStrings := filterStrings |
4051 |
select:[:eachFilter | eachFilter withoutSeparators notEmpty]. |
|
4052 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4053 |
filters := filterStrings |
12760 | 4054 |
reject:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
4055 |
thenCollect: |
|
4056 |
[:eachPattern | |
|
4057 |
|pattern| |
|
4058 |
||
4059 |
pattern := eachPattern withoutSeparators. |
|
15597 | 4060 |
pattern includesMatchCharacters ifFalse:[ |
4061 |
"JV@2012-03-05: Add implict star at the beginning and at the end of pattern, |
|
4062 |
that's how most of the other applications behave - do what most users expect" |
|
4063 |
pattern first == $* ifFalse:[pattern := '*' , pattern]. |
|
4064 |
pattern last == $* ifFalse:[pattern := pattern , '*']. |
|
4065 |
]. |
|
13856 | 4066 |
|
17481 | 4067 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
12760 | 4068 |
]. |
4069 |
||
4070 |
notFilters := filterStrings |
|
4071 |
select:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
|
4072 |
thenCollect: |
|
4073 |
[:eachPattern | |
|
9296 | 4074 |
|pattern| |
4075 |
||
4076 |
pattern := eachPattern withoutSeparators. |
|
12760 | 4077 |
pattern := (pattern copyFrom:2) withoutSeparators. |
17481 | 4078 |
[:name :baseName | pattern match:baseName caseSensitive:caseSensitive] |
9296 | 4079 |
]. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4080 |
|
12760 | 4081 |
|
4082 |
(filters size == 1 and:[notFilters isEmpty]) ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4083 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4084 |
] ifFalse:[ |
12760 | 4085 |
filters isEmpty ifTrue:[ |
4086 |
filterBlock := [:name :baseName | |
|
4087 |
(notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not |
|
4088 |
]. |
|
4089 |
] ifFalse:[ |
|
4090 |
notFilters isEmpty ifTrue:[ |
|
4091 |
filterBlock := [:name :baseName | |
|
4092 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4093 |
]. |
|
4094 |
] ifFalse:[ |
|
4095 |
filterBlock := [:name :baseName | |
|
4096 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4097 |
and:[ (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not ] |
|
4098 |
]. |
|
4099 |
] |
|
4100 |
] |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4101 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4102 |
|
4011 | 4103 |
showHidden := self showHiddenFiles value. |
4104 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4105 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4106 |
]. |
9296 | 4107 |
^ [:name :baseName | |
4108 |
name isHidden not and:[filterBlock value:name value:baseName]]. |
|
13856 | 4109 |
|
4110 |
"Modified: / 05-02-2012 / 01:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
17481 | 4111 |
"Modified: / 27-03-2017 / 12:52:08 / stefan" |
4018 | 4112 |
! |
4113 |
||
4114 |
shownFiles |
|
4115 |
||
4116 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 4117 |
! ! |
4118 |
||
14126 | 4119 |
|
3892 | 4120 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
4121 |
||
4122 |
dirHistory |
|
6369 | 4123 |
"obsolete" |
4124 |
^ self directoryHistory |
|
4125 |
! |
|
4126 |
||
4127 |
directoryHistory |
|
3952 | 4128 |
^ self class directoryHistory |
3892 | 4129 |
! |
4130 |
||
4131 |
enableBack |
|
4132 |
||
15259 | 4133 |
^ self aspectFor:#enableBack ifAbsent:[ValueHolder with:false] |
3892 | 4134 |
! |
4135 |
||
4136 |
enableFileHistory |
|
4137 |
||
15259 | 4138 |
^ self aspectFor:#enableFileHistory ifAbsent:[ValueHolder with:false] |
3892 | 4139 |
! |
4140 |
||
4141 |
enableForward |
|
4142 |
||
15259 | 4143 |
^ self aspectFor:#enableForward ifAbsent:[ValueHolder with:false] |
3892 | 4144 |
! |
4145 |
||
4146 |
fileHistory |
|
9820
07b7d7929e3e
variable renamed in: #fileHistory
Stefan Vogel <sv@exept.de>
parents:
9793
diff
changeset
|
4147 |
^ self aspectFor:#fileHistory ifAbsent:[OrderedSet new] |
3892 | 4148 |
! ! |
4149 |
||
4150 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
4151 |
||
4345 | 4152 |
activityVisibilityChannel |
6284 | 4153 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 4154 |
|
15259 | 4155 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ ValueHolder with:false ]. |
4345 | 4156 |
! |
4157 |
||
15111 | 4158 |
alwaysUseSmalltalkTools |
4159 |
" aspect to prevent os tools to be opened on double click" |
|
4160 |
||
15259 | 4161 |
^ self aspectFor:#alwaysUseSmalltalkTools ifAbsent:[ ValueHolder with:true ]. |
15111 | 4162 |
! |
4163 |
||
6602 | 4164 |
changeSetBrowserItemVisible |
4165 |
^ Screen current ctrlDown. |
|
4166 |
! |
|
4167 |
||
11135 | 4168 |
cvsMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4169 |
^ ConfigurableFeatures includesFeature: #CVSSupportEnabled |
11135 | 4170 |
|
4171 |
"Created: / 15-01-2012 / 13:00:05 / cg" |
|
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4172 |
"Modified: / 19-01-2012 / 10:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4173 |
! |
4174 |
||
13856 | 4175 |
hgMenusAreShown |
4176 |
^ (ConfigurableFeatures includesFeature: #HGSupportEnabled) |
|
4177 |
||
4178 |
"Created: / 14-01-2013 / 11:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4179 |
! |
|
4180 |
||
11135 | 4181 |
mercurialMenusAreShown |
11147 | 4182 |
^ ConfigurableFeatures hasMercurialSupportEnabled |
11135 | 4183 |
|
4184 |
"Created: / 15-01-2012 / 13:00:00 / cg" |
|
4185 |
! |
|
4186 |
||
4110 | 4187 |
openAlwaysInTextEditor |
17024 | 4188 |
" aspect for open every file in TextEditor don't use e.g. HtmlEditor for *.html'" |
4110 | 4189 |
|
15111 | 4190 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
4110 | 4191 |
! |
4192 |
||
3892 | 4193 |
openMultipleApplicationsForType |
4194 |
||
4201 | 4195 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
4196 |
open TextEditor " |
|
4197 |
||
3892 | 4198 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
4199 |
! |
|
4200 |
||
11137 | 4201 |
perforceMenusAreShown |
11996
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4202 |
^ (ConfigurableFeatures includesFeature: #PerforceSupportEnabled) |
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4203 |
and:[ ConfigurableFeatures hasPerforceSupportEnabled ] |
11137 | 4204 |
|
4205 |
"Created: / 15-01-2012 / 13:12:11 / cg" |
|
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4206 |
"Modified: / 19-01-2012 / 10:43:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11996
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4207 |
"Modified: / 02-11-2012 / 11:19:59 / cg" |
11137 | 4208 |
! |
4209 |
||
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
|
4210 |
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
|
4211 |
|
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
|
4212 |
^ 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
|
4213 |
|
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
|
4214 |
"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
|
4215 |
! |
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
|
4216 |
|
4201 | 4217 |
showDirectoryTree |
4218 |
||
4219 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 4220 |
! |
4221 |
||
4554 | 4222 |
showDiskUsageHolder |
4223 |
|holder| |
|
4224 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
4225 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 4226 |
holder addDependent:self. |
4554 | 4227 |
^ holder |
4228 |
! |
|
4229 |
||
3892 | 4230 |
showHiddenFiles |
4231 |
||
9582 | 4232 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
4233 |
||
4234 |
"Modified: / 15-10-2010 / 10:28:17 / cg" |
|
3892 | 4235 |
! |
4236 |
||
9108 | 4237 |
showHiddenFiles:aHolder |
4238 |
self aspectFor:#showHiddenFiles put:aHolder. |
|
4239 |
! |
|
4240 |
||
4241 |
shownFiles:aHolder |
|
4242 |
self aspectFor:#shownFiles put:aHolder. |
|
4243 |
! |
|
4244 |
||
11135 | 4245 |
svnMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4246 |
^ ConfigurableFeatures includesFeature: #SubversionSupportEnabled |
11135 | 4247 |
|
4248 |
"Created: / 15-01-2012 / 13:02:03 / cg" |
|
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4249 |
"Modified: / 19-01-2012 / 10:43:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4250 |
! |
4251 |
||
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4252 |
tagsBrowserVisibleHolder |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4253 |
masterApplication notNil ifTrue:[ |
11162
faf8af233ac0
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
11156
diff
changeset
|
4254 |
^ masterApplication perform:#tagsBrowserVisibleHolder ifNotUnderstood:false |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4255 |
]. |
10762
311190be6490
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
10757
diff
changeset
|
4256 |
^ self aspectFor:#tagsBrowserVisibleHolder ifAbsent:[ FileApplicationNoteBook::TextEditor defaultTagsBrowserVisible asValue ]. |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4257 |
|
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4258 |
"Created: / 27-06-2011 / 16:02:59 / cg" |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4259 |
! |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4260 |
|
10757
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4261 |
useCodeView2InTools |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4262 |
^ self aspectFor:#useCodeView2InTools ifAbsent:[ UserPreferences current useCodeView2InTools asValue ]. |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4263 |
|
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4264 |
"Created: / 06-10-2011 / 11:45:58 / cg" |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4265 |
! |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4266 |
|
4648 | 4267 |
userContextAvailable |
4268 |
||
4269 |
" aspect for show group and user columns in contents view |
|
4270 |
windows provides no user context" |
|
4271 |
||
4272 |
^ OperatingSystem isMSWINDOWSlike not |
|
4273 |
! |
|
4274 |
||
3892 | 4275 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4276 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4277 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4278 |
^ self directoryContentsBrowser viewDescription |
3892 | 4279 |
! |
4280 |
||
4281 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4282 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 4283 |
" |
3892 | 4284 |
|
6121 | 4285 |
|directoryContentsBrowser| |
4286 |
||
4287 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
4288 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
4289 |
^ directoryContentsBrowser viewDetails |
|
3892 | 4290 |
! |
4291 |
||
4292 |
viewDirectoryDescription |
|
4293 |
||
4201 | 4294 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
4295 |
on change directory " |
|
4296 |
||
3892 | 4297 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
4298 |
! |
|
4299 |
||
4201 | 4300 |
viewDirsInContentsBrowser |
4301 |
||
4302 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
9319
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4303 |
|
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4304 |
" |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4305 |
UserPreferences current viewDirsInContentsBrowser |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4306 |
" |
4201 | 4307 |
! |
4308 |
||
5870 | 4309 |
viewFilesInContentsBrowser |
4310 |
||
4311 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
4312 |
! |
|
4313 |
||
3892 | 4314 |
viewFilesInDirectoryTree |
4315 |
||
4201 | 4316 |
" aspect for view files in tree view (not only directories) " |
4317 |
||
3892 | 4318 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
4319 |
! |
|
4320 |
||
4321 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4322 |
" aspect for show group information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4323 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4324 |
^ self directoryContentsBrowser viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4325 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4326 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4327 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4328 |
" aspect for show file-type icon in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4329 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4330 |
^ self directoryContentsBrowser viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4331 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4332 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4333 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4334 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4335 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4336 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 4337 |
! |
4338 |
||
4339 |
viewNoteBookApplicationHolder |
|
4340 |
||
4341 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
4342 |
! |
|
4343 |
||
4344 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4345 |
" aspect for show owner information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4346 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4347 |
^ self directoryContentsBrowser viewOwner |
3892 | 4348 |
! |
4349 |
||
4350 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4351 |
" aspect for show permission information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4352 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4353 |
^ self directoryContentsBrowser viewPermissions |
3892 | 4354 |
! |
4355 |
||
4356 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4357 |
" aspect for show image previev in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4358 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4359 |
^ self directoryContentsBrowser viewPreview |
3892 | 4360 |
! |
4361 |
||
4362 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4363 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4364 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4365 |
^ self directoryContentsBrowser viewSize |
3892 | 4366 |
! |
4367 |
||
4974 | 4368 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4369 |
" aspect for show size-in-bytes information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4370 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4371 |
^ self directoryContentsBrowser viewSizeInBytes |
4974 | 4372 |
! |
4373 |
||
5312 | 4374 |
viewSizeInKiloBytes |
4375 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
4376 |
||
4377 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
4378 |
! |
|
4379 |
||
3892 | 4380 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4381 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4382 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4383 |
^ self directoryContentsBrowser viewTime |
3892 | 4384 |
! |
4385 |
||
4386 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4387 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4388 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4389 |
^ self directoryContentsBrowser viewType |
3892 | 4390 |
! ! |
4391 |
||
4392 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
4393 |
||
4394 |
executeCommand:cmd |
|
4395 |
||
4396 |
self executeCommand:cmd inDirectory:nil |
|
4397 |
! |
|
4398 |
||
5880 | 4399 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 4400 |
| nameString executionBlock| |
4401 |
||
5880 | 4402 |
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
|
4403 |
nameString := 'Execute: ', cmd. |
3892 | 4404 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4405 |
! |
|
4406 |
||
4407 |
getExecutionBlockForCommand:cmd |
|
4408 |
||
4409 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
4410 |
! |
|
4411 |
||
5880 | 4412 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
4413 |
| dir| |
|
4414 |
||
4415 |
dir := directoryOrNil. |
|
4416 |
directoryOrNil isNil ifTrue:[ |
|
4417 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6671 | 4418 |
dir isNil ifTrue:[ |
12493 | 4419 |
Dialog warn:(resources string:'Please select a single directory.'). |
16732 | 4420 |
AbortOperationRequest raise. |
6671 | 4421 |
^ nil |
4422 |
]. |
|
3892 | 4423 |
]. |
4523 | 4424 |
|
4425 |
^ [:stream| |
|
4426 |
stream notNil ifTrue:[ |
|
4414 | 4427 |
OperatingSystem |
4428 |
executeCommand:cmd |
|
4429 |
inputFrom:nil |
|
4430 |
outputTo:stream |
|
4431 |
errorTo:stream |
|
4432 |
inDirectory:dir |
|
16732 | 4433 |
lineWise:true |
16825 | 4434 |
showWindow:false |
4414 | 4435 |
onError:[:status| false]. |
4436 |
] |
|
4523 | 4437 |
]. |
3892 | 4438 |
! |
4439 |
||
4440 |
killAllRunningBackgroundProcesses |
|
4441 |
||
4442 |
self backgroundProcesses do:[ : process | |
|
4523 | 4443 |
self notify:'kill ', process name. |
4414 | 4444 |
process terminate. |
3892 | 4445 |
]. |
4446 |
! |
|
4447 |
||
4448 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
4449 |
| stream process appl nameString| |
|
4450 |
||
4451 |
appl := self openCommandResultApplication. |
|
4452 |
stream := appl resultStream. |
|
4453 |
nameString := aString ? 'Execution Result'. |
|
4454 |
appl changeTabTo:nameString. |
|
4523 | 4455 |
|
16102 | 4456 |
process := |
4457 |
[ |
|
4458 |
[aBlock value:stream] |
|
4459 |
ensure:[ |
|
4460 |
self backgroundProcesses remove:process ifAbsent:[]. |
|
4461 |
appl process value:nil. |
|
4462 |
||
4463 |
"/ close automatically, if there was no output. |
|
4571 | 4464 |
"/ appl resultStream contents isEmpty ifTrue:[ |
4465 |
"/ appl doClose. |
|
4466 |
"/ ] |
|
16102 | 4467 |
stream nextPutLine:'Done.'. |
4468 |
self enqueueMessage:#updateCurrentDirectory. |
|
4469 |
] |
|
4470 |
] newProcess. |
|
3892 | 4471 |
process priority:(Processor userBackgroundPriority). |
4472 |
process name:nameString. |
|
4473 |
self backgroundProcesses add:process. |
|
4474 |
appl process value:process. |
|
4475 |
process resume. |
|
4476 |
! ! |
|
4477 |
||
4478 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
4479 |
||
4915 | 4480 |
currentFileNameHolderChanged |
4481 |
"/ self currentFileNameHolderChangedForCommon |
|
4482 |
! |
|
4483 |
||
4577 | 4484 |
currentFileNameHolderChangedForCommon |
5476 | 4485 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4486 |
|
7560 | 4487 |
selection := self currentSelectedObjects. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4488 |
self class currentSelection:selection. |
4734 | 4489 |
|
13521 | 4490 |
selectionNotEmpty := selection notEmptyOrNil. |
5476 | 4491 |
self hasSelection value:selectionNotEmpty. |
4492 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
4734 | 4493 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4494 |
newDirectories := self directoriesForFiles:selection. |
6725 | 4495 |
oldDirectories := self currentSelectedDirectories. |
4011 | 4496 |
oldDirectories ~= newDirectories ifTrue:[ |
4347 | 4497 |
self currentDirectories value:newDirectories. |
4498 |
size := newDirectories size. |
|
4774 | 4499 |
rootInTreeView := self |
4500 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 4501 |
ifPresentDo:[:appl | appl rootHolder]. |
4502 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
4503 |
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
|
4504 |
|
4347 | 4505 |
newDirectories notEmpty ifTrue:[ |
6369 | 4506 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 4507 |
]. |
5074 | 4508 |
self enableHome value:((newDirectories includes:(Filename homeDirectory asAbsoluteFilename))not). |
14308 | 4509 |
"/ self enableGotoDesktop value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
6456 | 4510 |
self enableGotoDefaultDirectory value:((newDirectories includes:(Filename defaultDirectory asAbsoluteFilename))not). |
4511 |
self enableGotoSmalltalkDirectory value:((newDirectories includes:(self smalltalkDirectory asAbsoluteFilename))not). |
|
9572 | 4512 |
self enableGotoDesktopDirectory value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
9677 | 4513 |
self enableGotoTempDirectory value:((newDirectories includes:(self tempDirectory asAbsoluteFilename))not). |
4011 | 4514 |
]. |
9599
6ffff091db22
changed: #currentFileNameHolderChangedForCommon
Claus Gittinger <cg@exept.de>
parents:
9596
diff
changeset
|
4515 |
self enableGotoDefaultDirectory value:(self currentDirectory isNil or:[self currentDirectory pathName ~= OperatingSystem getCurrentDirectory]). |
9596 | 4516 |
self enableMakeCurrentDirectory value:(newDirectories size == 1 |
4517 |
and:[ newDirectories first asFilename pathName ~= OperatingSystem getCurrentDirectory ]). |
|
4022 | 4518 |
self enableForward value:self canForward. |
4734 | 4519 |
self enableBack value:self canBackward. |
6095 | 4520 |
|
13856 | 4521 |
self updateCanMake. |
7560 | 4522 |
|
9677 | 4523 |
"Modified: / 29-12-2010 / 11:01:52 / cg" |
13856 | 4524 |
"Modified: / 17-12-2013 / 08:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4011 | 4525 |
! |
4526 |
||
4527 |
filterModelChanged |
|
4528 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4529 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 4530 |
! |
4531 |
||
3892 | 4532 |
update:something with:aParameter from:changedObject |
4533 |
||
4534 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
4535 |
and the things that have to be done if it runs standalone " |
|
4536 |
||
4537 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 4538 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4539 |
^ self |
3892 | 4540 |
]. |
3989 | 4541 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4542 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4543 |
^ self |
3989 | 4544 |
]. |
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4545 |
changedObject == self sortBlockProperty ifTrue:[ |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4546 |
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
|
4547 |
^ self |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4548 |
]. |
4011 | 4549 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4550 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4551 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4552 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4553 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4554 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4555 |
^ self |
4004 | 4556 |
]. |
4781 | 4557 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 4558 |
self notify:nil. |
4781 | 4559 |
^ self |
4560 |
]. |
|
3989 | 4561 |
|
3892 | 4562 |
super update:something with:aParameter from:changedObject |
5543 | 4563 |
! |
4564 |
||
6095 | 4565 |
updateCanMake |
4566 |
|dir can| |
|
4567 |
||
4568 |
can := false. |
|
4569 |
dir := self currentDirectory. |
|
4570 |
dir notNil ifTrue:[ |
|
13856 | 4571 |
"/ Check for make |
6095 | 4572 |
can := (dir asFilename construct:'Makefile') exists. |
13856 | 4573 |
can ifFalse:[ |
4574 |
can := (dir asFilename construct:'makefile') exists. |
|
4575 |
]. |
|
6095 | 4576 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
4577 |
can ifFalse:[ |
|
13856 | 4578 |
can := (self currentDirectory asFilename construct:'bc.mak') exists. |
6095 | 4579 |
] |
4580 |
]. |
|
13856 | 4581 |
can ifTrue:[ |
4582 |
self makeCommandHolder value: 'make'. |
|
4583 |
self canMake value: true. |
|
4584 |
^ self |
|
4585 |
]. |
|
4586 |
||
4587 |
"/Check for Apache ant |
|
4588 |
(OperatingSystem canExecuteCommand: 'ant') ifTrue:[ |
|
4589 |
can := (dir asFilename construct:'build.xml') exists. |
|
4590 |
can ifTrue:[ |
|
4591 |
self makeCommandHolder value: 'ant'. |
|
4592 |
self canMake value: true. |
|
4593 |
^ self |
|
4594 |
]. |
|
4595 |
]. |
|
4596 |
||
4597 |
"/Add more here... |
|
4598 |
||
6095 | 4599 |
]. |
4600 |
self canMake value:can. |
|
13856 | 4601 |
|
4602 |
"Modified: / 17-12-2013 / 08:13:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6095 | 4603 |
! |
4604 |
||
5543 | 4605 |
updateListAfterDelete:colOfFiles |
4606 |
self updateCurrentDirectory |
|
3892 | 4607 |
! ! |
4608 |
||
4609 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
4610 |
||
4611 |
canPaste |
|
4612 |
||
15259 | 4613 |
^ self aspectFor:#canPaste ifAbsent:[ ValueHolder with:false ]. |
3892 | 4614 |
! |
4615 |
||
4616 |
clipboard |
|
4617 |
||
4618 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
4619 |
! |
|
4620 |
||
4621 |
copyFilesToClipBoard:colOfFiles |
|
4622 |
self putInClipBoard:colOfFiles as:#copy. |
|
4623 |
! |
|
4624 |
||
4625 |
cutFilesToClipBoard:colOfFiles |
|
4626 |
"defete current selected files/directories |
|
4627 |
" |
|
4628 |
self putInClipBoard:colOfFiles as:#cut. |
|
4629 |
! |
|
4630 |
||
4631 |
emptyClipBoard |
|
4632 |
||
4633 |
self clipboard files:nil. |
|
4634 |
self canPaste value:false. |
|
4635 |
! |
|
4636 |
||
4637 |
putInClipBoard:colOfFiles as:aSymbol |
|
4638 |
| stream clp| |
|
4639 |
||
4640 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
4641 |
clp := self clipboard. |
|
4642 |
clp files:nil. |
|
4643 |
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
|
4644 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
4645 |
stream := String writeStream. |
3892 | 4646 |
stream nextPutAll:aSymbol asString. |
4647 |
stream nextPutAll:' <'. |
|
4648 |
stream nextPutAll:colOfFiles first asString. |
|
4649 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 4650 |
stream nextPutAll:' ...'. |
3892 | 4651 |
]. |
4652 |
stream nextPutAll:'> to clipboard'. |
|
4653 |
||
4523 | 4654 |
self notify:stream contents. |
3892 | 4655 |
clp files:colOfFiles. |
4656 |
self canPaste value:true. |
|
4657 |
! ! |
|
4658 |
||
4659 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
4660 |
||
4661 |
canDropFiles:dropedObjects for:filename |
|
6284 | 4662 |
|filenameDirString filenameDir| |
3892 | 4663 |
|
4664 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 4665 |
|
3892 | 4666 |
filenameDir := self getDirWithoutFileName:filename. |
7491 | 4667 |
filenameDir isNil ifTrue:[^ false ]. |
13232 | 4668 |
filenameDir isWritableDirectory ifFalse:[^ false]. |
6284 | 4669 |
|
3892 | 4670 |
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
|
4671 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
4672 |
dropedObjects do:[:aDropObject | |
6284 | 4673 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
4674 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
4675 |
"/ |
|
4676 |
"/ dropFileName := aDropObject theObject. |
|
4677 |
"/ dropFileNameString := dropFileName asString. |
|
4678 |
"/ dropFileName isDirectory ifTrue:[ |
|
4679 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
4680 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
4681 |
"/ ^ false |
|
4682 |
"/ ] |
|
4683 |
"/ ] ifFalse:[ |
|
4684 |
"/ physicalPathName := dropFileName physicalPathName. |
|
4685 |
"/ (filenameDirString = dropFileName directory asString |
|
4686 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
4687 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
4688 |
"/ self notify:'Cannot drop a file into same directory'. |
|
4689 |
"/ ^ false |
|
4690 |
"/ ] |
|
4691 |
"/ ] |
|
4692 |
]. |
|
4693 |
self notify:nil. |
|
4694 |
^ true |
|
4695 |
! |
|
4696 |
||
4697 |
canDropObject:aDropObject into:aDirectory |
|
4698 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
4699 |
||
4700 |
dropFileName := aDropObject theObject. |
|
4701 |
dropFileNameString := dropFileName asString. |
|
4702 |
dropFileName isDirectory ifTrue:[ |
|
4703 |
filenameDirString := aDirectory asString. |
|
4704 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
4705 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
4706 |
^ false |
|
4414 | 4707 |
] |
6284 | 4708 |
] ifFalse:[ |
4709 |
physicalPathName := dropFileName physicalPathName. |
|
4710 |
(aDirectory = dropFileName directory |
|
4711 |
or:[ aDropObject isFileInArchive not |
|
4712 |
and:[physicalPathName notNil |
|
4713 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
4714 |
self notify:'Cannot drop a file into same directory'. |
|
4715 |
^ false |
|
4716 |
] |
|
4717 |
]. |
|
4718 |
^ true. |
|
3892 | 4719 |
! |
4720 |
||
7406 | 4721 |
canDropObjects:aCollectionOfDropObjects in:aWidget |
4722 |
^ aCollectionOfDropObjects contains:[:dropObject | dropObject isFileObject] |
|
4723 |
||
4724 |
"Created: / 13-10-2006 / 15:52:49 / cg" |
|
4725 |
! |
|
4726 |
||
17202 | 4727 |
doStartDrag:arg1 in:arg2 |
4728 |
^ self class doStartDrag:arg1 in:arg2 |
|
6479 | 4729 |
! |
4730 |
||
7408 | 4731 |
dropObjects:aCollectionOfDropObjects in:aWidget at:position |
7990 | 4732 |
|fileEntryFieldHolder destDir dropObject fn d| |
4733 |
||
4734 |
fileEntryFieldHolder := self masterApplication notNil |
|
4735 |
ifTrue:[ self masterApplication fileEntryFieldHolder ] |
|
4736 |
ifFalse:[ self fileEntryFieldHolder ]. |
|
4737 |
||
4738 |
aWidget model == fileEntryFieldHolder ifTrue:[ |
|
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4739 |
dropObject := aCollectionOfDropObjects first. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4740 |
dropObject isFileObject ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4741 |
fn := dropObject theObject asFilename. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4742 |
dropObject isDirectory ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4743 |
d := fn. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4744 |
] ifFalse:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4745 |
d := fn directory. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4746 |
]. |
7990 | 4747 |
fileEntryFieldHolder value:d pathName. |
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4748 |
]. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4749 |
^ self. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4750 |
]. |
6479 | 4751 |
|
4752 |
destDir := self currentDirectory. |
|
4753 |
destDir isNil ifTrue:[^ self]. |
|
4754 |
||
8601 | 4755 |
self withWaitCursorDo:[ |
4756 |
aCollectionOfDropObjects do:[:dropObject | |
|
4757 |
|fn| |
|
4758 |
||
4759 |
dropObject isFileObject ifTrue:[ |
|
4760 |
fn := dropObject theObject asFilename. |
|
4761 |
dropObject isDirectory ifTrue:[ |
|
8808
cb6476c0cd3a
oops - drop of directories was broken
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
4762 |
fn recursiveCopyTo:destDir |
8601 | 4763 |
] ifFalse:[ |
8950
48c69259d82d
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
8887
diff
changeset
|
4764 |
fn copyTo:(destDir / fn baseName ) |
8601 | 4765 |
] |
6479 | 4766 |
] |
8601 | 4767 |
]. |
4768 |
]. |
|
9268
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4769 |
self directoryContentsBrowser notNil ifTrue:[ |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4770 |
self directoryContentsBrowser |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4771 |
directoryContentsChangeFlag:true; |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4772 |
wakeUp |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4773 |
]. |
7408 | 4774 |
|
4775 |
"Created: / 13-10-2006 / 18:26:41 / cg" |
|
3892 | 4776 |
! ! |
4777 |
||
4778 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
4779 |
||
4780 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 4781 |
"copy to" |
4782 |
||
7635 | 4783 |
^ self copyFile:aSourceFile to:aDestFile repairCorruptedFiles:false |
4784 |
||
4785 |
"Modified: / 07-02-2007 / 18:46:44 / cg" |
|
4786 |
! |
|
4787 |
||
4788 |
copyFile:aSourceFile to:aDestFile repairCorruptedFiles:repairCorruptedFiles |
|
4789 |
"copy to" |
|
4790 |
||
4791 |
|copyOperation msg| |
|
4792 |
||
4793 |
repairCorruptedFiles ifTrue:[ |
|
4794 |
copyOperation := FileOperation copyCorruptedFile:aSourceFile to:aDestFile |
|
4795 |
] ifFalse:[ |
|
4796 |
copyOperation := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
|
4797 |
]. |
|
4798 |
copyOperation result ifTrue:[ |
|
6190 | 4799 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 4800 |
] ifFalse:[ |
7635 | 4801 |
msg := copyOperation errorString. |
6190 | 4802 |
]. |
4803 |
self notify:msg. |
|
7635 | 4804 |
^ copyOperation result |
4805 |
||
4806 |
"Created: / 07-02-2007 / 18:46:34 / cg" |
|
3892 | 4807 |
! |
4808 |
||
4809 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
6374 | 4810 |
|copy result| |
3892 | 4811 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4812 |
self withActivityIndicationDo:[ |
5961 | 4813 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
6374 | 4814 |
copy result ifTrue:[ |
4815 |
result := Dictionary withKeys:(copy collectionOfCopiedFiles) andValues:(copy collectionOfNewFiles). |
|
4816 |
] ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4817 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4818 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4819 |
self updateCurrentDirectory. |
3892 | 4820 |
]. |
6374 | 4821 |
^ result |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4822 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4823 |
"Modified: / 25-07-2006 / 09:07:04 / cg" |
3892 | 4824 |
! |
4825 |
||
15569 | 4826 |
copyFromToRepairingCorruptedFiles |
4827 |
"ask for source and destination and copy the entered file. |
|
4828 |
Especially useful for raw devices to copy corrupted disks/files |
|
4829 |
" |
|
4830 |
||
4831 |
|source destination| |
|
4832 |
||
4833 |
source := Dialog |
|
4834 |
requestDirectoryName:(resources string:'Copy from:') |
|
4835 |
default:(LastMoveDestination ? self currentDirectory) |
|
4836 |
ok:(resources string:'Continue') |
|
4837 |
abort:nil. |
|
4838 |
||
4839 |
source isEmptyOrNil ifTrue:[^ self]. |
|
4840 |
source := source asFilename. |
|
4841 |
||
4842 |
destination := Dialog |
|
4843 |
requestDirectoryName:(resources string:'Copy "%1" to:' with:source) |
|
4844 |
default:(LastMoveDestination ? self currentDirectory) |
|
4845 |
ok:(resources string:'Copy') |
|
4846 |
abort:nil. |
|
4847 |
||
4848 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
4849 |
destination := destination asFilename. |
|
4850 |
||
4851 |
self copyFile:source to:destination repairCorruptedFiles:true. |
|
4852 |
! |
|
4853 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4854 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
12850 | 4855 |
|size msg answer file| |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4856 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4857 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4858 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4859 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4860 |
"/ 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
|
4861 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4862 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4863 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4864 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4865 |
"/ 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
|
4866 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4867 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4868 |
"/ 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
|
4869 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4870 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4871 |
"/ 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
|
4872 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4873 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4874 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4875 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4876 |
stringWithCRs:'Copy or move\\%1:\ %2\to:\ %3 ?' |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4877 |
with:(file type == #regular ifTrue:'file' ifFalse:[file isDirectory ifTrue:'directory' ifFalse:'object']) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4878 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4879 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4880 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4881 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4882 |
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
|
4883 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4884 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 4885 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4886 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4887 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4888 |
request:msg |
8127 | 4889 |
label:(resources string:'Copy or Move') |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
4890 |
image:(WarningBox iconBitmap) |
8127 | 4891 |
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
|
4892 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4893 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4894 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4895 |
^ answer. |
3892 | 4896 |
! |
4897 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4898 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 4899 |
"copy or move aColOfSourceFiles to aDirectory. |
4900 |
Asks the used if a move or a copy is wanted. |
|
4901 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
4902 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4903 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4904 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4905 |
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
|
4906 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4907 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4908 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4909 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4910 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4911 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4912 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4913 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4914 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4915 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4916 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4917 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 4918 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4919 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4920 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4921 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4922 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4923 |
|
4745 | 4924 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4925 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4926 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4927 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 4928 |
^ true. |
3892 | 4929 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4930 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4931 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 4932 |
^ true. |
3892 | 4933 |
]. |
4745 | 4934 |
^ false. |
3892 | 4935 |
! |
4936 |
||
6107 | 4937 |
copySelectionTo |
4938 |
"copy the selected file(s) to another directory" |
|
4939 |
||
13704 | 4940 |
self copySelectionToRepairingCorruptedFiles:false. |
4941 |
self updateCurrentDirectoryWithReread. |
|
7635 | 4942 |
|
4943 |
"Modified: / 07-02-2007 / 18:42:48 / cg" |
|
4944 |
! |
|
4945 |
||
4946 |
copySelectionToRepairingCorruptedFiles |
|
4947 |
"copy the selected file(s) to another directory" |
|
4948 |
||
13704 | 4949 |
self copySelectionToRepairingCorruptedFiles:true. |
4950 |
self updateCurrentDirectoryWithReread. |
|
7635 | 4951 |
|
4952 |
"Created: / 07-02-2007 / 18:42:59 / cg" |
|
4953 |
! |
|
4954 |
||
4955 |
copySelectionToRepairingCorruptedFiles:repairingCorruptedFiles |
|
4956 |
"copy the selected file(s) to another directory" |
|
4957 |
||
6299 | 4958 |
|selectedFiles msg destination directory| |
4959 |
||
7560 | 4960 |
selectedFiles := self currentSelectedObjects copy. |
6299 | 4961 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
4962 |
||
4963 |
msg := (selectedFiles size > 1) |
|
14588 | 4964 |
ifTrue:[ 'Copy Selected Items to Directory:' ] |
4965 |
ifFalse:[ 'Copy "%1" to Directory:' ]. |
|
6299 | 4966 |
|
4967 |
destination := Dialog |
|
14588 | 4968 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first baseName) |
7635 | 4969 |
default:(LastMoveDestination ? self currentDirectory) |
4970 |
ok:(resources string:'Copy') |
|
4971 |
abort:nil. |
|
4972 |
||
6299 | 4973 |
destination isEmptyOrNil ifTrue:[^ self]. |
4974 |
destination := destination asFilename. |
|
4975 |
||
4976 |
destination isDirectory ifFalse:[ |
|
4977 |
selectedFiles size == 1 ifTrue:[ |
|
4978 |
directory := destination directory. |
|
4979 |
directory isDirectory ifTrue:[ |
|
4980 |
LastMoveDestination := directory. |
|
7635 | 4981 |
self copyFile:selectedFiles first to:destination repairCorruptedFiles:repairingCorruptedFiles. |
6299 | 4982 |
^ self. |
4983 |
] |
|
4984 |
] |
|
4985 |
]. |
|
4986 |
||
4987 |
LastMoveDestination := destination. |
|
7635 | 4988 |
repairingCorruptedFiles ifTrue:[ |
4989 |
selectedFiles do:[:eachFile | |
|
4990 |
self copyFile:eachFile to:destination repairCorruptedFiles:repairingCorruptedFiles. |
|
4991 |
]. |
|
4992 |
^ self. |
|
4993 |
] ifFalse:[ |
|
4994 |
self copyFiles:selectedFiles to:destination |
|
4995 |
] |
|
4996 |
||
4997 |
"Created: / 07-02-2007 / 18:42:35 / cg" |
|
6107 | 4998 |
! |
4999 |
||
3892 | 5000 |
deleteFile:aFile |
6373 | 5001 |
"delete the selected files/directories" |
3892 | 5002 |
|
5003 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
5004 |
! |
|
5005 |
||
5006 |
deleteFiles:colOfFiles |
|
6373 | 5007 |
"delete some files/directories" |
5008 |
||
5081 | 5009 |
^ self deleteFiles:colOfFiles confirm:true. |
5010 |
! |
|
5011 |
||
5012 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 5013 |
"delete some files/directories" |
5014 |
||
5673 | 5015 |
|delete result| |
3892 | 5016 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5017 |
self withActivityIndicationDo:[ |
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5018 |
ProgressNotification handle:[:info | |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5019 |
self progressPercentageHolder value:info progressValue. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5020 |
info proceed |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5021 |
] do:[ |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5022 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5023 |
result := delete result. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5024 |
]. |
5673 | 5025 |
result notNil ifTrue:[ |
5026 |
result ifFalse:[ |
|
5027 |
self notify:delete errorString. |
|
5753 | 5028 |
] ifTrue:[ |
5029 |
self updateListAfterDelete:colOfFiles. |
|
5030 |
] |
|
4394 | 5031 |
]. |
5673 | 5032 |
]. |
5033 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5034 |
|
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5035 |
"Modified: / 11-10-2010 / 13:08:24 / cg" |
3892 | 5036 |
! |
5037 |
||
6169 | 5038 |
eraseFiles:colOfFiles |
6373 | 5039 |
"erase (clear and delete) some files/directories" |
5040 |
||
6169 | 5041 |
^ self eraseFiles:colOfFiles confirm:true. |
5042 |
! |
|
5043 |
||
5044 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 5045 |
"erase (clear and delete) some files/directories" |
5046 |
||
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5047 |
|deleteOperation result fileSize| |
6169 | 5048 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5049 |
self withActivityIndicationDo:[ |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5050 |
fileSize := colOfFiles first asFilename fileSize. |
8294 | 5051 |
deleteOperation := FileOperation eraseFiles:colOfFiles confirm:confirm. |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5052 |
(colOfFiles size == 1 and:[ fileSize < (10*1024*1024) ]) |
8294 | 5053 |
ifTrue:[ |
5054 |
result := deleteOperation result. |
|
5055 |
] ifFalse:[ |
|
5056 |
ProgressIndicator |
|
5057 |
displayProgressNotifications:'Erasing' |
|
5058 |
abortable:true |
|
5059 |
at:nil |
|
5060 |
during:[ |
|
5061 |
result := deleteOperation result. |
|
5062 |
]. |
|
5063 |
]. |
|
5064 |
||
6169 | 5065 |
result notNil ifTrue:[ |
5066 |
result ifFalse:[ |
|
8294 | 5067 |
self notify:deleteOperation errorString. |
6169 | 5068 |
] ifTrue:[ |
5069 |
self updateListAfterDelete:colOfFiles. |
|
5070 |
] |
|
5071 |
]. |
|
5072 |
]. |
|
5073 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5074 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5075 |
"Modified: / 25-07-2006 / 09:07:16 / cg" |
6169 | 5076 |
! |
5077 |
||
3892 | 5078 |
moveFile:aSourceFile to:aDestFile |
6373 | 5079 |
"move a file/directory" |
3892 | 5080 |
|
5081 |
|move| |
|
5082 |
||
5961 | 5083 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 5084 |
move result ifTrue:[ |
15346 | 5085 |
self notify:(resources string: 'move "%1" to "%2"' with:aSourceFile asString with:aDestFile asString). |
3892 | 5086 |
] ifFalse:[ |
4523 | 5087 |
self notify:move errorString. |
3892 | 5088 |
]. |
5089 |
self updateCurrentDirectory. |
|
5090 |
^ move result |
|
5091 |
! |
|
5092 |
||
5093 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 5094 |
"move some files to aDirectory" |
5095 |
||
3892 | 5096 |
|move| |
5097 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5098 |
self withActivityIndicationDo:[ |
5961 | 5099 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5100 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5101 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5102 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5103 |
self updateCurrentDirectory. |
3892 | 5104 |
]. |
6373 | 5105 |
^ move collectionOfMovedFiles |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5106 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5107 |
"Modified: / 25-07-2006 / 09:07:32 / cg" |
3892 | 5108 |
! |
5109 |
||
6107 | 5110 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5111 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5112 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5113 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5114 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5115 |
destinationDirectory := Dialog |
14588 | 5116 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items to Directory:') |
5789 | 5117 |
default:(LastMoveDestination ? self currentDirectory) |
6952 | 5118 |
ok:(resources string:'Move') |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5119 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5120 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5121 |
|
5789 | 5122 |
LastMoveDestination := destinationDirectory. |
13704 | 5123 |
self moveFiles:(self currentSelectedObjects copy) to:destinationDirectory asFilename. |
5124 |
self updateCurrentDirectoryWithReread. |
|
5125 |
||
7560 | 5126 |
|
5127 |
"Modified: / 04-12-2006 / 13:15:12 / cg" |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5128 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5129 |
|
3892 | 5130 |
newDirectory |
5131 |
"ask for and create a new directory" |
|
5132 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5133 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5134 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5135 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5136 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5137 |
self warn:'Select a single directory to create a directory'. |
4979
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5138 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5139 |
]. |
4521 | 5140 |
|
5141 |
"/ 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
|
5142 |
selectedFiles := self currentSelectedFiles. |
4521 | 5143 |
selectedFiles size == 1 ifTrue:[ |
5144 |
singleSelectedFile := selectedFiles first. |
|
5145 |
||
5146 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
13714 | 5147 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5148 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
5149 |
||
5150 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
13714 | 5151 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5152 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
5153 |
]. |
|
5154 |
]. |
|
5155 |
]. |
|
5156 |
||
5961 | 5157 |
|
4521 | 5158 |
defaultAnswer notNil ifTrue:[ |
5961 | 5159 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 5160 |
] ifFalse:[ |
5961 | 5161 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 5162 |
]. |
5163 |
createOp result ifFalse:[ ^ self]. |
|
5164 |
newFile := createOp createdFile. |
|
3892 | 5165 |
newFile notNil ifTrue:[ |
4414 | 5166 |
self updateCurrentDirectory. |
3892 | 5167 |
] |
5168 |
! |
|
5169 |
||
5170 |
newFile |
|
5171 |
"ask for and create a new file" |
|
5172 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5173 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5174 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5175 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5176 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5177 |
self warn:'Select a single directory to create a file.'. |
4979
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5178 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5179 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5180 |
|
3982 | 5181 |
curFile := self firstSelectedFile. |
3892 | 5182 |
curFile notNil ifTrue:[ |
4414 | 5183 |
file := curFile. |
3892 | 5184 |
] ifFalse:[ |
4414 | 5185 |
file := directory. |
3892 | 5186 |
]. |
5961 | 5187 |
create := FileOperation createFileIn:file. |
3892 | 5188 |
create result ifFalse:[ ^ self]. |
5189 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
5190 |
! |
|
5191 |
||
5192 |
newHardLink |
|
5193 |
"ask for and create a hard link (unix only)" |
|
5194 |
||
6151 | 5195 |
self newLink:#hard. |
5196 |
! |
|
5197 |
||
5198 |
newLink:typeOfLink |
|
3892 | 5199 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
5200 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5201 |
| sel dir create createdFile| |
3892 | 5202 |
|
7560 | 5203 |
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
|
5204 |
(sel size ~= 1) ifTrue:[ |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5205 |
self warn:'Select one directory to link'. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5206 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5207 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5208 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5209 |
|
6151 | 5210 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 5211 |
create result ifFalse:[ ^ self]. |
5212 |
createdFile := create createdFile. |
|
5213 |
createdFile notNil ifTrue:[ |
|
6151 | 5214 |
typeOfLink == #soft ifTrue:[ |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5215 |
self updateCurrentDirectory. |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5216 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5217 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5218 |
] |
3892 | 5219 |
]. |
7560 | 5220 |
|
5221 |
"Modified: / 04-12-2006 / 13:15:15 / cg" |
|
3892 | 5222 |
! |
5223 |
||
5224 |
newSoftLink |
|
5225 |
"ask for and create a soft link (unix only)" |
|
5226 |
||
6151 | 5227 |
self newLink:#soft. |
3892 | 5228 |
! |
5229 |
||
5230 |
pasteFiles |
|
6373 | 5231 |
"paste from clipBoard" |
5232 |
||
5233 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 5234 |
|
5235 |
files := self clipboard files. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
5236 |
files isEmptyOrNil ifTrue:[ ^ self ]. |
6373 | 5237 |
|
5238 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
5239 |
||
3892 | 5240 |
buffer := self clipboard copy. |
3982 | 5241 |
directories := self currentSelectedDirectories. |
5880 | 5242 |
directories size ~~ 1 ifTrue:[ |
4414 | 5243 |
|box dirStringCol| |
5880 | 5244 |
|
4414 | 5245 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
5246 |
box := ListSelectionBox new. |
|
6373 | 5247 |
box title:'Paste into which directory ?'. |
4414 | 5248 |
box list:dirStringCol. |
5249 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5250 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5251 |
box destroy. |
3892 | 5252 |
] ifFalse:[ |
5880 | 5253 |
destination := directories anElement. |
3892 | 5254 |
]. |
6373 | 5255 |
|
5256 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 5257 |
buffer files copy do:[:aFile| |
5258 |
aFile directory = destination ifTrue:[ |
|
5259 |
buffer files remove:aFile. |
|
5260 |
]. |
|
5261 |
]. |
|
5262 |
]. |
|
5263 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6374 | 5264 |
copiedFiles notEmptyOrNil ifTrue:[ |
5265 |
thisIsAFileMoveOperation ifTrue:[ |
|
5266 |
self deleteFiles:(copiedFiles keys) confirm:false. |
|
5267 |
]. |
|
5268 |
||
5269 |
"/ select those pasted files. |
|
5270 |
self updateCurrentDirectory:true. |
|
5271 |
self currentFileNameHolder value:copiedFiles values. |
|
5272 |
] |
|
3892 | 5273 |
! |
5274 |
||
5275 |
renameFile:aFile |
|
5276 |
"rename the selected file(s)" |
|
5277 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5278 |
^ self renameFiles:(Array with:aFile). |
3892 | 5279 |
! |
5280 |
||
4230 | 5281 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 5282 |
"rename filename to newFileString" |
5283 |
||
5284 |
|rename| |
|
5285 |
||
5961 | 5286 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 5287 |
rename result ifTrue:[ |
4230 | 5288 |
aBoolean ifTrue:[ |
5289 |
self updateAndSelect:(rename renamedFiles). |
|
5290 |
]. |
|
3892 | 5291 |
] ifFalse:[ |
4523 | 5292 |
self notify:rename errorString. |
3892 | 5293 |
]. |
5294 |
^ rename result |
|
5295 |
! |
|
5296 |
||
5297 |
renameFiles:aColOfFiles |
|
6373 | 5298 |
"rename some file(s)" |
3892 | 5299 |
|
5300 |
|rename| |
|
5301 |
||
5961 | 5302 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 5303 |
rename result ifFalse:[ |
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5304 |
self notify:rename errorString. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5305 |
^ nil. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5306 |
]. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5307 |
^ rename |
3892 | 5308 |
! |
5309 |
||
5310 |
renameSelection |
|
5311 |
"rename the selected file(s)" |
|
5312 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5313 |
|renamed| |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5314 |
|
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5315 |
renamed := self renameFiles:(self currentSelectedObjects copy). |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5316 |
renamed notNil ifTrue:[ |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5317 |
self updateAndSelect:renamed renamedFiles. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5318 |
]. |
7560 | 5319 |
|
5320 |
"Modified: / 04-12-2006 / 13:15:24 / cg" |
|
3892 | 5321 |
! ! |
5322 |
||
4080 | 5323 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 5324 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5325 |
bookmarksMenu |
3952 | 5326 |
<resource: #programMenu> |
5327 |
||
14941 | 5328 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec. |
5329 |
! |
|
5330 |
||
5331 |
bookmarksMenuForBaseSpec:aBaseMenuSpec |
|
5332 |
<resource: #programMenu> |
|
5333 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5334 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5335 |
|
14941 | 5336 |
menu := aBaseMenuSpec decodeAsLiteralArray. |
7763 | 5337 |
|
5338 |
"/ add the bookmark items ... |
|
5339 |
bookmarks := self class directoryBookmarks. |
|
5340 |
bookmarks notEmptyOrNil ifTrue:[ |
|
14604 | 5341 |
menu addSeparator. |
7763 | 5342 |
bookmarks do:[:dirName | |
12963 | 5343 |
menu addItem:(MenuItem |
5344 |
label:dirName asString |
|
5345 |
itemValue:[ |
|
5346 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
|
5347 |
self setCurrentFileName:dirName. |
|
5348 |
]. |
|
5349 |
]). |
|
7763 | 5350 |
]. |
5351 |
]. |
|
4080 | 5352 |
menu findGuiResourcesIn:self. |
7763 | 5353 |
^ menu |
5354 |
||
11135 | 5355 |
"Modified: / 14-01-2012 / 21:14:03 / cg" |
7763 | 5356 |
! |
5357 |
||
5358 |
canBackward |
|
5359 |
^ self directoryHistory canBackward. |
|
5360 |
||
5361 |
"Modified: / 27-03-2007 / 10:54:55 / cg" |
|
5362 |
! |
|
5363 |
||
5364 |
canForward |
|
5365 |
^ self directoryHistory canForward. |
|
5366 |
||
5367 |
"Modified: / 27-03-2007 / 10:54:57 / cg" |
|
5368 |
! |
|
5369 |
||
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5370 |
gotoBookmarksMenu |
7763 | 5371 |
<resource: #programMenu> |
5372 |
||
14941 | 5373 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec2. |
6099 | 5374 |
! |
5375 |
||
3892 | 5376 |
menuDirHistory:backOrForward |
7763 | 5377 |
"initialize the history menu" |
5378 |
||
3892 | 5379 |
<resource: #programMenu > |
5380 |
||
7763 | 5381 |
|hist menu pathList currentSel currentPath| |
5382 |
||
5383 |
hist := self directoryHistory. |
|
5384 |
hist isEmpty ifTrue:[^ nil]. |
|
5385 |
||
3892 | 5386 |
backOrForward == #back ifTrue:[ |
6725 | 5387 |
currentSel := self currentSelectedDirectories. |
4347 | 5388 |
currentSel size == 1 ifTrue:[ |
5389 |
currentPath := currentSel first asString. |
|
5390 |
] ifFalse:[ |
|
5391 |
currentPath := nil. |
|
5392 |
]. |
|
7763 | 5393 |
pathList := hist getBackCollection. |
3892 | 5394 |
] ifFalse:[ |
7763 | 5395 |
pathList := hist getForwardCollection. |
3892 | 5396 |
]. |
4022 | 5397 |
pathList isEmpty ifTrue:[ ^ nil]. |
7763 | 5398 |
|
6370 | 5399 |
pathList size > 30 ifTrue:[ |
5400 |
pathList := pathList copyTo:30 |
|
5401 |
]. |
|
7763 | 5402 |
|
5403 |
menu := Menu new. |
|
5404 |
||
3964 | 5405 |
pathList do:[:aPath| |
14593 | 5406 |
menu addItem:(MenuItem |
5407 |
label:aPath |
|
5408 |
itemValue:[ self setCurrentFileName:(aPath asFilename) ] |
|
5409 |
translateLabel:false). |
|
3952 | 5410 |
]. |
7763 | 5411 |
menu findGuiResourcesIn:self. |
3892 | 5412 |
^ menu |
7763 | 5413 |
|
11783 | 5414 |
"Modified: / 09-09-2012 / 13:07:22 / cg" |
3892 | 5415 |
! |
5416 |
||
5417 |
menuDirHistoryBack |
|
5418 |
"initialize the directory menu |
|
5419 |
" |
|
5420 |
<resource: #programMenu > |
|
5421 |
||
5422 |
^ self menuDirHistory:#back. |
|
5423 |
! |
|
5424 |
||
5425 |
menuDirHistoryForward |
|
5426 |
"initialize the directory menu |
|
5427 |
" |
|
5428 |
<resource: #programMenu > |
|
5429 |
||
5430 |
^ self menuDirHistory:#forward. |
|
3906 | 5431 |
! |
5432 |
||
5433 |
menuFileHistory |
|
5434 |
"initialize the file history menu |
|
5435 |
" |
|
5436 |
<resource: #programMenu > |
|
5437 |
||
7763 | 5438 |
|menu hist text removeItem| |
3906 | 5439 |
|
5440 |
hist := self fileHistory. |
|
5441 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5442 |
|
7763 | 5443 |
menu := Menu new. |
5444 |
||
5445 |
hist copy do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5446 |
aFileItem fileName exists ifTrue:[ |
12963 | 5447 |
menu addItem:(MenuItem |
5448 |
label: aFileItem fileName asString |
|
14593 | 5449 |
itemValue: |
5450 |
[ |
|
5451 |
self setCurrentFileName:(aFileItem fileName). |
|
5452 |
self openApplByFileItem:aFileItem |
|
5453 |
] |
|
5454 |
translateLabel:false). |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5455 |
] ifFalse:[ |
7763 | 5456 |
"/ remove all not existing history entries |
5457 |
hist remove:aFileItem. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5458 |
] |
3906 | 5459 |
]. |
7763 | 5460 |
menu addSeparator. |
5461 |
||
4080 | 5462 |
removeItem := MenuItem new. |
5463 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5464 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5465 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 5466 |
removeItem label:text. |
11783 | 5467 |
removeItem |
5468 |
itemValue:[ |
|
5469 |
self fileHistory removeAll. |
|
5470 |
self enableFileHistory value:false. |
|
5471 |
]. |
|
3906 | 5472 |
menu addItem:removeItem. |
7763 | 5473 |
menu findGuiResourcesIn:self. |
3906 | 5474 |
^ menu |
7763 | 5475 |
|
11783 | 5476 |
"Modified (format): / 09-09-2012 / 13:07:36 / cg" |
3952 | 5477 |
! |
5478 |
||
4080 | 5479 |
sortMenu |
5480 |
<resource: #programMenu > |
|
5481 |
||
5482 |
|menu| |
|
5483 |
||
7763 | 5484 |
menu := Menu decodeFromLiteralArray:self class sortMenu. |
4080 | 5485 |
menu findGuiResourcesIn:self. |
5486 |
^ menu |
|
7763 | 5487 |
|
5488 |
"Modified: / 27-03-2007 / 10:47:42 / cg" |
|
4080 | 5489 |
! |
5490 |
||
5491 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5492 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5493 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5494 |
specHere := self class viewDetailsMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5495 |
itemsHere := specHere at:2. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5496 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5497 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5498 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5499 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5500 |
spec := specHere copy. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5501 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5502 |
^ spec |
4080 | 5503 |
! |
5504 |
||
5505 |
viewInContentsBrowserMenu |
|
5009 | 5506 |
self |
5507 |
applicationNamed:#DirectoryContentsBrowser |
|
5508 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
5509 |
||
5510 |
^ nil. |
|
4080 | 5511 |
! |
5512 |
||
3952 | 5513 |
visitedDirectoriesMenu |
5514 |
<resource: #programMenu > |
|
5515 |
||
5516 |
|menu histCopy text removeItem| |
|
5517 |
||
7763 | 5518 |
histCopy := self directoryHistory. |
5519 |
histCopy isEmpty ifTrue:[^ nil]. |
|
5520 |
||
3952 | 5521 |
menu := Menu new. |
7763 | 5522 |
|
5523 |
histCopy do:[:aFile| |
|
12963 | 5524 |
menu addItem:(MenuItem |
5525 |
label:aFile asString |
|
5526 |
itemValue:[ |
|
5527 |
self setCurrentFileName:(aFile path asFilename). |
|
5528 |
]). |
|
7763 | 5529 |
]. |
5530 |
menu addSeparator. |
|
5531 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5532 |
"/ 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
|
5533 |
text := (resources string:'Clear History'). |
3952 | 5534 |
removeItem := MenuItem new. |
4040 | 5535 |
removeItem translateLabel:true. |
3952 | 5536 |
removeItem label:text. |
11783 | 5537 |
removeItem |
5538 |
itemValue:[ |
|
5539 |
self directoryHistory removeAll. |
|
5540 |
self enableForward value:self canForward. |
|
5541 |
self enableBack value:self canBackward. |
|
5542 |
]. |
|
7763 | 5543 |
|
3952 | 5544 |
menu addItem:removeItem. |
7763 | 5545 |
menu findGuiResourcesIn:self. |
3952 | 5546 |
^ menu |
7763 | 5547 |
|
11783 | 5548 |
"Modified: / 09-09-2012 / 13:07:45 / cg" |
3892 | 5549 |
! ! |
5550 |
||
5880 | 5551 |
!AbstractFileBrowser methodsFor:'menu actions'! |
5552 |
||
5553 |
doCompareTwoFiles |
|
5554 |
self openDiffView. |
|
5555 |
! |
|
5556 |
||
5557 |
doGoDirectoryUp |
|
5960 | 5558 |
| upDir directory rootInTreeView| |
5880 | 5559 |
|
5560 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
5561 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 5562 |
directory := self currentDirectory. |
5563 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 5564 |
] ifFalse:[ |
5565 |
rootInTreeView := self |
|
5566 |
applicationNamed:#DirectoryTreeBrowser |
|
5567 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 5568 |
directory := rootInTreeView value asFilename. |
5569 |
]. |
|
5570 |
upDir := directory directory. |
|
5959 | 5571 |
self setCurrentFileName:upDir. |
5880 | 5572 |
! |
5573 |
||
5574 |
doGotoDefaultDirectory |
|
5575 |
self gotoFile:(Filename defaultDirectory). |
|
5576 |
! |
|
5577 |
||
8091 | 5578 |
doGotoDesktopDirectory |
5579 |
self gotoFile:(Filename desktopDirectory). |
|
5580 |
! |
|
5581 |
||
5880 | 5582 |
doGotoHomeDirectory |
8091 | 5583 |
self gotoFile:(Filename homeDirectory). |
5880 | 5584 |
! |
5585 |
||
6434 | 5586 |
doGotoSmalltalkDirectory |
5587 |
self gotoFile:(self smalltalkDirectory). |
|
5588 |
! |
|
5589 |
||
17187 | 5590 |
doGotoSmalltalkWorkspaceDirectory |
5591 |
self gotoFile:(UserPreferences current workspaceDirectory). |
|
5592 |
! |
|
5593 |
||
9677 | 5594 |
doGotoTempDirectory |
5595 |
self gotoFile:(self tempDirectory). |
|
5596 |
||
5597 |
"Created: / 29-12-2010 / 11:03:17 / cg" |
|
5598 |
! |
|
5599 |
||
9596 | 5600 |
doMakeCurrentDirectory |
17582 | 5601 |
<resource: #obsolete> |
5602 |
||
5603 |
"/ no longer |
|
5604 |
^ self |
|
5605 |
"/ OperatingSystem setCurrentDirectory:(self currentDirectory pathName). |
|
5606 |
"/ self currentFileNameHolderChangedForCommon. |
|
9596 | 5607 |
|
5608 |
"Created: / 26-10-2010 / 17:21:19 / cg" |
|
17582 | 5609 |
"Modified (format): / 17-07-2017 / 10:09:39 / cg" |
9596 | 5610 |
! |
5611 |
||
5880 | 5612 |
fileGetInfo:longInfo |
5613 |
"get info on selected file - show it in a box" |
|
5614 |
||
5615 |
|string box updater| |
|
5616 |
||
5617 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
5618 |
string notNil ifTrue:[ |
|
5619 |
box := InfoBox title:string. |
|
5620 |
updater := [ |
|
5621 |
[true] whileTrue:[ |
|
5622 |
Delay waitForSeconds:2. |
|
5623 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
5624 |
string isNil ifTrue:[ ^ self]. |
|
5625 |
box title:string |
|
5626 |
] |
|
5627 |
] fork. |
|
5628 |
box show. |
|
5629 |
updater terminate. |
|
5630 |
box destroy |
|
5631 |
] |
|
6434 | 5632 |
! |
5633 |
||
17686 | 5634 |
showDeltaBetweenTwoImageFiles |
5635 |
|i1 i2 delta| |
|
5636 |
||
5637 |
i1 := Image fromFile:(self selectedFileNames first). |
|
5638 |
i2 := Image fromFile:(self selectedFileNames second). |
|
5639 |
delta := ImageAlgorithms new differenceImageBetween:i1 and:i2. |
|
5640 |
ImageView openOn:delta. |
|
5641 |
||
5642 |
"Created: / 10-09-2017 / 16:59:08 / cg" |
|
5643 |
! |
|
5644 |
||
6434 | 5645 |
smalltalkDirectory |
8590 | 5646 |
|stxPath| |
6434 | 5647 |
|
5648 |
stxPath := OperatingSystem pathOfSTXExecutable. |
|
8590 | 5649 |
stxPath isNil ifTrue:[ |
5650 |
^ Filename currentDirectory |
|
5651 |
]. |
|
5652 |
^ stxPath asFilename directory. |
|
9677 | 5653 |
! |
5654 |
||
5655 |
tempDirectory |
|
5656 |
^ Filename tempDirectory. |
|
5657 |
||
5658 |
"Created: / 29-12-2010 / 11:03:00 / cg" |
|
5880 | 5659 |
! ! |
5660 |
||
11139 | 5661 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
5662 |
||
14262 | 5663 |
addDirToJavaSourcePath |
5664 |
"add the current path to java's sourcePath |
|
5665 |
(only available with ST/J System" |
|
5666 |
||
5667 |
Java addToSourcePath:self currentDirectory pathName |
|
5668 |
||
5669 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
5670 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
5671 |
! |
|
5672 |
||
11139 | 5673 |
copyFiles |
5674 |
self |
|
5675 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
5676 |
! |
|
5677 |
||
5678 |
cutFiles |
|
5679 |
self |
|
5680 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
5681 |
! |
|
5682 |
||
5683 |
deleteFiles |
|
5684 |
self |
|
5685 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
5686 |
! |
|
5687 |
||
5688 |
eraseFiles |
|
5689 |
self |
|
5690 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
5691 |
! |
|
5692 |
||
14262 | 5693 |
fileAddToJavaSourcePath |
5694 |
"add the current path to java's sourcePath |
|
5695 |
(only available with ST/J System" |
|
5696 |
||
5697 |
self currentSelectedObjects do:[:each | |
|
5698 |
Java addToSourcePath:(each pathName) |
|
5699 |
]. |
|
5700 |
||
5701 |
"Created: / 9.11.1998 / 05:41:34 / cg" |
|
5702 |
"Modified: / 9.11.1998 / 05:56:00 / cg" |
|
5703 |
! |
|
5704 |
||
11139 | 5705 |
openSettingsDialog |
5706 |
|dialog| |
|
5707 |
||
5708 |
dialog := FileBrowserV2SettingsDialog new. |
|
5709 |
dialog settingsDialog:self. |
|
5710 |
dialog allButOpen. |
|
5711 |
dialog doReload. |
|
5712 |
dialog openWindow |
|
5713 |
! |
|
5714 |
||
5715 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
5716 |
|files dirs| |
|
5717 |
||
5718 |
files := self currentSelectedFiles. |
|
5719 |
files notEmpty ifTrue:[ |
|
5720 |
aBlock value:files. |
|
5721 |
] ifFalse:[ |
|
5722 |
dirs := self currentSelectedDirectories. |
|
5723 |
dirs notEmpty ifTrue:[ |
|
5724 |
aBlock value:dirs. |
|
5725 |
]. |
|
5726 |
]. |
|
5727 |
! ! |
|
5728 |
||
5729 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
|
5730 |
||
5731 |
openAboutThisApplication |
|
5732 |
"opens an about box for this application." |
|
5733 |
||
5734 |
Dialog aboutClass:self class. |
|
5735 |
! |
|
5736 |
||
5737 |
openHTMLDocument:relativeDocPath |
|
5738 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
5739 |
! ! |
|
5740 |
||
5741 |
!AbstractFileBrowser methodsFor:'menu actions-scm-cvs'! |
|
3892 | 5742 |
|
15905 | 5743 |
canCvsAddAndCommit |
5744 |
||
5745 |
|selectedFiles| |
|
5746 |
||
5747 |
selectedFiles := self currentSelectedObjects. |
|
5748 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
5749 |
! |
|
5750 |
||
5751 |
canRemoveCVSContainer |
|
5752 |
^ self currentSelectedFiles |
|
5753 |
contains:[:fileName| |
|
5754 |
|dirOfFile cvsDir| |
|
5755 |
||
5756 |
dirOfFile := self getDirWithoutFileName:fileName. |
|
5757 |
cvsDir := dirOfFile construct:'CVS'. |
|
5758 |
cvsDir isDirectory |
|
5759 |
]. |
|
5760 |
! |
|
5761 |
||
12777 | 5762 |
commitFilesToCVS:files |
5763 |
|numFiles| |
|
5764 |
||
5765 |
(numFiles := files size) > 0 ifTrue:[ |
|
5766 |
self withActivityIndicationDo:[ |
|
5767 |
self cvsCommitFiles:files |
|
5768 |
] |
|
5769 |
] |
|
5770 |
! |
|
5771 |
||
3892 | 5772 |
cvsAddAndCommit |
4849 | 5773 |
self cvsAddAndCommitAsBinary:false |
5774 |
! |
|
5775 |
||
5776 |
cvsAddAndCommitAsBinary:asBinary |
|
8588 | 5777 |
|sel log logArg binArg cmd dir executionBlock nameString| |
3892 | 5778 |
|
5779 |
log := Dialog |
|
11139 | 5780 |
requestText:(resources string:'Enter initial log message:') |
4414 | 5781 |
lines:10 |
5782 |
columns:70 |
|
5783 |
initialAnswer:nil. |
|
8322
cf10f08b6164
care for cancel in #cvsAddAndCommitAsBinary:
Claus Gittinger <cg@exept.de>
parents:
8294
diff
changeset
|
5784 |
log isNil ifTrue:[^ self]. |
3892 | 5785 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5786 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5787 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5788 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5789 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5790 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5791 |
|
8588 | 5792 |
binArg := ''. |
5793 |
asBinary ifTrue:[ |
|
5794 |
binArg := '-kb '. |
|
5795 |
]. |
|
3982 | 5796 |
sel := self currentSelectedFiles. |
11139 | 5797 |
executionBlock := |
5798 |
[:stream | |
|
5799 |
log notNil ifTrue:[ |
|
17416 | 5800 |
sel notEmptyOrNil ifTrue:[ |
11139 | 5801 |
sel do:[:fn | |
5802 |
|nameArg| |
|
5803 |
||
5804 |
nameArg := '"',fn baseName,'"'. |
|
5805 |
||
5806 |
dir := self getDirWithoutFileName:fn. |
|
5807 |
cmd := 'cvs add ',logArg,' ',binArg,nameArg. |
|
5808 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5809 |
||
5810 |
cmd := ('cvs commit -l ',logArg,' ',nameArg). |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5811 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
11139 | 5812 |
"/ mhmh - it seems that only old CVS implementations (at least turqoise) |
5813 |
"/ support and need the 'admin -kb' command. |
|
5814 |
"/ newer ones use the '-kb' option in the 'cvs add' command |
|
5815 |
asBinary ifTrue:[ |
|
5816 |
cmd := ('cvs admin -kb ' , nameArg). |
|
5817 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5818 |
||
5819 |
cmd := ('cvs upd ' , nameArg). |
|
5820 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5821 |
]. |
|
5822 |
] |
|
5823 |
] |
|
5824 |
] |
|
5825 |
]. |
|
4107 | 5826 |
nameString := 'Command> cvs add and commit'. |
3892 | 5827 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
11139 | 5828 |
|
17416 | 5829 |
"Modified: / 17-02-2017 / 08:25:16 / cg" |
3892 | 5830 |
! |
5831 |
||
4849 | 5832 |
cvsAddBinaryAndCommit |
5833 |
self cvsAddAndCommitAsBinary:true |
|
5834 |
! |
|
5835 |
||
3892 | 5836 |
cvsCommit |
12777 | 5837 |
|selectedFiles| |
3892 | 5838 |
|
3982 | 5839 |
selectedFiles:= self currentSelectedFiles. |
12777 | 5840 |
self cvsCommitFiles:selectedFiles |
5841 |
! |
|
5842 |
||
5843 |
cvsCommitFiles:files |
|
5844 |
|nFiles log logTmp s logArg msg executionBlock nameString | |
|
5845 |
||
5846 |
nFiles := files size. |
|
5847 |
nFiles == 0 ifTrue:[^ self]. |
|
5848 |
||
5849 |
nFiles == 1 ifTrue:[ |
|
5850 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(files first baseName) |
|
3892 | 5851 |
] ifFalse:[ |
12777 | 5852 |
nFiles > 1 ifTrue:[ |
5853 |
msg := resources string:'Enter log message for %1 files to checkIn' with:nFiles printString |
|
4414 | 5854 |
] ifFalse:[ |
6627 | 5855 |
msg := resources string:'Enter log message for checkIn' |
4414 | 5856 |
] |
3892 | 5857 |
]. |
5858 |
||
5859 |
log := Dialog |
|
4414 | 5860 |
requestText:msg |
5861 |
lines:10 |
|
5862 |
columns:70 |
|
5863 |
initialAnswer:nil. |
|
3892 | 5864 |
|
4663 | 5865 |
log isNil ifTrue:[^ self]. |
12777 | 5866 |
log := log replChar:$" withString:'\"'. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5867 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5868 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
12777 | 5869 |
"/ save the log message into another tempFile ... |
13121 | 5870 |
s := FileStream newTemporary. |
5871 |
logTmp := s fileName. |
|
12777 | 5872 |
s nextPutAll:log. |
5873 |
s close. |
|
5874 |
||
5875 |
logArg := '-F "', logTmp pathName, '"'. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5876 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5877 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5878 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5879 |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
5880 |
executionBlock := [:stream | |
12777 | 5881 |
[ |
5882 |
files do:[:fn | |
|
5883 |
| dir nameArg cmd | |
|
5884 |
||
5885 |
nameArg := '"',fn baseName,'"'. |
|
5886 |
dir := fn directory. |
|
5887 |
cmd := 'cvs commit ',logArg,' ' , nameArg. |
|
5888 |
stream showCR:fn pathName. |
|
5889 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
4663 | 5890 |
] |
12777 | 5891 |
] ensure:[ |
5892 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
5893 |
]. |
|
4107 | 5894 |
]. |
5895 |
nameString := 'Command> cvs commit'. |
|
5896 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 5897 |
! |
5898 |
||
14527 | 5899 |
cvsCommitFolder |
5900 |
|dir log logTmp s logArg msg executionBlock nameString | |
|
5901 |
||
5902 |
(dir := self currentDirectory) isNil ifTrue:[ ^ self ]. |
|
5903 |
||
5904 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(dir baseName). |
|
5905 |
log := Dialog |
|
5906 |
requestText:msg |
|
5907 |
lines:10 |
|
5908 |
columns:70 |
|
5909 |
initialAnswer:nil. |
|
5910 |
||
5911 |
log isNil ifTrue:[^ self]. |
|
5912 |
log := log replChar:$" withString:'\"'. |
|
5913 |
||
5914 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
5915 |
"/ save the log message into another tempFile ... |
|
5916 |
s := FileStream newTemporary. |
|
5917 |
logTmp := s fileName. |
|
5918 |
s nextPutAll:log. |
|
5919 |
s close. |
|
5920 |
||
5921 |
logArg := '-F "', logTmp pathName, '"'. |
|
5922 |
] ifFalse:[ |
|
5923 |
logArg := '-m ''' , log , ''''. |
|
5924 |
]. |
|
5925 |
||
5926 |
executionBlock := [:stream | |
|
5927 |
[ |
|
5928 |
|cmd| |
|
5929 |
||
5930 |
cmd := 'cvs commit ',logArg. |
|
5931 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5932 |
] ensure:[ |
|
5933 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
5934 |
]. |
|
5935 |
]. |
|
5936 |
||
5937 |
nameString := 'Command> cvs commit'. |
|
5938 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
5939 |
! |
|
5940 |
||
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5941 |
cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5942 |
|selectedFiles| |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5943 |
|
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5944 |
selectedFiles:= self currentSelectedFiles. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5945 |
selectedFiles do:[:each | |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5946 |
|out diffs| |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5947 |
|
15589 | 5948 |
out := CharacterWriteStream new:100. |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5949 |
OperatingSystem |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5950 |
executeCommand:'cvs diff -b ',each baseName |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5951 |
outputTo:out |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5952 |
inDirectory:each directoryName. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5953 |
diffs := out contents. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5954 |
TextView openWith:diffs. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5955 |
]. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5956 |
|
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5957 |
"Modified: / 23-01-2012 / 14:08:28 / cg" |
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5958 |
! |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5959 |
|
15211 | 5960 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
5961 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
5962 |
||
5963 |
|toRemove updateRunning executionBlock nameString| |
|
5964 |
||
5965 |
updateRunning := self backgroundProcesses value notEmpty. |
|
5966 |
self killAllRunningBackgroundProcesses. |
|
5967 |
toRemove := OrderedCollection new. |
|
5968 |
||
5969 |
executionBlock := |
|
5970 |
[:stream | |
|
5971 |
|cmd logArg prevDir prevFiles| |
|
5972 |
||
5973 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
5974 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
|
5975 |
] ifFalse:[ |
|
5976 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
|
5977 |
]. |
|
5978 |
prevFiles := ''. |
|
5979 |
||
5980 |
filesToRemove do:[:fileName | |
|
5981 |
|dir file| |
|
5982 |
||
5983 |
dir := fileName directory. |
|
5984 |
(prevDir notNil and:[prevDir ~= dir]) ifTrue:[ |
|
5985 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
5986 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
5987 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
5988 |
prevFiles := ''. |
|
5989 |
]. |
|
5990 |
||
17116 | 5991 |
OsError handle:[:ex| |
15211 | 5992 |
"was not able to remove it" |
5993 |
| lastError msg | |
|
5994 |
lastError := OperatingSystem lastErrorString. |
|
5995 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
5996 |
lastError isNil ifFalse:[ |
|
5997 |
msg := msg , '\\(' , lastError , ')' |
|
5998 |
]. |
|
5999 |
Dialog warn:msg withCRs |
|
6000 |
] do:[ |
|
6001 |
(fileName isSymbolicLink) ifFalse:[ |
|
6002 |
fileName remove. |
|
6003 |
file := fileName baseName. |
|
6004 |
cmd := ('cvs remove -f "',file,'"'). |
|
6005 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6006 |
"/ Transcript show:dir; space; showCR:cmd. |
|
6007 |
] |
|
6008 |
]. |
|
6009 |
prevDir := dir. |
|
6010 |
prevFiles := prevFiles,' ',file. |
|
6011 |
]. |
|
6012 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
6013 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
6014 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6015 |
]. |
|
6016 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
|
6017 |
filesToRemove size > 1 ifTrue:[ |
|
6018 |
nameString := nameString, ' ...'. |
|
6019 |
]. |
|
6020 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6021 |
! |
|
3892 | 6022 |
|
6023 |
cvsRemoveFileAndCVSContainer |
|
12493 | 6024 |
|files| |
6025 |
||
6026 |
files := self currentSelectedFiles copy. |
|
6027 |
self removeFilesAndCVSContainers:files |
|
3892 | 6028 |
! |
6029 |
||
9338 | 6030 |
cvsRevisionLog |
6031 |
| cmd sel executionBlock nameString| |
|
6032 |
||
6033 |
sel := self currentSelectedObjects. |
|
6034 |
sel isEmpty ifTrue:[ ^ self ]. |
|
6035 |
||
6036 |
executionBlock := [:stream | |
|
6037 |
sel do:[:fn | |
|
6038 |
| dir nameArg | |
|
6039 |
||
6040 |
nameArg := '"',fn baseName,'"'. |
|
6041 |
dir := fn directory. |
|
6042 |
cmd := 'cvs log ' , nameArg. |
|
6043 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6044 |
] |
|
6045 |
]. |
|
6046 |
nameString := 'Command> cvs log'. |
|
6047 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6048 |
! |
|
6049 |
||
8562 | 6050 |
cvsTagSelection |
12856 | 6051 |
|tag tags cmd| |
6052 |
||
6053 |
tag := Dialog |
|
6054 |
request:(resources string:'Tag (possibly multiple, separated by ";"):') |
|
6055 |
initialAnswer:(CVSSourceCodeManager recentTag). |
|
6056 |
tag isEmptyOrNil ifTrue:[^ self ]. |
|
6057 |
||
6058 |
CVSSourceCodeManager recentTag:tag. |
|
8562 | 6059 |
|
6060 |
CVSSourceCodeManager notNil ifTrue:[ |
|
6061 |
cmd := CVSSourceCodeManager cvsExecutable. |
|
6062 |
] ifFalse:[ |
|
6063 |
cmd := 'cvs'. |
|
6064 |
]. |
|
6065 |
||
12856 | 6066 |
tags := tag asCollectionOfSubstringsSeparatedByAny:',;'. |
6067 |
tags do:[:eachTag | |
|
6068 |
self executeCommand:('%1 tag -F "%2" %3' |
|
6069 |
bindWith:cmd |
|
12858 | 6070 |
with:(eachTag withoutSeparators) |
12856 | 6071 |
with:(self makeFileNameArgumentString)) |
6072 |
]. |
|
8562 | 6073 |
! |
6074 |
||
3892 | 6075 |
cvsUpdateAll |
6076 |
| cmd | |
|
6077 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6078 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6079 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6080 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6081 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6082 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6083 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6084 |
self executeCommand:(cmd, ' upd -l'). |
3892 | 6085 |
! |
6086 |
||
6087 |
cvsUpdateAllRecursive |
|
6088 |
| cmd | |
|
6089 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6090 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6091 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6092 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6093 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6094 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6095 |
self executeCommand:(cmd, ' upd -d'). |
3892 | 6096 |
! |
6097 |
||
6098 |
cvsUpdateSelection |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6099 |
|stream cmd| |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6100 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6101 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6102 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6103 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6104 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6105 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6106 |
|
15589 | 6107 |
stream := CharacterWriteStream new. |
8563 | 6108 |
stream |
6109 |
nextPutAll:cmd; |
|
6110 |
nextPutAll:' upd '; |
|
6111 |
nextPutAll:(self makeFileNameArgumentString). |
|
6112 |
||
6113 |
self executeCommand:stream contents. |
|
6114 |
! |
|
6115 |
||
6116 |
makeFileNameArgumentString |
|
6117 |
|stream| |
|
6118 |
||
15589 | 6119 |
stream := CharacterWriteStream new. |
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6120 |
self currentSelectedFiles do:[: file | |
8563 | 6121 |
stream nextPut:$". |
4414 | 6122 |
stream nextPutAll:file baseName. |
8563 | 6123 |
stream nextPutAll:'" '. |
6124 |
]. |
|
6125 |
^ stream contents. |
|
12493 | 6126 |
! |
6127 |
||
6128 |
removeFilesAndCVSContainers:files |
|
6129 |
|numFiles question aswer| |
|
6130 |
||
6131 |
(numFiles := files size) > 0 ifTrue:[ |
|
6132 |
numFiles > 1 ifTrue:[ |
|
6133 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:numFiles |
|
6134 |
] ifFalse:[ |
|
6135 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(files first baseName allBold) |
|
6136 |
]. |
|
6137 |
||
6138 |
aswer := Dialog |
|
6139 |
confirm:question withCRs |
|
6140 |
yesLabel:(resources string:'Remove') |
|
6141 |
noLabel:(resources string:'Cancel'). |
|
6142 |
||
6143 |
aswer ifTrue:[ |
|
6144 |
self withActivityIndicationDo:[ |
|
6145 |
self cvsRemoveAndRemoveFromCVS:files |
|
6146 |
] |
|
6147 |
] |
|
6148 |
] |
|
3892 | 6149 |
! ! |
6150 |
||
14126 | 6151 |
|
11139 | 6152 |
!AbstractFileBrowser methodsFor:'menu actions-scm-mercurial'! |
6153 |
||
6154 |
mercurialAdd |
|
6155 |
|executionBlock sel maxCmdSize| |
|
6156 |
||
6157 |
maxCmdSize := 512. |
|
6158 |
||
6159 |
sel := self currentSelectedObjects. |
|
6160 |
sel isEmptyOrNil ifTrue:[ |
|
6161 |
^ self |
|
6162 |
]. |
|
6163 |
||
6164 |
executionBlock := |
|
6165 |
[:stream | |
|
6166 |
|prevDir cmd| |
|
6167 |
||
6168 |
prevDir := nil. |
|
6169 |
sel do:[:fn | |
|
6170 |
|nameArg dir| |
|
6171 |
||
6172 |
nameArg := '"',fn baseName,'"'. |
|
6173 |
dir := fn directory. |
|
6174 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6175 |
"/ flush |
|
6176 |
cmd notNil ifTrue:[ |
|
6177 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6178 |
cmd := nil. |
|
6179 |
] |
|
6180 |
]. |
|
6181 |
cmd isNil ifTrue:[ |
|
6182 |
cmd := 'hg add'. |
|
6183 |
]. |
|
6184 |
cmd := cmd,' ',nameArg. |
|
6185 |
prevDir := dir. |
|
6186 |
]. |
|
6187 |
cmd notNil ifTrue:[ |
|
6188 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6189 |
cmd := nil. |
|
6190 |
]. |
|
6191 |
stream nextPutLine:'Commit to finish the transaction'. |
|
6192 |
]. |
|
6193 |
||
6194 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg add'. |
|
6195 |
||
6196 |
"Created: / 15-01-2012 / 15:55:47 / cg" |
|
6197 |
! |
|
6198 |
||
6199 |
mercurialCommit |
|
6200 |
|dir executionBlock| |
|
6201 |
||
6202 |
"/ dir := self currentDirectory. |
|
6203 |
dir := self directoryContentsBrowser directory. |
|
6204 |
executionBlock := |
|
6205 |
[:stream | |
|
6206 |
(self getExecutionBlockForCommand:'hg commit' |
|
6207 |
inDirectory:dir) value:stream. |
|
6208 |
stream nextPutLine:'Push to sync other repositories'. |
|
6169 | 6209 |
]. |
11139 | 6210 |
|
6211 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg commit'. |
|
6212 |
||
6213 |
"Created: / 15-01-2012 / 16:21:27 / cg" |
|
6214 |
! |
|
6215 |
||
11144 | 6216 |
mercurialInit |
6217 |
|dir executionBlock| |
|
6218 |
||
6219 |
dir := self directoryContentsBrowser directory. |
|
6220 |
||
6221 |
(Dialog confirm:(resources |
|
6222 |
string:'Initialize new Mercurial Repository in %1?' |
|
6223 |
with:dir baseName)) ifFalse:[^ self]. |
|
6224 |
||
6225 |
executionBlock := |
|
6226 |
[:stream | |
|
6227 |
(self getExecutionBlockForCommand:('hg init') |
|
6228 |
inDirectory:dir) value:stream. |
|
6229 |
]. |
|
6230 |
||
6231 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg init'. |
|
6232 |
||
6233 |
"Created: / 17-01-2012 / 15:58:46 / cg" |
|
6234 |
! |
|
6235 |
||
11139 | 6236 |
mercurialPush |
6237 |
|destination dir executionBlock| |
|
6238 |
||
6239 |
destination := Dialog request:'Mercurial Repository' |
|
6240 |
initialAnswer:(LastMercurialRepository ? MercurialSourceCodeManager repositoryName). |
|
6241 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
6242 |
||
6243 |
LastMercurialRepository := destination. |
|
6244 |
||
6245 |
dir := self directoryContentsBrowser directory. |
|
6246 |
executionBlock := |
|
6247 |
[:stream | |
|
6248 |
(self getExecutionBlockForCommand:('hg push "%1"' bindWith:destination) |
|
6249 |
inDirectory:dir) value:stream. |
|
6250 |
]. |
|
6251 |
||
6252 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg push'. |
|
6253 |
||
6254 |
"Created: / 15-01-2012 / 16:29:41 / cg" |
|
6255 |
! |
|
6256 |
||
6257 |
mercurialStatus |
|
6258 |
|executionBlock sel maxCmdSize| |
|
6259 |
||
6260 |
maxCmdSize := 512. |
|
6261 |
||
6262 |
sel := self currentSelectedObjects. |
|
6263 |
sel isEmptyOrNil ifTrue:[ |
|
6264 |
^ self |
|
6265 |
]. |
|
6266 |
||
6267 |
executionBlock := |
|
6268 |
[:stream | |
|
6269 |
|prevDir cmd| |
|
6270 |
||
6271 |
prevDir := nil. |
|
6272 |
sel do:[:fn | |
|
6273 |
|nameArg dir| |
|
6274 |
||
6275 |
nameArg := '"',fn baseName,'"'. |
|
6276 |
dir := fn directory. |
|
6277 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6278 |
"/ flush |
|
6279 |
cmd notNil ifTrue:[ |
|
6280 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6281 |
cmd := nil. |
|
6282 |
] |
|
6283 |
]. |
|
6284 |
cmd isNil ifTrue:[ |
|
6285 |
cmd := 'hg status'. |
|
6286 |
]. |
|
6287 |
cmd := cmd,' ',nameArg. |
|
6288 |
prevDir := dir. |
|
6289 |
]. |
|
6290 |
cmd notNil ifTrue:[ |
|
6291 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6292 |
cmd := nil. |
|
6293 |
]. |
|
6294 |
]. |
|
6295 |
||
6296 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg status'. |
|
6297 |
||
6298 |
"Created: / 15-01-2012 / 19:43:08 / cg" |
|
3892 | 6299 |
! ! |
6300 |
||
4849 | 6301 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
3892 | 6302 |
|
8510 | 6303 |
allFilesInSelectedDirectoriesForWhich:aBlock |
6304 |
|directories allFiles| |
|
6305 |
||
6306 |
directories := self currentSelectedDirectories. |
|
6307 |
directories isEmpty ifTrue:[^ self]. |
|
6308 |
||
6309 |
allFiles := OrderedCollection new. |
|
6310 |
directories do:[:dir| |
|
6311 |
[ |
|
6312 |
|fileNames| |
|
6313 |
||
6314 |
fileNames := dir directoryContents. |
|
6315 |
fileNames notNil ifTrue:[ |
|
6316 |
fileNames := fileNames |
|
6317 |
collect:[:fn | dir construct:fn] |
|
6318 |
thenSelect:[:fn | fn isDirectory not and:[aBlock value:fn]]. |
|
6319 |
allFiles addAll:fileNames. |
|
6320 |
] |
|
6321 |
] on:FileStream openErrorSignal do:[:ex| |
|
6322 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
|
6323 |
with:ex pathName |
|
6324 |
with:ex description). |
|
6325 |
ex proceedWith:nil. |
|
6326 |
]. |
|
6327 |
]. |
|
6328 |
||
6329 |
^ allFiles |
|
6330 |
! |
|
6331 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6332 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6333 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6334 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6335 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6336 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6337 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6338 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6339 |
"/ 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
|
6340 |
"/ 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
|
6341 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6342 |
conv := OrderedCollection new. |
4722 | 6343 |
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
|
6344 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6345 |
outSuffix = 'png' ifTrue:[ |
4722 | 6346 |
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
|
6347 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6348 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6349 |
outSuffix = 'gif' ifTrue:[ |
4722 | 6350 |
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
|
6351 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6352 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6353 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 6354 |
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
|
6355 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6356 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6357 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 6358 |
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
|
6359 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6360 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6361 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6362 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6363 |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6364 |
convertImageFrom:fileName to:outFile onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6365 |
|writer image outSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6366 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6367 |
outSuffix := outFile suffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6368 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6369 |
((writer := MIMETypes imageReaderForSuffix:outSuffix) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6370 |
and:[ (image := Image fromFile:fileName) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6371 |
and:[ writer canRepresent:image ]]) ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6372 |
"/ can do it with Smalltalk tools |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6373 |
writer save:image onFile:outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6374 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6375 |
"/ use external tools (pbm-package, if available) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6376 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6377 |
convertImageUsingExternalFileToolsFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6378 |
toSuffix:outSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6379 |
onError:exceptionBlock. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6380 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6381 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6382 |
"Created: / 20-05-2010 / 11:12:36 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6383 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6384 |
|
4367 | 6385 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6386 |
self convertImageToSuffix:'gif' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6387 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6388 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6389 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6390 |
self convertImageToSuffix:'jpg' |
4531 | 6391 |
! |
6392 |
||
6393 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6394 |
self convertImageToSuffix:'png' |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6395 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6396 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6397 |
convertImageToSuffix:outSuffix |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6398 |
|outFile filesToConvert| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6399 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6400 |
self withActivityIndicationDo:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6401 |
filesToConvert := self currentSelectedObjects copy. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6402 |
filesToConvert do:[:fileName | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6403 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6404 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6405 |
fileName isDirectory ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6406 |
|skip| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6407 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6408 |
skip := false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6409 |
outFile := fileName withSuffix:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6410 |
outFile exists ifTrue:[ |
4722 | 6411 |
|answer| |
6412 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6413 |
answer := Dialog |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6414 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6415 |
default:false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6416 |
answer isNil ifTrue:[AbortSignal raise]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6417 |
answer ifFalse:[ skip := true ]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6418 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6419 |
skip ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6420 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6421 |
convertImageFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6422 |
to:outFile |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6423 |
onError:[:errMsg | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6424 |
filesToConvert size == 1 ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6425 |
Dialog warn:errMsg |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6426 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6427 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6428 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6429 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6430 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6431 |
]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6432 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6433 |
self updateAndSelect:nil. |
4367 | 6434 |
] |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6435 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6436 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6437 |
self notify:nil. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6438 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6439 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6440 |
"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
|
6441 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6442 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6443 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6444 |
self convertImageToSuffix:'xpm' |
4367 | 6445 |
! |
6446 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6447 |
convertImageUsingExternalFileToolsFrom:fileName toSuffix:outSuffix onError:exceptionBlock |
13121 | 6448 |
|inFile outFile chainOfConversions conversionStream |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6449 |
eachConversionSuffixCommandPair eachConversionCommand eachConversionSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6450 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6451 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6452 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6453 |
chainOfConversions isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6454 |
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
|
6455 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6456 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6457 |
conversionStream := chainOfConversions readStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6458 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6459 |
inFile := fileName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6460 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6461 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6462 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6463 |
eachConversionCommand == #readToXPM ifTrue:[ |
13121 | 6464 |
|image tempStreamXPM| |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6465 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6466 |
image := Image fromFile:(inFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6467 |
image isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6468 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6469 |
^ false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6470 |
]. |
13121 | 6471 |
tempStreamXPM := FileStream newTemporaryWithSuffix:'xpm'. |
6472 |
XPMReader save:image onStream:tempStreamXPM. |
|
6473 |
tempStreamXPM close. |
|
6474 |
inFile := tempStreamXPM fileName. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6475 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6476 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6477 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6478 |
[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6479 |
|command errOutput errMsg| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6480 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6481 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6482 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6483 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6484 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6485 |
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
|
6486 |
|
13121 | 6487 |
outFile := (FileStream newTemporaryWithSuffix:eachConversionSuffix) close pathName. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6488 |
command := eachConversionCommand |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6489 |
bindWith:(inFile pathName) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6490 |
with:(outFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6491 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6492 |
errOutput := String writeStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6493 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6494 |
(OperatingSystem executeCommand:command errorTo:errOutput) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6495 |
errMsg := resources |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6496 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6497 |
with:inFile baseName allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6498 |
with:eachConversionSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6499 |
with:eachConversionCommand allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6500 |
with:errOutput contents. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6501 |
exceptionBlock value:errMsg. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6502 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6503 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6504 |
outFile delete. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6505 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6506 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6507 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6508 |
inFile := outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6509 |
eachConversionSuffixCommandPair := conversionStream next |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6510 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6511 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6512 |
] ifCurtailed:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6513 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6514 |
outFile delete. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6515 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6516 |
^ true. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6517 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6518 |
"Created: / 20-05-2010 / 11:05:50 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6519 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6520 |
|
3892 | 6521 |
createProjectAndOpenProjectBrowser |
6522 |
|nm f s directory| |
|
6523 |
||
6524 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 6525 |
directory := self currentDirectory. |
3892 | 6526 |
nm := directory baseName. |
6527 |
f := (directory construct:nm) withSuffix:'prj'. |
|
6528 |
f exists ifTrue:[ |
|
4414 | 6529 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
6530 |
^ self. |
|
3892 | 6531 |
]. |
6532 |
s := f writeStream. |
|
6533 |
s nextPutAll:' |
|
6534 |
name ''' , nm , ''' |
|
6535 |
type #classLibrary |
|
6536 |
package #''private:' , nm , ''' |
|
6537 |
prerequisites nil |
|
6538 |
||
6539 |
classes #( ) |
|
6540 |
'. |
|
6541 |
s close. |
|
6542 |
ProjectBrowser openOnFile:f. |
|
6543 |
! |
|
6544 |
||
5880 | 6545 |
doExecuteCommand |
6546 |
"execute an OperatingSystem-command" |
|
6547 |
||
6548 |
| action fileName| |
|
6549 |
||
6550 |
fileName := self firstSelectedFile. |
|
6551 |
action := [:command | |
|
6552 |
self addToCommandHistory:command for:fileName. |
|
6553 |
self executeCommand:command. |
|
6554 |
]. |
|
6555 |
self askForCommandFor:fileName thenDo:action |
|
6556 |
! |
|
6557 |
||
6558 |
doExecuteScript |
|
16941 | 6559 |
"execute a Smalltalk script" |
5880 | 6560 |
|
6561 |
|textHolder dialog template dummyClass dummyInstance| |
|
6562 |
||
6563 |
template := |
|
6564 |
'"/ Smalltalk script: |
|
6565 |
||
16084 | 6566 |
"/ the following variables are accessible: |
5880 | 6567 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
6568 |
"/ selectedFiles (= ...) |
|
6569 |
"/ |
|
6570 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
6571 |
"/ |
|
6572 |
"/ Useful operations are: |
|
6573 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
6574 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
6575 |
"/ directory directory |
|
6576 |
"/ |
|
6577 |
"/ example: move all files which match a aarticular pattern to |
|
6578 |
"/ a separate directory: |
|
6579 |
"/ |
|
6580 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
6581 |
"/ |
|
6582 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
6583 |
"/ |
|
6584 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
6585 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
6586 |
"/ idx := eachBaseNameString indexOf:$_. |
|
6587 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
6588 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
6589 |
"/ newDir := directory construct:prefix. |
|
6590 |
"/ newDir exists ifFalse:[ |
|
6591 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
6592 |
"/ newDir makeDirectory. |
|
6593 |
"/ ]. |
|
6594 |
"/ ]. |
|
6595 |
"/ newDir exists ifTrue:[ |
|
6596 |
"/ oldFile := directory construct:eachBaseNameString. |
|
6597 |
"/ newFile := newDir construct:rest. |
|
6598 |
"/ oldFile moveTo:newFile |
|
6599 |
"/ ] |
|
6600 |
"/ ] |
|
6601 |
"/ ] |
|
6602 |
'. |
|
6603 |
||
6604 |
LastScriptBlockString isNil ifTrue:[ |
|
6605 |
LastScriptBlockString := template. |
|
6606 |
]. |
|
6607 |
||
6608 |
textHolder := ValueHolder new. |
|
6609 |
dialog := Dialog |
|
6610 |
forRequestText:(resources string:'Enter script') |
|
6611 |
editViewClass:CodeView |
|
6612 |
lines:25 |
|
6613 |
columns:70 |
|
6614 |
initialAnswer:LastScriptBlockString |
|
6615 |
model:textHolder. |
|
6616 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
6617 |
dialog open. |
|
6618 |
dialog accepted ifFalse:[^ self]. |
|
6619 |
||
6620 |
LastScriptBlockString := textHolder value. |
|
6621 |
||
6622 |
Class classConventionViolationConfirmationQuerySignal |
|
6623 |
answer:true |
|
6624 |
do:[ |
|
6625 |
dummyClass := Object class |
|
6626 |
name:#Dummy |
|
6627 |
inEnvironment:nil |
|
6628 |
subclassOf:Object |
|
6629 |
instanceVariableNames:'directory selectedFiles' |
|
6630 |
variable:false |
|
6631 |
words:true |
|
6632 |
pointers:true |
|
6633 |
classVariableNames:'' |
|
6634 |
poolDictionaries:'' |
|
6635 |
category:#dummyCategory |
|
6636 |
comment:nil |
|
6637 |
changed:true. |
|
6638 |
]. |
|
6639 |
||
6640 |
dummyInstance := dummyClass basicNew. |
|
6641 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
6642 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
6643 |
||
6644 |
Compiler |
|
6645 |
evaluate:textHolder value |
|
6646 |
in:nil |
|
6647 |
receiver:dummyInstance |
|
6648 |
notifying:nil |
|
6649 |
logged:false |
|
6650 |
ifFail:[] |
|
6651 |
compile:true. |
|
6652 |
||
6653 |
"/ fileName := self firstSelectedFile. |
|
6654 |
"/ action := [:command | |
|
6655 |
"/ self addToCommandHistory:command for:fileName. |
|
6656 |
"/ self executeCommand:command. |
|
6657 |
"/ ]. |
|
6658 |
"/ self askForCommandFor:fileName thenDo:action |
|
6659 |
! |
|
6660 |
||
4230 | 6661 |
doMake |
7938 | 6662 |
|dir cmd| |
4230 | 6663 |
|
13856 | 6664 |
cmd := self makeCommandHolder value. |
6665 |
||
6666 |
"Make" |
|
6667 |
cmd = 'make' ifTrue:[ |
|
6668 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6669 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6670 |
dir notNil ifTrue:[ |
|
6671 |
(dir construct:'bmake.bat') exists ifTrue:[ |
|
6672 |
cmd := 'bmake.bat'. |
|
6673 |
] |
|
7938 | 6674 |
] |
13856 | 6675 |
]. |
6676 |
self executeCommand:cmd. |
|
6677 |
^self. |
|
6678 |
]. |
|
6679 |
||
6680 |
"Apache ant" |
|
6681 |
cmd = 'ant' ifTrue:[ |
|
6682 |
self executeCommand:cmd. |
|
6683 |
^self. |
|
6684 |
]. |
|
6685 |
||
6686 |
"Add more here..." |
|
6687 |
||
6688 |
"Modified (comment): / 13-04-2012 / 17:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4230 | 6689 |
! |
6690 |
||
8256 | 6691 |
doOpenCBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6692 |
"the CBrowser is an eXept-internal C-language IDE tool. |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6693 |
(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
|
6694 |
20 years ago ;-)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6695 |
|
8256 | 6696 |
|destDir| |
6697 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6698 |
(CBrowser isNil or:[ CBrowser::Browser isNil ]) ifTrue:[ |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6699 |
Smalltalk loadPackage:'exept:CC' |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6700 |
]. |
8256 | 6701 |
destDir := self currentDirectory. |
6702 |
CBrowser::Browser openIn:destDir pathName |
|
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6703 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6704 |
"Modified: / 04-10-2011 / 13:41:31 / cg" |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6705 |
"Modified (comment): / 27-07-2012 / 20:41:40 / cg" |
8256 | 6706 |
! |
6707 |
||
7829 | 6708 |
doOpenExplorer |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6709 |
self currentDirectory asFilename openExplorer |
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6710 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6711 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
7829 | 6712 |
! |
6713 |
||
12473 | 6714 |
doOpenFinder |
6715 |
self currentDirectory asFilename openFinder |
|
6716 |
||
6717 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
|
6718 |
! |
|
6719 |
||
12811 | 6720 |
doOpenMonticelloBrowser |
12874
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
6721 |
MCMczReader isNil ifTrue:[ Smalltalk loadPackage:'stx:goodies/monticello']. |
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
6722 |
|
12811 | 6723 |
self withWaitCursorDo:[ |
6724 |
self currentSelectedFiles do:[:fn | |
|
6725 |
|version snapshot| |
|
6726 |
||
6727 |
fn suffix asLowercase = 'mcz' ifTrue:[ |
|
6728 |
version := MCMczReader versionFromFile:fn. |
|
6729 |
snapshot := version snapshot. |
|
6730 |
(Tools::ChangeSetBrowser2 |
|
6731 |
on: snapshot asChangeSet |
|
6732 |
label: version info name) |
|
6733 |
beTwoColumn; |
|
6734 |
targetNamespace:nil; |
|
6735 |
targetPackage:nil; |
|
6736 |
open |
|
6737 |
] |
|
6738 |
] |
|
6739 |
] |
|
6740 |
! |
|
6741 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6742 |
doOpenSettings |
8168 | 6743 |
self openSettingsDialog |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6744 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6745 |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6746 |
doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6747 |
"open using win32-shell" |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6748 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6749 |
|fileName| |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6750 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6751 |
fileName := self firstSelectedFile. |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6752 |
fileName notNil ifTrue:[ |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6753 |
OperatingSystem |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6754 |
openApplicationForDocument:fileName pathName |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6755 |
operation:#open |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6756 |
] |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6757 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6758 |
"Modified: / 21-07-2012 / 12:26:10 / cg" |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6759 |
! |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6760 |
|
7104 | 6761 |
editMode:aSymbol |
6762 |
self |
|
6763 |
applicationNamed:#FileApplicationNoteBook |
|
6764 |
ifPresentDo:[:appl | |
|
6765 |
|subApp| |
|
6766 |
||
6767 |
subApp := appl selectedApplication. |
|
6768 |
subApp notNil ifTrue:[ |
|
6769 |
^ subApp perform:aSymbol |
|
6770 |
] |
|
6771 |
]. |
|
6772 |
||
6773 |
"Created: / 11-09-2006 / 12:42:08 / cg" |
|
6774 |
! |
|
6775 |
||
6776 |
editModeInsert |
|
6777 |
self editMode:#editModeInsert |
|
6778 |
||
6779 |
"Created: / 11-09-2006 / 12:40:36 / cg" |
|
6780 |
! |
|
6781 |
||
6782 |
editModeInsertAndSelect |
|
6783 |
self editMode:#editModeInsertAndSelect |
|
6784 |
||
6785 |
"Created: / 11-09-2006 / 12:40:45 / cg" |
|
6786 |
! |
|
6787 |
||
6788 |
editModeOverwrite |
|
6789 |
self editMode:#editModeOverwrite |
|
6790 |
||
6791 |
"Modified: / 11-09-2006 / 12:42:26 / cg" |
|
6792 |
! |
|
6793 |
||
15528 | 6794 |
fetchFileByURL |
6795 |
|url destinationFilename| |
|
6796 |
||
6797 |
url := Dialog request:'URL to Fetch:' initialAnswer:'http://host/path'. |
|
6798 |
url isEmptyOrNil ifTrue:[^ self]. |
|
6799 |
url := url asURL. |
|
6800 |
||
6801 |
destinationFilename := Dialog request:'Download As:' initialAnswer:(UnixFilename named:url path) baseName. |
|
6802 |
destinationFilename isEmptyOrNil ifTrue:[^ self]. |
|
6803 |
||
6804 |
destinationFilename := self currentDirectory asFilename / destinationFilename. |
|
6805 |
destinationFilename exists ifTrue:[ |
|
6806 |
|answer| |
|
6807 |
||
6808 |
answer := Dialog |
|
6809 |
confirm:(resources string:'Overwrite existing %1 ?' with:destinationFilename baseName allBold) |
|
6810 |
default:false. |
|
6811 |
answer ~~ true ifTrue:[^ self]. |
|
6812 |
]. |
|
6813 |
self withActivityIndicationDo:[ |
|
6814 |
self notify:(resources string:'Fetching %1' with:url). |
|
6815 |
HTTPInterface get:url destinationFile:destinationFilename. |
|
6816 |
self notify:nil. |
|
6817 |
] |
|
6818 |
||
6819 |
"Modified: / 20-05-2010 / 11:15:35 / cg" |
|
6820 |
! |
|
6821 |
||
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6822 |
fileContentsAsByteArray |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6823 |
|file| |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6824 |
|
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6825 |
file := self firstSelectedFile. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6826 |
file isNil ifTrue:[^ self ]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6827 |
file asFilename fileSize > (1024*1024) ifTrue:[ |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6828 |
file asFilename fileSize > (128*1024*1024) ifTrue:[ |
11889 | 6829 |
Dialog warn:(resources string:'File is too big'). |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6830 |
^ self. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6831 |
]. |
11889 | 6832 |
(Dialog confirm:(resources string:'File is big - proceed ?')) ifFalse:[^ self]. |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6833 |
]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6834 |
file asFilename binaryContentsOfEntireFile inspect |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6835 |
! |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6836 |
|
3892 | 6837 |
fileFileIn |
6838 |
"fileIn the selected file(s)" |
|
6839 |
||
6840 |
self fileFileInLazy:false |
|
6841 |
! |
|
6842 |
||
7324 | 6843 |
fileFileIn:aFilename lazy:lazy |
6844 |
"fileIn a file" |
|
6845 |
||
6846 |
self withActivityIndicationDo:[ |
|
6847 |
self notify:('File in:', aFilename asFilename baseName). |
|
6848 |
self singleFileFileIn:aFilename lazy:lazy. |
|
6849 |
self notify:nil. |
|
6850 |
] |
|
6851 |
||
6852 |
"Created: / 20-09-2006 / 14:28:35 / cg" |
|
6853 |
! |
|
6854 |
||
3892 | 6855 |
fileFileInLazy |
6856 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
6857 |
||
6858 |
self fileFileInLazy:true |
|
6859 |
! |
|
6860 |
||
6861 |
fileFileInLazy:lazy |
|
6862 |
"fileIn the selected file(s)" |
|
6863 |
||
7324 | 6864 |
self currentSelectedFiles do:[:fileName | |
6865 |
self fileIn:fileName lazy:lazy |
|
6866 |
]. |
|
6867 |
||
6868 |
"Modified: / 20-09-2006 / 14:29:24 / cg" |
|
3892 | 6869 |
! |
6870 |
||
12497 | 6871 |
fileFileInPackage |
6872 |
"assuming the current directory is a package directory, load it" |
|
6873 |
||
6874 |
|packageDir dir path top packageID| |
|
6875 |
||
6876 |
"/ find a reasonable package-id (walk up until we find stx) |
|
6877 |
path := ''. |
|
6878 |
dir := packageDir := self currentDirectory. |
|
6879 |
||
6880 |
top := (Smalltalk projectDirectoryForPackage:'stx') asFilename. |
|
6881 |
[ (dir / 'stx') = top ] whileFalse:[ |
|
6882 |
path := dir baseName , '/' , path. |
|
6883 |
dir := dir directory. |
|
6884 |
dir isNil ifTrue:[ |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
6885 |
Dialog warn:'Could not find a path from "stx" to the current directory.'. |
12497 | 6886 |
"/ should ask the user for a packageID and proceed... |
6887 |
^ self. |
|
6888 |
]. |
|
6889 |
]. |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
6890 |
packageID := path copyButLast:1. |
12497 | 6891 |
Smalltalk loadPackage:packageID fromDirectory:packageDir asAutoloaded:true |
6892 |
! |
|
6893 |
||
3892 | 6894 |
fileFileInToNameSpace |
6895 |
"fileIn the selected file(s)<into a nameSpace" |
|
6896 |
||
6897 |
|ns listOfKnownNameSpaces| |
|
6898 |
||
6899 |
listOfKnownNameSpaces := Set new. |
|
6900 |
NameSpace |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
6901 |
allNameSpaces |
4414 | 6902 |
do:[:eachNameSpace | |
6903 |
listOfKnownNameSpaces add:eachNameSpace name |
|
6904 |
]. |
|
3892 | 6905 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
6906 |
||
6907 |
ns := Dialog |
|
4414 | 6908 |
request:'During fileIn, new classes are created in nameSpace:' |
6909 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
6910 |
list:listOfKnownNameSpaces. |
|
3892 | 6911 |
ns isEmptyOrNil ifTrue:[^ self]. |
6912 |
||
6913 |
LastEnforcedNameSpace := ns. |
|
6914 |
ns := NameSpace name:ns. |
|
6915 |
||
6916 |
Class nameSpaceQuerySignal |
|
4414 | 6917 |
answer:ns |
6918 |
do:[ |
|
6919 |
self fileFileInLazy:false |
|
6920 |
] |
|
3892 | 6921 |
! |
6922 |
||
6923 |
fileFindAllDuplicates |
|
6924 |
"scan directory and all subdirs for duplicate files" |
|
6925 |
||
6926 |
|fileNames dir infoDir filesBySize |
|
6927 |
result info dirPrefix myName stream textBox maxLength directories| |
|
6928 |
||
6929 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
6930 |
self withActivityIndicationDo:[ |
4414 | 6931 |
result := Dictionary new. |
6932 |
myName := self class name asString. |
|
6933 |
directories := self currentSelectedDirectories. |
|
6934 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 6935 |
|
4414 | 6936 |
dir := directories first. |
3892 | 6937 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6938 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6939 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6940 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 6941 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
6942 |
with:ex pathName |
|
6943 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6944 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6945 |
]. |
4765 | 6946 |
fileNames := fileNames |
6947 |
collect:[:fn | dir construct:fn] |
|
6948 |
thenSelect:[:fn | fn isDirectory not]. |
|
3892 | 6949 |
|
6950 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 6951 |
infoDir := Dictionary new. |
6952 |
fileNames do:[:fn | |
|
6953 |
infoDir at:fn put:(fn fileSize) |
|
6954 |
]. |
|
6955 |
||
14497 | 6956 |
"/ for each, get the file's size. |
4414 | 6957 |
"/ in a first pass, look for files of the same size and |
6958 |
"/ compare them ... |
|
3892 | 6959 |
|
6960 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 6961 |
filesBySize := Dictionary new. |
6962 |
infoDir keysAndValuesDo:[:fn :sz | |
|
6963 |
|entry| |
|
6964 |
||
6965 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
6966 |
entry add:fn. |
|
6967 |
]. |
|
6968 |
||
6969 |
"/ any of same size ? |
|
3892 | 6970 |
|
6971 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 6972 |
filesBySize do:[:entry | |
6973 |
|files| |
|
6974 |
||
6975 |
entry size > 1 ifTrue:[ |
|
6976 |
files := entry asArray. |
|
6977 |
1 to:files size-1 do:[:idx1 | |
|
6978 |
idx1+1 to:files size do:[:idx2 | |
|
6979 |
|fn1 fn2| |
|
6980 |
||
6981 |
fn1 := files at:idx1. |
|
6982 |
fn2 := files at:idx2. |
|
3892 | 6983 |
|
6984 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 6985 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
6986 |
"/ compare the files |
|
6987 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 6988 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 6989 |
result at:fn1 put:fn2. |
6990 |
] |
|
6991 |
] |
|
6992 |
] |
|
6993 |
] |
|
6994 |
] |
|
6995 |
]. |
|
3892 | 6996 |
|
6997 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 6998 |
dirPrefix := dir pathName. |
6999 |
result := result associations. |
|
7000 |
result := result collect:[:assoc | |
|
7001 |
|f1 f2| |
|
7002 |
||
7003 |
f1 := assoc key name. |
|
7004 |
f2 := assoc value name. |
|
7005 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
7006 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
7007 |
]. |
|
7008 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
7009 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
7010 |
]. |
|
7011 |
f1 < f2 ifTrue:[ |
|
7012 |
f2 -> f1 |
|
7013 |
] ifFalse:[ |
|
7014 |
f1 -> f2 |
|
7015 |
] |
|
7016 |
]. |
|
7017 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
7018 |
||
7019 |
info := OrderedCollection new. |
|
7020 |
result do:[:assoc | |
|
7021 |
info add:(assoc key , ' same as ' , assoc value) |
|
7022 |
]. |
|
7023 |
info isEmpty ifTrue:[ |
|
11889 | 7024 |
Dialog information:(resources string:'No duplicate files found.'). |
5543 | 7025 |
^ self. |
4414 | 7026 |
]. |
3892 | 7027 |
]. |
7028 |
||
15589 | 7029 |
stream := CharacterWriteStream new. |
11688 | 7030 |
stream nextPutAllLines:info. |
5542 | 7031 |
|
3892 | 7032 |
textBox := TextBox new. |
7033 |
textBox initialText:(stream contents). |
|
5542 | 7034 |
stream close. |
11889 | 7035 |
textBox title:(resources string:'File duplicates in directory: %1' with:dir asString). |
3892 | 7036 |
textBox readOnly:true. |
7037 |
textBox noCancel. |
|
11889 | 7038 |
textBox label:(resources string:'Duplicates in %1' with:dir asString). |
3892 | 7039 |
maxLength := 10. |
7040 |
info do:[: el | |
|
4414 | 7041 |
maxLength := maxLength max:(el size). |
3892 | 7042 |
]. |
7043 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 7044 |
textBox maxExtent:Screen current extent. |
7045 |
textBox openModeless. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7046 |
|
11688 | 7047 |
"Modified: / 27-07-2012 / 09:29:00 / cg" |
3892 | 7048 |
! |
7049 |
||
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7050 |
fileFindDuplicateFile |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7051 |
"scan directory for duplicates of the selected files" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7052 |
|
10306 | 7053 |
|files filesBySize samePerFile stream textBox mustHaveMatches| |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7054 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7055 |
files := self currentSelectedFiles. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7056 |
files isEmpty ifTrue:[^ self]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7057 |
|
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7058 |
self withWaitCursorDo:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7059 |
filesBySize := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7060 |
files do:[:fn | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7061 |
|sz entry| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7062 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7063 |
sz := fn asFilename fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7064 |
(filesBySize at:sz ifAbsentPut:[Set new]) add:fn. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7065 |
]. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7066 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7067 |
samePerFile := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7068 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7069 |
self currentSelectedDirectories do:[:eachDir | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7070 |
eachDir recursiveDirectoryContentsAsFilenamesDo:[:eachFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7071 |
eachFile isDirectory ifFalse:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7072 |
|sz possibleMatches| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7073 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7074 |
sz := eachFile fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7075 |
possibleMatches := filesBySize at:sz ifAbsent:nil. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7076 |
possibleMatches notNil ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7077 |
possibleMatches do:[:eachFileWithSameSize | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7078 |
eachFileWithSameSize ~= eachFile ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7079 |
(eachFileWithSameSize sameContentsAs:eachFile) ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7080 |
(samePerFile at:eachFileWithSameSize ifAbsentPut:[Set new]) add:eachFile |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7081 |
] |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7082 |
] |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7083 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7084 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7085 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7086 |
] |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7087 |
]. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7088 |
]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7089 |
|
15589 | 7090 |
stream := CharacterWriteStream with:'Duplicates:'. |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7091 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7092 |
do:[:origFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7093 |
|sameFiles| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7094 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7095 |
sameFiles := samePerFile at:origFile. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7096 |
stream nextPutLine:origFile baseName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7097 |
(sameFiles asOrderedCollection collect:[:each | each baseName]) sort do:[:eachSameName | |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7098 |
stream nextPutAll:' '; nextPutLine:eachSameName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7099 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7100 |
]. |
10306 | 7101 |
stream nextPutLine:'Files without duplicates:'. |
7102 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7103 |
do:[:origFile | |
|
7104 |
|sameFiles| |
|
7105 |
||
7106 |
sameFiles := samePerFile at:origFile. |
|
7107 |
sameFiles isEmpty ifTrue:[ |
|
7108 |
stream nextPutLine:origFile baseName. |
|
7109 |
]. |
|
7110 |
]. |
|
7111 |
||
7112 |
mustHaveMatches := Dialog request:'Must have for duplicates matching ?:' initialAnswer:(LastMustMatchPattern ? '[a-z][a-z][a-z]_[0-9][0-9][0-9].*'). |
|
7113 |
mustHaveMatches notEmptyOrNil ifTrue:[ |
|
7114 |
LastMustMatchPattern := mustHaveMatches. |
|
7115 |
||
7116 |
stream nextPutLine:'Files without duplicates in xxx_nnn.jpg:'. |
|
7117 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7118 |
do:[:origFile | |
|
7119 |
|sameFiles| |
|
7120 |
||
7121 |
sameFiles := samePerFile at:origFile. |
|
7122 |
sameFiles notEmpty ifTrue:[ |
|
7123 |
(sameFiles contains:[:file | mustHaveMatches match:file baseName]) ifFalse:[ |
|
7124 |
stream nextPutLine:origFile baseName. |
|
7125 |
] |
|
7126 |
]. |
|
7127 |
]. |
|
7128 |
]. |
|
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7129 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7130 |
textBox := TextBox new. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7131 |
textBox initialText:(stream contents). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7132 |
textBox title:'Files with same contents'. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7133 |
textBox readOnly:true. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7134 |
textBox noCancel. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7135 |
textBox extent:(350@400). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7136 |
textBox maxExtent:Screen current extent. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7137 |
textBox openModeless. "/ showAtPointer. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7138 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7139 |
"Created: / 11-07-2011 / 12:39:44 / cg" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7140 |
! |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7141 |
|
3892 | 7142 |
fileFindDuplicates |
7143 |
"scan directory for duplicate files" |
|
7144 |
||
8510 | 7145 |
|infoDir filesBySize result info stream textBox maxLength directories allFiles titleStream size| |
7146 |
||
7147 |
directories := self currentSelectedDirectories. |
|
3892 | 7148 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7149 |
self withActivityIndicationDo:[ |
4355 | 7150 |
result := Dictionary new. |
7151 |
||
7152 |
directories := self currentSelectedDirectories. |
|
7153 |
directories isEmpty ifTrue:[^ self]. |
|
7154 |
||
8510 | 7155 |
allFiles := self allFilesInSelectedDirectoriesForWhich:[:f | true]. |
4355 | 7156 |
|
7157 |
infoDir := Dictionary new. |
|
7158 |
allFiles do:[:fn | |
|
7159 |
infoDir at:fn put:(fn info) |
|
7160 |
]. |
|
7161 |
||
14497 | 7162 |
"/ for each, get the file's size. |
4355 | 7163 |
"/ in a first pass, look for files of the same size and |
7164 |
"/ compare them ... |
|
7165 |
||
7166 |
filesBySize := Dictionary new. |
|
7167 |
infoDir keysAndValuesDo:[:fn :info | |
|
7168 |
|sz entry| |
|
7169 |
||
7170 |
sz := info size. |
|
7171 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7172 |
entry add:fn. |
|
7173 |
]. |
|
7174 |
||
7175 |
"/ any of same size ? |
|
7176 |
||
7177 |
filesBySize do:[:entry | |
|
7178 |
|files| |
|
7179 |
||
7180 |
entry size > 1 ifTrue:[ |
|
7181 |
files := entry asArray. |
|
7182 |
1 to:files size-1 do:[:idx1 | |
|
7183 |
idx1+1 to:files size do:[:idx2 | |
|
7184 |
|fn1 fn2| |
|
7185 |
||
7186 |
fn1 := files at:idx1. |
|
7187 |
fn2 := files at:idx2. |
|
7188 |
||
7189 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
7190 |
"/ compare the files |
|
7191 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7192 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4355 | 7193 |
result at:fn1 put:fn2. |
7194 |
] |
|
7195 |
] |
|
7196 |
] |
|
7197 |
] |
|
7198 |
] |
|
7199 |
]. |
|
7200 |
||
7201 |
result := result associations. |
|
7202 |
result := result collect:[:assoc | |
|
7203 |
|f1 f2| |
|
7204 |
||
7205 |
f1 := assoc key asString. |
|
7206 |
f2 := assoc value asString. |
|
7207 |
f1 < f2 ifTrue:[ |
|
7208 |
f2 -> f1 |
|
7209 |
] ifFalse:[ |
|
7210 |
f1 -> f2 |
|
7211 |
] |
|
7212 |
]. |
|
5789 | 7213 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
7214 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
4355 | 7215 |
|
7216 |
info := OrderedCollection new. |
|
7217 |
size := self getBestDirectory asString size. |
|
7218 |
result do:[:assoc | |
|
7219 |
|fn1 fn2| |
|
7220 |
||
7221 |
fn1 := assoc key. |
|
7222 |
fn2 := assoc value. |
|
7223 |
size > 1 ifTrue:[ |
|
7224 |
fn1 := ('..', (fn1 copyFrom:(size + 1))). |
|
7225 |
fn2 := ('..', (fn2 copyFrom:(size + 1))). |
|
7226 |
]. |
|
7227 |
(fn1 includes:Character space) ifTrue:[ |
|
7228 |
fn1 := '"' , fn1 , '"' |
|
7229 |
]. |
|
7230 |
(fn2 includes:Character space) ifTrue:[ |
|
7231 |
fn2 := '"' , fn2 , '"' |
|
7232 |
]. |
|
7233 |
info add:(fn1 , ' same as ' , fn2) |
|
7234 |
]. |
|
7235 |
info isEmpty ifTrue:[ |
|
5543 | 7236 |
Dialog information:'No duplicate files found.'. |
7237 |
^ self. |
|
4355 | 7238 |
]. |
3892 | 7239 |
]. |
15589 | 7240 |
stream := CharacterWriteStream new. |
11688 | 7241 |
stream nextPutAllLines:info. |
7242 |
||
15589 | 7243 |
titleStream := CharacterWriteStream with:'File duplicates in directory'. |
3892 | 7244 |
directories size == 1 ifTrue:[ |
12602 | 7245 |
titleStream nextPutAll:'y: '; nextPutAll: directories first asString. |
3892 | 7246 |
] ifFalse:[ |
4535 | 7247 |
titleStream nextPutLine:'ies: '. |
4355 | 7248 |
directories do:[:dir| |
7249 |
size > 1 ifTrue:[ |
|
7250 |
titleStream nextPutAll:'..'. |
|
4535 | 7251 |
titleStream nextPutLine:((dir asString) copyFrom:(size + 1)). |
4355 | 7252 |
] ifFalse:[ |
4535 | 7253 |
titleStream nextPutLine:(dir asString). |
4355 | 7254 |
]. |
7255 |
] |
|
3892 | 7256 |
]. |
5543 | 7257 |
|
3892 | 7258 |
textBox := TextBox new. |
7259 |
textBox initialText:(stream contents). |
|
7260 |
textBox title:(titleStream contents). |
|
7261 |
textBox readOnly:true. |
|
7262 |
textBox noCancel. |
|
14715 | 7263 |
stream := WriteStream on:''. |
7264 |
stream nextPutAll:'Duplicates in '. |
|
4170 | 7265 |
directories do:[ :aDirectory | |
4355 | 7266 |
stream nextPutAll:aDirectory baseName. |
7267 |
stream space. |
|
4050 | 7268 |
]. |
4170 | 7269 |
textBox label:stream contents. |
3892 | 7270 |
maxLength := 10. |
7271 |
info do:[: el | |
|
4355 | 7272 |
maxLength := maxLength max:(el size). |
3892 | 7273 |
]. |
5092 | 7274 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
7275 |
textBox maxExtent:Screen current extent. |
|
4355 | 7276 |
textBox openModeless. "/ showAtPointer. |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7277 |
|
11688 | 7278 |
"Modified: / 27-07-2012 / 09:29:14 / cg" |
3892 | 7279 |
! |
7280 |
||
7281 |
fileFindFile |
|
5961 | 7282 |
|filename| |
7283 |
||
7284 |
filename := self firstSelectedFileName. |
|
7285 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7286 |
filename := Filename homeDirectory. |
3892 | 7287 |
]. |
4101 | 7288 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 7289 |
! |
7290 |
||
8510 | 7291 |
fileFindSimilarImages |
7292 |
"scan directory for similar image files" |
|
7293 |
||
8512 | 7294 |
|result stream textBox directories imageFiles histogramsV histogramsH |
7295 |
similarV similarH similar alreadyPrinted| |
|
8510 | 7296 |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7297 |
self withWaitCursorDo:[ |
8510 | 7298 |
self withActivityIndicationDo:[ |
7299 |
result := Dictionary new. |
|
7300 |
||
7301 |
directories := self currentSelectedDirectories. |
|
7302 |
directories isEmpty ifTrue:[^ self]. |
|
7303 |
||
13714 | 7304 |
imageFiles := self allFilesInSelectedDirectoriesForWhich:[:f | f mimeTypeFromName isImageType]. |
8511 | 7305 |
"/ imageFiles := imageFiles select:[:f | f baseName startsWith:'foo']. |
7306 |
imageFiles sort:[:a :b | a pathName < b pathName]. |
|
7307 |
||
8510 | 7308 |
"/ for each, get the color histogram |
7309 |
histogramsV := Dictionary new. |
|
7310 |
histogramsH := Dictionary new. |
|
7311 |
imageFiles do:[:fn | |
|
7312 |
|hist image| |
|
7313 |
||
7314 |
image := Image fromFile:fn. |
|
7315 |
Transcript showCR:'generating histogram for ',fn baseName. |
|
7316 |
hist := ImageColorHistogram new forImage:image. |
|
7317 |
histogramsV at:fn put:(hist histogramVectorV). |
|
7318 |
histogramsH at:fn put:(hist histogramVectorH). |
|
7319 |
]. |
|
7320 |
||
7321 |
similarH := Dictionary new. |
|
7322 |
similarV := Dictionary new. |
|
7323 |
similar := Dictionary new. |
|
7324 |
||
8512 | 7325 |
(self firstSelectedFile notNil |
7326 |
ifTrue:[ Array with:self firstSelectedFile ] |
|
7327 |
ifFalse:[ imageFiles ]) |
|
7328 |
do:[:eachFile1 | |
|
8510 | 7329 |
|setOfSimilar distancesV distancesH| |
7330 |
||
7331 |
distancesV := OrderedCollection new. |
|
7332 |
distancesH := OrderedCollection new. |
|
7333 |
setOfSimilar := OrderedCollection new. |
|
7334 |
||
7335 |
imageFiles do:[:eachFile2 | |
|
7336 |
|v1 v2 dV dH| |
|
7337 |
||
7338 |
eachFile1 ~= eachFile2 ifTrue:[ |
|
7339 |
v1 := histogramsV at:eachFile1. |
|
7340 |
v2 := histogramsV at:eachFile2. |
|
7341 |
dV := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7342 |
distancesV add:(eachFile2 -> dV). |
|
7343 |
v1 := histogramsH at:eachFile1. |
|
7344 |
v2 := histogramsH at:eachFile2. |
|
7345 |
dH := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7346 |
distancesH add:(eachFile2 -> dH). |
|
7347 |
(dV < 10000 and:[dH < 10000]) ifTrue:[ |
|
8512 | 7348 |
setOfSimilar add:eachFile2->(dV + dH). |
8510 | 7349 |
]. |
7350 |
] |
|
7351 |
]. |
|
7352 |
distancesV sort:[:a1 :a2 | a1 value < a2 value]. |
|
7353 |
distancesH sort:[:a1 :a2 | a1 value < a2 value]. |
|
7354 |
similarV at:eachFile1 put:distancesV. |
|
7355 |
similarH at:eachFile1 put:distancesH. |
|
7356 |
setOfSimilar notEmpty ifTrue:[ similar at:eachFile1 put:setOfSimilar ]. |
|
7357 |
]. |
|
7358 |
||
7359 |
similar isEmpty ifTrue:[ |
|
7360 |
Dialog information:'No similarities found.'. |
|
7361 |
^ self. |
|
7362 |
]. |
|
7363 |
]. |
|
7364 |
||
15589 | 7365 |
stream := CharacterWriteStream new. |
8512 | 7366 |
alreadyPrinted := Set new. |
7367 |
||
7368 |
imageFiles do:[:eachFile | |
|
7369 |
|eachSet| |
|
7370 |
||
7371 |
(alreadyPrinted includes:eachFile) ifFalse:[ |
|
7372 |
eachSet := similar at:eachFile ifAbsent:nil. |
|
7373 |
eachSet notNil ifTrue:[ |
|
7374 |
stream nextPutLine:eachFile pathName. |
|
7375 |
eachSet do:[:info | |
|
7376 |
|fn2 dist| |
|
7377 |
||
7378 |
fn2 := info key. |
|
7379 |
dist := info value. |
|
7380 |
stream nextPutAll:' '. |
|
7381 |
stream nextPutAll:fn2 pathName. |
|
7382 |
stream nextPutLine:' (',dist printString,')'. |
|
7383 |
alreadyPrinted add:fn2. |
|
7384 |
]. |
|
7385 |
stream cr. |
|
7386 |
]. |
|
8510 | 7387 |
]. |
7388 |
]. |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7389 |
]. |
8510 | 7390 |
|
7391 |
textBox := TextBox new. |
|
7392 |
textBox initialText:(stream contents). |
|
7393 |
textBox title:'File similarities:'. |
|
7394 |
textBox readOnly:true. |
|
7395 |
textBox noCancel. |
|
7396 |
||
7397 |
textBox label:'File similarities'. |
|
7398 |
textBox extent:(400@((similar size max:40)* 10)). |
|
7399 |
textBox maxExtent:Screen current extent. |
|
7400 |
textBox openModeless. "/ showAtPointer. |
|
7401 |
||
7402 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
|
7403 |
! |
|
7404 |
||
4618 | 7405 |
fileHexDump |
7406 |
||
7407 |
| file item| |
|
7408 |
||
7409 |
file := self firstSelectedFile. |
|
7410 |
file notNil ifTrue:[ |
|
7411 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 7412 |
self |
7413 |
applicationNamed:#FileApplicationNoteBook |
|
7414 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 7415 |
]. |
7416 |
! |
|
7417 |
||
7324 | 7418 |
fileIn:aFilename |
7419 |
"fileIn a file" |
|
7420 |
||
7421 |
self fileIn:aFilename lazy:false |
|
7422 |
||
7423 |
"Created: / 20-09-2006 / 14:30:06 / cg" |
|
7424 |
! |
|
7425 |
||
7426 |
fileIn:aFilename lazy:lazy |
|
7427 |
"fileIn a file" |
|
7428 |
||
7429 |
self withActivityIndicationDo:[ |
|
7430 |
self notify:('File in:', aFilename asFilename baseName). |
|
7431 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7432 |
self notify:nil. |
|
7433 |
] |
|
7434 |
||
7435 |
"Created: / 20-09-2006 / 14:29:21 / cg" |
|
7436 |
! |
|
7437 |
||
4930 | 7438 |
filterSelectedFiles:whichFilter |
7439 |
|selectedFiles numFiles msg filterBlock| |
|
7440 |
||
7560 | 7441 |
selectedFiles := self currentSelectedObjects. |
4930 | 7442 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
7443 |
||
7444 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
7445 |
numFiles > 1 ifTrue:[ |
|
7446 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
7447 |
]. |
|
7448 |
||
7449 |
(Dialog |
|
6352 | 7450 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 7451 |
initialAnswer:false |
7452 |
) ifFalse:[ |
|
7453 |
^ self |
|
7454 |
]. |
|
7455 |
||
7456 |
whichFilter == #rot13 ifTrue:[ |
|
7457 |
filterBlock := [:charIn | charIn rot13 ]. |
|
7458 |
]. |
|
7459 |
"/ add more here... |
|
7460 |
||
7461 |
filterBlock isNil ifTrue:[ |
|
7462 |
self information:'No such filter: ' , whichFilter. |
|
7463 |
^ self. |
|
7464 |
]. |
|
7465 |
||
7466 |
selectedFiles do:[:fileName | |
|
7467 |
|s| |
|
7468 |
||
7469 |
self notify:('Processing:', fileName baseName). |
|
7470 |
fileName isDirectory ifFalse:[ |
|
7471 |
[ |
|
7472 |
|inFile outFile in out| |
|
7473 |
||
7474 |
inFile := fileName asFilename. |
|
7475 |
outFile := (fileName pathName , '.filter') asFilename. |
|
7476 |
||
7477 |
[ |
|
7478 |
|charIn charOut| |
|
7479 |
||
7480 |
in := inFile readStream. |
|
7481 |
out := outFile writeStream. |
|
7482 |
[in atEnd] whileFalse:[ |
|
7483 |
charIn := in next. |
|
7484 |
charOut := filterBlock value:charIn. |
|
7485 |
out nextPut:charOut. |
|
7486 |
]. |
|
13683 | 7487 |
out close. out:= nil. |
4930 | 7488 |
outFile renameTo:inFile. |
7489 |
] ensure:[ |
|
7490 |
out notNil ifTrue:[ out close ]. |
|
7491 |
in notNil ifTrue:[ in close ]. |
|
7492 |
outFile delete. |
|
7493 |
] |
|
7494 |
] on:FileStream openErrorSignal do:[:ex| |
|
7495 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
7496 |
]. |
|
7497 |
] |
|
7498 |
]. |
|
6190 | 7499 |
self notify:nil. |
7560 | 7500 |
|
7501 |
"Modified: / 04-12-2006 / 13:14:48 / cg" |
|
4930 | 7502 |
! |
7503 |
||
9784 | 7504 |
forEachParsedXmlFileDo:aBlock |
7505 |
"parse all selected XML files, for each dom-tree, evaluate aBlock" |
|
7506 |
||
7507 |
self withActivityIndicationDo:[ |
|
7508 |
| selectedFiles xmlDocument | |
|
7509 |
||
7510 |
selectedFiles:= self currentSelectedFiles. |
|
7511 |
selectedFiles do:[:fileName | |
|
7512 |
XML::XMLSignal handle:[:ex | |
|
14551 | 7513 |
Dialog |
7514 |
information:('Error while reading XML:\ %1' bindWith:ex description) withCRs |
|
7515 |
title:'XML Error'. |
|
9784 | 7516 |
^ self. |
7517 |
] do:[ |
|
7518 |
|s d magic encoder document| |
|
7519 |
||
7520 |
s := fileName asFilename readStream. |
|
14012 | 7521 |
[ |
7522 |
s binary. |
|
7523 |
magic := (s next:2). |
|
7524 |
magic = #[254 255] ifTrue:[ |
|
7525 |
"/ UTF16BE |
|
7526 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16be. |
|
7527 |
] ifFalse:[ |
|
7528 |
magic = #[255 254] ifTrue:[ |
|
7529 |
"/ UTF16LE |
|
7530 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16le. |
|
7531 |
]. |
|
7532 |
]. |
|
7533 |
] ensure:[ |
|
7534 |
s close. |
|
7535 |
]. |
|
9784 | 7536 |
document notNil ifTrue:[ |
7537 |
xmlDocument := XML::XMLParser |
|
7538 |
processDocumentString:document |
|
7539 |
beforeScanDo:[:parse| parse validate:false]. |
|
7540 |
] ifFalse:[ |
|
7541 |
xmlDocument := XML::XMLParser |
|
7542 |
processDocumentInFilename:fileName |
|
7543 |
beforeScanDo:[:parse| parse validate:false]. |
|
7544 |
] |
|
7545 |
]. |
|
7546 |
aBlock value:xmlDocument. |
|
7547 |
]. |
|
7548 |
] |
|
7549 |
||
7550 |
"Created: / 17-02-2011 / 13:58:21 / cg" |
|
7551 |
! |
|
7552 |
||
8832 | 7553 |
forEachSelectedFileIgnoringDirectories:ignoreDirs do:aBlock |
7554 |
|numItems path files| |
|
7555 |
||
7556 |
files := self currentSelectedFiles. |
|
7557 |
||
7558 |
(numItems := files size) > 2 ifTrue:[ |
|
7559 |
(self |
|
7560 |
confirm:(resources string:'Open for each of the %1 items ?' |
|
7561 |
with:numItems)) ifFalse:[^ self]. |
|
7562 |
]. |
|
7563 |
||
7564 |
self withActivityIndicationDo:[ |
|
7565 |
files do:[:fileName | |
|
7566 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
7567 |
fileName isAbsolute ifTrue:[ |
|
17239 | 7568 |
path := fileName name. |
8832 | 7569 |
] ifFalse:[ |
7570 |
path := fileName pathName. |
|
7571 |
]. |
|
7572 |
aBlock value:path |
|
7573 |
] |
|
7574 |
]. |
|
7575 |
]. |
|
17239 | 7576 |
|
7577 |
"Modified: / 19-01-2017 / 16:57:03 / stefan" |
|
8832 | 7578 |
! |
7579 |
||
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7580 |
generateDetachedSignaturesForSelectedFiles |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7581 |
"generate detached signature (pkcs7) files from the contents of the selected files. |
16941 | 7582 |
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
|
7583 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7584 |
self withActivityIndicationDo:[ |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7585 |
self currentSelectedFiles do:[:fn | |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7586 |
|data hash signature signatureFile| |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7587 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7588 |
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
|
7589 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7590 |
data := fn contentsAsString. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7591 |
hash := SHA1Stream hashValueOf:data. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7592 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7593 |
signature := Expecco::KeyFileGenerator new signExpeccoCode:hash. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7594 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7595 |
signatureFile := fn addSuffix:'sig'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7596 |
signatureFile contents:signature. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7597 |
]. |
13677 | 7598 |
self updateCurrentDirectoryWithReread. |
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7599 |
self notify:nil. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7600 |
] |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7601 |
! |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7602 |
|
15211 | 7603 |
generatePatchInstallerForSelectedFiles |
7604 |
"generate an expecco patch, which installs the selected file(s). |
|
7605 |
Opens a dialog asking for the target directory and if the patch should be signed" |
|
7606 |
||
7607 |
|dialog targetDirHolder targetDir |
|
7608 |
generateSignedPatchHolder patchFileNameHolder patchFileName| |
|
7609 |
||
7610 |
targetDirHolder := '.' asValue. |
|
7611 |
generateSignedPatchHolder := true asValue. |
|
7612 |
patchFileNameHolder := '/tmp/00nn_patchFile.st' asValue. |
|
7613 |
||
7614 |
dialog := Dialog new. |
|
7615 |
dialog label:(resources string:'Patch Installer for File(s)'). |
|
7616 |
dialog addTextLabel:'Patchfile Name' adjust:#left. |
|
7617 |
dialog addInputFieldOn:patchFileNameHolder tabable:true. |
|
7618 |
dialog addTextLabel:'Target directory (relative to executable''s directory at execution time)' adjust:#left. |
|
7619 |
dialog addInputFieldOn:targetDirHolder tabable:true. |
|
7620 |
dialog addCheckBox:'Generate Signed Patch' on:generateSignedPatchHolder. |
|
7621 |
dialog addAbortAndOkButtons. |
|
7622 |
dialog open. |
|
7623 |
||
7624 |
dialog accepted ifFalse:[^ self]. |
|
7625 |
||
7626 |
targetDir := targetDirHolder value asFilename. |
|
7627 |
patchFileName := patchFileNameHolder value asFilename. |
|
7628 |
||
7629 |
self withActivityIndicationDo:[ |
|
7630 |
|outStream zipArchive pkcs7SignedData signatureFilename| |
|
7631 |
||
7632 |
self notify:'Generating self extracting st script: ', patchFileName name, '...'. |
|
7633 |
outStream := patchFileName writeStream. |
|
7634 |
outStream nextPutAll:' |
|
7635 |
|patchStream zipArchive| |
|
7636 |
patchStream := Expecco::Browser::CurrentPatchStreamQuery query. |
|
7637 |
patchStream isNil ifTrue:[ self error:''sorry, this patch can only be installed in expecco 2.6.2 and newer (missing CurrentPatchStreamQuery)'']. |
|
7638 |
zipArchive := ZipArchive readingFrom:patchStream. |
|
7639 |
zipArchive members do:[:each | zipArchive extract:each fileName]. |
|
7640 |
patchStream setToEnd. "/ to force fileIn to finish |
|
7641 |
!! |
|
7642 |
||
7643 |
!! !! |
|
7644 |
||
7645 |
'. |
|
7646 |
zipArchive := ZipArchive writingTo:outStream. "/ newFileNamed:(patchFileName). |
|
7647 |
||
7648 |
self currentSelectedFiles do:[:fn | |
|
7649 |
|inStream signatureFilename| |
|
7650 |
||
7651 |
inStream := fn asFilename readStream. |
|
7652 |
zipArchive addFile: (targetDir construct:fn asFilename baseName) name fromStream:inStream. |
|
7653 |
inStream close. |
|
7654 |
]. |
|
7655 |
||
16975 | 7656 |
zipArchive close. |
15211 | 7657 |
|
7658 |
generateSignedPatchHolder value ifTrue:[ |
|
7659 |
self notify:'Generating signed file from: ', patchFileName name, '...'. |
|
7660 |
||
7661 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:patchFileName contentsOfEntireFile. |
|
7662 |
signatureFilename := patchFileName withSuffix:'expeccoPatch'. |
|
7663 |
signatureFilename contents:pkcs7SignedData. |
|
7664 |
]. |
|
7665 |
self notify:nil. |
|
7666 |
] |
|
7667 |
! |
|
13783 | 7668 |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7669 |
generateSignaturesForSelectedFiles |
13783 | 7670 |
"generate signed pkcs7 files from the contents of the selected files. |
7671 |
These can be delivered as expeccoPatch files" |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7672 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7673 |
self withActivityIndicationDo:[ |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7674 |
self currentSelectedFiles do:[:fn | |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7675 |
|pkcs7SignedData signatureFilename| |
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7676 |
|
8646 | 7677 |
self notify:'Generating signed file from: ', (fn baseName), '...'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7678 |
|
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7679 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:fn contentsOfEntireFile. |
12094 | 7680 |
signatureFilename := fn withSuffix:'expeccoPatch'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7681 |
signatureFilename contents:pkcs7SignedData. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7682 |
]. |
13677 | 7683 |
self updateCurrentDirectoryWithReread. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7684 |
self notify:nil. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7685 |
] |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7686 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7687 |
|
9784 | 7688 |
inspectXmlFile |
7689 |
"Show an XML file - either in an XMLInspector or fall back to |
|
7690 |
a plain inspector on the XML tree" |
|
7691 |
||
7692 |
self forEachParsedXmlFileDo:[:xmlDocument | |
|
7693 |
XML::XMLInspector notNil ifTrue:[ |
|
7694 |
XML::XMLInspector openOn:xmlDocument. |
|
7695 |
] ifFalse:[ |
|
7696 |
"fall back..." |
|
7697 |
xmlDocument inspect. |
|
7698 |
] |
|
7699 |
]. |
|
7700 |
||
7701 |
"Modified: / 17-02-2011 / 13:58:16 / cg" |
|
7702 |
! |
|
7703 |
||
3892 | 7704 |
installAllAsAutoloaded |
7705 |
"install all classes found here as autoloaded classes" |
|
7706 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7707 |
self installAllAsAutoloadedRecursive:false |
3892 | 7708 |
! |
7709 |
||
6521 | 7710 |
installAllAsAutoloadedRecursive |
7711 |
"install all classes found here and in subdirectories as autoloaded classes" |
|
7712 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7713 |
self installAllAsAutoloadedRecursive:true |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7714 |
! |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7715 |
|
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7716 |
installAllAsAutoloadedRecursive:aBoolean |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7717 |
"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
|
7718 |
|
6521 | 7719 |
[ |
15507 | 7720 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
7721 |
|installAction| |
|
7722 |
||
7723 |
installAction := |
|
7724 |
[:fn | |
|
7725 |
(fn suffix = 'st') ifTrue:[ |
|
7726 |
self notify:('Install as autoloaded: ', fn baseName). |
|
7727 |
self installAsAutoloaded:fn. |
|
7728 |
] |
|
7729 |
]. |
|
7730 |
||
7731 |
self withActivityIndicationDo:[ |
|
7732 |
self currentSelectedDirectories do:[:dir| |
|
7733 |
aBoolean ifTrue:[ |
|
7734 |
dir recursiveDirectoryContentsAsFilenamesDo:installAction |
|
7735 |
] ifFalse:[ |
|
7736 |
dir directoryContentsAsFilenamesDo:installAction |
|
15152 | 7737 |
]. |
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7738 |
]. |
15507 | 7739 |
self notify:nil. |
7740 |
]. |
|
7741 |
] |
|
6521 | 7742 |
] fork. |
7743 |
! |
|
7744 |
||
3892 | 7745 |
installAsAutoloaded:aFilename |
7746 |
"install aFilename as autoloaded class" |
|
7747 |
||
13292 | 7748 |
Smalltalk installAutoloadedClassFromSourceFile:aFilename |
7749 |
||
7750 |
"Modified: / 01-08-2013 / 16:58:09 / cg" |
|
3892 | 7751 |
! |
7752 |
||
15211 | 7753 |
joinSelectedFiles |
7754 |
|selectedFiles numFiles msg outFileName outFile outStream| |
|
7755 |
||
7756 |
selectedFiles := self currentSelectedObjects. |
|
7757 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
7758 |
||
7759 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
7760 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
7761 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
|
7762 |
outFile := selectedFiles first directory construct:outFileName. |
|
7763 |
||
7764 |
outStream := outFile writeStream. |
|
7765 |
||
7766 |
selectedFiles do:[:fileName | |
|
7767 |
|inStream| |
|
7768 |
||
7769 |
self notify:('Adding:', fileName baseName). |
|
7770 |
inStream := fileName readStream. |
|
7771 |
inStream copyToEndInto:outStream. |
|
7772 |
inStream close. |
|
7773 |
]. |
|
7774 |
outStream close. |
|
7775 |
self notify:nil. |
|
7776 |
||
7777 |
"Modified: / 04-12-2006 / 13:15:10 / cg" |
|
7778 |
! |
|
4558 | 7779 |
|
6292 | 7780 |
loadImageThenDo:aBlock |
3892 | 7781 |
|img path files| |
7782 |
||
3982 | 7783 |
files := self currentSelectedFiles. |
3892 | 7784 |
files isEmpty ifTrue:[ ^ self]. |
7785 |
files do:[:fileName | |
|
4414 | 7786 |
path := fileName. |
7787 |
path isDirectory ifFalse:[ |
|
7788 |
img := Image fromFile:(path pathName). |
|
7789 |
img notNil ifTrue:[ |
|
6292 | 7790 |
aBlock value:img |
4414 | 7791 |
] ifFalse:[ |
15346 | 7792 |
Dialog warn:(resources string:'Unknown image format: "%1"' with:fileName asString) |
4414 | 7793 |
] |
7794 |
] |
|
3892 | 7795 |
]. |
7796 |
! |
|
7797 |
||
13089 | 7798 |
loadSignatureSupport |
7799 |
Expecco::KeyFileGenerator isNil ifTrue:[ |
|
14047 | 7800 |
Smalltalk loadPackage:'exept:expecco/license' |
13089 | 7801 |
]. |
7802 |
! |
|
7803 |
||
3892 | 7804 |
openASN1Browser |
7805 |
||
7806 |
self openTool:OSI::ASN1Browser |
|
7807 |
! |
|
7808 |
||
7809 |
openAppletViewer |
|
7810 |
|numItems files| |
|
7811 |
||
3982 | 7812 |
files := self currentSelectedFiles. |
3892 | 7813 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 7814 |
(self |
7815 |
confirm:(resources string:'open for each of the %1 items ?' |
|
7816 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 7817 |
]. |
7818 |
||
7819 |
Java startupJavaSystem. |
|
7820 |
"/ Java markAllClassesUninitialized. |
|
7821 |
"/ Java initAllStaticFields. |
|
7822 |
"/ Java initAllClasses. |
|
7823 |
||
7824 |
files do:[:fileName | |
|
4414 | 7825 |
|p path| |
7826 |
||
7827 |
path := fileName. |
|
7828 |
path isDirectory ifFalse:[ |
|
7829 |
p := Java |
|
7830 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
7831 |
argumentString:path pathName. |
|
7832 |
p resume. |
|
7833 |
] |
|
3892 | 7834 |
]. |
7835 |
! |
|
7836 |
||
7837 |
openCBrowser |
|
6031 | 7838 |
|dir files| |
5880 | 7839 |
|
7840 |
dir := self theSingleSelectedDirectoryOrNil. |
|
7841 |
dir isNil ifTrue:[ ^ self]. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7842 |
self withActivityIndicationDo:[ |
7560 | 7843 |
files := self currentSelectedObjects. |
6031 | 7844 |
files notEmptyOrNil ifTrue:[ |
7845 |
CBrowser::Browser openOn:files first. |
|
7846 |
] ifFalse:[ |
|
7847 |
CBrowser::Browser openIn:dir. |
|
7848 |
] |
|
3892 | 7849 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7850 |
|
7560 | 7851 |
"Modified: / 04-12-2006 / 13:15:19 / cg" |
3892 | 7852 |
! |
7853 |
||
4230 | 7854 |
openChangeSetBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7855 |
"open a changeSet browser on the selected file(s)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7856 |
|
4230 | 7857 |
self |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7858 |
openTool:(UserPreferences current changeSetBrowserClass) |
4230 | 7859 |
with:#openOnFile: |
7860 |
ignoreDirectories:true |
|
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7861 |
|
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7862 |
"Modified (comment): / 27-07-2012 / 20:42:55 / cg" |
4230 | 7863 |
! |
7864 |
||
3892 | 7865 |
openChangesBrowser |
7866 |
"open a change browser on the selected file(s)" |
|
7867 |
||
7868 |
self openTool:(UserPreferences current changesBrowserClass) |
|
7869 |
! |
|
7870 |
||
7871 |
openDiffView |
|
15215 | 7872 |
"open a diff-view on the two selected files" |
7873 |
||
7874 |
|name1 name2 files title |
|
7875 |
defaultName defaultDir| |
|
6460 | 7876 |
|
7877 |
files := self currentSelectedObjects. |
|
3892 | 7878 |
files isEmpty ifTrue:[ |
6460 | 7879 |
Dialog warn:(resources string:'You have to select a file first'). |
4414 | 7880 |
^ self. |
3892 | 7881 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7882 |
|
3892 | 7883 |
(files size == 2) ifTrue:[ |
4414 | 7884 |
name1 := files last. |
7885 |
name2 := files first. |
|
3892 | 7886 |
] ifFalse:[ |
4414 | 7887 |
LastFileDiffFile notNil ifTrue:[ |
11052 | 7888 |
LastFileDiffFile exists ifTrue:[ |
7889 |
name1 := LastFileDiffFile. |
|
7890 |
]. |
|
7891 |
"/ | directory | |
|
7892 |
"/ directory := self currentDirectory. |
|
7893 |
"/ directory notNil ifTrue:[ |
|
7894 |
"/ lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
7895 |
"/ (lastFile exists and:[lastFile isReadable]) ifTrue:[ |
|
7896 |
"/ name1 := lastFile. |
|
7897 |
"/ ] |
|
7898 |
"/ ] |
|
4414 | 7899 |
]. |
7900 |
name2 := files first. |
|
6460 | 7901 |
title := resources string:'Show differences between "%1" and:' with:name2 baseName. |
4414 | 7902 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
11052 | 7903 |
defaultDir := name1 notNil ifTrue:[name1 directory] ifFalse:[self currentDirectory]. |
4414 | 7904 |
name1 := DialogBox |
7905 |
requestFileName:title |
|
7906 |
default:defaultName |
|
6460 | 7907 |
ok:(resources string:'OK') |
7908 |
abort:(resources string:'Compare against File List') |
|
4414 | 7909 |
pattern:'*' |
11052 | 7910 |
fromDirectory:defaultDir. |
3892 | 7911 |
]. |
15215 | 7912 |
self openDiffViewOn:name1 and:name2 |
7913 |
||
7914 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
|
7915 |
! |
|
7916 |
||
7917 |
openDiffViewOn:fileArg1 and:fileArg2 |
|
7918 |
"open a diff-view on two files" |
|
7919 |
||
7920 |
|file1 file2 text1 text2 d err nm l1 sameContents msg| |
|
7921 |
||
7922 |
file1 := fileArg1. |
|
7923 |
file2 := fileArg2. |
|
3892 | 7924 |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7925 |
self withWaitCursorDo:[ |
15215 | 7926 |
(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
|
7927 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
14126 | 7928 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l string]]. |
15215 | 7929 |
file1 := nil. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7930 |
l1 := 'browser contents' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7931 |
] ifFalse:[ |
15215 | 7932 |
file1 := file1 asFilename. |
7933 |
LastFileDiffFile := file1. |
|
7934 |
file1 isReadable ifFalse:[ |
|
7935 |
nm := file1. |
|
7936 |
file1 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7937 |
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
|
7938 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7939 |
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
|
7940 |
]. |
4414 | 7941 |
]. |
15215 | 7942 |
l1 := file1 pathName |
4414 | 7943 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7944 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7945 |
err isNil ifTrue:[ |
15215 | 7946 |
file2 isReadable ifFalse:[ |
7947 |
nm := file2. |
|
7948 |
file2 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7949 |
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
|
7950 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7951 |
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
|
7952 |
]. |
4414 | 7953 |
]. |
7954 |
]. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7955 |
err notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7956 |
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
|
7957 |
^ self |
6176 | 7958 |
]. |
7959 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7960 |
self withActivityIndicationDo:[ |
15215 | 7961 |
((file1 notNil and:[file1 fileSize > (1024*1024*32)]) |
7962 |
or:[ file2 fileSize > (1024*1024*32) ]) ifTrue:[ |
|
7963 |
file1 fileSize = file2 fileSize ifTrue:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7964 |
ProgressIndicator |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7965 |
displayBusyIndicator:'Comparing...' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7966 |
at:(Screen default center) |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7967 |
during:[ |
15215 | 7968 |
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
|
7969 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7970 |
sameContents ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7971 |
self information:'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7972 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7973 |
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
|
7974 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7975 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7976 |
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
|
7977 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7978 |
^ self. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7979 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7980 |
|
15215 | 7981 |
file1 notNil ifTrue:[ |
7982 |
file1 isDirectory ifTrue:[ |
|
7983 |
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
|
7984 |
] ifFalse:[ |
15215 | 7985 |
text1 := file1 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7986 |
] |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7987 |
]. |
15215 | 7988 |
file2 isDirectory ifTrue:[ |
7989 |
text2 := file2 directoryContents asString. |
|
6460 | 7990 |
] ifFalse:[ |
15215 | 7991 |
text2 := file2 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7992 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7993 |
text1 = text2 ifTrue:[ |
15215 | 7994 |
(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
|
7995 |
msg := 'Same filename lists.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7996 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7997 |
msg := 'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7998 |
]. |
16911 | 7999 |
self information:msg |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8000 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8001 |
d := DiffTextView |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
8002 |
openOn:text1 label:l1 |
15215 | 8003 |
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
|
8004 |
d topView label:(resources string:'File Differences'). |
6460 | 8005 |
] |
4414 | 8006 |
] |
3892 | 8007 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8008 |
|
11494 | 8009 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
3892 | 8010 |
! |
8011 |
||
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8012 |
openDirectoryDiffView |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8013 |
"open a directory diff-view" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8014 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8015 |
|name1 name2 files| |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8016 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8017 |
files := self currentSelectedObjects. |
11108 | 8018 |
files notEmpty ifTrue:[ |
8019 |
name1 := files first asFilename. |
|
8020 |
name1 asFilename isDirectory ifFalse:[ |
|
8021 |
name1 := name1 directory |
|
8022 |
]. |
|
8023 |
]. |
|
8024 |
||
8025 |
(files size == 2) ifTrue:[ |
|
8026 |
name2 := files second. |
|
8027 |
] ifFalse:[ |
|
8028 |
(files size ~= 1) ifTrue:[ |
|
8029 |
Dialog warn:(resources string:'Please select one or two directories.'). |
|
8030 |
^ self. |
|
8031 |
]. |
|
8032 |
name2 := Dialog |
|
8033 |
requestDirectoryName:(resources |
|
8034 |
string:'Recursive compare "%1" with folder:' |
|
8035 |
with:name1 asFilename baseName) |
|
8036 |
default:(LastFileDiffDirectory ? self currentDirectory). |
|
8037 |
name2 isEmptyOrNil ifTrue:[^ self]. |
|
8038 |
LastFileDiffDirectory := name2. |
|
8039 |
]. |
|
8040 |
name2 := name2 asFilename. |
|
8041 |
||
8042 |
name2 asFilename isDirectory ifFalse:[ |
|
8043 |
name2 := name2 directory |
|
8044 |
]. |
|
8045 |
||
8046 |
self |
|
8047 |
applicationNamed:#FileApplicationNoteBook |
|
8048 |
ifPresentDo:[:appl | ^ appl openCompareDirectory:name1 with:name2]. |
|
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8049 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8050 |
"Created: / 20-05-2010 / 15:01:17 / cg" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8051 |
! |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8052 |
|
3892 | 8053 |
openEditor |
8054 |
self openTool:EditTextView |
|
8055 |
! |
|
8056 |
||
4957 | 8057 |
openGV |
8058 |
self openOSCommandWithFiles:'gv' |
|
8059 |
! |
|
8060 |
||
3892 | 8061 |
openHTMLReader |
8062 |
||
8063 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
8064 |
! |
|
8065 |
||
8066 |
openImageEditor |
|
6292 | 8067 |
[ |
8068 |
self loadImageThenDo:[:img | img edit] |
|
8069 |
] fork |
|
3892 | 8070 |
! |
8071 |
||
8072 |
openImageInspector |
|
6292 | 8073 |
[ |
8074 |
self loadImageThenDo:[:img | img inspect] |
|
8075 |
] fork |
|
3892 | 8076 |
! |
8077 |
||
8078 |
openImagePreview |
|
5778 | 8079 |
[ |
8080 |
self |
|
6292 | 8081 |
loadImageThenDo: |
5778 | 8082 |
[:img | |
8083 |
|i top viewer| |
|
8084 |
||
8085 |
top := StandardSystemView new. |
|
8086 |
||
8087 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8088 |
i := img. |
|
8089 |
top extent:200@200. |
|
8090 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
8091 |
top openAndWait. |
|
8092 |
||
8093 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
8094 |
i := i magnifiedPreservingRatioTo:200@200. |
|
8095 |
]. |
|
8096 |
viewer image:i. |
|
8097 |
]. |
|
3892 | 8098 |
] fork |
8099 |
! |
|
8100 |
||
8101 |
openMP3Player |
|
8102 |
|file| |
|
8103 |
||
3982 | 8104 |
file := self currentSelectedFiles. |
3892 | 8105 |
(file isEmpty) ifTrue:[ |
4414 | 8106 |
^ self. |
3892 | 8107 |
]. |
8108 |
file := file first. |
|
8109 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
8110 |
! |
|
8111 |
||
4957 | 8112 |
openOSCommandWithFiles:command |
8113 |
|files fileNames| |
|
8114 |
||
8115 |
files := self currentSelectedFiles. |
|
8116 |
(files isEmpty) ifTrue:[ |
|
8117 |
^ self. |
|
8118 |
]. |
|
8119 |
||
8120 |
fileNames := files collect:[:each | |
|
8121 |
'"' , each asFilename pathName , '"' |
|
8122 |
]. |
|
8123 |
||
8124 |
[ |
|
8125 |
OperatingSystem |
|
4959 | 8126 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
8127 |
inDirectory:(files first asFilename directory). |
|
4957 | 8128 |
] fork |
8129 |
! |
|
8130 |
||
4820 | 8131 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8132 |
|files fileNames cmd arg| |
4820 | 8133 |
|
8134 |
files := self currentSelectedFiles. |
|
8135 |
(files isEmpty) ifTrue:[ |
|
8136 |
^ self. |
|
8137 |
]. |
|
12972 | 8138 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'. |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8139 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8140 |
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
|
8141 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8142 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8143 |
|
4820 | 8144 |
fileNames := |
8145 |
files |
|
8146 |
collect: |
|
8147 |
[:each | |
|
8148 |
'"' , each asFilename pathName , '"' |
|
8149 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8150 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8151 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8152 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8153 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8154 |
]. |
4820 | 8155 |
|
4950 | 8156 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8157 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 8158 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8159 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8160 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 8161 |
! |
8162 |
||
4958 | 8163 |
openRP |
8164 |
self openOSCommandWithFiles:'realplay' |
|
8165 |
! |
|
8166 |
||
8426 | 8167 |
openResourceFileEditor |
8168 |
||
8169 |
self |
|
8170 |
openTool: Tools::InternationalLanguageTranslationEditor |
|
8171 |
with: #openOnFile: |
|
8172 |
! |
|
8173 |
||
3892 | 8174 |
openSlideShow |
5880 | 8175 |
|dir| |
8176 |
||
8177 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8178 |
dir isNil ifTrue:[^ self]. |
|
8179 |
||
3892 | 8180 |
CodingExamples_GUI::SlideShow openIn:dir. |
8181 |
! |
|
8182 |
||
8183 |
openSnapshotImageBrowser |
|
4491 | 8184 |
"Sorry, for now, only the old browser can handle snapShotImages." |
8185 |
||
3892 | 8186 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
8187 |
! |
|
8188 |
||
8189 |
openTerminal |
|
5880 | 8190 |
|dir| |
8191 |
||
8192 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 8193 |
|
5300 | 8194 |
TerminalApplication notNil ifTrue:[ |
8195 |
TerminalApplication openIn:dir |
|
8196 |
] ifFalse:[ |
|
8197 |
VT100TerminalView openShellIn:dir. |
|
8198 |
]. |
|
3892 | 8199 |
! |
8200 |
||
8201 |
openTool:aToolClass |
|
8202 |
"open a tool on the selected file(s)" |
|
8203 |
||
8204 |
^ self openTool:aToolClass ignoreDirectories:true |
|
8205 |
! |
|
8206 |
||
8207 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
8208 |
"open a tool on the selected file(s)" |
|
8209 |
||
8210 |
^ self |
|
4414 | 8211 |
openTool:aToolClass |
8212 |
with:#openOn: |
|
8213 |
ignoreDirectories:ignoreDirs |
|
3892 | 8214 |
! |
8215 |
||
8426 | 8216 |
openTool:aToolClass with:aSelector |
8217 |
"open a tool on the selected file(s)" |
|
8218 |
||
8219 |
^ self openTool:aToolClass with:aSelector ignoreDirectories:true |
|
8220 |
! |
|
8221 |
||
3892 | 8222 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
8223 |
"open a tool on the selected file(s)" |
|
8224 |
||
8832 | 8225 |
|tool| |
3892 | 8226 |
|
8227 |
aToolClass isNil ifTrue:[ |
|
4414 | 8228 |
Dialog warn:'Sorry, that tool seems to be not available'. |
8229 |
^ nil. |
|
3892 | 8230 |
]. |
8832 | 8231 |
self forEachSelectedFileIgnoringDirectories:ignoreDirs do:[:path | |
8232 |
tool := aToolClass perform:aSelector with:path. |
|
3892 | 8233 |
]. |
8234 |
^ tool |
|
8832 | 8235 |
! |
8236 |
||
8237 |
openWebBrowser |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8238 |
self |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8239 |
forEachSelectedFileIgnoringDirectories:true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8240 |
do:[:path | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8241 |
Error |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8242 |
handle:[:ex | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8243 |
Dialog warn:'Shell execution failed: ',ex description |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8244 |
] do:[ |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8245 |
OperatingSystem openApplicationForDocument:path operation:#open. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8246 |
^ self. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8247 |
] |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8248 |
]. |
3892 | 8249 |
! |
8250 |
||
6022 | 8251 |
openWorkspace |
8252 |
self |
|
8253 |
openTool:WorkspaceApplication |
|
8254 |
with:#openOnFile: |
|
8255 |
ignoreDirectories:true |
|
8256 |
! |
|
8257 |
||
4950 | 8258 |
openXV |
4957 | 8259 |
self openOSCommandWithFiles:'xv' |
4950 | 8260 |
! |
8261 |
||
3892 | 8262 |
openZipTool |
5880 | 8263 |
|zipTool| |
3892 | 8264 |
|
8265 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 8266 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 8267 |
]. |
8268 |
! |
|
8269 |
||
8270 |
readAbbrevFile |
|
8271 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
8272 |
||
5880 | 8273 |
|directories| |
3892 | 8274 |
|
3982 | 8275 |
directories := self currentSelectedDirectories. |
3892 | 8276 |
directories isEmpty ifTrue:[^ self]. |
8277 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8278 |
self withActivityIndicationDo:[ |
5880 | 8279 |
directories do:[:eachDir | |
8280 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
8281 |
] |
|
5828 | 8282 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8283 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8284 |
"Modified: / 25-07-2006 / 09:07:43 / cg" |
3892 | 8285 |
! |
8286 |
||
6460 | 8287 |
readAndShowResources |
8288 |
self withActivityIndicationDo:[ |
|
8289 |
| selectedFiles| |
|
8290 |
||
8291 |
selectedFiles:= self currentSelectedFiles. |
|
8292 |
selectedFiles do:[:fileName | |
|
8293 |
resources := ResourcePack fromFile:fileName. |
|
8294 |
resources inspect. |
|
8295 |
]. |
|
8296 |
] |
|
8297 |
! |
|
8298 |
||
3892 | 8299 |
singleFileFileIn:fileName lazy:lazy |
8300 |
"fileIn the selected file(s)" |
|
8301 |
||
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8302 |
|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
|
8303 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8304 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8305 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8306 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8307 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8308 |
[ |
4345 | 8309 |
(ObjectFileLoader notNil |
5491 | 8310 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 8311 |
AbortOperationRequest catch:[ |
8312 |
|p| |
|
8313 |
||
8314 |
"/ |
|
8315 |
"/ look if already loaded ... then unload first |
|
8316 |
"/ |
|
8317 |
p := fileName pathName. |
|
8318 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
8319 |
(Dialog confirm:(resources |
|
8320 |
string:'%1 is already loaded; load anyway ?' |
|
8321 |
with:p)) ifFalse:[ |
|
8322 |
^ self |
|
8323 |
]. |
|
8324 |
notifyString := 'unloading old ' , p , ' ...'. |
|
8325 |
Transcript showCR:notifyString. |
|
4523 | 8326 |
self notify:notifyString. |
4345 | 8327 |
ObjectFileLoader unloadObjectFile:p. |
8328 |
]. |
|
8329 |
||
8330 |
notifyString := 'loading ' , p , ' ...'. |
|
8331 |
Transcript showCR:notifyString. |
|
4523 | 8332 |
self notify:notifyString. |
12426 | 8333 |
(ObjectFileLoader loadObjectFile:p) isNil ifTrue:[ |
8334 |
notifyString := 'Error: could not load ' , p. |
|
8335 |
Transcript showCR:notifyString. |
|
8336 |
self notify:notifyString. |
|
8337 |
] ifFalse:[ |
|
8338 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
8339 |
]. |
|
4345 | 8340 |
] |
8341 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
8342 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
8343 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
8344 |
aStream := fileName readStreamOrNil. |
4345 | 8345 |
aStream notNil ifTrue:[ |
8346 |
aStream fileInBinary. |
|
8347 |
] |
|
8348 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8349 |
((fileName hasSuffix:'class') or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 8350 |
"/ loading a java class file |
8351 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 8352 |
JavaClassReader loadFile:fileName |
4345 | 8353 |
] |
8354 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
8355 |
"/ loading a sif (smalltalk interchange format) file |
|
8356 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
8357 |
SmalltalkInterchangeFileManager newForFileIn |
|
8358 |
fileName: fileName pathName; |
|
8359 |
fileIn. |
|
8360 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
|
8361 |
Parcel isNil ifTrue:[ |
|
8362 |
Dialog warn:'Parcel support not loaded.' |
|
8363 |
] ifFalse:[ |
|
8364 |
Parcel loadParcelFrom: fileName pathName |
|
8365 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8366 |
] ifFalse:[ (fileName hasSuffix:'jar') ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8367 |
JavaVM isNil ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8368 |
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
|
8369 |
^ self. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8370 |
] ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8371 |
JavaVM booted ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8372 |
(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
|
8373 |
JavaVM boot. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8374 |
]. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8375 |
JavaVM loadClassesIn: fileName. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8376 |
] |
4345 | 8377 |
] ifFalse:[ |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8378 |
"/ ask programming languages... |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8379 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
14360 | 8380 |
(lang isNil and:[(fileName hasSuffix:'js')]) ifTrue:[ |
14362 | 8381 |
Smalltalk loadPackage:'stx:libjavascript'. |
14360 | 8382 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
8383 |
]. |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8384 |
(lang notNil and:[lang ~= SmalltalkLanguage]) ifTrue:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8385 |
lang fileIn:fileName. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8386 |
] ifFalse:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8387 |
"/ loading a regular (chunk) or xml source file |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8388 |
Error handle:[:ex | |
15675 | 8389 |
self errorNotify:'Error during file in: ', ex description. |
15981 | 8390 |
ex resume. |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8391 |
] do:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8392 |
aStream := fileName readStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8393 |
[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8394 |
Class withoutUpdatingChangesDo:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8395 |
wasLazy := Compiler compileLazy:lazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8396 |
Smalltalk fileInStream:aStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8397 |
]. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8398 |
Class addInfoRecord:('fileIn ' , fileName asString) |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8399 |
] ensure:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8400 |
Compiler compileLazy:wasLazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8401 |
aStream close |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8402 |
] |
4345 | 8403 |
] |
8404 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8405 |
]]]] |
4345 | 8406 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8407 |
] 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
|
8408 |
|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
|
8409 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8410 |
isRedef := false. |
12684 | 8411 |
sig := ex creator. |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8412 |
(dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8413 |
action := #continue |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8414 |
] ifFalse:[ |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8415 |
(sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8416 |
ex reject |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8417 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8418 |
sig == Class methodRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8419 |
msg := 'trying to overwrite method:\\ ' , ex oldMethod whoString , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8420 |
, ex oldPackage , ''' with method from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8421 |
label := 'Method redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8422 |
redefKind := 'method'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8423 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8424 |
] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8425 |
msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8426 |
, ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8427 |
label := 'Class redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8428 |
redefKind := 'class'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8429 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8430 |
] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender| |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8431 |
label := msg := 'Breakpoint/Halt in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8432 |
sender := ex suspendedContext. |
17024 | 8433 |
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
|
8434 |
] ifFalse:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8435 |
label := 'Error in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8436 |
msg := 'error in fileIn: %1' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8437 |
]]]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8438 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8439 |
msg := msg bindWith:ex description. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8440 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8441 |
labels := #('Cancel' 'Skip' 'Debug' 'Compare Sources'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8442 |
values := #(abort skip debug compareSources). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8443 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8444 |
isRedef ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8445 |
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
|
8446 |
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
|
8447 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8448 |
labels := labels , #('Keep Package' ). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8449 |
values := values , #(keep). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8450 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8451 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8452 |
labels := labels , #( 'Continue' 'ContinueForAll'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8453 |
values := values , #( continue continueForAll). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8454 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8455 |
AbortAllOperationWantedQuery query ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8456 |
labels := #('Cancel All') , labels. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8457 |
values := #(cancelAll) , values. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8458 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8459 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8460 |
action := Dialog |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8461 |
choose:(msg withCRs) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8462 |
label:label |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8463 |
image:(WarningBox iconBitmap) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8464 |
labels:labels |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8465 |
values:values |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8466 |
default:#continue |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8467 |
onCancel:#abort. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8468 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8469 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8470 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8471 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8472 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8473 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8474 |
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
|
8475 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8476 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8477 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8478 |
(action == #compareSources) ifTrue:[ |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8479 |
DiffCodeView |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8480 |
openOn:(ex oldMethod source) label:'Old Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8481 |
and:(ex newMethod source) label:'New Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8482 |
title:ex description. |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8483 |
ex resignalAs:ex |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8484 |
]. |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
8485 |
(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
|
8486 |
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
|
8487 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8488 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8489 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8490 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8491 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8492 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8493 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8494 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8495 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8496 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8497 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8498 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8499 |
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
|
8500 |
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
|
8501 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8502 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8503 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8504 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8505 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8506 |
] |
7040 | 8507 |
|
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8508 |
"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
|
8509 |
"Modified: / 19-02-2014 / 12:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4531 | 8510 |
! |
8511 |
||
4558 | 8512 |
splitFile:infile intoPiecesOfSize:kiloBytes |
8513 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
8514 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
8515 |
||
8516 |
bufferSize := 32*1024. |
|
8517 |
||
8518 |
inStream := infile readStream. |
|
8519 |
||
8520 |
bytesPerSplit := kiloBytes * 1024. |
|
8521 |
||
8522 |
remaining := infile fileSize. |
|
8523 |
splitIndex := 1. |
|
8524 |
[remaining > 0] whileTrue:[ |
|
8525 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8526 |
outStream := outFile asFilename writeStream. |
|
8527 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
8528 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
8529 |
buffer := ByteArray new:bufferSize. |
|
8530 |
n := inStream |
|
8531 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
8532 |
into:buffer |
|
8533 |
startingAt:1. |
|
8534 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
8535 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
8536 |
remaining := remaining - n. |
|
8537 |
]. |
|
8538 |
outStream close. |
|
8539 |
splitIndex := splitIndex + 1. |
|
8540 |
]. |
|
8541 |
inStream close. |
|
8542 |
! |
|
8543 |
||
15906 | 8544 |
splitFile:infile intoPiecesWithNumberOfLines:numberOfLines |
8545 |
|splitIndex line |
|
8546 |
inStream outFile outStream remainingLinesInThisOutfile| |
|
8547 |
||
8548 |
inStream := infile readStream. |
|
8549 |
||
8550 |
splitIndex := 1. |
|
8551 |
[inStream atEnd] whileFalse:[ |
|
8552 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8553 |
outStream := outFile asFilename writeStream. |
|
8554 |
remainingLinesInThisOutfile := numberOfLines. |
|
8555 |
[(remainingLinesInThisOutfile > 0) and:[inStream atEnd not]] whileTrue:[ |
|
8556 |
line := inStream nextLine. |
|
15910 | 8557 |
outStream nextPutLine:line. |
15906 | 8558 |
remainingLinesInThisOutfile := remainingLinesInThisOutfile - 1. |
8559 |
]. |
|
8560 |
outStream close. |
|
8561 |
splitIndex := splitIndex + 1. |
|
8562 |
]. |
|
8563 |
inStream close. |
|
8564 |
! |
|
8565 |
||
4558 | 8566 |
splitSelectedFiles |
6264 | 8567 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 8568 |
|
12871 | 8569 |
selectedFiles := self currentSelectedFiles. |
4558 | 8570 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
8571 |
||
6265 | 8572 |
msg := (numFiles > 1) |
8573 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
8574 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 8575 |
|
6352 | 8576 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 8577 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
8578 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 8579 |
kiloBytes isNil ifTrue:[^ self]. |
8580 |
||
8581 |
selectedFiles do:[:fileName | |
|
8582 |
self notify:('Splitting:', fileName baseName). |
|
8583 |
fileName isDirectory ifFalse:[ |
|
8584 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
|
8585 |
] |
|
8586 |
]. |
|
6190 | 8587 |
self notify:nil. |
6265 | 8588 |
|
7560 | 8589 |
"Modified: / 04-12-2006 / 13:15:26 / cg" |
4558 | 8590 |
! |
8591 |
||
15906 | 8592 |
splitSelectedFilesByLines |
8593 |
|selectedFiles numFiles msg numLinesString numLines| |
|
8594 |
||
8595 |
selectedFiles := self currentSelectedFiles. |
|
8596 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
8597 |
||
8598 |
msg := (numFiles > 1) |
|
8599 |
ifTrue:'Split each of the %1 files into pieces with number of lines:' |
|
8600 |
ifFalse:'Split %2 into pieces with number of lines:'. |
|
8601 |
||
8602 |
numLinesString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
8603 |
numLinesString isEmptyOrNil ifTrue:[^ self]. |
|
8604 |
||
8605 |
numLines := Integer readFrom:numLinesString onError:nil. |
|
8606 |
numLines isNil ifTrue:[^ self]. |
|
8607 |
||
8608 |
selectedFiles do:[:fileName | |
|
8609 |
self notify:('Splitting:', fileName baseName). |
|
8610 |
fileName isDirectory ifFalse:[ |
|
8611 |
self splitFile:fileName intoPiecesWithNumberOfLines:numLines |
|
8612 |
] |
|
8613 |
]. |
|
8614 |
self notify:nil. |
|
8615 |
! |
|
8616 |
||
15211 | 8617 |
truncateSelectedFilesToZeroSize |
8618 |
|selectedFiles numFiles msg| |
|
8619 |
||
8620 |
selectedFiles := self currentSelectedObjects. |
|
8621 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
8622 |
||
8623 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
|
8624 |
numFiles > 1 ifTrue:[ |
|
8625 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
|
8626 |
]. |
|
8627 |
||
8628 |
(Dialog |
|
8629 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
|
8630 |
initialAnswer:false |
|
8631 |
) ifFalse:[ |
|
8632 |
^ self |
|
8633 |
]. |
|
8634 |
||
8635 |
selectedFiles do:[:fileName | |
|
8636 |
|s| |
|
8637 |
||
8638 |
self notify:('Truncating:', fileName baseName). |
|
8639 |
fileName isDirectory ifFalse:[ |
|
8640 |
[ |
|
8641 |
s := fileName writeStream. |
|
8642 |
s close. |
|
8643 |
] on:FileStream openErrorSignal do:[:ex| |
|
8644 |
self warn:('Cannot truncate "%1".' bindWith:fileName baseName allBold). |
|
8645 |
]. |
|
8646 |
] |
|
8647 |
]. |
|
8648 |
self notify:nil. |
|
8649 |
||
8650 |
"Modified: / 04-12-2006 / 13:15:28 / cg" |
|
8651 |
! ! |
|
3892 | 8652 |
|
4849 | 8653 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 8654 |
|
8655 |
anySTFilesPresent |
|
8656 |
^ self anyFilesPresentWithSuffix:'st' |
|
8657 |
! |
|
8658 |
||
8659 |
canCreateNewProject |
|
8660 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
12811 | 8661 |
^ self currentSelectedFiles contains:[:fileName| |
8662 |
| suffix| |
|
8663 |
suffix := fileName suffix asLowercase. |
|
8664 |
(suffix = 'prj' or:[suffix = 'st']) |
|
8665 |
] |
|
3892 | 8666 |
! |
8667 |
||
8668 |
canDoTerminal |
|
8669 |
||
8670 |
^ OperatingSystem isUNIXlike |
|
8671 |
or:[OperatingSystem isMSWINDOWSlike] |
|
8672 |
! |
|
8673 |
||
8674 |
canDoTerminalAndSystemIsDOS |
|
8675 |
||
8676 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
8677 |
! |
|
8678 |
||
8679 |
canDoTerminalAndSystemIsUnix |
|
8680 |
||
8681 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
8682 |
! |
|
8683 |
||
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8684 |
canGenerateSignatureFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8685 |
"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
|
8686 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8687 |
Expecco::KeyFileGenerator isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8688 |
Expecco::KeyFile isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8689 |
|
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8690 |
^ self currentSelectedFiles notEmptyOrNil |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8691 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8692 |
|
12811 | 8693 |
canOpenMonticelloBrowser |
8694 |
^ self currentSelectedFiles |
|
8695 |
contains:[:fileName| |
|
8696 |
fileName suffix asLowercase = 'mcz' |
|
8697 |
] |
|
8698 |
! |
|
8699 |
||
3892 | 8700 |
canReadAbbrevFile |
8701 |
||
5960 | 8702 |
|currentDirectory| |
3892 | 8703 |
|
8704 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 8705 |
currentDirectory := self currentDirectory. |
8706 |
^ currentDirectory notNil |
|
8707 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 8708 |
! |
8709 |
||
8710 |
canRemoveFromSourcePath |
|
8711 |
||
8712 |
^ false |
|
8713 |
! |
|
8714 |
||
13089 | 8715 |
cannotGenerateSignatureFiles |
8716 |
^ self canGenerateSignatureFiles not |
|
8717 |
! |
|
8718 |
||
3892 | 8719 |
hasASN1 |
8720 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 8721 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 8722 |
|
8723 |
! |
|
8724 |
||
8725 |
hasASN1AndSelection |
|
8726 |
^ [ self hasSelection value |
|
17416 | 8727 |
and:[self currentSelectedFiles notEmptyOrNil |
4414 | 8728 |
and:[OSI::ASN1Parser notNil |
8729 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
17416 | 8730 |
|
8731 |
"Modified: / 17-02-2017 / 08:25:09 / cg" |
|
3892 | 8732 |
! |
8733 |
||
8734 |
hasCBrowser |
|
8735 |
^ [ CBrowser::Browser notNil ] |
|
8736 |
! |
|
8737 |
||
8738 |
hasJava |
|
8739 |
||
14298 | 8740 |
^ [ JavaVM notNil |
8741 |
and:[JavaClassReader notNil |
|
8742 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 8743 |
! |
8744 |
||
8745 |
hasJavaAndSelection |
|
8746 |
||
12871 | 8747 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 8748 |
and:[JavaClassReader notNil |
8749 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 8750 |
! |
8751 |
||
8752 |
hasMP3Player |
|
8753 |
||
8754 |
^ [ MP3PlayerApplication notNil |
|
4414 | 8755 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 8756 |
! |
8757 |
||
8758 |
hasMP3PlayerAndSelection |
|
8759 |
||
12871 | 8760 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 8761 |
and:[ self hasMP3Player value]] |
3892 | 8762 |
! |
8763 |
||
8426 | 8764 |
hasResourceFileSelected |
12871 | 8765 |
^ (self currentSelectedFiles) |
8766 |
contains:[:fn | |
|
12811 | 8767 |
fn suffix asLowercase = 'rs' |
8768 |
]. |
|
8426 | 8769 |
! |
8770 |
||
3892 | 8771 |
hasSlideShow |
8772 |
||
8773 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
8774 |
! |
|
8775 |
||
8776 |
hasSnapshotSelection |
|
8777 |
||
8778 |
^ [ |
|
4414 | 8779 |
| files | |
8426 | 8780 |
|
4414 | 8781 |
files := self currentSelectedFiles. |
8782 |
((files size == 1) |
|
8783 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 8784 |
] |
8785 |
! |
|
8786 |
||
7869 | 8787 |
hasXml |
9206 | 8788 |
^ [ XML::XMLParser notNil ] |
7869 | 8789 |
! |
8790 |
||
8791 |
hasXmlFileSelected |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
8792 |
"/ 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
|
8793 |
"/ then handle the error when it ever fails during xml-parsing. |
7869 | 8794 |
|
8426 | 8795 |
^ [ |
8796 |
|sel fileName| |
|
7869 | 8797 |
|
8798 |
sel := self currentSelectedFiles. |
|
8799 |
sel size == 1 ifTrue:[ |
|
8800 |
fileName := sel first. |
|
8801 |
fileName notNil ifTrue:[ |
|
15936 | 8802 |
#('xml' 'xsd' 'vdx') includes:fileName suffix asLowercase |
7869 | 8803 |
] ifFalse:[ |
8804 |
false |
|
8805 |
] |
|
8806 |
] ifFalse:[ |
|
8807 |
false |
|
8808 |
] |
|
8809 |
] |
|
8810 |
! |
|
8811 |
||
3892 | 8812 |
hasZipFileSelected |
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8813 |
|sel fileName suff| |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8814 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8815 |
sel := self currentSelectedFiles. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8816 |
sel size == 1 ifFalse:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8817 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8818 |
fileName := sel first. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8819 |
fileName isNil ifTrue:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8820 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8821 |
suff := fileName suffix asLowercase. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8822 |
(suff = 'zip' or:[suff = 'jar']) ifTrue:[^ true]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8823 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8824 |
^ fileName mimeTypeOfContents = 'application/x-zip-compressed' |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8825 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8826 |
"Modified: / 14-02-2011 / 17:17:03 / cg" |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8827 |
! |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8828 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8829 |
hasZipFileSelectedHolder |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8830 |
^ [ self hasZipFileSelected ] |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8831 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8832 |
"Created: / 14-02-2011 / 17:16:08 / cg" |
3892 | 8833 |
! |
8834 |
||
8835 |
javaSupportLoaded |
|
8836 |
||
8837 |
^ false |
|
8838 |
! ! |
|
8839 |
||
14126 | 8840 |
|
8841 |
||
3906 | 8842 |
!AbstractFileBrowser methodsFor:'presentation'! |
8843 |
||
8844 |
getModeString:modeBits |
|
8845 |
"convert file-mode bits into a more user-friendly string. |
|
8846 |
This is wrong here - should be moved into OperatingSystem." |
|
8847 |
||
8848 |
^ self getModeString:modeBits |
|
4414 | 8849 |
with:#( 'owner:' $r $w $x |
8850 |
' group:' $r $w $x |
|
8851 |
' others:' $r $w $x ) |
|
3906 | 8852 |
! |
8853 |
||
8854 |
getModeString:modeBits with:texts |
|
8855 |
"convert file-mode bits into a more user-friendly string. |
|
8856 |
This is wrong here - should be moved into OperatingSystem." |
|
8857 |
||
8858 |
|bits modeString| |
|
8859 |
||
8860 |
bits := modeBits bitAnd:8r777. |
|
8861 |
modeString := ''. |
|
8862 |
||
8863 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
8864 |
with: texts do:[:bitMask :access | |
|
4414 | 8865 |
|ch| |
8866 |
||
8867 |
bitMask isNil ifTrue:[ |
|
8868 |
modeString := modeString , access |
|
8869 |
] ifFalse:[ |
|
8870 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
8871 |
ch := $- |
|
8872 |
] ifFalse:[ |
|
8873 |
ch := access |
|
8874 |
]. |
|
8875 |
modeString := modeString copyWith:ch |
|
8876 |
] |
|
3906 | 8877 |
]. |
8878 |
^ modeString |
|
8879 |
! ! |
|
8880 |
||
5880 | 8881 |
!AbstractFileBrowser methodsFor:'private'! |
8882 |
||
8883 |
theSingleSelectedDirectoryOrHomeDir |
|
8884 |
|dir| |
|
8885 |
||
5888 | 8886 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 8887 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
8888 |
^ dir. |
|
8889 |
! |
|
8890 |
||
8891 |
theSingleSelectedDirectoryOrNil |
|
8892 |
|dirs| |
|
8893 |
||
8894 |
dirs := self currentSelectedDirectories. |
|
8895 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
8896 |
^ dirs anElement. |
|
14577 | 8897 |
! |
8898 |
||
8899 |
theSingleSelectedFileOrNil |
|
8900 |
|dirs| |
|
8901 |
||
8902 |
dirs := self currentSelectedFiles. |
|
8903 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
8904 |
^ dirs anElement. |
|
5880 | 8905 |
! ! |
8906 |
||
3892 | 8907 |
!AbstractFileBrowser methodsFor:'queries'! |
8908 |
||
8256 | 8909 |
cBrowserLoaded |
8910 |
^ CBrowser::Browser notNil |
|
8911 |
! |
|
8912 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8913 |
cBrowserMenuItemVisible |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8914 |
^ self cBrowserLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8915 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8916 |
"Created: / 04-10-2011 / 13:40:38 / cg" |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8917 |
! |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8918 |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8919 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8920 |
"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
|
8921 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8922 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8923 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8924 |
|
3906 | 8925 |
getFileInfoStringForFirstSelectedFile:longInfo |
8926 |
"get stat info on selected file - return a string which can be |
|
8927 |
shown in a box" |
|
8928 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
8929 |
|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
|
8930 |
sizeString fileSize tAccess tModification buffer| |
3906 | 8931 |
|
7560 | 8932 |
selFiles := self currentSelectedObjects. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
8933 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 8934 |
filename := selFiles first. |
8935 |
||
8364 | 8936 |
info := filename linkInfo. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8937 |
info isNil ifTrue:[ |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8938 |
^ 'Cannot get fileInfo'. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8939 |
^ nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8940 |
]. |
8364 | 8941 |
|
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
8942 |
buffer := Text writeStream. |
4765 | 8943 |
|
8944 |
buffer |
|
8945 |
nextPutAll:'filename: '; |
|
8946 |
nextPutLine:filename asString. |
|
8947 |
||
8364 | 8948 |
OperatingSystem isMSDOSlike ifTrue: [ |
8949 |
(info alternativeName notNil |
|
8950 |
and:[ info alternativeName ~= info fullName ]) ifTrue:[ |
|
8951 |
buffer nextPutAll:'shortname: '. |
|
8952 |
buffer nextPutLine:info alternativeName. |
|
8953 |
] |
|
8954 |
]. |
|
8955 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8956 |
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
|
8957 |
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
|
8958 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8959 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8960 |
]. |
4765 | 8961 |
buffer |
8962 |
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
|
8963 |
nextPutLine:(info path ? '???'). |
3906 | 8964 |
] 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
|
8965 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8966 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8967 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8968 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8969 |
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
|
8970 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8971 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8972 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8973 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8974 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8975 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8976 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8977 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8978 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8979 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8980 |
fileSize > 1024 ifTrue:[ |
8172 | 8981 |
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
|
8982 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8983 |
]. |
4765 | 8984 |
buffer nextPutLine:sizeString. |
3906 | 8985 |
|
8986 |
modeBits := info mode. |
|
8987 |
modeString := self getModeString:modeBits. |
|
4765 | 8988 |
|
8989 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 8990 |
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
|
8991 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 8992 |
]. |
4765 | 8993 |
buffer |
8994 |
cr; |
|
8995 |
nextPutAll:'owner: '; |
|
8996 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
8997 |
||
3906 | 8998 |
longInfo ifTrue:[ |
4765 | 8999 |
buffer |
9000 |
nextPutAll:'group: '; |
|
9001 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
9002 |
||
9003 |
tAccess := info accessTime. |
|
9004 |
buffer |
|
9005 |
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
|
9006 |
nextPutAll:tAccess asDate printString; |
4765 | 9007 |
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
|
9008 |
nextPutLine:tAccess asTime printString. |
4765 | 9009 |
|
9010 |
tModification := info modificationTime. |
|
9011 |
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
|
9012 |
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
|
9013 |
nextPutAll:tModification asDate printString; |
4765 | 9014 |
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
|
9015 |
nextPutLine:tModification asTime printString. |
3906 | 9016 |
]. |
4765 | 9017 |
^ buffer contents |
7560 | 9018 |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
9019 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
3906 | 9020 |
! |
9021 |
||
8510 | 9022 |
hasImageColorHistogram |
9023 |
^ ImageColorHistogram notNil |
|
9024 |
! |
|
9025 |
||
17686 | 9026 |
hasImageHistogram |
9027 |
^ ImageAlgorithms notNil |
|
9028 |
||
9029 |
"Created: / 10-09-2017 / 16:50:34 / cg" |
|
9030 |
! |
|
9031 |
||
10258 | 9032 |
hasSubversionSupport |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
9033 |
^ ConfigurableFeatures includesFeature: #SubversionSupport |
10258 | 9034 |
|
9035 |
"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
|
9036 |
"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
|
9037 |
"Modified: / 19-01-2012 / 10:43:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10258 | 9038 |
! |
9039 |
||
3892 | 9040 |
initialCommandFor:fileName into:aBox |
9041 |
"set a useful initial command for execute box." |
|
9042 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
9043 |
self class initialCommandFor:fileName in:Filename currentDirectory intoBox:aBox |
3892 | 9044 |
! |
9045 |
||
9046 |
isAbstractFileBrowser |
|
9047 |
||
9048 |
^ true |
|
9049 |
! |
|
9050 |
||
9051 |
systemIsDOS |
|
9052 |
||
9053 |
^ OperatingSystem isMSDOSlike |
|
9054 |
! |
|
9055 |
||
12473 | 9056 |
systemIsOSX |
9057 |
||
9058 |
^ OperatingSystem isOSXlike |
|
9059 |
! |
|
9060 |
||
3892 | 9061 |
systemIsUnix |
9062 |
^ OperatingSystem isUNIXlike |
|
14980 | 9063 |
! |
9064 |
||
9065 |
systemSupportsVolumes |
|
9066 |
||
9067 |
^ OperatingSystem supportsVolumes |
|
3892 | 9068 |
! ! |
9069 |
||
9070 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
9071 |
||
9072 |
allItemsOfCurrentDirectory |
|
5009 | 9073 |
self |
4774 | 9074 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 9075 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
9076 |
||
9077 |
^ nil |
|
3892 | 9078 |
! |
9079 |
||
9080 |
anyFilesPresentWithSuffix:suffix |
|
6725 | 9081 |
self currentSelectedDirectories do:[:dir| |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9082 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
9083 |
(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
|
9084 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 9085 |
]. |
9086 |
^ false. |
|
9087 |
! |
|
9088 |
||
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9089 |
commonPrefixOfSelectedFiles |
4773 | 9090 |
|selFiles stringCol firstPre| |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9091 |
|
7560 | 9092 |
selFiles := self currentSelectedObjects. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9093 |
selFiles isEmpty ifTrue:[^ nil]. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9094 |
|
4772 | 9095 |
stringCol := selFiles collect:[:file | file asString]. |
4773 | 9096 |
firstPre := stringCol at:1. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9097 |
stringCol from:2 do:[:el| |
4773 | 9098 |
firstPre := firstPre commonPrefixWith:el. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9099 |
]. |
4773 | 9100 |
^ firstPre asFilename |
7560 | 9101 |
|
9102 |
"Modified: / 04-12-2006 / 13:14:25 / cg" |
|
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9103 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9104 |
|
12481 | 9105 |
compressTabsOnSave |
9106 |
"if true, compress leading spaces (multiples of 8) with a tab character |
|
9107 |
when saving. |
|
9108 |
Default is true" |
|
9109 |
||
9110 |
^ true |
|
9111 |
! |
|
9112 |
||
3892 | 9113 |
currentFilesAreInSameDirectory |
9114 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9115 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 9116 |
! |
9117 |
||
9118 |
currentFilesHasDirectories |
|
9119 |
||
6725 | 9120 |
^ self currentSelectedDirectories notEmpty. |
3892 | 9121 |
! |
9122 |
||
3982 | 9123 |
directoriesForFiles:aFileCol |
11743 | 9124 |
^ aFileCol collect:[:file| self getDirWithoutFileName:file] as:Set. |
3982 | 9125 |
! |
9126 |
||
3892 | 9127 |
fileListIsEmpty |
5009 | 9128 |
self |
9129 |
applicationNamed:#DirectoryContentsBrowser |
|
9130 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
9131 |
||
9132 |
^ nil. |
|
3892 | 9133 |
! |
9134 |
||
9135 |
fileListIsNotEmpty |
|
9136 |
||
9137 |
^ self fileListIsEmpty not. |
|
9138 |
! |
|
9139 |
||
9140 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 9141 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 9142 |
|
9143 |
| file1 file2 | |
|
9144 |
||
6284 | 9145 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 9146 |
file1 := aFilename1 asFilename. |
9147 |
file2 := aFilename2 asFilename. |
|
6284 | 9148 |
|
3892 | 9149 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 9150 |
|
3892 | 9151 |
((file1 isDirectory) |
9152 |
and:[(file2 isDirectory) |
|
9153 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 9154 |
^ file1 baseName = file2 baseName |
3892 | 9155 |
]. |
3982 | 9156 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 9157 |
! |
9158 |
||
9159 |
getAllFilesAsStringCollection |
|
5009 | 9160 |
self |
9161 |
applicationNamed:#DirectoryContentsBrowser |
|
9162 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
9163 |
||
9164 |
^ nil |
|
3892 | 9165 |
! |
9166 |
||
9167 |
getBestDirectory |
|
9168 |
||
9169 |
|selFiles stringCol firstPre| |
|
9170 |
||
6725 | 9171 |
selFiles := self currentSelectedDirectories. |
3892 | 9172 |
selFiles isEmpty ifTrue:[^ nil]. |
9173 |
selFiles size == 1 ifTrue:[^ selFiles first]. |
|
4486 | 9174 |
stringCol := (selFiles collect:[:file| file asString]) asOrderedCollection. |
3892 | 9175 |
firstPre := stringCol at:1. |
9176 |
stringCol from:2 do:[:el| |
|
4414 | 9177 |
firstPre := firstPre commonPrefixWith:el. |
3892 | 9178 |
]. |
9179 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
4414 | 9180 |
firstPre removeLast. |
3892 | 9181 |
]. |
9182 |
^ firstPre asFilename |
|
9183 |
! |
|
9184 |
||
9185 |
getDirWithoutFileName:aFileName |
|
9186 |
||
9187 |
| dir | |
|
9188 |
aFileName isNil ifTrue:[ |
|
4414 | 9189 |
^ aFileName. |
3892 | 9190 |
]. |
9191 |
dir := aFileName asFilename. |
|
9192 |
dir isDirectory ifFalse:[ |
|
4414 | 9193 |
dir := dir directory. |
3892 | 9194 |
]. |
9195 |
^ dir. |
|
9196 |
! |
|
9197 |
||
9198 |
getInfoItem |
|
9199 |
"get filename of a description-file (.dir.info, README etc.); |
|
16778 | 9200 |
This file is automatically shown when a directory is entered. |
3892 | 9201 |
You can add more names below if you like." |
9202 |
||
5880 | 9203 |
|dir| |
9204 |
||
9205 |
dir := self theSingleSelectedDirectoryOrNil. |
|
9206 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 9207 |
|
16778 | 9208 |
#( |
3892 | 9209 |
'.dir.info' |
9210 |
'README' |
|
9211 |
'ReadMe' |
|
9212 |
'Readme' |
|
9213 |
'readme' |
|
9214 |
'read.me' |
|
9215 |
'Read.me' |
|
9216 |
'READ.ME' |
|
9217 |
'README.TXT' |
|
15915 | 9218 |
'README.txt' |
3892 | 9219 |
'readme.txt' |
9220 |
'Readme.txt' |
|
9221 |
'Info.txt' |
|
9222 |
'info.txt' |
|
9223 |
'INFO.TXT' |
|
15915 | 9224 |
'INFO.txt' |
16778 | 9225 |
) do:[:f | |
5883 | 9226 |
|n| |
4414 | 9227 |
|
5880 | 9228 |
n := dir construct:f. |
4414 | 9229 |
(n isReadable and:[n isDirectory not]) ifTrue:[ |
9230 |
^ DirectoryContentsBrowser itemClass fileName:n |
|
9231 |
] |
|
3892 | 9232 |
]. |
9233 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9234 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9235 |
|
12497 | 9236 |
hasPackageDirectorySelected |
9237 |
|dir| |
|
9238 |
||
9239 |
dir := self currentDirectory. |
|
9240 |
^ dir notNil |
|
9241 |
and:[ dir exists |
|
9242 |
and:[ (dir / 'abbrev.stc') exists ]] |
|
9243 |
! |
|
9244 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9245 |
parentDirectoriesOfCurrentFiles |
11743 | 9246 |
^ self currentSelectedObjects |
9247 |
collect:[:file | file directory] as:Set |
|
7560 | 9248 |
|
9249 |
"Modified: / 04-12-2006 / 13:15:21 / cg" |
|
6521 | 9250 |
! |
9251 |
||
9252 |
recursiveAnyFilesPresentWithSuffix:suffix |
|
6652 | 9253 |
^ true. "/ the code below is too slow for a menu enabling operation |
9254 |
||
9255 |
"/ |directories| |
|
9256 |
"/ |
|
9257 |
"/ directories := self currentDirectories value. |
|
9258 |
"/ directories do:[:dir| |
|
9259 |
"/ [ |
|
9260 |
"/ dir recursiveDirectoryContentsDo:[:f | |
|
9261 |
"/ (f asFilename suffix = suffix) ifTrue:[ ^ true] |
|
9262 |
"/ ] |
|
9263 |
"/ ] on:FileStream openErrorSignal do:[:ex|]. |
|
9264 |
"/ ]. |
|
9265 |
"/ ^ false. |
|
6586 | 9266 |
! |
9267 |
||
9268 |
recursiveAnySTFilesPresent |
|
9269 |
^ self recursiveAnyFilesPresentWithSuffix:'st' |
|
3982 | 9270 |
! ! |
9271 |
||
9272 |
!AbstractFileBrowser methodsFor:'selection'! |
|
9273 |
||
9274 |
currentSelectedDirectories |
|
6725 | 9275 |
^ self currentDirectoriesValue. |
3982 | 9276 |
! |
9277 |
||
9278 |
currentSelectedFiles |
|
12824 | 9279 |
^ self currentSelectedObjects reject:[:file | file isDirectory]. |
7560 | 9280 |
|
9281 |
"Modified: / 04-12-2006 / 13:14:39 / cg" |
|
3982 | 9282 |
! |
9283 |
||
6460 | 9284 |
currentSelectedObjects |
9285 |
^ self currentFileNameHolder value |
|
9286 |
! |
|
9287 |
||
3982 | 9288 |
firstSelectedFile |
7560 | 9289 |
^ self currentSelectedObjects |
12102 | 9290 |
detect:[:file | (file ? '') asFilename isDirectory not] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9291 |
ifNone:[]. |
7560 | 9292 |
|
9293 |
"Modified: / 04-12-2006 / 13:14:50 / cg" |
|
4414 | 9294 |
! |
9295 |
||
9490 | 9296 |
hasOnlyDirectoriesSelected |
9297 |
^ self currentSelectedObjects conform:[:file | file isDirectory]. |
|
9298 |
||
9299 |
"Created: / 20-05-2010 / 10:45:03 / cg" |
|
9300 |
! |
|
9301 |
||
4414 | 9302 |
hasOnlyFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9303 |
|
7560 | 9304 |
^ self currentSelectedObjects conform:[:file | file isDirectory not]. |
9305 |
||
9306 |
"Modified: / 04-12-2006 / 13:15:01 / cg" |
|
4414 | 9307 |
! |
9308 |
||
9490 | 9309 |
hasTwoDirectoriesSelected |
9310 |
||
9311 |
^ self currentSelectedObjects size == 2 |
|
9312 |
and:[self hasOnlyDirectoriesSelected] |
|
9313 |
||
9314 |
"Created: / 20-05-2010 / 10:45:18 / cg" |
|
9315 |
! |
|
9316 |
||
4414 | 9317 |
hasTwoFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9318 |
|
7560 | 9319 |
^ self currentSelectedObjects size == 2 |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9320 |
and:[self hasOnlyFilesSelected] |
7560 | 9321 |
|
9322 |
"Modified: / 04-12-2006 / 13:15:04 / cg" |
|
14577 | 9323 |
! |
9324 |
||
9325 |
selectNextFile |
|
9326 |
self |
|
9327 |
applicationNamed:#DirectoryContentsBrowser |
|
9328 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectNextFile ]]. |
|
9329 |
! |
|
9330 |
||
9331 |
selectPreviousFile |
|
9332 |
self |
|
9333 |
applicationNamed:#DirectoryContentsBrowser |
|
9334 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectPreviousFile ]]. |
|
3892 | 9335 |
! ! |
9336 |
||
3964 | 9337 |
!AbstractFileBrowser methodsFor:'sorting'! |
9338 |
||
3989 | 9339 |
currentSortOrder |
4027 | 9340 |
^ self aspectFor:#currentSortOrder ifAbsent:[ Dictionary new asValue ]. |
3989 | 9341 |
! |
9342 |
||
9343 |
sortBlockHolder |
|
9344 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 9345 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9346 |
selector:#fileName |
|
9347 |
sortCaseless:self sortCaseless value |
|
9348 |
sortReverse:false) asValue. |
|
3989 | 9349 |
]. |
9350 |
! |
|
9351 |
||
9352 |
sortBlockProperty |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9353 |
|v| |
4027 | 9354 |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9355 |
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
|
9356 |
v addDependent:self. |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9357 |
^ v. |
3989 | 9358 |
! |
9359 |
||
9360 |
sortCaseless |
|
4201 | 9361 |
" aspect for sort caseless " |
3989 | 9362 |
|
13000 | 9363 |
^ self |
9364 |
aspectFor:#sortCaseless |
|
9365 |
ifAbsent:[ (Filename isCaseSensitive not) asValue ] |
|
3989 | 9366 |
! |
9367 |
||
4074 | 9368 |
sortDirectoriesBeforeFiles |
9369 |
||
4201 | 9370 |
" aspect for sort directories always before files" |
4074 | 9371 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
9372 |
! |
|
9373 |
||
3989 | 9374 |
sortFileListsBy:instanceName |
9375 |
||
9376 |
self sortFileListsBy:instanceName withReverse:true |
|
9377 |
! |
|
9378 |
||
9379 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
9380 |
| aSymbol sortCaselessLocal currentSortOrder sorter isReverse| |
3964 | 9381 |
|
9382 |
aSymbol := instanceName asSymbol. |
|
4027 | 9383 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 9384 |
sortCaselessLocal := self sortCaseless value. |
4027 | 9385 |
currentSortOrder := self currentSortOrder value. |
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9386 |
currentSortOrder isEmptyOrNil ifTrue:[ |
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9387 |
self currentSortOrder value:(currentSortOrder := Dictionary new). |
4343 | 9388 |
currentSortOrder at:#column put:aSymbol. |
9389 |
currentSortOrder at:#reverse put:false. |
|
9390 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 9391 |
] ifFalse:[ |
4343 | 9392 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
9393 |
"/ sort caseless changed |
|
9394 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
9395 |
] ifFalse:[ |
|
9396 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
9397 |
"/ same column like before - change sort order ifReverse is true |
|
9398 |
aBoolean ifTrue:[ |
|
9399 |
isReverse := currentSortOrder at:#reverse. |
|
9400 |
currentSortOrder at:#reverse put:(isReverse not). |
|
9401 |
]. |
|
9402 |
] ifFalse:[ |
|
9403 |
"/ another column - remark column |
|
9404 |
currentSortOrder at:#column put:aSymbol. |
|
9405 |
] |
|
9406 |
] |
|
3964 | 9407 |
]. |
4027 | 9408 |
self currentSortOrder changed. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9409 |
|
5383 | 9410 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9411 |
selector:instanceName |
|
9412 |
sortCaseless:sortCaselessLocal |
|
9413 |
sortReverse:(currentSortOrder at:#reverse). |
|
9414 |
self sortBlockHolder value:sorter. |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9415 |
|
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9416 |
"Modified: / 18-09-2007 / 09:42:47 / cg" |
3964 | 9417 |
! ! |
9418 |
||
3892 | 9419 |
!AbstractFileBrowser methodsFor:'startup & release'! |
9420 |
||
16720 | 9421 |
initializeAspects |
9422 |
aspects := IdentityDictionary new. |
|
9423 |
aspects at:#applications put:(IdentityDictionary new). |
|
9424 |
! |
|
9425 |
||
3892 | 9426 |
makeDependent |
4074 | 9427 |
self filterModel addDependent:self. |
4004 | 9428 |
self currentFileNameHolder addDependent:self. |
4074 | 9429 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 9430 |
self sortCaseless addDependent:self. |
4011 | 9431 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
9432 |
self rootHolder addDependent:self. |
3892 | 9433 |
! |
9434 |
||
9435 |
masterApplication:anApplication |
|
9436 |
||
9437 |
masterApplication isNil ifTrue:[ |
|
4414 | 9438 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
9439 |
aspects := anApplication aspects |
|
9440 |
] ifFalse:[ |
|
9441 |
aspects isNil ifTrue:[ |
|
16721 | 9442 |
self initializeAspects. |
4414 | 9443 |
] |
9444 |
]. |
|
9445 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9446 |
"/ self makeDependent. |
3892 | 9447 |
]. |
3952 | 9448 |
^ super masterApplication:anApplication. |
3892 | 9449 |
! |
9450 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9451 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9452 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9453 |
super postBuildWith:aBuilder. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9454 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9455 |
|
3892 | 9456 |
postOpenWith:aBuilder |
9457 |
||
9458 |
super postOpenWith:aBuilder. |
|
14655 | 9459 |
"/ now done for all windowGroups by the group itself |
9460 |
"/ self windowGroup showWaitCursorWhenBusyForMillis:100. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9461 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9462 |
"Modified: / 25-07-2006 / 09:12:45 / cg" |
3892 | 9463 |
! ! |
9464 |
||
9465 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
9466 |
||
9467 |
files |
|
9468 |
"return the value of the instance variable 'files' (automatically generated)" |
|
9469 |
||
9470 |
^ files |
|
9471 |
! |
|
9472 |
||
9473 |
files:something |
|
9474 |
"set the value of the instance variable 'files' (automatically generated)" |
|
9475 |
||
9476 |
files := something. |
|
9477 |
! |
|
9478 |
||
9479 |
method |
|
9480 |
"return the value of the instance variable 'method' (automatically generated)" |
|
9481 |
||
9482 |
^ method |
|
9483 |
! |
|
9484 |
||
9485 |
method:something |
|
9486 |
"set the value of the instance variable 'method' (automatically generated)" |
|
9487 |
||
9488 |
method := something. |
|
9489 |
! ! |
|
9490 |
||
9491 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
9492 |
||
9493 |
locked |
|
9494 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
9495 |
||
9496 |
locked isNil ifTrue:[ |
|
4414 | 9497 |
locked := false. |
3892 | 9498 |
]. |
9499 |
^ locked |
|
9500 |
! ! |
|
9501 |
||
9502 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
9503 |
||
9504 |
doIfUnLocked:aBlock |
|
9505 |
||
9506 |
self locked ifFalse:[ |
|
4414 | 9507 |
aBlock value. |
3892 | 9508 |
]. |
9509 |
! |
|
9510 |
||
9511 |
doLocked:aBlock |
|
9512 |
||
9513 |
locked := true. |
|
4004 | 9514 |
aBlock ensure:[ |
4414 | 9515 |
locked := false. |
4004 | 9516 |
] |
3892 | 9517 |
! ! |
9518 |
||
3952 | 9519 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
9520 |
||
6369 | 9521 |
defaultHistorySize |
9522 |
^ 50 |
|
3892 | 9523 |
! ! |
9524 |
||
6371 | 9525 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 9526 |
|
9527 |
new |
|
6371 | 9528 |
^ (super new) initializeHistory. |
6369 | 9529 |
! ! |
9530 |
||
9531 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
9532 |
||
9533 |
historySize |
|
9534 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
9535 |
^ historySize |
|
9536 |
! |
|
9537 |
||
9538 |
historySize:aNumber |
|
9539 |
historySize := aNumber |
|
4032 | 9540 |
! ! |
9541 |
||
3892 | 9542 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
9543 |
||
3952 | 9544 |
addToHistory:aPath |
15803 | 9545 |
| item pathToAdd sep| |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9546 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9547 |
pathToAdd := aPath. |
15803 | 9548 |
(pathToAdd endsWith:(sep := Filename separator)) ifTrue:[ |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9549 |
pathToAdd asFilename isRootDirectory ifFalse:[ |
15803 | 9550 |
pathToAdd := pathToAdd copyButLast:(sep asString size). |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9551 |
] |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9552 |
]. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9553 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9554 |
item := self getItemFor:pathToAdd. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9555 |
self backForwardListAdd:pathToAdd. |
3952 | 9556 |
item isNil ifTrue:[ |
4347 | 9557 |
" not already in history" |
6369 | 9558 |
self size >= self historySize ifTrue:[ |
4347 | 9559 |
self removeLast. |
9560 |
]. |
|
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9561 |
item := DirectoryHistoryItem path:pathToAdd. |
3952 | 9562 |
] ifFalse:[ |
4347 | 9563 |
"already been there before; move the entry to |
9564 |
the beginning, so it will fall out later." |
|
9565 |
self remove:item. |
|
10381
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9566 |
]. |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9567 |
self addFirst:item |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9568 |
|
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9569 |
"Modified: / 24-07-2011 / 07:12:54 / cg" |
3952 | 9570 |
! |
9571 |
||
4347 | 9572 |
backForwardListAdd:aPath |
9573 |
|pathIndex| |
|
9574 |
||
9575 |
pathIndex := backForwardList indexOf:aPath. |
|
9576 |
pathIndex == 0 ifTrue:[ |
|
9577 |
" a new path comes in remove forward paths " |
|
9578 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
9579 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
9580 |
]. |
|
9581 |
] ifFalse:[ |
|
9582 |
backForwardList remove:aPath. |
|
9583 |
pathIndex <= backForwardIndex ifTrue:[ |
|
9584 |
backForwardIndex := backForwardIndex - 1. |
|
9585 |
] |
|
4022 | 9586 |
]. |
4347 | 9587 |
backForwardList add:aPath afterIndex:backForwardIndex. |
9588 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 9589 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 9590 |
backForwardList removeFirst. |
9591 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 9592 |
]. |
4347 | 9593 |
! |
9594 |
||
9595 |
goBackward |
|
4288 | 9596 |
"return the first path of the backward list; |
9597 |
remove it from the back list and add it ti the forward list." |
|
4022 | 9598 |
|
4347 | 9599 |
|retPath| |
9600 |
||
9601 |
self canBackward ifTrue:[ |
|
9602 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
9603 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 9604 |
]. |
4022 | 9605 |
^ retPath. |
9606 |
! |
|
9607 |
||
9608 |
goForward |
|
4288 | 9609 |
"return the first path of the forward list; |
9610 |
remove it from the list." |
|
4022 | 9611 |
|
4347 | 9612 |
|retPath| |
9613 |
||
9614 |
self canForward ifTrue:[ |
|
9615 |
retPath := backForwardList at:backForwardIndex + 1. |
|
9616 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 9617 |
]. |
4022 | 9618 |
^ retPath. |
9619 |
! |
|
9620 |
||
9621 |
resetForwardBackward |
|
9622 |
||
4347 | 9623 |
self initialize |
4022 | 9624 |
! |
9625 |
||
9626 |
setPosition:aPosition for:aPath |
|
9627 |
||
9628 |
self do:[:item| |
|
4414 | 9629 |
item path = aPath ifTrue:[ |
9630 |
item position:aPosition. |
|
9631 |
] |
|
4022 | 9632 |
]. |
3892 | 9633 |
! ! |
9634 |
||
4870 | 9635 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 9636 |
|
6371 | 9637 |
initializeHistory |
4032 | 9638 |
|
4347 | 9639 |
backForwardList := OrderedCollection new. |
9640 |
self reverseDo:[:el| |
|
9641 |
backForwardList add:el path. |
|
9642 |
]. |
|
9643 |
backForwardIndex := backForwardList size. |
|
4032 | 9644 |
! ! |
9645 |
||
3892 | 9646 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
9647 |
||
4288 | 9648 |
canBackward |
4347 | 9649 |
|
9650 |
^ backForwardIndex > 1 |
|
4288 | 9651 |
! |
9652 |
||
3892 | 9653 |
canForward |
4347 | 9654 |
|
9655 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
9656 |
! |
|
9657 |
||
9658 |
getBackCollection |
|
9659 |
||
9660 |
| backCol | |
|
9661 |
||
9662 |
backCol := OrderedCollection new. |
|
9663 |
self canBackward ifTrue:[ |
|
9664 |
| tmpCol | |
|
9665 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
9666 |
tmpCol reverseDo:[ :el| |
|
9667 |
backCol add:el. |
|
9668 |
] |
|
9669 |
]. |
|
9670 |
^ backCol |
|
3952 | 9671 |
! |
9672 |
||
9673 |
getForwardCollection |
|
9674 |
||
4347 | 9675 |
| forwCol | |
9676 |
||
9677 |
forwCol := OrderedCollection new. |
|
9678 |
self canForward ifTrue:[ |
|
9679 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
9680 |
]. |
|
9681 |
^ forwCol |
|
3952 | 9682 |
! |
9683 |
||
9684 |
getItemFor:aPath |
|
6627 | 9685 |
^ self detect:[:item| item path = aPath] ifNone:nil. |
9686 |
"/ self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
9687 |
"/ ^ nil. |
|
3952 | 9688 |
! |
9689 |
||
9690 |
getPositionFor:aPath |
|
9691 |
||
9692 |
|item| |
|
9693 |
||
9694 |
item := self getItemFor:aPath. |
|
9695 |
||
9696 |
item notNil ifTrue:[ |
|
4414 | 9697 |
^ item position. |
3952 | 9698 |
]. |
9699 |
^ nil |
|
9700 |
! |
|
9701 |
||
9702 |
includesPath:aPath |
|
6627 | 9703 |
^ self contains:[:item | item path = aPath]. |
9704 |
||
9705 |
"/ self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
9706 |
"/ ^ false. |
|
4347 | 9707 |
! |
9708 |
||
9709 |
nextBackwardItem |
|
9710 |
"return the first path of the backward list" |
|
9711 |
||
9712 |
|retPath| |
|
9713 |
||
9714 |
self canBackward ifTrue:[ |
|
9715 |
retPath := backForwardList at:backForwardIndex. |
|
9716 |
]. |
|
9717 |
^ retPath. |
|
9718 |
! |
|
9719 |
||
9720 |
nextForwardItem |
|
9721 |
"return the first path of the forward list" |
|
9722 |
||
9723 |
|retPath| |
|
9724 |
||
9725 |
self canForward ifTrue:[ |
|
9726 |
retPath := backForwardList at:backForwardIndex + 1. |
|
9727 |
]. |
|
9728 |
^ retPath. |
|
3952 | 9729 |
! ! |
9730 |
||
9731 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
9732 |
||
9733 |
path:aPath |
|
9734 |
||
9735 |
^ self new path:aPath |
|
9736 |
! ! |
|
9737 |
||
9738 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
9739 |
||
6433 | 9740 |
asFilename |
9741 |
^ path asFilename |
|
9742 |
! |
|
9743 |
||
3952 | 9744 |
path |
9745 |
"return the value of the instance variable 'path' (automatically generated)" |
|
9746 |
||
9747 |
^ path |
|
9748 |
! |
|
9749 |
||
9750 |
path:something |
|
9751 |
"set the value of the instance variable 'path' (automatically generated)" |
|
9752 |
||
9753 |
path := something. |
|
9754 |
! |
|
9755 |
||
9756 |
position |
|
9757 |
"return the value of the instance variable 'position' (automatically generated)" |
|
9758 |
||
9759 |
^ position |
|
9760 |
! |
|
9761 |
||
9762 |
position:something |
|
9763 |
"set the value of the instance variable 'position' (automatically generated)" |
|
9764 |
||
9765 |
position := something. |
|
9766 |
! |
|
9767 |
||
9768 |
printString |
|
9769 |
||
9770 |
^ self path asString |
|
3892 | 9771 |
! ! |
9772 |
||
9773 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
9774 |
||
9775 |
withValue:aValue isHolder:aBoolean |
|
9776 |
||
9777 |
| instance | |
|
9778 |
||
9779 |
instance := self basicNew. |
|
9780 |
instance value:aValue. |
|
9781 |
instance isHolder:aBoolean. |
|
9782 |
^ instance |
|
9783 |
! ! |
|
9784 |
||
9785 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
9786 |
||
9787 |
isHolder |
|
9788 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
9789 |
||
9790 |
^ isHolder |
|
9791 |
! |
|
9792 |
||
9793 |
isHolder:something |
|
9794 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
|
9795 |
||
9796 |
isHolder := something. |
|
9797 |
! |
|
9798 |
||
9799 |
value |
|
9800 |
"return the value of the instance variable 'value' (automatically generated)" |
|
9801 |
||
9802 |
^ value |
|
9803 |
! |
|
9804 |
||
9805 |
value:something |
|
9806 |
"set the value of the instance variable 'value' (automatically generated)" |
|
9807 |
||
9808 |
value := something. |
|
9809 |
! ! |
|
9810 |
||
9811 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
9812 |
||
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9813 |
version |
15803 | 9814 |
^ '$Header$' |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9815 |
! |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9816 |
|
8832 | 9817 |
version_CVS |
15803 | 9818 |
^ '$Header$' |
3892 | 9819 |
! ! |
12094 | 9820 |