author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 19 Jul 2017 09:42:32 +0200 | |
branch | jv |
changeset 17619 | edb119820fcb |
parent 17379 | 028adf14bc05 |
child 18532 | cccb41254edf |
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 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
757 |
^ Icon deleteIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
758 |
! |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
759 |
|
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
760 |
copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
761 |
<resource: #programImage> |
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 |
^ ToolbarIconLibrary copyIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
764 |
! |
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 |
cutIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
767 |
<resource: #programImage> |
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 |
^ ToolbarIconLibrary cut20x20Icon2 "cut28x28Icon" |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
770 |
! |
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 |
deleteIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
773 |
<resource: #programImage> |
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 |
^ ToolbarIconLibrary erase20x20Icon "/ delete28x28Icon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
776 |
! |
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 |
directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
779 |
<resource: #programImage> |
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 |
^ ToolbarIconLibrary directoryUpIcon |
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
782 |
! |
3892 | 783 |
|
15211 | 784 |
disabledCursorIcon |
785 |
"This resource specification was automatically generated |
|
786 |
by the ImageEditor of ST/X." |
|
787 |
||
788 |
"Do not manually edit this!! If it is corrupted, |
|
789 |
the ImageEditor may not be able to read the specification." |
|
790 |
||
791 |
" |
|
17202 | 792 |
self disabledCursorIcon inspect |
793 |
ImageEditor openOnClass:self andSelector:#disabledCursorIcon |
|
15211 | 794 |
Icon flushCachedIcons |
795 |
" |
|
796 |
||
797 |
<resource: #image> |
|
798 |
||
799 |
^Icon |
|
800 |
constantNamed:#'AbstractFileBrowser class disabledCursorIcon' |
|
801 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
802 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@XF@@@H@P@@DOB@@BLLP@AA@"@@RHD @H1AD@BRHI@@$QBP@IBH$@BPQI@@"BLP@D QH@ADBB@@H0Q@@AC |
|
803 |
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:' |
|
804 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@_ @@@_>@@@O?0@@G?>@@C<O0@A?@>@@_8G @O?A<@C38O@@<_C0@OC8<@C0_O@@>C?0@G _8@A<C>@@O0_@@A? |
|
805 |
? @@O?0@@A?8@@@G8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
806 |
! |
|
6337 | 807 |
|
15211 | 808 |
enabledCursorIcon |
809 |
"This resource specification was automatically generated |
|
810 |
by the ImageEditor of ST/X." |
|
811 |
||
812 |
"Do not manually edit this!! If it is corrupted, |
|
813 |
the ImageEditor may not be able to read the specification." |
|
814 |
||
815 |
" |
|
17202 | 816 |
self enabledCursorIcon inspect |
817 |
ImageEditor openOnClass:self andSelector:#enabledCursorIcon |
|
15211 | 818 |
Icon flushCachedIcons |
819 |
" |
|
820 |
||
821 |
<resource: #image> |
|
822 |
||
823 |
^Icon |
|
824 |
constantNamed:#'AbstractFileBrowser class enabledCursorIcon' |
|
825 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#[1]); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
826 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@T@@@@E@@@@AP@@@@@@@@?0_0@@@@@@C?A?@@@@@@@@AP@@@@T@@@@E@@@@A |
|
827 |
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:' |
|
828 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@@G@@@@A0@@@@\@@@?8?0@O>O<@C?#?@@@G@@@@A0@@@@\@@@@G@@@@A |
|
829 |
0@@@@\@@@@G@@@@A0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself] |
|
830 |
! |
|
6337 | 831 |
|
3892 | 832 |
fileInIcon |
833 |
<resource: #programImage> |
|
834 |
||
6116 | 835 |
^ ToolbarIconLibrary fileInIcon |
3892 | 836 |
! |
837 |
||
6079 | 838 |
historyBackIcon |
839 |
<resource: #programImage> |
|
840 |
||
841 |
^ ToolbarIconLibrary historyBackIcon |
|
842 |
! |
|
843 |
||
844 |
historyForwardIcon |
|
845 |
<resource: #programImage> |
|
846 |
||
847 |
^ ToolbarIconLibrary historyForwardIcon |
|
848 |
! |
|
849 |
||
3892 | 850 |
homeIcon |
851 |
<resource: #programImage> |
|
852 |
||
6079 | 853 |
^ ToolbarIconLibrary homeIcon |
3892 | 854 |
! |
855 |
||
6074 | 856 |
homeIcon2 |
6079 | 857 |
<resource: #programImage> |
858 |
||
859 |
^ ToolbarIconLibrary homeIcon2 |
|
6074 | 860 |
! |
861 |
||
862 |
htmlReloadIcon |
|
863 |
<resource: #programImage> |
|
864 |
||
865 |
^ ToolbarIconLibrary reload22x22Icon |
|
866 |
! |
|
867 |
||
15211 | 868 |
leftDownIcon |
869 |
<resource: #image> |
|
870 |
"This resource specification was automatically generated |
|
871 |
by the ImageEditor of ST/X." |
|
872 |
"Do not manually edit this!! If it is corrupted, |
|
873 |
the ImageEditor may not be able to read the specification." |
|
874 |
" |
|
875 |
self leftDownIcon inspect |
|
876 |
ImageEditor openOnClass:self andSelector:#leftDownIcon" |
|
877 |
||
878 |
^ Icon constantNamed:#'AbstractFileBrowser class leftDownIcon' |
|
879 |
ifAbsentPut:[ |
|
880 |
(Depth2Image new) |
|
881 |
width:28; |
|
882 |
height:28; |
|
883 |
photometric:(#palette); |
|
884 |
bitsPerSample:(#( 2 )); |
|
885 |
samplesPerPixel:(1); |
|
886 |
bits:(ByteArray |
|
887 |
fromPackedString:' |
|
888 |
UUUUUUUUUUUPAUUUUUUUP@UUUUUUUPB!!UUUUUU@B*AUUUUU@B*(UUUUUPB** UUUUPB***AUUUTB***(EUUUB****%UUUR*****UUUUU@*%UUUUUUPJ)UUUU |
|
889 |
UUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*%UUUUUUPJ)UUUUUUTB*UUUUUUU@*$@@@@AUPJ*****)UTB******UU@******%UPJ*****)UTAUUUU |
|
890 |
UUUU@@@@@@@AUUUUUUUUUP@a'); |
|
891 |
colorMapFromArray:#[ 255 255 255 0 0 0 40 40 100 255 0 0 ]; |
|
892 |
mask:((ImageMask new) |
|
893 |
width:28; |
|
894 |
height:28; |
|
895 |
bits:(ByteArray |
|
896 |
fromPackedString:' |
|
897 |
@@@@@@@@@@@@ @@@@\@@@@O @@@G<@@@C? @@A?<@@@?? @@_?<@@G?? @@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C<@@@@?@@@@O0@@@C??? @???8@O? |
|
898 |
?>@C??? @???8@O??>@@@@@@@@@@@@@a'); |
|
899 |
yourself); |
|
900 |
yourself |
|
901 |
] |
|
902 |
! |
|
903 |
||
904 |
menuHistoryList9x20Icon |
|
905 |
<resource: #image> |
|
906 |
"This resource specification was automatically generated |
|
907 |
by the ImageEditor of ST/X." |
|
908 |
"Do not manually edit this!! If it is corrupted, |
|
909 |
the ImageEditor may not be able to read the specification." |
|
910 |
" |
|
911 |
self menuHistoryList9x20Icon inspect |
|
912 |
ImageEditor openOnClass:self andSelector:#menuHistoryList9x20Icon |
|
913 |
Icon flushCachedIcons" |
|
914 |
||
915 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryList9x20Icon' |
|
916 |
ifAbsentPut:[ |
|
917 |
(Depth1Image new) |
|
918 |
width:9; |
|
919 |
height:20; |
|
920 |
photometric:(#palette); |
|
921 |
bitsPerSample:(#( 1 )); |
|
922 |
samplesPerPixel:(1); |
|
923 |
bits:(ByteArray |
|
924 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
925 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
926 |
mask:((ImageMask new) |
|
927 |
width:9; |
|
928 |
height:20; |
|
929 |
bits:(ByteArray |
|
930 |
fromPackedString:'@@@@@A0@G@@\@A0@G@@\@A0@G@@\@A0@G@A?@C8@G@@H@G<@@@@@@@@a'); |
|
931 |
yourself); |
|
932 |
yourself |
|
933 |
] |
|
934 |
! |
|
935 |
||
936 |
menuHistoryListIcon |
|
937 |
<resource: #image> |
|
938 |
"This resource specification was automatically generated |
|
939 |
by the ImageEditor of ST/X." |
|
940 |
"Do not manually edit this!! If it is corrupted, |
|
941 |
the ImageEditor may not be able to read the specification." |
|
942 |
" |
|
943 |
self menuHistoryListIcon inspect |
|
944 |
ImageEditor openOnClass:self andSelector:#menuHistoryListIcon" |
|
945 |
||
946 |
^ Icon constantNamed:#'AbstractFileBrowser class menuHistoryListIcon' |
|
947 |
ifAbsentPut:[ |
|
948 |
(Depth1Image new) |
|
949 |
width:12; |
|
950 |
height:12; |
|
951 |
photometric:(#palette); |
|
952 |
bitsPerSample:(#( 1 )); |
|
953 |
samplesPerPixel:(1); |
|
954 |
bits:(ByteArray fromPackedString:'??S?<O?0??C?<O?0??/?=_?0??C?<O?0'); |
|
955 |
colorMapFromArray:#[ 255 255 255 0 0 0 ]; |
|
956 |
mask:((ImageMask new) |
|
957 |
width:12; |
|
958 |
height:12; |
|
959 |
bits:(ByteArray fromPackedString:'@@@O@@<@C0A?8C?@G8@O@@X@@@A?8@@@'); |
|
960 |
yourself); |
|
961 |
yourself |
|
962 |
] |
|
963 |
! |
|
3892 | 964 |
|
6087 | 965 |
newDirectoryIcon |
6074 | 966 |
<resource: #programImage> |
967 |
||
6087 | 968 |
^ ToolbarIconLibrary newDirectoryIcon |
3923 | 969 |
! |
970 |
||
6091 | 971 |
removeTabIcon |
972 |
<resource: #programImage> |
|
973 |
||
974 |
^ ToolbarIconLibrary removeTabIcon |
|
975 |
! |
|
976 |
||
3892 | 977 |
vt100Terminal |
978 |
<resource: #programImage> |
|
979 |
||
980 |
^ ToolbarIconLibrary shell20x20Icon |
|
981 |
! ! |
|
982 |
||
5528 | 983 |
!AbstractFileBrowser class methodsFor:'interface specs'! |
984 |
||
15211 | 985 |
encodingDialogSpec |
986 |
"This resource specification was automatically generated |
|
987 |
by the UIPainter of ST/X." |
|
988 |
||
989 |
"Do not manually edit this!! If it is corrupted, |
|
990 |
the UIPainter may not be able to read the specification." |
|
991 |
||
992 |
" |
|
993 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#encodingDialogSpec |
|
994 |
AbstractFileBrowser new openInterface:#encodingDialogSpec |
|
995 |
" |
|
996 |
||
997 |
<resource: #canvas> |
|
998 |
||
999 |
^ |
|
1000 |
#(FullSpec |
|
1001 |
name: encodingDialogSpec |
|
1002 |
window: |
|
1003 |
(WindowSpec |
|
1004 |
label: 'File Encoding' |
|
1005 |
name: 'File Encoding' |
|
1006 |
min: (Point 10 10) |
|
1007 |
bounds: (Rectangle 0 0 379 590) |
|
1008 |
) |
|
1009 |
component: |
|
1010 |
(SpecCollection |
|
1011 |
collection: ( |
|
1012 |
(LabelSpec |
|
1013 |
label: 'Select the External (File-) Encoding:' |
|
1014 |
name: 'Label1' |
|
1015 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1016 |
translateLabel: true |
|
1017 |
adjust: left |
|
1018 |
) |
|
1019 |
(DataSetSpec |
|
1020 |
name: 'Table1' |
|
1021 |
layout: (LayoutFrame 0 0 30 0 0 1 -60 1) |
|
1022 |
model: selectedEncoding |
|
1023 |
hasHorizontalScrollBar: true |
|
1024 |
hasVerticalScrollBar: true |
|
1025 |
dataList: encodingList |
|
1026 |
has3Dseparators: true |
|
1027 |
columns: |
|
1028 |
(Array |
|
1029 |
||
1030 |
(DataSetColumnSpec |
|
1031 |
label: 'Encoding' |
|
1032 |
labelButtonType: Button |
|
1033 |
height: heightOfFirstRow |
|
1034 |
model: at: |
|
1035 |
canSelect: false |
|
1036 |
isResizeable: false |
|
1037 |
showRowSeparator: false |
|
1038 |
showColSeparator: false |
|
1039 |
) |
|
1040 |
(DataSetColumnSpec |
|
1041 |
label: 'Description' |
|
1042 |
labelButtonType: Button |
|
1043 |
height: heightOfFirstRow |
|
1044 |
model: at: |
|
1045 |
canSelect: false |
|
1046 |
isResizeable: false |
|
1047 |
showRowSeparator: false |
|
1048 |
showColSeparator: false |
|
1049 |
) |
|
1050 |
) |
|
1051 |
doubleClickChannel: accept |
|
1052 |
) |
|
1053 |
(CheckBoxSpec |
|
1054 |
label: 'Lock Encoding' |
|
1055 |
name: 'LockEncodingCheckBox' |
|
1056 |
layout: (LayoutFrame 3 0 -60 1 217 0 -30 1) |
|
1057 |
activeHelpKey: lockFileEncoding |
|
1058 |
model: lockFileEncoding |
|
1059 |
translateLabel: true |
|
1060 |
) |
|
1061 |
(HorizontalPanelViewSpec |
|
1062 |
name: 'ButtonPanel' |
|
1063 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1064 |
horizontalLayout: fitSpace |
|
1065 |
verticalLayout: center |
|
1066 |
horizontalSpace: 3 |
|
1067 |
verticalSpace: 3 |
|
1068 |
reverseOrderIfOKAtLeft: true |
|
1069 |
component: |
|
1070 |
(SpecCollection |
|
1071 |
collection: ( |
|
1072 |
(ActionButtonSpec |
|
1073 |
label: 'Cancel' |
|
1074 |
name: 'Button2' |
|
1075 |
translateLabel: true |
|
1076 |
model: cancel |
|
1077 |
extent: (Point 183 22) |
|
1078 |
) |
|
1079 |
(ActionButtonSpec |
|
1080 |
label: 'OK' |
|
1081 |
name: 'Button1' |
|
1082 |
translateLabel: true |
|
1083 |
model: accept |
|
1084 |
isDefault: true |
|
1085 |
extent: (Point 184 22) |
|
1086 |
) |
|
1087 |
) |
|
1088 |
||
1089 |
) |
|
1090 |
) |
|
1091 |
) |
|
1092 |
||
1093 |
) |
|
1094 |
) |
|
1095 |
! |
|
1096 |
||
1097 |
lineEndConventionDialogSpec |
|
1098 |
"This resource specification was automatically generated |
|
1099 |
by the UIPainter of ST/X." |
|
1100 |
||
1101 |
"Do not manually edit this!! If it is corrupted, |
|
1102 |
the UIPainter may not be able to read the specification." |
|
1103 |
||
1104 |
" |
|
1105 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#lineEndConventionDialogSpec |
|
1106 |
AbstractFileBrowser new openInterface:#lineEndConventionDialogSpec |
|
1107 |
" |
|
1108 |
||
1109 |
<resource: #canvas> |
|
1110 |
||
1111 |
^ |
|
15212 | 1112 |
#(FullSpec |
1113 |
name: lineEndConventionDialogSpec |
|
1114 |
window: |
|
1115 |
(WindowSpec |
|
1116 |
label: 'Line-End Convention' |
|
1117 |
name: 'Line-End Convention' |
|
1118 |
min: (Point 10 10) |
|
1119 |
bounds: (Rectangle 0 0 379 239) |
|
1120 |
) |
|
1121 |
component: |
|
1122 |
(SpecCollection |
|
1123 |
collection: ( |
|
1124 |
(LabelSpec |
|
1125 |
label: 'Select the Line-End Convention (used when saving files):' |
|
1126 |
name: 'Label1' |
|
1127 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1128 |
translateLabel: true |
|
1129 |
adjust: left |
|
1130 |
) |
|
1131 |
(VerticalPanelViewSpec |
|
1132 |
name: 'VerticalPanel1' |
|
1133 |
layout: (LayoutFrame 20 0 40 0 0 1 -30 1) |
|
1134 |
horizontalLayout: fit |
|
1135 |
verticalLayout: topSpace |
|
1136 |
horizontalSpace: 3 |
|
1137 |
verticalSpace: 3 |
|
1138 |
component: |
|
1139 |
(SpecCollection |
|
1140 |
collection: ( |
|
1141 |
(RadioButtonSpec |
|
1142 |
label: 'NL (Unix)' |
|
1143 |
name: 'RadioButton1' |
|
1144 |
translateLabel: true |
|
1145 |
model: lineEndConvention |
|
1146 |
isTriggerOnDown: true |
|
1147 |
select: nl |
|
1148 |
extent: (Point 359 22) |
|
1149 |
) |
|
1150 |
(RadioButtonSpec |
|
1151 |
label: 'CR-NL (MSDOS)' |
|
1152 |
name: 'RadioButton4' |
|
1153 |
translateLabel: true |
|
1154 |
model: lineEndConvention |
|
1155 |
isTriggerOnDown: true |
|
1156 |
select: crlf |
|
1157 |
extent: (Point 359 22) |
|
1158 |
) |
|
1159 |
(RadioButtonSpec |
|
1160 |
label: 'CR (VMS and pre OSX mac)' |
|
1161 |
name: 'RadioButton5' |
|
1162 |
translateLabel: true |
|
1163 |
model: lineEndConvention |
|
1164 |
isTriggerOnDown: true |
|
1165 |
select: cr |
|
1166 |
extent: (Point 359 22) |
|
15211 | 1167 |
) |
15212 | 1168 |
(RadioButtonSpec |
1169 |
label: 'ETX (some modem protocols and mainframe files)' |
|
1170 |
name: 'RadioButton6' |
|
1171 |
translateLabel: true |
|
1172 |
model: lineEndConvention |
|
1173 |
isTriggerOnDown: true |
|
1174 |
select: etx |
|
1175 |
extent: (Point 359 22) |
|
1176 |
) |
|
1177 |
(RadioButtonSpec |
|
1178 |
label: 'EOT (some modem protocols and mainframe files)' |
|
1179 |
name: 'RadioButton7' |
|
1180 |
translateLabel: true |
|
1181 |
model: lineEndConvention |
|
1182 |
isTriggerOnDown: true |
|
1183 |
select: eot |
|
1184 |
extent: (Point 359 22) |
|
15211 | 1185 |
) |
15212 | 1186 |
) |
1187 |
||
1188 |
) |
|
15211 | 1189 |
) |
15212 | 1190 |
(HorizontalPanelViewSpec |
1191 |
name: 'ButtonPanel' |
|
1192 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1193 |
horizontalLayout: fitSpace |
|
1194 |
verticalLayout: center |
|
1195 |
horizontalSpace: 3 |
|
1196 |
verticalSpace: 3 |
|
1197 |
reverseOrderIfOKAtLeft: true |
|
1198 |
component: |
|
1199 |
(SpecCollection |
|
1200 |
collection: ( |
|
1201 |
(ActionButtonSpec |
|
1202 |
label: 'Cancel' |
|
1203 |
name: 'Button2' |
|
1204 |
translateLabel: true |
|
1205 |
model: cancel |
|
1206 |
extent: (Point 185 22) |
|
1207 |
) |
|
1208 |
(ActionButtonSpec |
|
1209 |
label: 'OK' |
|
1210 |
name: 'Button1' |
|
1211 |
translateLabel: true |
|
1212 |
model: accept |
|
1213 |
isDefault: true |
|
1214 |
extent: (Point 185 22) |
|
1215 |
) |
|
1216 |
) |
|
1217 |
||
1218 |
) |
|
1219 |
) |
|
1220 |
) |
|
1221 |
||
1222 |
) |
|
1223 |
) |
|
15211 | 1224 |
! |
1225 |
||
1226 |
tabStopConversionDialogSpec |
|
1227 |
"This resource specification was automatically generated |
|
1228 |
by the UIPainter of ST/X." |
|
1229 |
||
1230 |
"Do not manually edit this!! If it is corrupted, |
|
1231 |
the UIPainter may not be able to read the specification." |
|
1232 |
||
1233 |
" |
|
1234 |
UIPainter new openOnClass:AbstractFileBrowser andSelector:#tabStopConversionDialogSpec |
|
1235 |
AbstractFileBrowser new openInterface:#tabStopConversionDialogSpec |
|
1236 |
" |
|
1237 |
||
1238 |
<resource: #canvas> |
|
1239 |
||
1240 |
^ |
|
1241 |
#(FullSpec |
|
1242 |
name: 'tabStopConversionDialogSpec' |
|
1243 |
window: |
|
1244 |
(WindowSpec |
|
1245 |
label: 'Tab-Stop Conversion' |
|
1246 |
name: 'Tab-Stop Conversion' |
|
1247 |
min: (Point 10 10) |
|
1248 |
bounds: (Rectangle 0 0 379 239) |
|
1249 |
) |
|
1250 |
component: |
|
1251 |
(SpecCollection |
|
1252 |
collection: ( |
|
1253 |
(LabelSpec |
|
1254 |
label: 'Select the Tab-Stop Conversion (used when saving files):' |
|
1255 |
name: 'Label1' |
|
1256 |
layout: (LayoutFrame 0 0 0 0 0 1 30 0) |
|
1257 |
translateLabel: true |
|
1258 |
adjust: left |
|
1259 |
) |
|
1260 |
(VerticalPanelViewSpec |
|
1261 |
name: 'VerticalPanel1' |
|
1262 |
layout: (LayoutFrame 0 0 30 0 0 1 -30 1) |
|
1263 |
horizontalLayout: center |
|
1264 |
verticalLayout: center |
|
1265 |
horizontalSpace: 3 |
|
1266 |
verticalSpace: 3 |
|
1267 |
component: |
|
1268 |
(SpecCollection |
|
1269 |
collection: ( |
|
1270 |
(RadioButtonSpec |
|
1271 |
label: '4' |
|
1272 |
name: 'RadioButton1' |
|
1273 |
translateLabel: true |
|
1274 |
model: tabStops |
|
1275 |
isTriggerOnDown: true |
|
1276 |
select: 4 |
|
1277 |
extent: (Point 136 22) |
|
1278 |
) |
|
1279 |
(RadioButtonSpec |
|
1280 |
label: '8' |
|
1281 |
name: 'RadioButton4' |
|
1282 |
translateLabel: true |
|
1283 |
model: tabStops |
|
1284 |
isTriggerOnDown: true |
|
1285 |
select: 8 |
|
1286 |
extent: (Point 136 22) |
|
1287 |
) |
|
1288 |
) |
|
1289 |
||
1290 |
) |
|
1291 |
) |
|
1292 |
(HorizontalPanelViewSpec |
|
1293 |
name: 'ButtonPanel' |
|
1294 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
1295 |
horizontalLayout: fitSpace |
|
1296 |
verticalLayout: center |
|
1297 |
horizontalSpace: 3 |
|
1298 |
verticalSpace: 3 |
|
1299 |
reverseOrderIfOKAtLeft: true |
|
1300 |
component: |
|
1301 |
(SpecCollection |
|
1302 |
collection: ( |
|
1303 |
(ActionButtonSpec |
|
1304 |
label: 'Cancel' |
|
1305 |
name: 'Button2' |
|
1306 |
translateLabel: true |
|
1307 |
model: cancel |
|
1308 |
extent: (Point 185 22) |
|
1309 |
) |
|
1310 |
(ActionButtonSpec |
|
1311 |
label: 'OK' |
|
1312 |
name: 'Button1' |
|
1313 |
translateLabel: true |
|
1314 |
model: accept |
|
1315 |
isDefault: true |
|
1316 |
extent: (Point 185 22) |
|
1317 |
) |
|
1318 |
) |
|
1319 |
||
1320 |
) |
|
1321 |
) |
|
1322 |
) |
|
1323 |
||
1324 |
) |
|
1325 |
) |
|
1326 |
||
1327 |
"Modified: / 28-02-2012 / 11:12:38 / cg" |
|
1328 |
! ! |
|
5528 | 1329 |
|
3892 | 1330 |
!AbstractFileBrowser class methodsFor:'menu specs'! |
1331 |
||
15211 | 1332 |
baseBookmarksMenuSpec |
1333 |
"This resource specification was automatically generated |
|
1334 |
by the MenuEditor of ST/X." |
|
1335 |
||
1336 |
"Do not manually edit this!! If it is corrupted, |
|
1337 |
the MenuEditor may not be able to read the specification." |
|
1338 |
||
1339 |
" |
|
1340 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec |
|
1341 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec)) startUp |
|
1342 |
" |
|
1343 |
||
1344 |
<resource: #menu> |
|
1345 |
||
1346 |
^ |
|
1347 |
#(Menu |
|
1348 |
( |
|
1349 |
(MenuItem |
|
1350 |
enabled: currentFilesHasDirectories |
|
1351 |
label: 'Add Bookmark' |
|
1352 |
itemValue: addBookmark |
|
1353 |
translateLabel: true |
|
1354 |
) |
|
1355 |
(MenuItem |
|
1356 |
enabled: hasBookmarksToRemove |
|
1357 |
label: 'Remove Bookmark' |
|
1358 |
itemValue: removeBookmark |
|
1359 |
translateLabel: true |
|
1360 |
) |
|
1361 |
(MenuItem |
|
1362 |
label: 'Save Bookmarks In...' |
|
1363 |
itemValue: saveBookmarks |
|
1364 |
translateLabel: true |
|
1365 |
) |
|
1366 |
) |
|
1367 |
nil |
|
1368 |
nil |
|
1369 |
) |
|
1370 |
! |
|
1371 |
||
1372 |
baseBookmarksMenuSpec2 |
|
1373 |
"This resource specification was automatically generated |
|
1374 |
by the MenuEditor of ST/X." |
|
1375 |
||
1376 |
"Do not manually edit this!! If it is corrupted, |
|
1377 |
the MenuEditor may not be able to read the specification." |
|
1378 |
||
1379 |
" |
|
1380 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#baseBookmarksMenuSpec2 |
|
1381 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser baseBookmarksMenuSpec2)) startUp |
|
1382 |
" |
|
1383 |
||
1384 |
<resource: #menu> |
|
1385 |
||
1386 |
^ |
|
1387 |
#(Menu |
|
1388 |
( |
|
1389 |
(MenuItem |
|
1390 |
label: 'Edit Bookmarks' |
|
1391 |
itemValue: editBookmarks |
|
1392 |
translateLabel: true |
|
1393 |
) |
|
1394 |
(MenuItem |
|
1395 |
label: '-' |
|
1396 |
) |
|
1397 |
(MenuItem |
|
1398 |
enabled: currentFilesHasDirectories |
|
1399 |
label: 'Add Bookmark' |
|
1400 |
itemValue: addBookmark |
|
1401 |
translateLabel: true |
|
1402 |
) |
|
1403 |
) |
|
1404 |
nil |
|
1405 |
nil |
|
1406 |
) |
|
1407 |
! |
|
1408 |
||
1409 |
browserMenu |
|
1410 |
"This resource specification was automatically generated |
|
1411 |
by the MenuEditor of ST/X." |
|
1412 |
||
1413 |
"Do not manually edit this!! If it is corrupted, |
|
1414 |
the MenuEditor may not be able to read the specification." |
|
1415 |
||
1416 |
||
1417 |
" |
|
1418 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#browserMenu |
|
1419 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser browserMenu)) startUp |
|
1420 |
" |
|
1421 |
||
1422 |
<resource: #menu> |
|
1423 |
||
1424 |
^ |
|
1425 |
#(Menu |
|
1426 |
( |
|
1427 |
(MenuItem |
|
1428 |
label: 'Spawn Filebrowser' |
|
1429 |
itemValue: doSpawn |
|
1430 |
translateLabel: true |
|
1431 |
shortcutKey: Ctrln |
|
1432 |
) |
|
1433 |
(MenuItem |
|
1434 |
label: 'Windows Explorer' |
|
1435 |
itemValue: doOpenExplorer |
|
1436 |
translateLabel: true |
|
1437 |
isVisible: systemIsDOS |
|
1438 |
) |
|
1439 |
(MenuItem |
|
1440 |
label: 'Open Finder' |
|
1441 |
itemValue: doOpenFinder |
|
1442 |
translateLabel: true |
|
1443 |
isVisible: systemIsOSX |
|
1444 |
) |
|
1445 |
(MenuItem |
|
1446 |
label: 'C Browser' |
|
1447 |
itemValue: doOpenCBrowser |
|
1448 |
translateLabel: true |
|
1449 |
isVisible: cBrowserMenuItemVisible |
|
1450 |
) |
|
1451 |
(MenuItem |
|
1452 |
label: '-' |
|
1453 |
) |
|
1454 |
(MenuItem |
|
1455 |
label: 'Add Text Editor Page' |
|
1456 |
itemValue: newTextEditor |
|
1457 |
translateLabel: true |
|
1458 |
shortcutKey: Ctrlt |
|
1459 |
) |
|
1460 |
(MenuItem |
|
1461 |
label: 'Add Shell Terminal Page' |
|
1462 |
itemValue: doAddTerminal |
|
1463 |
translateLabel: true |
|
1464 |
) |
|
1465 |
(MenuItem |
|
1466 |
label: 'Add Archiver Page' |
|
1467 |
itemValue: doAddArchiver |
|
1468 |
translateLabel: true |
|
1469 |
) |
|
1470 |
(MenuItem |
|
1471 |
label: 'Add Search Page' |
|
1472 |
itemValue: doOpenSearchFile |
|
1473 |
translateLabel: true |
|
1474 |
) |
|
1475 |
(MenuItem |
|
1476 |
label: '-' |
|
1477 |
isVisible: false |
|
1478 |
) |
|
1479 |
(MenuItem |
|
1480 |
label: 'Settings...' |
|
1481 |
itemValue: doOpenSettings |
|
1482 |
translateLabel: true |
|
1483 |
isVisible: false |
|
1484 |
) |
|
1485 |
(MenuItem |
|
1486 |
label: 'Encoding...' |
|
1487 |
itemValue: fileEncodingDialog |
|
1488 |
translateLabel: true |
|
1489 |
isVisible: false |
|
1490 |
) |
|
1491 |
(MenuItem |
|
1492 |
label: 'Line End Convention...' |
|
1493 |
itemValue: lineEndConventionDialog |
|
1494 |
translateLabel: true |
|
1495 |
isVisible: false |
|
1496 |
) |
|
1497 |
(MenuItem |
|
1498 |
label: 'Tab Stop Conversion...' |
|
1499 |
itemValue: tabStopConversionDialog |
|
1500 |
translateLabel: true |
|
1501 |
isVisible: false |
|
1502 |
) |
|
1503 |
(MenuItem |
|
1504 |
label: '-' |
|
1505 |
) |
|
1506 |
(MenuItem |
|
1507 |
label: 'Exit' |
|
1508 |
itemValue: closeRequest |
|
1509 |
translateLabel: true |
|
1510 |
) |
|
1511 |
) |
|
1512 |
nil |
|
1513 |
nil |
|
1514 |
) |
|
1515 |
||
1516 |
"Modified: / 07-01-2012 / 12:51:20 / cg" |
|
1517 |
! |
|
1518 |
||
1519 |
directoryMenu |
|
1520 |
"This resource specification was automatically generated |
|
1521 |
by the MenuEditor of ST/X." |
|
1522 |
||
1523 |
"Do not manually edit this!! If it is corrupted, |
|
1524 |
the MenuEditor may not be able to read the specification." |
|
1525 |
||
1526 |
||
1527 |
" |
|
1528 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#directoryMenu |
|
1529 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser directoryMenu)) startUp |
|
1530 |
" |
|
1531 |
||
1532 |
<resource: #menu> |
|
1533 |
||
1534 |
^ |
|
1535 |
#(Menu |
|
1536 |
( |
|
1537 |
(MenuItem |
|
1538 |
label: 'Bookmarks' |
|
1539 |
submenuChannel: bookmarksMenu |
|
1540 |
) |
|
1541 |
(MenuItem |
|
1542 |
label: 'Visited Directories' |
|
1543 |
submenuChannel: visitedDirectoriesMenu |
|
1544 |
) |
|
1545 |
(MenuItem |
|
1546 |
label: '-' |
|
1547 |
) |
|
1548 |
(MenuItem |
|
1549 |
label: 'Up' |
|
1550 |
itemValue: doGoDirectoryUp |
|
1551 |
) |
|
1552 |
(MenuItem |
|
1553 |
activeHelpKey: directoryBack |
|
1554 |
enabled: enableBack |
|
1555 |
label: 'Back' |
|
1556 |
itemValue: doBack |
|
1557 |
) |
|
1558 |
(MenuItem |
|
1559 |
activeHelpKey: directoryBack |
|
1560 |
enabled: enableForward |
|
1561 |
label: 'Forward' |
|
1562 |
itemValue: doForward |
|
1563 |
) |
|
1564 |
(MenuItem |
|
1565 |
label: '-' |
|
1566 |
) |
|
1567 |
(MenuItem |
|
1568 |
enabled: enableHome |
|
1569 |
label: 'Home Directory' |
|
1570 |
itemValue: doGotoHomeDirectory |
|
1571 |
) |
|
1572 |
(MenuItem |
|
1573 |
enabled: enableGotoDesktopDirectory |
|
1574 |
label: 'Desktop' |
|
1575 |
itemValue: doGotoDesktopDirectory |
|
1576 |
) |
|
1577 |
(MenuItem |
|
1578 |
enabled: enableGotoDefaultDirectory |
|
1579 |
label: 'Default (Current) Directory' |
|
1580 |
itemValue: doGotoDefaultDirectory |
|
1581 |
) |
|
1582 |
(MenuItem |
|
1583 |
enabled: enableGotoSmalltalkDirectory |
|
1584 |
label: 'Smalltalk (Application) Directory' |
|
1585 |
itemValue: doGotoSmalltalkDirectory |
|
1586 |
) |
|
1587 |
(MenuItem |
|
17187 | 1588 |
enabled: enableGotoSmalltalkWorkspaceDirectory |
1589 |
label: 'Smalltalk Workspace Directory' |
|
1590 |
itemValue: doGotoSmalltalkWorkspaceDirectory |
|
1591 |
) |
|
1592 |
(MenuItem |
|
15211 | 1593 |
enabled: enableGotoTempDirectory |
1594 |
label: 'Smalltalk Temp Directory' |
|
1595 |
itemValue: doGotoTempDirectory |
|
1596 |
) |
|
1597 |
(MenuItem |
|
1598 |
label: '-' |
|
1599 |
) |
|
1600 |
(MenuItem |
|
1601 |
enabled: enableMakeCurrentDirectory |
|
1602 |
label: 'Make this the Default (Current) Directory' |
|
1603 |
itemValue: doMakeCurrentDirectory |
|
1604 |
) |
|
1605 |
) |
|
1606 |
nil |
|
1607 |
nil |
|
1608 |
) |
|
1609 |
! |
|
1610 |
||
1611 |
editMenu |
|
1612 |
"This resource specification was automatically generated |
|
1613 |
by the MenuEditor of ST/X." |
|
1614 |
||
1615 |
"Do not manually edit this!! If it is corrupted, |
|
1616 |
the MenuEditor may not be able to read the specification." |
|
1617 |
||
1618 |
" |
|
1619 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#editMenu |
|
1620 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser editMenu)) startUp |
|
1621 |
" |
|
1622 |
||
1623 |
<resource: #menu> |
|
1624 |
||
1625 |
^ |
|
1626 |
#(Menu |
|
1627 |
( |
|
1628 |
(MenuItem |
|
1629 |
enabled: hasFileSelection |
|
1630 |
label: 'Copy Selected Filenames to Clipboard' |
|
1631 |
itemValue: copySelectedFilenames |
|
1632 |
translateLabel: true |
|
1633 |
) |
|
1634 |
(MenuItem |
|
1635 |
enabled: fileListIsNotEmpty |
|
1636 |
label: 'Copy all Filenames to Clipboard' |
|
1637 |
itemValue: copyFileList |
|
1638 |
translateLabel: true |
|
1639 |
) |
|
1640 |
) |
|
1641 |
nil |
|
1642 |
nil |
|
1643 |
) |
|
1644 |
! |
|
1645 |
||
1646 |
emptyMenuSpec |
|
1647 |
"This resource specification was automatically generated |
|
1648 |
by the MenuEditor of ST/X." |
|
1649 |
||
1650 |
"Do not manually edit this!! If it is corrupted, |
|
1651 |
the MenuEditor may not be able to read the specification." |
|
1652 |
||
1653 |
" |
|
1654 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#emptyMenuSpec |
|
1655 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser emptyMenuSpec)) startUp |
|
1656 |
" |
|
1657 |
||
1658 |
<resource: #menu> |
|
1659 |
||
1660 |
^ |
|
1661 |
#(#Menu |
|
1662 |
#( |
|
1663 |
) |
|
1664 |
nil |
|
1665 |
nil |
|
1666 |
) |
|
1667 |
! |
|
1668 |
||
1669 |
extraMenu |
|
1670 |
"This resource specification was automatically generated |
|
1671 |
by the MenuEditor of ST/X." |
|
1672 |
||
1673 |
"Do not manually edit this!! If it is corrupted, |
|
1674 |
the MenuEditor may not be able to read the specification." |
|
1675 |
||
1676 |
||
1677 |
" |
|
1678 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#extraMenu |
|
1679 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser extraMenu)) startUp |
|
1680 |
" |
|
1681 |
||
1682 |
<resource: #menu> |
|
1683 |
||
1684 |
^ |
|
1685 |
#(Menu |
|
1686 |
( |
|
1687 |
(MenuItem |
|
1688 |
label: 'Encoding...' |
|
1689 |
itemValue: fileEncodingDialog |
|
1690 |
translateLabel: true |
|
1691 |
) |
|
1692 |
(MenuItem |
|
1693 |
label: 'Line End Convention...' |
|
1694 |
itemValue: lineEndConventionDialog |
|
1695 |
translateLabel: true |
|
1696 |
) |
|
1697 |
(MenuItem |
|
1698 |
label: 'Tab Stop Conversion...' |
|
1699 |
itemValue: tabStopConversionDialog |
|
1700 |
translateLabel: true |
|
1701 |
) |
|
1702 |
(MenuItem |
|
1703 |
label: '-' |
|
1704 |
) |
|
1705 |
(MenuItem |
|
1706 |
label: 'Settings...' |
|
1707 |
itemValue: doOpenSettings |
|
1708 |
translateLabel: true |
|
1709 |
labelImage: (ResourceRetriever ToolbarIconLibrary settings16x16Icon 'Settings...') |
|
1710 |
) |
|
1711 |
) |
|
1712 |
nil |
|
1713 |
nil |
|
1714 |
) |
|
1715 |
! |
|
1716 |
||
1717 |
fileMenu |
|
1718 |
"This resource specification was automatically generated |
|
1719 |
by the MenuEditor of ST/X." |
|
1720 |
||
1721 |
"Do not manually edit this!! If it is corrupted, |
|
1722 |
the MenuEditor may not be able to read the specification." |
|
1723 |
||
1724 |
||
1725 |
" |
|
1726 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileMenu |
|
1727 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileMenu)) startUp |
|
1728 |
" |
|
1729 |
||
1730 |
<resource: #menu> |
|
1731 |
||
1732 |
^ |
|
1733 |
#(Menu |
|
1734 |
( |
|
1735 |
(MenuItem |
|
1736 |
enabled: enableFileHistory |
|
1737 |
label: 'File History' |
|
1738 |
submenuChannel: menuFileHistory |
|
1739 |
) |
|
1740 |
(MenuItem |
|
1741 |
label: '-' |
|
1742 |
) |
|
1743 |
(MenuItem |
|
1744 |
label: 'Open' |
|
1745 |
itemValue: doShowFileContents |
|
1746 |
) |
|
1747 |
(MenuItem |
|
1748 |
label: '-' |
|
1749 |
) |
|
1750 |
(MenuItem |
|
1751 |
enabled: hasFileSelection |
|
1752 |
label: 'FileIn' |
|
1753 |
itemValue: fileFileIn |
|
1754 |
) |
|
1755 |
(MenuItem |
|
1756 |
enabled: hasFileSelection |
|
1757 |
label: 'FileIn to Namespace...' |
|
1758 |
itemValue: fileFileInToNameSpace |
|
1759 |
) |
|
1760 |
(MenuItem |
|
1761 |
enabled: hasPackageDirectorySelected |
|
1762 |
label: 'Load Package from Here' |
|
1763 |
itemValue: fileFileInPackage |
|
1764 |
) |
|
1765 |
(MenuItem |
|
1766 |
label: '-' |
|
1767 |
) |
|
1768 |
(MenuItem |
|
1769 |
label: 'New' |
|
1770 |
submenuChannel: newMenu |
|
1771 |
keepLinkedMenu: true |
|
1772 |
) |
|
1773 |
(MenuItem |
|
1774 |
label: '-' |
|
1775 |
) |
|
1776 |
(MenuItem |
|
1777 |
enabled: hasSelection |
|
1778 |
label: 'Cut' |
|
1779 |
itemValue: cutFiles |
|
1780 |
) |
|
1781 |
(MenuItem |
|
1782 |
enabled: hasSelection |
|
1783 |
label: 'Copy' |
|
1784 |
itemValue: copyFiles |
|
1785 |
) |
|
1786 |
(MenuItem |
|
1787 |
enabled: canPaste |
|
1788 |
label: 'Paste' |
|
1789 |
itemValue: pasteFiles |
|
1790 |
) |
|
1791 |
(MenuItem |
|
1792 |
enabled: hasSelection |
|
1793 |
label: 'Delete' |
|
1794 |
itemValue: deleteFiles |
|
1795 |
) |
|
1796 |
(MenuItem |
|
1797 |
enabled: hasSelection |
|
1798 |
label: 'Erase' |
|
1799 |
itemValue: eraseFiles |
|
1800 |
) |
|
1801 |
(MenuItem |
|
1802 |
label: '-' |
|
1803 |
) |
|
1804 |
(MenuItem |
|
1805 |
enabled: hasSelection |
|
1806 |
label: 'Rename...' |
|
1807 |
itemValue: renameSelection |
|
1808 |
shortcutKey: Rename |
|
1809 |
) |
|
1810 |
(MenuItem |
|
1811 |
enabled: hasSelection |
|
1812 |
label: 'Move To...' |
|
1813 |
itemValue: moveSelectionTo |
|
1814 |
) |
|
1815 |
(MenuItem |
|
1816 |
enabled: hasSelection |
|
1817 |
label: 'Copy To...' |
|
1818 |
itemValue: copySelectionTo |
|
1819 |
) |
|
1820 |
(MenuItem |
|
1821 |
enabled: hasSelection |
|
1822 |
label: 'Properties...' |
|
1823 |
itemValue: doShowProperties |
|
1824 |
) |
|
1825 |
(MenuItem |
|
1826 |
label: '-' |
|
1827 |
isVisible: javaSupportLoaded |
|
1828 |
) |
|
1829 |
(MenuItem |
|
1830 |
enabled: canAddToClassPath |
|
1831 |
label: 'Add to Java Class Path' |
|
1832 |
isVisible: javaSupportLoaded |
|
1833 |
) |
|
1834 |
(MenuItem |
|
1835 |
enabled: canRemoveFromClassPath |
|
1836 |
label: 'Remove from Java Class Path' |
|
1837 |
isVisible: javaSupportLoaded |
|
1838 |
) |
|
1839 |
(MenuItem |
|
1840 |
enabled: canAddToSourcePath |
|
1841 |
label: 'Add to Java Source Path' |
|
1842 |
isVisible: javaSupportLoaded |
|
1843 |
) |
|
1844 |
(MenuItem |
|
1845 |
enabled: canRemoveFromSourcePath |
|
1846 |
label: 'Remove from Java Source Path' |
|
1847 |
isVisible: javaSupportLoaded |
|
1848 |
) |
|
1849 |
) |
|
1850 |
nil |
|
1851 |
nil |
|
1852 |
) |
|
1853 |
! |
|
1854 |
||
1855 |
fileOpMenu |
|
1856 |
"This resource specification was automatically generated |
|
1857 |
by the MenuEditor of ST/X." |
|
1858 |
||
1859 |
"Do not manually edit this!! If it is corrupted, |
|
1860 |
the MenuEditor may not be able to read the specification." |
|
1861 |
||
1862 |
||
1863 |
" |
|
1864 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#fileOpMenu |
|
1865 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser fileOpMenu)) startUp |
|
1866 |
" |
|
1867 |
||
1868 |
<resource: #menu> |
|
1869 |
||
1870 |
^ |
|
1871 |
#(Menu |
|
1872 |
( |
|
1873 |
(MenuItem |
|
1874 |
enabled: hasFileSelection |
|
15906 | 1875 |
label: 'Split (by size)...' |
15211 | 1876 |
itemValue: splitSelectedFiles |
1877 |
) |
|
1878 |
(MenuItem |
|
1879 |
enabled: hasFileSelection |
|
15906 | 1880 |
label: 'Split (by #lines)...' |
1881 |
itemValue: splitSelectedFilesByLines |
|
1882 |
) |
|
1883 |
(MenuItem |
|
1884 |
enabled: hasFileSelection |
|
15211 | 1885 |
label: 'Join...' |
1886 |
itemValue: joinSelectedFiles |
|
1887 |
) |
|
1888 |
(MenuItem |
|
1889 |
enabled: hasFileSelection |
|
1890 |
label: 'Copy Corrupted File To...' |
|
1891 |
itemValue: copySelectionToRepairingCorruptedFiles |
|
1892 |
) |
|
1893 |
(MenuItem |
|
15569 | 1894 |
label: 'Copy Corrupted File From -> To...' |
1895 |
itemValue: copyFromToRepairingCorruptedFiles |
|
1896 |
) |
|
1897 |
(MenuItem |
|
15211 | 1898 |
label: '-' |
1899 |
) |
|
1900 |
(MenuItem |
|
1901 |
enabled: hasFileSelection |
|
1902 |
label: 'Rot13...' |
|
1903 |
itemValue: filterSelectedFiles: |
|
1904 |
argument: rot13 |
|
1905 |
) |
|
1906 |
(MenuItem |
|
1907 |
label: '-' |
|
1908 |
) |
|
1909 |
(MenuItem |
|
1910 |
enabled: hasFileSelection |
|
1911 |
label: 'Truncate...' |
|
1912 |
itemValue: truncateSelectedFilesToZeroSize |
|
1913 |
) |
|
1914 |
(MenuItem |
|
1915 |
label: '-' |
|
1916 |
) |
|
1917 |
(MenuItem |
|
1918 |
label: 'Load Signature Support Package' |
|
1919 |
itemValue: loadSignatureSupport |
|
1920 |
isVisible: cannotGenerateSignatureFiles |
|
1921 |
) |
|
1922 |
(MenuItem |
|
1923 |
enabled: canGenerateSignatureFiles |
|
1924 |
label: 'Generate Signed Files' |
|
1925 |
itemValue: generateSignaturesForSelectedFiles |
|
1926 |
) |
|
1927 |
(MenuItem |
|
1928 |
enabled: canGenerateSignatureFiles |
|
1929 |
label: 'Generate Detached Signature Files (use for dll)' |
|
1930 |
itemValue: generateDetachedSignaturesForSelectedFiles |
|
1931 |
) |
|
1932 |
(MenuItem |
|
1933 |
enabled: canGenerateSignatureFiles |
|
1934 |
label: 'Generate Patch Installer for File(s)' |
|
1935 |
itemValue: generatePatchInstallerForSelectedFiles |
|
1936 |
) |
|
1937 |
(MenuItem |
|
1938 |
label: '-' |
|
1939 |
) |
|
1940 |
(MenuItem |
|
1941 |
enabled: hasFileSelection |
|
1942 |
label: 'File Differences' |
|
1943 |
itemValue: openDiffView |
|
1944 |
isVisible: hasTwoFilesSelectedHolder |
|
1945 |
) |
|
1946 |
(MenuItem |
|
1947 |
enabled: hasFileSelection |
|
1948 |
label: 'File Differences...' |
|
1949 |
itemValue: openDiffView |
|
1950 |
isVisible: hasNotTwoFilesSelectedHolder |
|
1951 |
) |
|
1952 |
(MenuItem |
|
1953 |
enabled: hasSelection |
|
1954 |
label: 'Directory Differences' |
|
1955 |
itemValue: openDirectoryDiffView |
|
1956 |
isVisible: hasTwoDirectoriesSelectedHolder |
|
1957 |
) |
|
1958 |
(MenuItem |
|
1959 |
enabled: hasSelection |
|
1960 |
label: 'Directory Differences...' |
|
1961 |
itemValue: openDirectoryDiffView |
|
1962 |
isVisible: hasNotTwoDirectoriesSelectedHolder |
|
1963 |
) |
|
1964 |
) |
|
1965 |
nil |
|
1966 |
nil |
|
1967 |
) |
|
1968 |
! |
|
1969 |
||
1970 |
newMenu |
|
1971 |
"This resource specification was automatically generated |
|
1972 |
by the MenuEditor of ST/X." |
|
1973 |
||
1974 |
"Do not manually edit this!! If it is corrupted, |
|
1975 |
the MenuEditor may not be able to read the specification." |
|
1976 |
||
1977 |
" |
|
1978 |
MenuEditor new openOnClass:DirectoryTreeBrowser andSelector:#newMenu |
|
1979 |
(Menu new fromLiteralArrayEncoding:(DirectoryTreeBrowser newMenu)) startUp |
|
1980 |
" |
|
1981 |
||
1982 |
<resource: #menu> |
|
1983 |
||
1984 |
^ |
|
1985 |
#(#Menu |
|
1986 |
#( |
|
1987 |
#(#MenuItem |
|
1988 |
#label: 'Directory...' |
|
1989 |
#translateLabel: true |
|
1990 |
#value: #newDirectory |
|
1991 |
) |
|
1992 |
#(#MenuItem |
|
1993 |
#label: 'File...' |
|
1994 |
#translateLabel: true |
|
1995 |
#value: #newFile |
|
1996 |
) |
|
1997 |
#(#MenuItem |
|
1998 |
#label: 'Hard Link...' |
|
1999 |
#translateLabel: true |
|
2000 |
#value: #newHardLink |
|
2001 |
) |
|
2002 |
#(#MenuItem |
|
2003 |
#label: 'Symbolic Link...' |
|
2004 |
#translateLabel: true |
|
2005 |
#value: #newSoftLink |
|
2006 |
) |
|
2007 |
) |
|
2008 |
nil |
|
2009 |
nil |
|
2010 |
) |
|
2011 |
! |
|
2012 |
||
2013 |
scmMenuSlice |
|
2014 |
"This resource specification was automatically generated |
|
2015 |
by the MenuEditor of ST/X." |
|
2016 |
||
2017 |
"Do not manually edit this!! If it is corrupted, |
|
2018 |
the MenuEditor may not be able to read the specification." |
|
2019 |
||
2020 |
||
2021 |
" |
|
2022 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#scmMenuSlice |
|
2023 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser scmMenuSlice)) startUp |
|
2024 |
" |
|
2025 |
||
2026 |
<resource: #menu> |
|
2027 |
||
2028 |
^ |
|
2029 |
#(Menu |
|
2030 |
( |
|
2031 |
(MenuItem |
|
2032 |
label: 'CVS' |
|
2033 |
isVisible: cvsMenusAreShown |
|
2034 |
submenuChannel: cvsMenu |
|
2035 |
) |
|
2036 |
(MenuItem |
|
2037 |
label: 'SVN' |
|
2038 |
isVisible: svnMenusAreShown |
|
2039 |
submenuChannel: svnMenu |
|
2040 |
) |
|
2041 |
(MenuItem |
|
2042 |
label: 'Mercurial' |
|
2043 |
isVisible: mercurialMenusAreShown |
|
2044 |
submenuChannel: mercurialMenu |
|
2045 |
) |
|
2046 |
(MenuItem |
|
2047 |
label: 'HG' |
|
2048 |
isVisible: hgMenusAreShown |
|
2049 |
submenuChannel: hgMenu |
|
2050 |
) |
|
2051 |
(MenuItem |
|
2052 |
label: 'Perforce' |
|
2053 |
isVisible: perforceMenusAreShown |
|
2054 |
submenuChannel: perforceMenu |
|
2055 |
) |
|
2056 |
) |
|
2057 |
nil |
|
2058 |
nil |
|
2059 |
) |
|
2060 |
! |
|
2061 |
||
2062 |
showMenuSpec |
|
2063 |
"This resource specification was automatically generated |
|
2064 |
by the MenuEditor of ST/X." |
|
2065 |
||
2066 |
"Do not manually edit this!! If it is corrupted, |
|
2067 |
the MenuEditor may not be able to read the specification." |
|
2068 |
||
2069 |
" |
|
2070 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpec |
|
2071 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpec)) startUp |
|
2072 |
" |
|
2073 |
||
2074 |
<resource: #menu> |
|
2075 |
||
2076 |
^ |
|
2077 |
#(Menu |
|
2078 |
( |
|
2079 |
(MenuItem |
|
2080 |
label: 'Hidden Files' |
|
2081 |
translateLabel: true |
|
2082 |
hideMenuOnActivated: false |
|
2083 |
indication: showHiddenFiles |
|
2084 |
) |
|
2085 |
(MenuItem |
|
2086 |
label: '-' |
|
2087 |
) |
|
2088 |
(MenuItem |
|
2089 |
label: 'Directory Tree' |
|
2090 |
translateLabel: true |
|
2091 |
hideMenuOnActivated: false |
|
2092 |
indication: showDirectoryTree |
|
2093 |
) |
|
2094 |
(MenuItem |
|
2095 |
label: 'Regular Files in TreeView (Left)' |
|
2096 |
translateLabel: true |
|
2097 |
hideMenuOnActivated: false |
|
2098 |
indication: viewFilesInDirectoryTree |
|
2099 |
) |
|
2100 |
(MenuItem |
|
2101 |
label: 'Directories in ContentsView (Right)' |
|
2102 |
translateLabel: true |
|
2103 |
hideMenuOnActivated: false |
|
2104 |
indication: viewDirsInContentsBrowser |
|
2105 |
) |
|
2106 |
(MenuItem |
|
2107 |
enabled: enableViewNoteBookApplication |
|
2108 |
label: 'File Applications' |
|
2109 |
translateLabel: true |
|
2110 |
hideMenuOnActivated: false |
|
2111 |
indication: viewNoteBookApplicationHolder |
|
2112 |
) |
|
2113 |
(MenuItem |
|
2114 |
label: '-' |
|
2115 |
) |
|
2116 |
(MenuItem |
|
2117 |
label: 'DiskUsage' |
|
2118 |
translateLabel: true |
|
2119 |
hideMenuOnActivated: false |
|
2120 |
indication: showDiskUsageHolder |
|
2121 |
) |
|
2122 |
) |
|
2123 |
nil |
|
2124 |
nil |
|
2125 |
) |
|
2126 |
! |
|
2127 |
||
2128 |
showMenuSpecForDialog |
|
2129 |
"This resource specification was automatically generated |
|
2130 |
by the MenuEditor of ST/X." |
|
2131 |
||
2132 |
"Do not manually edit this!! If it is corrupted, |
|
2133 |
the MenuEditor may not be able to read the specification." |
|
2134 |
||
2135 |
" |
|
2136 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#showMenuSpecForDialog |
|
2137 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser showMenuSpecForDialog)) startUp |
|
2138 |
" |
|
2139 |
||
2140 |
<resource: #menu> |
|
2141 |
||
2142 |
^ |
|
2143 |
#(Menu |
|
2144 |
( |
|
2145 |
(MenuItem |
|
2146 |
label: 'Hidden Files' |
|
2147 |
translateLabel: true |
|
2148 |
hideMenuOnActivated: false |
|
2149 |
indication: showHiddenFiles |
|
2150 |
) |
|
2151 |
) |
|
2152 |
nil |
|
2153 |
nil |
|
2154 |
) |
|
2155 |
! |
|
2156 |
||
2157 |
sortMenu |
|
2158 |
"This resource specification was automatically generated |
|
2159 |
by the MenuEditor of ST/X." |
|
2160 |
||
2161 |
"Do not manually edit this!! If it is corrupted, |
|
2162 |
the MenuEditor may not be able to read the specification." |
|
2163 |
||
2164 |
" |
|
2165 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#sortMenu |
|
2166 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser sortMenu)) startUp |
|
2167 |
" |
|
2168 |
||
2169 |
<resource: #menu> |
|
2170 |
||
2171 |
^ |
|
2172 |
#(#Menu |
|
2173 |
#( |
|
2174 |
#(#MenuItem |
|
2175 |
#label: 'By Filename' |
|
2176 |
#translateLabel: true |
|
2177 |
#hideMenuOnActivated: false |
|
2178 |
#choice: #sortBlockProperty |
|
2179 |
#choiceValue: #baseName |
|
2180 |
) |
|
2181 |
#(#MenuItem |
|
2182 |
#label: 'By Extension' |
|
2183 |
#translateLabel: true |
|
2184 |
#hideMenuOnActivated: false |
|
2185 |
#choice: #sortBlockProperty |
|
2186 |
#choiceValue: #suffix |
|
2187 |
) |
|
2188 |
#(#MenuItem |
|
2189 |
#label: 'By Permissions' |
|
2190 |
#translateLabel: true |
|
2191 |
#hideMenuOnActivated: false |
|
2192 |
#choice: #sortBlockProperty |
|
2193 |
#choiceValue: #permissions |
|
2194 |
) |
|
2195 |
#(#MenuItem |
|
2196 |
#label: 'By Owner' |
|
2197 |
#translateLabel: true |
|
2198 |
#isVisible: #viewOwner |
|
2199 |
#hideMenuOnActivated: false |
|
2200 |
#choice: #sortBlockProperty |
|
2201 |
#choiceValue: #owner |
|
2202 |
) |
|
2203 |
#(#MenuItem |
|
2204 |
#label: 'By Group' |
|
2205 |
#translateLabel: true |
|
2206 |
#isVisible: #viewOwner |
|
2207 |
#hideMenuOnActivated: false |
|
2208 |
#choice: #sortBlockProperty |
|
2209 |
#choiceValue: #group |
|
2210 |
) |
|
2211 |
#(#MenuItem |
|
2212 |
#label: 'By Size' |
|
2213 |
#translateLabel: true |
|
2214 |
#hideMenuOnActivated: false |
|
2215 |
#choice: #sortBlockProperty |
|
2216 |
#choiceValue: #fileSize |
|
2217 |
) |
|
2218 |
#(#MenuItem |
|
2219 |
#label: 'By Date && Time' |
|
2220 |
#translateLabel: true |
|
2221 |
#hideMenuOnActivated: false |
|
2222 |
#choice: #sortBlockProperty |
|
2223 |
#choiceValue: #modificationTime |
|
2224 |
) |
|
2225 |
#(#MenuItem |
|
2226 |
#label: '-' |
|
2227 |
) |
|
2228 |
#(#MenuItem |
|
2229 |
#label: 'Ignore Case in Sort' |
|
2230 |
#translateLabel: true |
|
2231 |
#hideMenuOnActivated: false |
|
2232 |
#indication: #sortCaseless |
|
2233 |
) |
|
2234 |
#(#MenuItem |
|
2235 |
#label: 'Directories before Files' |
|
2236 |
#translateLabel: true |
|
2237 |
#hideMenuOnActivated: false |
|
2238 |
#indication: #sortDirectoriesBeforeFiles |
|
2239 |
) |
|
2240 |
) |
|
2241 |
nil |
|
2242 |
nil |
|
2243 |
) |
|
2244 |
! |
|
2245 |
||
2246 |
toolsMenuSpec |
|
2247 |
"This resource specification was automatically generated |
|
2248 |
by the MenuEditor of ST/X." |
|
2249 |
||
2250 |
"Do not manually edit this!! If it is corrupted, |
|
2251 |
the MenuEditor may not be able to read the specification." |
|
2252 |
||
2253 |
||
2254 |
" |
|
2255 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#toolsMenuSpec |
|
2256 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser toolsMenuSpec)) startUp |
|
2257 |
" |
|
2258 |
||
2259 |
<resource: #menu> |
|
2260 |
||
2261 |
^ |
|
2262 |
#(Menu |
|
2263 |
( |
|
2264 |
(MenuItem |
|
2265 |
label: 'Open (Win32-Shell)' |
|
2266 |
itemValue: doOpenWithShellCommand |
|
2267 |
isVisible: systemIsDOS |
|
2268 |
) |
|
2269 |
(MenuItem |
|
2270 |
label: 'Execute UNIX Command...' |
|
2271 |
itemValue: doExecuteCommand |
|
2272 |
isVisible: systemIsUnix |
|
2273 |
) |
|
2274 |
(MenuItem |
|
2275 |
label: 'Execute DOS Command...' |
|
2276 |
itemValue: doExecuteCommand |
|
2277 |
isVisible: systemIsDOS |
|
2278 |
) |
|
2279 |
(MenuItem |
|
2280 |
label: 'Execute Script...' |
|
2281 |
itemValue: doExecuteScript |
|
2282 |
) |
|
2283 |
(MenuItem |
|
2284 |
enabled: canDoTerminal |
|
2285 |
label: 'Shell Terminal' |
|
2286 |
itemValue: openTerminal |
|
2287 |
isVisible: canDoTerminalAndSystemIsUnix |
|
2288 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'Shell Terminal') |
|
2289 |
) |
|
2290 |
(MenuItem |
|
2291 |
enabled: canDoTerminal |
|
2292 |
label: 'DOS Terminal' |
|
2293 |
itemValue: openTerminal |
|
2294 |
isVisible: canDoTerminalAndSystemIsDOS |
|
2295 |
labelImage: (ResourceRetriever ToolbarIconLibrary terminal16x16Icon 'DOS Terminal') |
|
2296 |
) |
|
2297 |
(MenuItem |
|
2298 |
label: '-' |
|
2299 |
) |
|
2300 |
(MenuItem |
|
2301 |
enabled: hasFileSelection |
|
2302 |
label: 'Changes Browser' |
|
2303 |
itemValue: openChangesBrowser |
|
2304 |
) |
|
2305 |
(MenuItem |
|
2306 |
enabled: hasFileSelection |
|
2307 |
label: 'ChangeSet Browser' |
|
2308 |
itemValue: openChangeSetBrowser |
|
2309 |
isVisible: changeSetBrowserItemVisible |
|
2310 |
) |
|
2311 |
(MenuItem |
|
2312 |
enabled: hasFileSelection |
|
2313 |
label: 'Workspace' |
|
2314 |
itemValue: openWorkspace |
|
2315 |
) |
|
2316 |
(MenuItem |
|
2317 |
label: '-' |
|
2318 |
) |
|
2319 |
(MenuItem |
|
2320 |
enabled: canReadAbbrevFile |
|
2321 |
label: 'Install Autoloaded' |
|
2322 |
itemValue: readAbbrevFile |
|
2323 |
) |
|
2324 |
(MenuItem |
|
2325 |
enabled: anySTFilesPresent |
|
2326 |
label: 'Install all ST-Files as Autoloaded' |
|
2327 |
itemValue: installAllAsAutoloaded |
|
2328 |
) |
|
2329 |
(MenuItem |
|
2330 |
enabled: recursiveAnySTFilesPresent |
|
2331 |
label: 'Recursive Install all ST-Files as Autoloaded' |
|
2332 |
itemValue: installAllAsAutoloadedRecursive |
|
2333 |
) |
|
2334 |
(MenuItem |
|
2335 |
label: '-' |
|
2336 |
) |
|
2337 |
(MenuItem |
|
2338 |
enabled: hasJava |
|
2339 |
label: 'Add Directory to Java Source Path (stx:libjava)' |
|
2340 |
itemValue: addDirToJavaSourcePath |
|
2341 |
) |
|
2342 |
(MenuItem |
|
2343 |
enabled: hasJava |
|
2344 |
label: 'Add Selected Files to Java Source Path (stx:libjava)' |
|
2345 |
itemValue: fileAddToJavaSourcePath |
|
2346 |
) |
|
2347 |
(MenuItem |
|
2348 |
label: '-' |
|
2349 |
) |
|
2350 |
(MenuItem |
|
2351 |
label: 'File Operations' |
|
2352 |
submenuChannel: fileOpMenu |
|
2353 |
) |
|
2354 |
(MenuItem |
|
2355 |
label: 'File Utilities' |
|
2356 |
submenu: |
|
2357 |
(Menu |
|
2358 |
( |
|
2359 |
(MenuItem |
|
2360 |
enabled: hasFileSelection |
|
2361 |
label: 'Editor' |
|
2362 |
itemValue: openEditor |
|
2363 |
) |
|
2364 |
(MenuItem |
|
2365 |
enabled: hasFileSelection |
|
2366 |
label: 'HTML Reader' |
|
2367 |
itemValue: openHTMLReader |
|
2368 |
) |
|
2369 |
(MenuItem |
|
2370 |
enabled: hasFileSelection |
|
2371 |
label: 'Web Browser' |
|
2372 |
itemValue: openWebBrowser |
|
2373 |
) |
|
2374 |
(MenuItem |
|
2375 |
label: 'XML Inspector' |
|
2376 |
itemValue: inspectXmlFile |
|
2377 |
isVisible: hasXml |
|
2378 |
showBusyCursorWhilePerforming: true |
|
2379 |
) |
|
2380 |
(MenuItem |
|
2381 |
enabled: hasFileSelection |
|
2382 |
label: 'Acroread (PDF Viewer)' |
|
2383 |
itemValue: openPDFViewer |
|
2384 |
) |
|
2385 |
(MenuItem |
|
2386 |
enabled: hasASN1AndSelection |
|
2387 |
label: 'ASN1 Browser' |
|
2388 |
itemValue: openASN1Browser |
|
2389 |
isVisible: hasASN1 |
|
2390 |
) |
|
2391 |
(MenuItem |
|
2392 |
enabled: hasCBrowser |
|
2393 |
label: 'C Browser' |
|
2394 |
itemValue: openCBrowser |
|
2395 |
isVisible: hasCBrowser |
|
2396 |
) |
|
2397 |
(MenuItem |
|
2398 |
enabled: canOpenMonticelloBrowser |
|
2399 |
label: 'Monticello Browser' |
|
2400 |
itemValue: doOpenMonticelloBrowser |
|
2401 |
) |
|
2402 |
(MenuItem |
|
2403 |
enabled: hasJavaAndSelection |
|
2404 |
label: 'Applet Viewer' |
|
2405 |
itemValue: openAppletViewer |
|
2406 |
isVisible: hasJava |
|
2407 |
) |
|
2408 |
(MenuItem |
|
2409 |
enabled: hasMP3PlayerAndSelection |
|
2410 |
label: 'MP3 Player' |
|
2411 |
itemValue: openMP3Player |
|
2412 |
isVisible: hasMP3Player |
|
2413 |
) |
|
2414 |
(MenuItem |
|
2415 |
enabled: hasFileSelection |
|
2416 |
label: 'xv (Image Viewer)' |
|
2417 |
itemValue: openXV |
|
2418 |
isVisible: systemIsUnix |
|
2419 |
) |
|
2420 |
(MenuItem |
|
2421 |
enabled: currentFilesAreInSameDirectory |
|
2422 |
label: 'Slide Show' |
|
2423 |
itemValue: openSlideShow |
|
2424 |
isVisible: hasSlideShow |
|
2425 |
) |
|
2426 |
(MenuItem |
|
2427 |
enabled: hasFileSelection |
|
2428 |
label: 'gv (Postscript Viewer)' |
|
2429 |
itemValue: openGV |
|
2430 |
isVisible: systemIsUnix |
|
2431 |
) |
|
2432 |
(MenuItem |
|
2433 |
enabled: hasMP3PlayerAndSelection |
|
2434 |
label: 'MP3 Player' |
|
2435 |
itemValue: openMP3Player |
|
2436 |
isVisible: hasMP3Player |
|
2437 |
) |
|
2438 |
(MenuItem |
|
2439 |
enabled: hasFileSelection |
|
2440 |
label: 'Realplay (avi viewer)' |
|
2441 |
itemValue: openRP |
|
2442 |
isVisible: systemIsUnix |
|
2443 |
) |
|
2444 |
(MenuItem |
|
2445 |
label: '-' |
|
2446 |
) |
|
2447 |
(MenuItem |
|
2448 |
label: 'Smalltalk' |
|
2449 |
submenu: |
|
2450 |
(Menu |
|
2451 |
( |
|
2452 |
(MenuItem |
|
2453 |
enabled: hasSnapshotSelection |
|
2454 |
label: 'Snapshot Image Browser' |
|
2455 |
itemValue: openSnapshotImageBrowser |
|
2456 |
) |
|
2457 |
(MenuItem |
|
2458 |
enabled: canCreateNewProject |
|
2459 |
label: 'Create Smalltalk Project' |
|
2460 |
itemValue: createProjectAndOpenProjectBrowser |
|
2461 |
) |
|
2462 |
(MenuItem |
|
2463 |
label: '-' |
|
2464 |
) |
|
2465 |
(MenuItem |
|
2466 |
enabled: hasResourceFileSelected |
|
2467 |
label: 'Show Contents of Resourcefile' |
|
2468 |
itemValue: readAndShowResources |
|
2469 |
) |
|
2470 |
(MenuItem |
|
2471 |
enabled: hasResourceFileSelected |
|
2472 |
label: 'Resource File Editor' |
|
2473 |
itemValue: openResourceFileEditor |
|
2474 |
showBusyCursorWhilePerforming: true |
|
2475 |
) |
|
2476 |
(MenuItem |
|
2477 |
label: '-' |
|
2478 |
) |
|
2479 |
(MenuItem |
|
2480 |
enabled: hasFileSelection |
|
2481 |
label: 'Contents as ByteArray' |
|
2482 |
itemValue: fileContentsAsByteArray |
|
2483 |
) |
|
2484 |
) |
|
2485 |
nil |
|
2486 |
nil |
|
2487 |
) |
|
2488 |
) |
|
2489 |
(MenuItem |
|
2490 |
label: 'Image' |
|
2491 |
submenu: |
|
2492 |
(Menu |
|
2493 |
( |
|
2494 |
(MenuItem |
|
2495 |
enabled: hasFileSelection |
|
2496 |
label: 'Image Editor' |
|
2497 |
itemValue: openImageEditor |
|
2498 |
) |
|
2499 |
(MenuItem |
|
2500 |
enabled: hasFileSelection |
|
2501 |
label: 'Image Preview' |
|
2502 |
itemValue: openImagePreview |
|
2503 |
) |
|
2504 |
(MenuItem |
|
2505 |
enabled: hasFileSelection |
|
2506 |
label: 'Image Inspector' |
|
2507 |
itemValue: openImageInspector |
|
2508 |
) |
|
2509 |
(MenuItem |
|
2510 |
label: '-' |
|
2511 |
) |
|
2512 |
(MenuItem |
|
2513 |
enabled: hasFileSelection |
|
2514 |
label: 'Convert to GIF' |
|
2515 |
itemValue: convertImageToGIF |
|
2516 |
) |
|
2517 |
(MenuItem |
|
2518 |
enabled: hasFileSelection |
|
2519 |
label: 'Convert to PNG' |
|
2520 |
itemValue: convertImageToPNG |
|
2521 |
) |
|
2522 |
(MenuItem |
|
2523 |
enabled: hasFileSelection |
|
2524 |
label: 'Convert to XPM' |
|
2525 |
itemValue: convertImageToXPM |
|
2526 |
) |
|
2527 |
(MenuItem |
|
2528 |
enabled: hasFileSelection |
|
2529 |
label: 'Convert to JPG' |
|
2530 |
itemValue: convertImageToJPG |
|
2531 |
) |
|
2532 |
) |
|
2533 |
nil |
|
2534 |
nil |
|
2535 |
) |
|
2536 |
) |
|
2537 |
(MenuItem |
|
15528 | 2538 |
label: 'Web' |
2539 |
submenu: |
|
2540 |
(Menu |
|
2541 |
( |
|
2542 |
(MenuItem |
|
2543 |
label: 'Fetch File by URL...' |
|
2544 |
itemValue: fetchFileByURL |
|
2545 |
) |
|
2546 |
) |
|
2547 |
nil |
|
2548 |
nil |
|
2549 |
) |
|
2550 |
) |
|
2551 |
(MenuItem |
|
15211 | 2552 |
enabled: hasZipFileSelectedHolder |
2553 |
label: 'ZipFile Tool' |
|
2554 |
itemValue: openZipTool |
|
2555 |
) |
|
2556 |
(MenuItem |
|
2557 |
enabled: hasFileSelection |
|
2558 |
label: 'Hex Dump' |
|
2559 |
itemValue: fileHexDump |
|
2560 |
) |
|
2561 |
) |
|
2562 |
nil |
|
2563 |
nil |
|
2564 |
) |
|
2565 |
) |
|
2566 |
(MenuItem |
|
2567 |
label: 'Find' |
|
2568 |
submenu: |
|
2569 |
(Menu |
|
2570 |
( |
|
2571 |
(MenuItem |
|
2572 |
label: 'File...' |
|
2573 |
itemValue: fileFindFile |
|
2574 |
) |
|
2575 |
(MenuItem |
|
2576 |
enabled: hasFileSelection |
|
2577 |
label: 'Same Contents as Selected...' |
|
2578 |
itemValue: fileFindDuplicateFile |
|
2579 |
) |
|
2580 |
(MenuItem |
|
2581 |
label: 'Duplicate Files' |
|
2582 |
itemValue: fileFindDuplicates |
|
2583 |
) |
|
2584 |
(MenuItem |
|
2585 |
enabled: hasSelection |
|
2586 |
label: 'All Duplicate Files (Recursive)' |
|
2587 |
itemValue: fileFindAllDuplicates |
|
2588 |
) |
|
2589 |
(MenuItem |
|
2590 |
label: 'Similar Image Files' |
|
2591 |
itemValue: fileFindSimilarImages |
|
2592 |
isVisible: hasImageColorHistogram |
|
2593 |
) |
|
2594 |
) |
|
2595 |
nil |
|
2596 |
nil |
|
2597 |
) |
|
2598 |
) |
|
2599 |
) |
|
2600 |
nil |
|
2601 |
nil |
|
2602 |
) |
|
2603 |
! |
|
2604 |
||
2605 |
viewDetailsMenuSpec |
|
2606 |
"This resource specification was automatically generated |
|
2607 |
by the MenuEditor of ST/X." |
|
2608 |
||
2609 |
"Do not manually edit this!! If it is corrupted, |
|
2610 |
the MenuEditor may not be able to read the specification." |
|
2611 |
||
2612 |
" |
|
2613 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#viewDetailsMenuSpec |
|
2614 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser viewDetailsMenuSpec)) startUp |
|
2615 |
" |
|
2616 |
||
2617 |
<resource: #menu> |
|
2618 |
||
2619 |
^ |
|
2620 |
#(#Menu |
|
2621 |
#( |
|
2622 |
#(#MenuItem |
|
2623 |
#label: '-' |
|
2624 |
) |
|
2625 |
#(#MenuItem |
|
2626 |
#label: 'Hidden Files' |
|
2627 |
#translateLabel: true |
|
2628 |
#indication: #showHiddenFiles |
|
2629 |
) |
|
2630 |
) |
|
2631 |
nil |
|
2632 |
nil |
|
2633 |
) |
|
2634 |
! ! |
|
3892 | 2635 |
|
11144 | 2636 |
!AbstractFileBrowser class methodsFor:'menu specs-scm'! |
2637 |
||
15211 | 2638 |
cvsMenu |
2639 |
"This resource specification was automatically generated |
|
2640 |
by the MenuEditor of ST/X." |
|
2641 |
||
2642 |
"Do not manually edit this!! If it is corrupted, |
|
2643 |
the MenuEditor may not be able to read the specification." |
|
2644 |
||
2645 |
||
2646 |
" |
|
2647 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#cvsMenu |
|
2648 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser cvsMenu)) startUp |
|
2649 |
" |
|
2650 |
||
2651 |
<resource: #menu> |
|
2652 |
||
2653 |
^ |
|
2654 |
#(Menu |
|
2655 |
( |
|
2656 |
(MenuItem |
|
2657 |
label: 'Commit (CVS)...' |
|
2658 |
itemValue: cvsCommit |
|
2659 |
translateLabel: true |
|
2660 |
) |
|
2661 |
(MenuItem |
|
2662 |
enabled: canCvsAddAndCommit |
|
2663 |
label: 'Add && Commit...' |
|
2664 |
itemValue: cvsAddAndCommit |
|
2665 |
translateLabel: true |
|
2666 |
) |
|
2667 |
(MenuItem |
|
2668 |
enabled: canCvsAddAndCommit |
|
2669 |
label: 'Add as Binary && Commit...' |
|
2670 |
itemValue: cvsAddBinaryAndCommit |
|
2671 |
translateLabel: true |
|
2672 |
) |
|
2673 |
(MenuItem |
|
2674 |
label: 'Commit Folder (CVS)...' |
|
2675 |
itemValue: cvsCommitFolder |
|
2676 |
translateLabel: true |
|
2677 |
) |
|
2678 |
(MenuItem |
|
2679 |
label: '-' |
|
2680 |
) |
|
2681 |
(MenuItem |
|
2682 |
enabled: hasSelection |
|
2683 |
label: 'Update selected Files/Directories' |
|
2684 |
itemValue: cvsUpdateSelection |
|
2685 |
translateLabel: true |
|
2686 |
) |
|
2687 |
(MenuItem |
|
2688 |
label: 'Update Directory Local' |
|
2689 |
itemValue: cvsUpdateAll |
|
2690 |
translateLabel: true |
|
2691 |
) |
|
2692 |
(MenuItem |
|
2693 |
label: 'Update Directory Recursive' |
|
2694 |
itemValue: cvsUpdateAllRecursive |
|
2695 |
translateLabel: true |
|
2696 |
) |
|
2697 |
(MenuItem |
|
2698 |
label: '-' |
|
2699 |
) |
|
2700 |
(MenuItem |
|
2701 |
enabled: hasSelection |
|
2702 |
label: 'Tag...' |
|
2703 |
itemValue: cvsTagSelection |
|
2704 |
translateLabel: true |
|
2705 |
) |
|
2706 |
(MenuItem |
|
2707 |
enabled: hasSelection |
|
2708 |
label: 'Revision Log' |
|
2709 |
itemValue: cvsRevisionLog |
|
2710 |
translateLabel: true |
|
2711 |
) |
|
2712 |
(MenuItem |
|
2713 |
enabled: hasSelection |
|
2714 |
label: 'Compare with newest in Repository' |
|
2715 |
itemValue: cvsCompareWithNewest |
|
2716 |
translateLabel: true |
|
2717 |
) |
|
2718 |
(MenuItem |
|
2719 |
label: '-' |
|
2720 |
) |
|
2721 |
(MenuItem |
|
2722 |
enabled: canRemoveCVSContainer |
|
2723 |
label: 'Remove File && CVS Container...' |
|
2724 |
itemValue: cvsRemoveFileAndCVSContainer |
|
2725 |
translateLabel: true |
|
2726 |
) |
|
2727 |
) |
|
2728 |
nil |
|
2729 |
nil |
|
2730 |
) |
|
2731 |
! |
|
2732 |
||
2733 |
mercurialMenu |
|
2734 |
"This resource specification was automatically generated |
|
2735 |
by the MenuEditor of ST/X." |
|
2736 |
||
2737 |
"Do not manually edit this!! If it is corrupted, |
|
2738 |
the MenuEditor may not be able to read the specification." |
|
2739 |
||
2740 |
||
2741 |
" |
|
2742 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#mercurialMenu |
|
2743 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser mercurialMenu)) startUp |
|
2744 |
" |
|
2745 |
||
2746 |
<resource: #menu> |
|
2747 |
||
2748 |
^ |
|
2749 |
#(Menu |
|
2750 |
( |
|
2751 |
(MenuItem |
|
2752 |
label: 'Add' |
|
2753 |
itemValue: mercurialAdd |
|
2754 |
translateLabel: true |
|
2755 |
) |
|
2756 |
(MenuItem |
|
2757 |
label: 'Commit Changes' |
|
2758 |
itemValue: mercurialCommit |
|
2759 |
translateLabel: true |
|
2760 |
) |
|
2761 |
(MenuItem |
|
2762 |
label: 'Push...' |
|
2763 |
itemValue: mercurialPush |
|
2764 |
translateLabel: true |
|
2765 |
) |
|
2766 |
(MenuItem |
|
2767 |
label: 'Status' |
|
2768 |
itemValue: mercurialStatus |
|
2769 |
translateLabel: true |
|
2770 |
) |
|
2771 |
(MenuItem |
|
2772 |
label: '-' |
|
2773 |
) |
|
2774 |
(MenuItem |
|
2775 |
label: 'Init' |
|
2776 |
itemValue: mercurialInit |
|
2777 |
translateLabel: true |
|
2778 |
) |
|
2779 |
) |
|
2780 |
nil |
|
2781 |
nil |
|
2782 |
) |
|
2783 |
||
2784 |
"Modified: / 17-01-2012 / 15:57:40 / cg" |
|
2785 |
! |
|
2786 |
||
2787 |
perforceMenu |
|
2788 |
"This resource specification was automatically generated |
|
2789 |
by the MenuEditor of ST/X." |
|
2790 |
||
2791 |
"Do not manually edit this!! If it is corrupted, |
|
2792 |
the MenuEditor may not be able to read the specification." |
|
2793 |
||
2794 |
||
2795 |
" |
|
2796 |
MenuEditor new openOnClass:AbstractFileBrowser andSelector:#perforceMenu |
|
2797 |
(Menu new fromLiteralArrayEncoding:(AbstractFileBrowser perforceMenu)) startUp |
|
2798 |
" |
|
2799 |
||
2800 |
<resource: #menu> |
|
2801 |
||
2802 |
^ |
|
2803 |
#(Menu |
|
2804 |
( |
|
2805 |
(MenuItem |
|
2806 |
label: 'Commit' |
|
2807 |
itemValue: perforceCommit |
|
2808 |
translateLabel: true |
|
2809 |
) |
|
2810 |
) |
|
2811 |
nil |
|
2812 |
nil |
|
2813 |
) |
|
2814 |
||
2815 |
"Created: / 15-01-2012 / 13:12:30 / cg" |
|
2816 |
! ! |
|
11144 | 2817 |
|
3892 | 2818 |
!AbstractFileBrowser class methodsFor:'misc'! |
2819 |
||
2820 |
newLock |
|
2821 |
^ CodeExecutionLock new |
|
2822 |
! ! |
|
2823 |
||
17288 | 2824 |
!AbstractFileBrowser class methodsFor:'queries'! |
2825 |
||
2826 |
isAbstract |
|
2827 |
^ self == AbstractFileBrowser |
|
2828 |
! ! |
|
2829 |
||
5644
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2830 |
!AbstractFileBrowser class methodsFor:'resources'! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2831 |
|
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2832 |
classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2833 |
^ FileBrowser classResources |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2834 |
! ! |
e24749db1f5f
share resources with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
5634
diff
changeset
|
2835 |
|
4610 | 2836 |
!AbstractFileBrowser class methodsFor:'utilities'! |
2837 |
||
11262 | 2838 |
contentsOfBytesAsHexDump:data numberOfAddressDigits:addrDigits addressStart:virtualStart |
2839 |
"utility helper: generate a hexDump with addresses" |
|
2840 |
||
17252 | 2841 |
|lines nHexLines replacementForUnprintable| |
2842 |
||
2843 |
"/ used to be: |
|
2844 |
"/ replacementForUnprintable := $. |
|
2845 |
replacementForUnprintable := Character value:16rB7. "/ a centered dot. |
|
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2846 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2847 |
"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
|
2848 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2849 |
nHexLines := (data size + 15) // 16. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2850 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2851 |
lines := VirtualArray new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2852 |
lines setSize:nHexLines + (nHexLines // 16). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2853 |
lines |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2854 |
generator:[:lineNr | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2855 |
|blockNr lineNrInBlock startOffset lineStream asciiLineStream byte line| |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2856 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2857 |
blockNr := (lineNr - 1) // 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2858 |
lineNrInBlock := (lineNr - 1) \\ 17. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2859 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2860 |
lineNrInBlock == 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2861 |
line := '' |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2862 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2863 |
startOffset := ((blockNr * 16) + lineNrInBlock) * 16. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2864 |
lineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2865 |
asciiLineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2866 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2867 |
lineStream nextPutAll:((startOffset+virtualStart) hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2868 |
lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2869 |
1 to:16 do:[:i | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2870 |
i ~~ 1 ifTrue:[ lineStream space ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2871 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2872 |
(startOffset + i) > data size ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2873 |
asciiLineStream nextPut:(Character space). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2874 |
lineStream nextPutAll:' '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2875 |
] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2876 |
byte := data at:startOffset + i. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2877 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2878 |
lineStream nextPutAll:(byte hexPrintString:2). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2879 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2880 |
(byte between:32 and:127) ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2881 |
asciiLineStream nextPut:(Character value:byte) |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2882 |
] ifFalse:[ |
16188 | 2883 |
(byte between:0 and:31) ifTrue:[ |
2884 |
"/ the 'nul', 'soh' .. 'gs' chars in unicodePage 2400 |
|
17252 | 2885 |
"/ are perfect here, but usually not available in the font |
2886 |
"/ and we have currently no way of knowing if they are... |
|
2887 |
"/ (could let the font draw into abitmap and check if there is something...) |
|
2888 |
"/ therefore, for now, write a dot.· |
|
16188 | 2889 |
"/ asciiLineStream nextPut:(Character value:(byte + 16r2400)) |
17252 | 2890 |
asciiLineStream nextPut:replacementForUnprintable. |
16188 | 2891 |
] ifFalse:[ |
17252 | 2892 |
asciiLineStream nextPut:replacementForUnprintable. |
16188 | 2893 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2894 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2895 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2896 |
]. |
12421 | 2897 |
line := (lineStream contents paddedTo:(addrDigits + 1 + (3*16)+ 8)) |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2898 |
, asciiLineStream contents. |
11262 | 2899 |
]. |
11281
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2900 |
line |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2901 |
]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2902 |
^ lines. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2903 |
|
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2904 |
"/ |offs |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2905 |
"/ col line lineStream asciiLineStream lines| |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2906 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2907 |
"/ col := 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2908 |
"/ offs := virtualStart. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2909 |
"/ lines := StringCollection new. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2910 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2911 |
"/ lineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2912 |
"/ asciiLineStream := String writeStream. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2913 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2914 |
"/ lineStream nextPutAll:(offs hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2915 |
"/ lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2916 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2917 |
"/ data do:[:byte | |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2918 |
"/ lineStream nextPutAll:(byte hexPrintString:2). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2919 |
"/ (byte between:32 and:127) ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2920 |
"/ asciiLineStream nextPut:(Character value:byte) |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2921 |
"/ ] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2922 |
"/ asciiLineStream nextPut:$. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2923 |
"/ ]. |
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 |
"/ offs := offs + 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2926 |
"/ col := col + 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2927 |
"/ col > 16 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2928 |
"/ lineStream nextPutAll:' '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2929 |
"/ lineStream nextPutAll:asciiLineStream contents. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2930 |
"/ lines add:(lineStream contents). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2931 |
"/ (offs bitAnd:16rFF) == 0 ifTrue:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2932 |
"/ lines add:nil |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2933 |
"/ ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2934 |
"/ lineStream reset. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2935 |
"/ asciiLineStream reset. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2936 |
"/ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2937 |
"/ lineStream nextPutAll:(offs hexPrintString:addrDigits). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2938 |
"/ lineStream nextPutAll:': '. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2939 |
"/ col := 1. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2940 |
"/ ] ifFalse:[ |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2941 |
"/ lineStream space |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2942 |
"/ ] |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2943 |
"/ ]. |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2944 |
"/ line := lineStream contents paddedTo:(3*16 + addrDigits + 1). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2945 |
"/ lines add:(line , ' ' , asciiLineStream contents). |
1064ace6fbfa
changed: #contentsOfBytesAsHexDump:numberOfAddressDigits:addressStart:
Claus Gittinger <cg@exept.de>
parents:
11262
diff
changeset
|
2946 |
"/ ^ lines |
11262 | 2947 |
|
2948 |
"Created: / 13-02-2012 / 15:01:46 / cg" |
|
2949 |
! |
|
2950 |
||
4610 | 2951 |
contentsOfFileAsHexDump:f |
8472 | 2952 |
^ self contentsOfFileAsHexDump:f withLimit:nil lastPart:nil |
2953 |
! |
|
2954 |
||
2955 |
contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil |
|
4610 | 2956 |
|resources fileName stream data offs |
11262 | 2957 |
addrDigits col lines answer sizeLimit showLastPart| |
4610 | 2958 |
|
2959 |
resources := self classResources. |
|
2960 |
||
2961 |
fileName := f baseName. |
|
2962 |
f isDirectory ifTrue:[ |
|
2963 |
Dialog warn:(resources string:'%1 is a directory.' with:fileName). |
|
2964 |
^ nil |
|
2965 |
]. |
|
2966 |
f exists ifFalse:[ |
|
2967 |
Dialog warn:(resources string:'oops, ''%1'' is gone or unreadable.' with:fileName). |
|
2968 |
^ nil |
|
2969 |
]. |
|
2970 |
f isReadable ifFalse:[ |
|
2971 |
Dialog warn:(resources string:'''%1'' is unreadable.' with:fileName). |
|
2972 |
^ nil |
|
2973 |
]. |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
2974 |
f fileSize > (1024*1024) ifTrue:[ |
8472 | 2975 |
limitOrNil notNil ifTrue:[ |
2976 |
sizeLimit := limitOrNil. |
|
2977 |
showLastPart := showLastPartOrNil |
|
2978 |
] ifFalse:[ |
|
2979 |
answer := Dialog |
|
2980 |
confirmWithCancel:(resources |
|
2981 |
stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' |
|
2982 |
with:(fileName contractTo:40) allBold |
|
2983 |
with:(UnitConverter fileSizeStringFor:f fileSize)) |
|
2984 |
labels:#('Cancel' 'Show All' 'Show First Part' ). |
|
2985 |
||
2986 |
answer isNil ifTrue:[^ nil]. |
|
2987 |
answer ifTrue:[ |
|
2988 |
sizeLimit := 4 * 1024 * 1024 |
|
2989 |
]. |
|
8436 | 2990 |
]. |
4610 | 2991 |
]. |
2992 |
||
2993 |
stream := f readStream binary. |
|
8436 | 2994 |
sizeLimit notNil ifTrue:[ |
8472 | 2995 |
showLastPart == true ifTrue:[ |
2996 |
stream position:(f fileSize - sizeLimit). |
|
2997 |
]. |
|
8436 | 2998 |
data := stream nextBytes:sizeLimit. |
2999 |
] ifFalse:[ |
|
3000 |
data := stream contents. |
|
3001 |
]. |
|
4610 | 3002 |
stream close. |
3003 |
||
3004 |
col := 1. |
|
3005 |
offs := 0. |
|
3006 |
lines := StringCollection new. |
|
3007 |
||
3008 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
3009 |
||
11262 | 3010 |
^ self |
3011 |
contentsOfBytesAsHexDump:data |
|
3012 |
numberOfAddressDigits:addrDigits |
|
3013 |
addressStart:0 |
|
3014 |
||
3015 |
"Modified: / 13-02-2012 / 15:01:19 / cg" |
|
4610 | 3016 |
! ! |
3017 |
||
3892 | 3018 |
!AbstractFileBrowser methodsFor:'actions'! |
3019 |
||
3020 |
askForCommandFor:fileName thenDo:aBlock |
|
6284 | 3021 |
"setup and launch a querybox to ask for a unix command. |
3892 | 3022 |
Then evaluate aBlock passing the command-string as argument." |
3023 |
||
16160 | 3024 |
|box osName commandString alwaysOpenLikeThisHolder openCmd suffix| |
3892 | 3025 |
|
3026 |
osName := OperatingSystem platformName. |
|
3027 |
||
3028 |
box := FilenameEnterBox |
|
4414 | 3029 |
title:(resources string:'Execute %1 command:' with:osName) |
3030 |
okText:(resources string:'Execute') |
|
4523 | 3031 |
action:[:cmd | commandString := cmd]. |
3892 | 3032 |
|
3033 |
fileName notNil ifTrue:[ |
|
4414 | 3034 |
self initialCommandFor:fileName into:box. |
3892 | 3035 |
]. |
16160 | 3036 |
alwaysOpenLikeThisHolder := false asValue. |
3037 |
box verticalPanel add:((CheckBox label:'Always use this command for this file type') model:alwaysOpenLikeThisHolder). |
|
3892 | 3038 |
box directory:(self getDirWithoutFileName:fileName). |
16160 | 3039 |
box open. |
3040 |
||
3041 |
"/ box destroy. |
|
3042 |
alwaysOpenLikeThisHolder value ifTrue:[ |
|
3043 |
openCmd := commandString upTo:$". |
|
3044 |
suffix := fileName suffix. |
|
16306 | 3045 |
UserPreferences current |
3046 |
defaultFileOpenCommandFor:suffix put:(openCmd,' "%1"'); |
|
3047 |
beModified. |
|
3048 |
self breakPoint:#cg. |
|
16160 | 3049 |
]. |
3050 |
||
4523 | 3051 |
commandString notNil ifTrue:[ |
3052 |
aBlock value:commandString |
|
3053 |
]. |
|
3054 |
||
3892 | 3055 |
"Modified: / 7.9.1995 / 10:31:54 / claus" |
3056 |
"Modified: / 16.9.1997 / 15:35:10 / stefan" |
|
3057 |
"Modified: / 14.8.1998 / 14:12:52 / cg" |
|
3058 |
! |
|
3059 |
||
3060 |
changeFileBrowserTitleTo:aString |
|
4774 | 3061 |
self |
3062 |
applicationNamed:#FileBrowserV2 |
|
5009 | 3063 |
ifPresentDo:[:app | app changeFileBrowserTitleTo:aString] |
3892 | 3064 |
! |
3065 |
||
3066 |
copyFileList |
|
4774 | 3067 |
"copy the fileList to the clipBoard" |
3068 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3069 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3070 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3071 |
fileList := self |
4774 | 3072 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3073 |
ifPresentDo:[:app | app browserFileList]. |
3074 |
||
3075 |
fileList notNil ifTrue:[ |
|
3076 |
self copyFileListToClipBoard:fileList. |
|
3077 |
] |
|
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3078 |
! |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3079 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3080 |
copyFileListToClipBoard:fileList |
4774 | 3081 |
"copy the itemList to the clipBoard" |
3082 |
||
3083 |
|stream| |
|
3084 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3085 |
fileList isEmpty ifTrue:[^ self]. |
4774 | 3086 |
|
5772
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3087 |
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
|
3088 |
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
|
3089 |
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
|
3090 |
] ifFalse:[ |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3091 |
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
|
3092 |
(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
|
3093 |
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
|
3094 |
] |
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
3095 |
]. |
3892 | 3096 |
]. |
6034 | 3097 |
self window setClipboardText:stream contents. |
3892 | 3098 |
! |
3099 |
||
3100 |
copySelectedFilenames |
|
4774 | 3101 |
"copy the selected fileNames to the clipBoard" |
3102 |
||
4973
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3103 |
|fileList| |
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3104 |
|
e4b72eec43d3
refactoring the browserItemList access in directoryContentsBrowser
penk
parents:
4963
diff
changeset
|
3105 |
fileList := self |
4774 | 3106 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 3107 |
ifPresentDo:[:appl | appl selectedFileNames]. |
3108 |
fileList notNil ifTrue:[ |
|
3109 |
self copyFileListToClipBoard:fileList. |
|
3110 |
]. |
|
3892 | 3111 |
! |
3112 |
||
10923 | 3113 |
doAddArchiver |
3114 |
|files| |
|
3115 |
||
3116 |
files := self currentSelectedFiles. |
|
3117 |
files size == 1 ifFalse:[ |
|
3118 |
Dialog information:'Select exactly one archive.'. |
|
3119 |
^ self |
|
3120 |
]. |
|
3121 |
||
3122 |
self |
|
3123 |
applicationNamed:#FileApplicationNoteBook |
|
3124 |
ifPresentDo:[:appl | appl doAddArchiverOn:files first]. |
|
3125 |
||
3126 |
"Created: / 29-11-2011 / 19:01:31 / cg" |
|
3127 |
! |
|
3128 |
||
3892 | 3129 |
doAddTerminal |
5960 | 3130 |
|dir| |
3131 |
||
3132 |
dir := self currentDirectory. |
|
3892 | 3133 |
|
5960 | 3134 |
dir isNil ifTrue:[ |
4414 | 3135 |
dir := Filename homeDirectory |
3892 | 3136 |
]. |
4774 | 3137 |
|
5009 | 3138 |
self |
3139 |
applicationNamed:#FileApplicationNoteBook |
|
3140 |
ifPresentDo:[:appl | appl addTerminalIn:dir]. |
|
3892 | 3141 |
! |
3142 |
||
3143 |
doOpenSearchFile |
|
5961 | 3144 |
|item file| |
3145 |
||
3146 |
file := self firstSelectedFileName. |
|
3147 |
file isNil ifTrue:[ |
|
3148 |
file := Filename homeDirectory asAbsoluteFilename. |
|
3149 |
]. |
|
3150 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
3892 | 3151 |
self openSearchFileOn:item. |
3152 |
! |
|
3153 |
||
3154 |
doShowFileContents |
|
5009 | 3155 |
self |
3156 |
applicationNamed:#DirectoryContentsBrowser |
|
3157 |
ifPresentDo:[:appl | ^ appl doShowFileContents]. |
|
3158 |
||
3159 |
^ nil |
|
3892 | 3160 |
! |
3161 |
||
3162 |
doShowProperties |
|
3163 |
"show long stat (file)-info" |
|
3164 |
||
3165 |
self fileGetInfo:true |
|
3166 |
! |
|
3167 |
||
14577 | 3168 |
enterAction |
3169 |
self |
|
3170 |
applicationNamed:#DirectoryContentsBrowser |
|
3171 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl enterAction ]]. |
|
3172 |
! |
|
3173 |
||
5528 | 3174 |
fileEncodingDialog |
14497 | 3175 |
"open a dialog to allow change of the file's character encoding. |
5528 | 3176 |
Files are converted to internal encoding when read, and converted back |
3177 |
to this encoding when saved. |
|
3178 |
Notice: currently, not too many encodings are supported by the system." |
|
3179 |
||
3180 |
|bindings encodings encodingDescr idx selectedEncoding| |
|
3181 |
||
3182 |
encodingDescr := CharacterEncoder supportedExternalEncodings. |
|
3183 |
encodings := encodingDescr collect:[:d | d isNil ifTrue:[nil] ifFalse:[d first]]. |
|
3184 |
||
3185 |
bindings := IdentityDictionary new. |
|
3186 |
bindings at:#encodingList put:encodingDescr. |
|
3187 |
bindings at:#selectedEncoding put:(encodings indexOf:self fileEncoding ifAbsent:1) asValue. |
|
5737 | 3188 |
bindings at:#lockFileEncoding put:(self lockFileEncodingHolder value asValue). |
3189 |
||
5528 | 3190 |
(self openDialogInterface:#encodingDialogSpec withBindings:bindings) |
3191 |
ifTrue:[ |
|
3192 |
idx := (bindings at:#selectedEncoding) value. |
|
3193 |
selectedEncoding := encodings at:idx. |
|
3194 |
selectedEncoding notNil ifTrue:[ |
|
5704 | 3195 |
self fileEncoding:selectedEncoding asSymbol. |
5528 | 3196 |
]. |
5737 | 3197 |
self lockFileEncoding:(bindings at:#lockFileEncoding) value. |
5528 | 3198 |
]. |
3199 |
||
3200 |
"Modified: 30.6.1997 / 14:41:12 / cg" |
|
3201 |
! |
|
3202 |
||
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3203 |
gotoFile:aFilename |
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3204 |
"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
|
3205 |
|
5959 | 3206 |
|currentFileNameHolder currentSel| |
3207 |
||
3208 |
currentFileNameHolder := self currentFileNameHolder. |
|
3209 |
||
3210 |
currentSel := currentFileNameHolder value. |
|
5380
2f738f3a34b1
fixed bug introduced by stefans beautification ;-)
Claus Gittinger <cg@exept.de>
parents:
5374
diff
changeset
|
3211 |
(currentSel includes:aFilename) ifFalse:[ |
9677 | 3212 |
self withWaitCursorDo:[ |
3213 |
currentFileNameHolder value:(OrderedCollection with:(aFilename asAbsoluteFilename)). |
|
3214 |
] |
|
3215 |
]. |
|
3216 |
||
3217 |
"Modified: / 29-12-2010 / 11:04:29 / cg" |
|
3892 | 3218 |
! |
3219 |
||
11053 | 3220 |
lineEndConventionDialog |
3221 |
"open a dialog to allow change of the line end conventions |
|
3222 |
(when writing files)" |
|
3223 |
||
3224 |
|bindings| |
|
3225 |
||
3226 |
bindings := IdentityDictionary new. |
|
3227 |
bindings at:#lineEndConvention put:(self lineEndConvention asValue). |
|
3228 |
||
3229 |
(self openDialogInterface:#lineEndConventionDialogSpec withBindings:bindings) |
|
3230 |
ifTrue:[ |
|
15208 | 3231 |
self lineEndConventionHolder value:(bindings at:#lineEndConvention) value asSymbol |
11053 | 3232 |
]. |
3233 |
||
3234 |
"Created: / 06-01-2012 / 15:34:51 / cg" |
|
3235 |
! |
|
3236 |
||
4392 | 3237 |
newTextEditor |
5009 | 3238 |
self |
3239 |
applicationNamed:#FileApplicationNoteBook |
|
15936 | 3240 |
ifPresentDo:[:appl | |
3241 |
|editor files item| |
|
3242 |
||
3243 |
editor := appl newTextEditor. |
|
3244 |
(files := self currentSelectedFiles) size == 1 ifTrue:[ |
|
3245 |
item := DirectoryContentsBrowser itemClass fileName:files first. |
|
3246 |
editor item:item. |
|
3247 |
]. |
|
3248 |
^ editor |
|
3249 |
]. |
|
5009 | 3250 |
|
3251 |
^ nil. |
|
3252 |
! |
|
3253 |
||
3254 |
openApplByFileItem:anItem |
|
8490 | 3255 |
"/ q: is the following always wanted ? |
9267 | 3256 |
self window sensor shiftDown ifFalse:[ |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3257 |
"/ cg: no - batch and shell scripts are to be |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3258 |
"/ anItem fileName isExecutableProgram ifTrue:[ |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3259 |
"/ self executeCommand:anItem fileName pathName. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3260 |
"/ ^ self. |
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3261 |
"/ ]. |
9267 | 3262 |
|
8490 | 3263 |
"/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
3264 |
"/ Error handle:[:ex | |
|
3265 |
"/ ] do:[ |
|
3266 |
"/ OperatingSystem |
|
3267 |
"/ shellExecute:nil |
|
3268 |
"/ lpOperation:'open' |
|
3269 |
"/ lpFile:(anItem fileName pathName) |
|
3270 |
"/ lpParameters:nil |
|
3271 |
"/ lpDirectory:(self directory pathName) |
|
3272 |
"/ nShowCmd:#SW_SHOWNORMAL. |
|
3273 |
"/ ^ self. |
|
3274 |
"/ ] |
|
3275 |
"/ ] |
|
9267 | 3276 |
]. |
5306 | 3277 |
^ self |
5009 | 3278 |
applicationNamed:#FileApplicationNoteBook |
5306 | 3279 |
ifPresentDo:[:appl | appl openApplByFileItem:anItem]. |
10669
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3280 |
|
079d85556631
changed: #openApplByFileItem:
Claus Gittinger <cg@exept.de>
parents:
10556
diff
changeset
|
3281 |
"Modified: / 06-09-2011 / 11:11:15 / cg" |
3892 | 3282 |
! |
3283 |
||
4392 | 3284 |
openApplForFile:aFilename |
5306 | 3285 |
^ self openApplByFileItem:(DirectoryContentsBrowser itemClass fileName:aFilename). |
4392 | 3286 |
! |
3287 |
||
3892 | 3288 |
openCommandResultApplication |
3289 |
||
5009 | 3290 |
self |
3291 |
applicationNamed:#FileApplicationNoteBook |
|
3292 |
ifPresentDo:[:appl | ^ appl openCommandResultApplication]. |
|
3293 |
||
3294 |
^ nil |
|
3892 | 3295 |
! |
3296 |
||
5010 | 3297 |
openNewTextEditorOn:anItem |
5009 | 3298 |
self |
3299 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3300 |
ifPresentDo:[:appl | ^ appl openNewTextEditorOn:anItem ]. |
5009 | 3301 |
|
3302 |
^ nil |
|
4880
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3303 |
! |
87f511659680
edit file in context menu of DirectoryContentsBroser opens a new tab
penk
parents:
4878
diff
changeset
|
3304 |
|
5010 | 3305 |
openSearchFileOn:anItem |
5009 | 3306 |
self |
3307 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3308 |
ifPresentDo:[:appl | ^ appl openSearchFileOn:anItem]. |
5009 | 3309 |
|
3310 |
^ nil. |
|
3892 | 3311 |
! |
3312 |
||
5162 | 3313 |
openTextEditorForFile:aFilename |
3314 |
^ self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:aFilename). |
|
3315 |
! |
|
3316 |
||
5010 | 3317 |
openTextEditorOn:anItem |
5009 | 3318 |
self |
3319 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3320 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem ]. |
5009 | 3321 |
|
3322 |
^ nil. |
|
3892 | 3323 |
! |
3324 |
||
5010 | 3325 |
openTextEditorOn:anItem type:aDirDescrOrFile |
5009 | 3326 |
self |
3327 |
applicationNamed:#FileApplicationNoteBook |
|
5010 | 3328 |
ifPresentDo:[:appl | ^ appl openTextEditorOn:anItem type:aDirDescrOrFile]. |
5009 | 3329 |
|
3330 |
^ nil. |
|
4618 | 3331 |
! |
3332 |
||
5959 | 3333 |
setCurrentFileName:aFilename |
3334 |
self setCurrentFileNames:(OrderedCollection with:aFilename). |
|
3335 |
! |
|
3336 |
||
3337 |
setCurrentFileNames:aCollectionOfFilenames |
|
3338 |
self currentFileNameHolder value:aCollectionOfFilenames. |
|
3339 |
! |
|
3340 |
||
11053 | 3341 |
tabStopConversionDialog |
3342 |
"open a dialog to allow change of the tab stop conversion (when reading/writing files)" |
|
3343 |
||
3344 |
|bindings| |
|
3345 |
||
3346 |
bindings := IdentityDictionary new. |
|
3347 |
bindings at:#tabStops put:(self inputTabColumnConversion asValue). |
|
3348 |
||
3349 |
(self openDialogInterface:#tabStopConversionDialogSpec withBindings:bindings) |
|
3350 |
ifTrue:[ |
|
3351 |
self inputTabColumnConversionHolder value:(bindings at:#tabStops) value |
|
3352 |
]. |
|
3353 |
||
3354 |
"Created: / 06-01-2012 / 15:36:06 / cg" |
|
3355 |
! |
|
3356 |
||
3892 | 3357 |
updateAndSelect:aColOfFiles |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3358 |
self updateCurrentDirectory. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3359 |
aColOfFiles notNil ifTrue:[ |
5959 | 3360 |
self setCurrentFileNames:aColOfFiles |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
3361 |
]. |
3892 | 3362 |
! |
3363 |
||
3364 |
updateCurrentDirectory |
|
5739 | 3365 |
self updateCurrentDirectory:false |
3366 |
! |
|
3367 |
||
3368 |
updateCurrentDirectory:withReread |
|
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3369 |
DirectoryContents flushCachedDirectoryFor:(self getBestDirectory). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
3370 |
|
5009 | 3371 |
self |
3372 |
applicationNamed:#DirectoryContentsBrowser |
|
5739 | 3373 |
ifPresentDo:[:appl | withReread ifTrue:[appl doUpdate] ifFalse:[appl doUpdateDirectoryContents]]. |
5009 | 3374 |
self |
3375 |
applicationNamed:#DirectoryTreeBrowser |
|
3376 |
ifPresentDo:[:appl | appl doUpdate]. |
|
4345 | 3377 |
! |
3378 |
||
5739 | 3379 |
updateCurrentDirectoryWithReread |
3380 |
self updateCurrentDirectory:true |
|
3381 |
! |
|
3382 |
||
4345 | 3383 |
withActivityIndicationDo:aBlock |
3384 |
||
3385 |
self activityVisibilityChannel value:true. |
|
3386 |
[ |
|
9361 | 3387 |
self withWaitCursorDo:[ |
3388 |
aBlock value. |
|
3389 |
] |
|
4345 | 3390 |
] ensure:[ |
3391 |
self activityVisibilityChannel value:false. |
|
3392 |
] |
|
3892 | 3393 |
! ! |
3394 |
||
3395 |
!AbstractFileBrowser methodsFor:'actions bookmarks'! |
|
3396 |
||
3397 |
addBookmark |
|
3398 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
6725 | 3399 |
self addBookmarks:(self currentSelectedDirectories). |
5960 | 3400 |
self class saveBookmarksInDefaultBookmarksFile |
4679 | 3401 |
! |
3402 |
||
3403 |
addBookmarks:aColOfDirectories |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3404 |
aColOfDirectories do:[ :path | |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3405 |
self class addBookmark:path |
3892 | 3406 |
]. |
3407 |
! |
|
3408 |
||
8013 | 3409 |
editBookmarks |
3410 |
||
3411 |
| default selectedDirectories | |
|
3412 |
||
3413 |
selectedDirectories := self currentSelectedDirectories. |
|
3414 |
selectedDirectories notEmpty ifTrue:[default := selectedDirectories first]. |
|
3415 |
self class editBookmarksWithDefault: default. |
|
3416 |
! |
|
3417 |
||
3892 | 3418 |
hasBookmarks |
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3419 |
^ self class hasBookmarks |
3892 | 3420 |
! |
3421 |
||
3422 |
hasBookmarksToRemove |
|
3423 |
|bookmarks directories| |
|
3424 |
||
3982 | 3425 |
directories := self currentSelectedDirectories. |
3892 | 3426 |
bookmarks := self class directoryBookmarks. |
3427 |
^ (bookmarks size > 0 and:[directories notEmpty]) |
|
3428 |
! |
|
3429 |
||
3430 |
removeBookmark |
|
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3431 |
self currentSelectedDirectories do:[:dir| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
3432 |
self class removeBookmark:dir |
3892 | 3433 |
]. |
4679 | 3434 |
! |
3435 |
||
3436 |
saveBookmarks |
|
3437 |
self class saveBookmarks |
|
3892 | 3438 |
! ! |
3439 |
||
3440 |
!AbstractFileBrowser methodsFor:'actions history'! |
|
3441 |
||
3442 |
addToCommandHistory:aCommandString for:aFilename |
|
6369 | 3443 |
|cmd suffix cmdHist historySize| |
3892 | 3444 |
|
3445 |
cmdHist := self class commandHistory. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
3446 |
(aCommandString notEmptyOrNil) ifTrue:[ |
4414 | 3447 |
cmdHist notNil ifTrue:[ |
3448 |
cmdHist addFirst:aCommandString. |
|
6369 | 3449 |
historySize := self class commandHistorySize. |
3450 |
(historySize notNil and:[cmdHist size > historySize]) ifTrue:[ |
|
4414 | 3451 |
cmdHist removeLast |
3452 |
] |
|
3453 |
]. |
|
3454 |
aFilename notNil ifTrue:[ |
|
3455 |
cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
|
3456 |
DefaultCommandPerSuffix isNil ifTrue:[ |
|
3457 |
DefaultCommandPerSuffix := Dictionary new. |
|
3458 |
]. |
|
3459 |
suffix := aFilename asFilename suffix. |
|
3460 |
suffix notNil ifTrue:[ |
|
3461 |
DefaultCommandPerSuffix at:suffix put:cmd. |
|
3462 |
] |
|
3463 |
] |
|
3892 | 3464 |
] |
3465 |
! |
|
3466 |
||
3467 |
doBack |
|
6286 | 3468 |
"go backward in the history" |
3892 | 3469 |
|
4022 | 3470 |
| fileName| |
3471 |
||
6369 | 3472 |
fileName := self directoryHistory goBackward. |
3892 | 3473 |
fileName notNil ifTrue:[ |
4347 | 3474 |
self gotoFile:(fileName asFilename). |
3892 | 3475 |
] |
3476 |
! |
|
3477 |
||
3478 |
doForward |
|
6286 | 3479 |
"go forward in the history" |
3892 | 3480 |
|
3964 | 3481 |
| fileName| |
3482 |
||
6369 | 3483 |
fileName := self directoryHistory goForward. |
3892 | 3484 |
fileName notNil ifTrue:[ |
4414 | 3485 |
self gotoFile:(fileName asFilename). |
4022 | 3486 |
] ifFalse:[ |
4414 | 3487 |
self enableForward value:false. |
4022 | 3488 |
|
3489 |
]. |
|
3892 | 3490 |
! ! |
3491 |
||
3492 |
!AbstractFileBrowser methodsFor:'applications'! |
|
3493 |
||
5009 | 3494 |
applicationNamed:anApplicationName ifPresentDo:aBlock |
3495 |
|appl| |
|
3496 |
||
3497 |
appl := self applications at:anApplicationName ifAbsent:nil. |
|
3498 |
appl notNil ifTrue:[ |
|
3499 |
^ aBlock value:appl |
|
3500 |
]. |
|
3501 |
^ nil. |
|
3502 |
! |
|
3503 |
||
4004 | 3504 |
directoryContentsBrowser |
3505 |
^ self applications at:#DirectoryContentsBrowser ifAbsent:nil. |
|
3892 | 3506 |
! ! |
3507 |
||
3508 |
!AbstractFileBrowser methodsFor:'aspects'! |
|
3509 |
||
3510 |
applications |
|
3511 |
^ aspects at:#applications |
|
3512 |
! |
|
3513 |
||
3514 |
backgroundProcesses |
|
3515 |
||
3516 |
^ self aspectFor:#backgroundProcesses ifAbsent:[List new] |
|
3517 |
! |
|
3518 |
||
4230 | 3519 |
canMake |
15259 | 3520 |
^ self aspectFor:#canMake ifAbsent:[ ValueHolder with:false ]. |
4230 | 3521 |
! |
3522 |
||
3892 | 3523 |
currentDirectories |
6725 | 3524 |
" returns a holder on a Collection of all currently selected directories |
3525 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3892 | 3526 |
" |
3527 |
||
3528 |
^ self aspectFor:#currentDirectories ifAbsent:[ (OrderedCollection new) asValue ]. |
|
3529 |
! |
|
3530 |
||
6725 | 3531 |
currentDirectoriesValue |
3532 |
" returns a Collection of all currently selected directories |
|
3533 |
if only a file is selected, currentDirectories holds the directory of the file |
|
3534 |
" |
|
3535 |
||
3536 |
^ self currentDirectories value |
|
3537 |
! |
|
3538 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3539 |
currentDirectory |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3540 |
"return the single current directory or nil" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3541 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3542 |
|directories| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3543 |
|
6725 | 3544 |
directories := self currentSelectedDirectories. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3545 |
(directories size ~= 1) ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3546 |
^ nil |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3547 |
]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3548 |
^ directories first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3549 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
3550 |
|
13856 | 3551 |
currentDirectoryDisplayed |
3552 |
"Return a directory as Filename that is currently displayed in the browser" |
|
3553 |
||
3554 |
^self subclassResponsibility |
|
3555 |
||
3556 |
"Created: / 14-01-2013 / 11:57:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3557 |
! |
|
3558 |
||
3892 | 3559 |
currentFileNameHolder |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3560 |
"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
|
3561 |
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
|
3562 |
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
|
3563 |
|
6589 | 3564 |
^ self aspectFor:#currentFileNameHolder |
3565 |
ifAbsent:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3566 |
|currentSel| |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3567 |
|
4692 | 3568 |
currentSel := self class currentSelection. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3569 |
currentSel isEmpty ifTrue:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3570 |
currentSel := OrderedCollection with:(Filename currentDirectory asAbsoluteFilename) |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3571 |
]. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3572 |
currentSel asValue |
6589 | 3573 |
] |
3574 |
notPresentDo:[:holder| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3575 |
|filenames newFilenames| |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3576 |
filenames := holder value. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3577 |
newFilenames := Set new. |
6589 | 3578 |
filenames do:[:eachFilename| |
3579 |
|existingFilename| |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3580 |
existingFilename := eachFilename. |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3581 |
existingFilename notNil ifTrue:[ |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3582 |
[existingFilename isRootDirectory or:[existingFilename exists]] whileFalse:[ |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3583 |
existingFilename := existingFilename directory. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3584 |
]. |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3585 |
existingFilename exists ifTrue:[ |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3586 |
newFilenames add:existingFilename. |
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3587 |
]. |
4955
378481247391
if no item is selected directory up action do nothing now
penk
parents:
4950
diff
changeset
|
3588 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3589 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3590 |
newFilenames asOrderedCollection. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3591 |
] |
9649
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3592 |
|
ad956ada348e
changed: #currentFileNameHolder
Claus Gittinger <cg@exept.de>
parents:
9607
diff
changeset
|
3593 |
"Modified: / 27-11-2010 / 15:42:45 / cg" |
3892 | 3594 |
! |
3595 |
||
5528 | 3596 |
defaultFileEncoding |
3597 |
^ #'iso8859-1' "/ #'utf-8' |
|
3598 |
! |
|
3599 |
||
3892 | 3600 |
enableDirectoryUp |
3601 |
||
15259 | 3602 |
^ self aspectFor:#enableDirectoryUp ifAbsent:[ValueHolder with:false] |
3892 | 3603 |
! |
3604 |
||
6456 | 3605 |
enableGotoDefaultDirectory |
15259 | 3606 |
^ self aspectFor:#enableGotoDefaultDirectory ifAbsent:[ ValueHolder with:true ]. |
4593 | 3607 |
! |
3608 |
||
8168 | 3609 |
enableGotoDesktop |
14308 | 3610 |
"/ backward compatibility |
3611 |
^ self enableGotoDesktopDirectory. |
|
8168 | 3612 |
! |
3613 |
||
9572 | 3614 |
enableGotoDesktopDirectory |
15259 | 3615 |
^ self aspectFor:#enableGotoDesktopDirectory ifAbsent:[ ValueHolder with:true ]. |
9572 | 3616 |
|
3617 |
"Created: / 01-10-2010 / 16:19:17 / cg" |
|
3618 |
! |
|
3619 |
||
6434 | 3620 |
enableGotoSmalltalkDirectory |
6456 | 3621 |
^ self aspectFor:#enableGotoSmalltalkDirectory ifAbsent:[ true asValue ]. |
6434 | 3622 |
! |
3623 |
||
17187 | 3624 |
enableGotoSmalltalkWorkspaceDirectory |
3625 |
^ self aspectFor:#enableGotoSmalltalkWorkspaceDirectory ifAbsent:[ true asValue ]. |
|
3626 |
! |
|
3627 |
||
9677 | 3628 |
enableGotoTempDirectory |
3629 |
^ self aspectFor:#enableGotoTempDirectory ifAbsent:[ true asValue ]. |
|
3630 |
||
3631 |
"Created: / 29-12-2010 / 11:01:17 / cg" |
|
3632 |
! |
|
3633 |
||
3892 | 3634 |
enableHome |
3635 |
||
3636 |
^ self aspectFor:#enableHome ifAbsent:[ true asValue ]. |
|
3637 |
! |
|
3638 |
||
9596 | 3639 |
enableMakeCurrentDirectory |
3640 |
^ self aspectFor:#enableMakeCurrentDirectory ifAbsent:[ true asValue ]. |
|
3641 |
||
3642 |
"Created: / 26-10-2010 / 17:17:58 / cg" |
|
3643 |
! |
|
3644 |
||
3892 | 3645 |
enableViewNoteBookApplication |
3646 |
||
3647 |
^ self aspectFor:#enableViewNoteBookApplication ifAbsent:[false asValue] |
|
3648 |
! |
|
3649 |
||
5528 | 3650 |
fileEncoding |
3651 |
^ self fileEncodingHolder value |
|
3652 |
! |
|
3653 |
||
3654 |
fileEncoding:newEncoding |
|
5533 | 3655 |
self fileEncodingHolder value:newEncoding. |
3656 |
||
3657 |
self |
|
3658 |
applicationNamed:#FileApplicationNoteBook |
|
3659 |
ifPresentDo:[:nb | |
|
3660 |
|appl| |
|
3661 |
||
3662 |
appl := nb selectedApplication. |
|
5535 | 3663 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
5533 | 3664 |
appl fileEncoding:newEncoding |
3665 |
] |
|
3666 |
]. |
|
5528 | 3667 |
! |
3668 |
||
5737 | 3669 |
fileEncodingHolder |
3670 |
^ self |
|
3671 |
aspectFor:#fileEncodingHolder |
|
3672 |
ifAbsent:[ |
|
3673 |
self |
|
3674 |
applicationNamed:#FileApplicationNoteBook |
|
3675 |
ifPresentDo:[:appl | appl fileEncodingHolder]. |
|
3676 |
] |
|
3677 |
! |
|
3678 |
||
5961 | 3679 |
firstSelectedFileName |
3680 |
|files| |
|
3681 |
||
7560 | 3682 |
files := self currentSelectedObjects. |
5961 | 3683 |
files notEmpty ifTrue:[ |
3684 |
^ files first |
|
3685 |
]. |
|
3686 |
^ nil |
|
7560 | 3687 |
|
3688 |
"Modified: / 04-12-2006 / 13:14:53 / cg" |
|
5961 | 3689 |
! |
3690 |
||
6456 | 3691 |
gotoDefaultDirectoryIsVisible |
9596 | 3692 |
^ true. |
3693 |
"/ ^ (Filename defaultDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
3694 |
||
3695 |
"Modified: / 26-10-2010 / 17:23:51 / cg" |
|
6456 | 3696 |
! |
3697 |
||
9572 | 3698 |
gotoDesktopDirectoryIsVisible |
3699 |
Filename desktopDirectory = Filename homeDirectory ifTrue:[^ false]. |
|
3700 |
||
3701 |
^ (Filename desktopDirectory asAbsoluteFilename) ~= (self smalltalkDirectory asAbsoluteFilename). |
|
3702 |
||
3703 |
"Created: / 01-10-2010 / 16:26:27 / cg" |
|
3704 |
! |
|
3705 |
||
4618 | 3706 |
hasFileSelection |
3707 |
^ self aspectFor:#hasFileSelection ifAbsent:[ false asValue ]. |
|
3708 |
! |
|
3709 |
||
9490 | 3710 |
hasNotTwoDirectoriesSelectedHolder |
3711 |
^ self |
|
3712 |
aspectFor:#hasNotTwoDirectoriesSelectedHolder |
|
3713 |
ifAbsent:[ |
|
3714 |
BlockValue |
|
3715 |
with:[:m | self hasTwoDirectoriesSelected not] |
|
3716 |
argument:self currentFileNameHolder |
|
3717 |
]. |
|
3718 |
||
3719 |
"Created: / 20-05-2010 / 10:45:50 / cg" |
|
3720 |
! |
|
3721 |
||
5830 | 3722 |
hasNotTwoFilesSelectedHolder |
9490 | 3723 |
^ self |
3724 |
aspectFor:#hasNotTwoFilesSelectedHolder |
|
5830 | 3725 |
ifAbsent:[ |
3726 |
BlockValue |
|
3727 |
with:[:m | self hasTwoFilesSelected not] |
|
3728 |
argument:self currentFileNameHolder |
|
3729 |
]. |
|
9490 | 3730 |
|
3731 |
"Modified: / 20-05-2010 / 10:46:01 / cg" |
|
5830 | 3732 |
! |
3733 |
||
3892 | 3734 |
hasSelection |
3735 |
||
3736 |
^ self aspectFor:#hasSelection ifAbsent:[ false asValue ]. |
|
3737 |
! |
|
3738 |
||
9490 | 3739 |
hasTwoDirectoriesSelectedHolder |
3740 |
^ self |
|
3741 |
aspectFor:#hasTwoDirectoriesSelectedHolder |
|
3742 |
ifAbsent:[ |
|
3743 |
BlockValue |
|
3744 |
with:[:m | self hasTwoDirectoriesSelected] |
|
3745 |
argument:self currentFileNameHolder |
|
3746 |
]. |
|
3747 |
||
3748 |
"Created: / 20-05-2010 / 10:45:41 / cg" |
|
3749 |
! |
|
3750 |
||
4414 | 3751 |
hasTwoFilesSelectedHolder |
9490 | 3752 |
^ self |
3753 |
aspectFor:#hasTwoFilesSelectedHolder |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3754 |
ifAbsent:[ |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3755 |
BlockValue |
5830 | 3756 |
with:[:m | self hasTwoFilesSelected] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3757 |
argument:self currentFileNameHolder |
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
3758 |
]. |
9490 | 3759 |
|
3760 |
"Modified: / 20-05-2010 / 10:46:08 / cg" |
|
4414 | 3761 |
! |
3762 |
||
11053 | 3763 |
inputTabColumnConversion |
3764 |
^ self inputTabColumnConversionHolder value |
|
3765 |
||
3766 |
"Created: / 06-01-2012 / 15:25:56 / cg" |
|
3767 |
! |
|
3768 |
||
3769 |
inputTabColumnConversionHolder |
|
3770 |
^ self |
|
3771 |
aspectFor:#inputTabColumnConversionHolder |
|
3772 |
ifAbsent:[ |
|
3773 |
self |
|
3774 |
applicationNamed:#FileApplicationNoteBook |
|
3775 |
ifPresentDo:[:appl | appl inputTabColumnConversionHolder]. |
|
3776 |
] |
|
3777 |
||
3778 |
"Created: / 06-01-2012 / 15:26:16 / cg" |
|
3779 |
! |
|
3780 |
||
3781 |
lineEndConvention |
|
15208 | 3782 |
^ self lineEndConventionHolder value asSymbol |
11053 | 3783 |
|
3784 |
"Created: / 06-01-2012 / 13:05:14 / cg" |
|
3785 |
! |
|
3786 |
||
11591 | 3787 |
lineEndConvention: aSymbol |
15208 | 3788 |
self lineEndConventionHolder value: aSymbol asSymbol |
11591 | 3789 |
|
3790 |
"Created: / 11-07-2012 / 19:51:58 / cg" |
|
3791 |
! |
|
3792 |
||
11053 | 3793 |
lineEndConventionHolder |
3794 |
^ self |
|
3795 |
aspectFor:#lineEndConventionHolder |
|
3796 |
ifAbsent:[ |
|
3797 |
self |
|
3798 |
applicationNamed:#FileApplicationNoteBook |
|
3799 |
ifPresentDo:[:appl | appl lineEndConventionHolder]. |
|
3800 |
] |
|
3801 |
||
3802 |
"Created: / 06-01-2012 / 13:02:51 / cg" |
|
3803 |
! |
|
3804 |
||
5737 | 3805 |
lockFileEncoding:aBoolean |
3806 |
self lockFileEncodingHolder value:aBoolean. |
|
3807 |
||
3808 |
self |
|
3809 |
applicationNamed:#FileApplicationNoteBook |
|
3810 |
ifPresentDo:[:nb | |
|
3811 |
|appl| |
|
3812 |
||
3813 |
appl := nb selectedApplication. |
|
3814 |
(appl notNil and:[appl isTextEditor]) ifTrue:[ |
|
3815 |
appl lockFileEncoding:aBoolean |
|
3816 |
] |
|
3817 |
]. |
|
3818 |
! |
|
3819 |
||
3820 |
lockFileEncodingHolder |
|
3821 |
^ self |
|
3822 |
aspectFor:#lockFileEncodingHolder |
|
3823 |
ifAbsent:[ |
|
3824 |
self |
|
3825 |
applicationNamed:#FileApplicationNoteBook |
|
3826 |
ifPresentDo:[:appl | appl lockFileEncodingHolder]. |
|
3827 |
] |
|
3828 |
! |
|
3829 |
||
13856 | 3830 |
makeCommandHolder |
3831 |
^ self aspectFor:#makeCommandHolder ifAbsent:[ nil asValue ]. |
|
3832 |
||
3833 |
"Created: / 13-04-2012 / 17:01:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3834 |
! |
|
3835 |
||
4523 | 3836 |
notify:aString |
11108 | 3837 |
"aString is shown in the lower pane" |
3838 |
||
4523 | 3839 |
self notifyChannel value:aString |
11108 | 3840 |
|
3841 |
"Modified (comment): / 11-01-2012 / 21:46:55 / cg" |
|
4523 | 3842 |
! |
3843 |
||
3892 | 3844 |
notifyChannel |
3845 |
||
3846 |
^ self aspectFor:#notifyChannel ifAbsent:['' asValue] |
|
4071 | 3847 |
! |
3848 |
||
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3849 |
progressPercentageHolder |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3850 |
^ self aspectFor:#progressPercentageHolder ifAbsent:[ nil asValue ]. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3851 |
|
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3852 |
"Created: / 11-10-2010 / 12:54:46 / cg" |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3853 |
! |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
3854 |
|
4071 | 3855 |
rootHolder |
3856 |
"holder, which keeps the rootHolder of the treeView |
|
3857 |
" |
|
3858 |
||
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3859 |
^ self aspectFor:#rootHolder ifAbsent:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3860 |
self class rootHolder asValue. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
3861 |
]. |
8192
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3862 |
! |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3863 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3864 |
rootHolder:aHolder |
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3865 |
|
26660fb61e7a
Make FileDialog usable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8185
diff
changeset
|
3866 |
self aspectFor:#rootHolder put:aHolder |
3892 | 3867 |
! ! |
3868 |
||
3869 |
!AbstractFileBrowser methodsFor:'aspects handling'! |
|
3870 |
||
3871 |
aspectFor:something ifAbsent:aBlock |
|
6284 | 3872 |
"returns the model for an aspect; these are stored in a common dictionary" |
3873 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3874 |
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil |
3892 | 3875 |
! |
3876 |
||
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3877 |
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock |
6284 | 3878 |
"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
|
3879 |
|
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3880 |
|holder saveAspectItem aspect| |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3881 |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3882 |
holder := aspects at:aKey ifAbsent:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3883 |
masterApplication notNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3884 |
holder := masterApplication aspectOrNil:aKey forSubApplication:self. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3885 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3886 |
holder isNil ifTrue:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3887 |
saveAspectItem := self runtimeAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3888 |
saveAspectItem notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3889 |
saveAspectItem isHolder ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3890 |
holder := ValueHolder with:saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3891 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3892 |
holder := saveAspectItem value |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3893 |
]. |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3894 |
] ifFalse:[ |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3895 |
aspect := self userPreferencesAspectValueFor:aKey. |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3896 |
aspect notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3897 |
holder := aspect asValue |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3898 |
] ifFalse:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3899 |
holder := aBlock value. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3900 |
] |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3901 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3902 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3903 |
holder notNil ifTrue:[ |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3904 |
notPresentBlock notNil ifTrue:[ |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3905 |
holder value:(notPresentBlock value:holder). |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3906 |
]. |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
3907 |
aspects at:aKey put:holder |
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3908 |
]. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3909 |
holder |
4213
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3910 |
]. |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3911 |
^ holder |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3912 |
! |
b8e7d4276a33
startup if old filename not present - go up to first directory in path
penk
parents:
4203
diff
changeset
|
3913 |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3914 |
aspectFor:something put:aValueHolder |
6284 | 3915 |
"stores the model for an aspect; these are stored in a common dictionary" |
3916 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3917 |
aspects at:something put:aValueHolder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3918 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
3919 |
|
3892 | 3920 |
aspects |
6284 | 3921 |
"returns the common aspect dictionary" |
3922 |
||
3892 | 3923 |
^ aspects |
3924 |
! |
|
3925 |
||
3926 |
runtimeAspectValueFor:something |
|
3927 |
"returns the default aspect item from the class variable RuntimeAspects |
|
3928 |
" |
|
3929 |
^ self class runtimeAspects at:something ifAbsent:nil. |
|
3930 |
! |
|
3931 |
||
4201 | 3932 |
saveAspectValues |
16306 | 3933 |
|prefs saveAspects aspectValue| |
3934 |
||
3935 |
prefs := UserPreferences current. |
|
3936 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3937 |
saveAspects := self class userPreferencesAspectList keys. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3938 |
saveAspects do:[ :aspectKey | |
4201 | 3939 |
aspectValue := (self perform:aspectKey) value. |
16306 | 3940 |
prefs |
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3941 |
at: ('fileBrowser_',aspectKey asString) asSymbol |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3942 |
put: aspectValue. |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3943 |
]. |
16306 | 3944 |
prefs beModified. |
3945 |
||
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3946 |
"Modified: / 04-09-2006 / 10:02:41 / cg" |
4201 | 3947 |
! |
3948 |
||
3892 | 3949 |
saveRuntimeAspectValues |
3950 |
|savedAspects dictionary value isHolder aspect| |
|
3951 |
||
5941 | 3952 |
savedAspects := self class listOfRuntimeValuesToRemember. |
3892 | 3953 |
dictionary := Dictionary new. |
5941 | 3954 |
savedAspects do:[:aspectKey | |
4414 | 3955 |
aspect := self perform:aspectKey. |
3956 |
isHolder := aspect isValueModel. |
|
5941 | 3957 |
isHolder ifTrue:[ |
3958 |
value := aspect value |
|
3959 |
] ifFalse:[ |
|
3960 |
value := aspect |
|
3961 |
]. |
|
3962 |
dictionary at:aspectKey |
|
3963 |
put:(SaveAspectItem withValue:value isHolder:isHolder) |
|
3964 |
]. |
|
3965 |
RuntimeAspects := dictionary. |
|
3892 | 3966 |
! |
3967 |
||
4201 | 3968 |
userPreferencesAspectValueFor:something |
3969 |
"returns the default aspect from the Userpreferences |
|
3892 | 3970 |
" |
4201 | 3971 |
|
7078
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3972 |
(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
|
3973 |
^ UserPreferences current |
47db06f88879
preference-keys are private (no dependencies in UserPrefs)
Claus Gittinger <cg@exept.de>
parents:
7050
diff
changeset
|
3974 |
at:('fileBrowser_',something) asSymbol |
9579
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
3975 |
ifAbsent:nil "(self class userPreferencesAspectList at:something)". |
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
3976 |
|
7107f49e4583
changed: #userPreferencesAspectValueFor:
Claus Gittinger <cg@exept.de>
parents:
9575
diff
changeset
|
3977 |
"Modified: / 14-10-2010 / 19:16:38 / cg" |
3892 | 3978 |
! ! |
3979 |
||
4011 | 3980 |
!AbstractFileBrowser methodsFor:'aspects-filter'! |
3981 |
||
9015 | 3982 |
filter:aString |
3983 |
self filterModel value:aString |
|
3984 |
! |
|
3985 |
||
4018 | 3986 |
filterBackgroundColor |
3987 |
||
3988 |
^ self aspectFor:#filterBackgroundColor ifAbsent:[Color white asValue] |
|
3989 |
! |
|
3990 |
||
4011 | 3991 |
filterBlockHolder |
3992 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
3993 |
^ self aspectFor:#filterBlockHolder ifAbsent:[self makeFilterBlock asValue] |
4011 | 3994 |
! |
3995 |
||
3996 |
filterListModel |
|
3997 |
||
3998 |
^ self aspectFor:#filterListModel ifAbsent:[self class defaultFilterList] |
|
3999 |
! |
|
4000 |
||
4001 |
filterModel |
|
5941 | 4002 |
|m| |
4003 |
||
4004 |
m := self aspectFor:#filterModel ifAbsent:[(self filterListModel at:1) asValue]. |
|
4005 |
^ m |
|
4011 | 4006 |
! |
4007 |
||
8185
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4008 |
filterModel:aHolder |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4009 |
self aspectFor:#filterModel put:aHolder. |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4010 |
! |
8b6f11fd7fbf
Make #filterModel reusable as SubCanvas
Stefan Vogel <sv@exept.de>
parents:
8172
diff
changeset
|
4011 |
|
4018 | 4012 |
filterValueBox |
4013 |
||
4014 |
^ self aspectFor:#filterValueBox ifAbsent:[ValueHolder new] |
|
4015 |
! |
|
4016 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4017 |
makeFilterBlock |
14497 | 4018 |
"return a two-arg filterblock on the file's path- and base-name. This block should return true for files |
9102 | 4019 |
to be shown" |
4020 |
||
12760 | 4021 |
| filterString filterStrings filters notFilters showHidden filterBlock ignoreCase| |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4022 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4023 |
filterString := self filterModel value. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4024 |
filterString = '' ifTrue:[filterString := '*']. |
7565
521264d23941
ignoreCase if Filename is not case sensitive in #makeFilterBlock
fm
parents:
7560
diff
changeset
|
4025 |
ignoreCase := "ignoreCaseInPattern ? "(Filename isCaseSensitive not). |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4026 |
|
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4027 |
filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;. |
12760 | 4028 |
filterStrings := filterStrings |
4029 |
select:[:eachFilter | eachFilter withoutSeparators notEmpty]. |
|
4030 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4031 |
filters := filterStrings |
12760 | 4032 |
reject:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
4033 |
thenCollect: |
|
4034 |
[:eachPattern | |
|
4035 |
|pattern| |
|
4036 |
||
4037 |
pattern := eachPattern withoutSeparators. |
|
15597 | 4038 |
pattern includesMatchCharacters ifFalse:[ |
4039 |
"JV@2012-03-05: Add implict star at the beginning and at the end of pattern, |
|
4040 |
that's how most of the other applications behave - do what most users expect" |
|
4041 |
pattern first == $* ifFalse:[pattern := '*' , pattern]. |
|
4042 |
pattern last == $* ifFalse:[pattern := pattern , '*']. |
|
4043 |
]. |
|
13856 | 4044 |
|
4045 |
[:name :baseName | pattern match:baseName ignoreCase:ignoreCase] |
|
12760 | 4046 |
]. |
4047 |
||
4048 |
notFilters := filterStrings |
|
4049 |
select:[:eachFilter | eachFilter withoutSeparators startsWith:'~'] |
|
4050 |
thenCollect: |
|
4051 |
[:eachPattern | |
|
9296 | 4052 |
|pattern| |
4053 |
||
4054 |
pattern := eachPattern withoutSeparators. |
|
12760 | 4055 |
pattern := (pattern copyFrom:2) withoutSeparators. |
13439 | 4056 |
[:name :baseName | pattern match:baseName caseSensitive:ignoreCase not] |
9296 | 4057 |
]. |
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4058 |
|
12760 | 4059 |
|
4060 |
(filters size == 1 and:[notFilters isEmpty]) ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4061 |
filterBlock := filters first |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4062 |
] ifFalse:[ |
12760 | 4063 |
filters isEmpty ifTrue:[ |
4064 |
filterBlock := [:name :baseName | |
|
4065 |
(notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not |
|
4066 |
]. |
|
4067 |
] ifFalse:[ |
|
4068 |
notFilters isEmpty ifTrue:[ |
|
4069 |
filterBlock := [:name :baseName | |
|
4070 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4071 |
]. |
|
4072 |
] ifFalse:[ |
|
4073 |
filterBlock := [:name :baseName | |
|
4074 |
(filters contains:[:aFilter | aFilter value:name value:baseName ]) |
|
4075 |
and:[ (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not ] |
|
4076 |
]. |
|
4077 |
] |
|
4078 |
] |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4079 |
]. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4080 |
|
4011 | 4081 |
showHidden := self showHiddenFiles value. |
4082 |
showHidden ifTrue:[ |
|
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4083 |
^ filterBlock. |
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4084 |
]. |
9296 | 4085 |
^ [:name :baseName | |
4086 |
name isHidden not and:[filterBlock value:name value:baseName]]. |
|
13856 | 4087 |
|
4088 |
"Modified: / 05-02-2012 / 01:42:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4018 | 4089 |
! |
4090 |
||
4091 |
shownFiles |
|
4092 |
||
4093 |
^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue] |
|
4011 | 4094 |
! ! |
4095 |
||
14126 | 4096 |
|
3892 | 4097 |
!AbstractFileBrowser methodsFor:'aspects-history'! |
4098 |
||
4099 |
dirHistory |
|
6369 | 4100 |
"obsolete" |
4101 |
^ self directoryHistory |
|
4102 |
! |
|
4103 |
||
4104 |
directoryHistory |
|
3952 | 4105 |
^ self class directoryHistory |
3892 | 4106 |
! |
4107 |
||
4108 |
enableBack |
|
4109 |
||
15259 | 4110 |
^ self aspectFor:#enableBack ifAbsent:[ValueHolder with:false] |
3892 | 4111 |
! |
4112 |
||
4113 |
enableFileHistory |
|
4114 |
||
15259 | 4115 |
^ self aspectFor:#enableFileHistory ifAbsent:[ValueHolder with:false] |
3892 | 4116 |
! |
4117 |
||
4118 |
enableForward |
|
4119 |
||
15259 | 4120 |
^ self aspectFor:#enableForward ifAbsent:[ValueHolder with:false] |
3892 | 4121 |
! |
4122 |
||
4123 |
fileHistory |
|
9820
07b7d7929e3e
variable renamed in: #fileHistory
Stefan Vogel <sv@exept.de>
parents:
9793
diff
changeset
|
4124 |
^ self aspectFor:#fileHistory ifAbsent:[OrderedSet new] |
3892 | 4125 |
! ! |
4126 |
||
4127 |
!AbstractFileBrowser methodsFor:'aspects-visibility'! |
|
4128 |
||
4345 | 4129 |
activityVisibilityChannel |
6284 | 4130 |
" activityVisibilityChannel switches the activity indicator on/off" |
4345 | 4131 |
|
15259 | 4132 |
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ ValueHolder with:false ]. |
4345 | 4133 |
! |
4134 |
||
15111 | 4135 |
alwaysUseSmalltalkTools |
4136 |
" aspect to prevent os tools to be opened on double click" |
|
4137 |
||
15259 | 4138 |
^ self aspectFor:#alwaysUseSmalltalkTools ifAbsent:[ ValueHolder with:true ]. |
15111 | 4139 |
! |
4140 |
||
6602 | 4141 |
changeSetBrowserItemVisible |
4142 |
^ Screen current ctrlDown. |
|
4143 |
! |
|
4144 |
||
11135 | 4145 |
cvsMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4146 |
^ ConfigurableFeatures includesFeature: #CVSSupportEnabled |
11135 | 4147 |
|
4148 |
"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
|
4149 |
"Modified: / 19-01-2012 / 10:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4150 |
! |
4151 |
||
13856 | 4152 |
hgMenusAreShown |
4153 |
^ (ConfigurableFeatures includesFeature: #HGSupportEnabled) |
|
4154 |
||
4155 |
"Created: / 14-01-2013 / 11:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4156 |
! |
|
4157 |
||
11135 | 4158 |
mercurialMenusAreShown |
11147 | 4159 |
^ ConfigurableFeatures hasMercurialSupportEnabled |
11135 | 4160 |
|
4161 |
"Created: / 15-01-2012 / 13:00:00 / cg" |
|
4162 |
! |
|
4163 |
||
4110 | 4164 |
openAlwaysInTextEditor |
17024 | 4165 |
" aspect for open every file in TextEditor don't use e.g. HtmlEditor for *.html'" |
4110 | 4166 |
|
15111 | 4167 |
^ self aspectFor:#openAlwaysInTextEditor ifAbsent:[ false asValue ]. |
4110 | 4168 |
! |
4169 |
||
3892 | 4170 |
openMultipleApplicationsForType |
4171 |
||
4201 | 4172 |
" aspect for open more applications for e.g. TextEditor and not change the contents of already |
4173 |
open TextEditor " |
|
4174 |
||
3892 | 4175 |
^ self aspectFor:#openMultipleApplicationsForType ifAbsent:[ false asValue ]. |
4176 |
! |
|
4177 |
||
11137 | 4178 |
perforceMenusAreShown |
11996
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4179 |
^ (ConfigurableFeatures includesFeature: #PerforceSupportEnabled) |
e3b824f2d454
changed: #perforceMenusAreShown
Claus Gittinger <cg@exept.de>
parents:
11995
diff
changeset
|
4180 |
and:[ ConfigurableFeatures hasPerforceSupportEnabled ] |
11137 | 4181 |
|
4182 |
"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
|
4183 |
"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
|
4184 |
"Modified: / 02-11-2012 / 11:19:59 / cg" |
11137 | 4185 |
! |
4186 |
||
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
|
4187 |
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
|
4188 |
|
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
|
4189 |
^ 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
|
4190 |
|
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
|
4191 |
"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
|
4192 |
! |
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
|
4193 |
|
4201 | 4194 |
showDirectoryTree |
4195 |
||
4196 |
^ self aspectFor:#showDirectoryTree ifAbsent:[ true asValue ] |
|
3892 | 4197 |
! |
4198 |
||
4554 | 4199 |
showDiskUsageHolder |
4200 |
|holder| |
|
4201 |
||
4560
0d3db5e27bc0
default for disk usage is false
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
4202 |
holder := self aspectFor:#showDiskUsageHolder ifAbsent:[ false asValue]. |
4781 | 4203 |
holder addDependent:self. |
4554 | 4204 |
^ holder |
4205 |
! |
|
4206 |
||
3892 | 4207 |
showHiddenFiles |
4208 |
||
9582 | 4209 |
^ self aspectFor:#showHiddenFiles ifAbsent:[ true asValue ]. |
4210 |
||
4211 |
"Modified: / 15-10-2010 / 10:28:17 / cg" |
|
3892 | 4212 |
! |
4213 |
||
9108 | 4214 |
showHiddenFiles:aHolder |
4215 |
self aspectFor:#showHiddenFiles put:aHolder. |
|
4216 |
! |
|
4217 |
||
4218 |
shownFiles:aHolder |
|
4219 |
self aspectFor:#shownFiles put:aHolder. |
|
4220 |
! |
|
4221 |
||
11135 | 4222 |
svnMenusAreShown |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
4223 |
^ ConfigurableFeatures includesFeature: #SubversionSupportEnabled |
11135 | 4224 |
|
4225 |
"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
|
4226 |
"Modified: / 19-01-2012 / 10:43:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11135 | 4227 |
! |
4228 |
||
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4229 |
tagsBrowserVisibleHolder |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4230 |
masterApplication notNil ifTrue:[ |
11162
faf8af233ac0
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
11156
diff
changeset
|
4231 |
^ masterApplication perform:#tagsBrowserVisibleHolder ifNotUnderstood:false |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4232 |
]. |
10762
311190be6490
changed: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
10757
diff
changeset
|
4233 |
^ self aspectFor:#tagsBrowserVisibleHolder ifAbsent:[ FileApplicationNoteBook::TextEditor defaultTagsBrowserVisible asValue ]. |
9945
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4234 |
|
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4235 |
"Created: / 27-06-2011 / 16:02:59 / cg" |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4236 |
! |
b32126680c13
added: #tagsBrowserVisibleHolder
Claus Gittinger <cg@exept.de>
parents:
9820
diff
changeset
|
4237 |
|
10757
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4238 |
useCodeView2InTools |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4239 |
^ self aspectFor:#useCodeView2InTools ifAbsent:[ UserPreferences current useCodeView2InTools asValue ]. |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4240 |
|
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4241 |
"Created: / 06-10-2011 / 11:45:58 / cg" |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4242 |
! |
5bbe8b995a5f
added: #useCodeView2InTools
Claus Gittinger <cg@exept.de>
parents:
10747
diff
changeset
|
4243 |
|
4648 | 4244 |
userContextAvailable |
4245 |
||
4246 |
" aspect for show group and user columns in contents view |
|
4247 |
windows provides no user context" |
|
4248 |
||
4249 |
^ OperatingSystem isMSWINDOWSlike not |
|
4250 |
! |
|
4251 |
||
3892 | 4252 |
viewDescription |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4253 |
"aspect for show file description in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4254 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4255 |
^ self directoryContentsBrowser viewDescription |
3892 | 4256 |
! |
4257 |
||
4258 |
viewDetails |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4259 |
"aspect for show more file properties in DirectoryContentsBrowser |
4201 | 4260 |
" |
3892 | 4261 |
|
6121 | 4262 |
|directoryContentsBrowser| |
4263 |
||
4264 |
directoryContentsBrowser := self directoryContentsBrowser. |
|
4265 |
directoryContentsBrowser isNil ifTrue:[^ nil]. |
|
4266 |
^ directoryContentsBrowser viewDetails |
|
3892 | 4267 |
! |
4268 |
||
4269 |
viewDirectoryDescription |
|
4270 |
||
4201 | 4271 |
" aspect for auto open a TextView for Readme and other see getInfoItem Method files |
4272 |
on change directory " |
|
4273 |
||
3892 | 4274 |
^ self aspectFor:#viewDirectoryDescription ifAbsent:[ true asValue ]. |
4275 |
! |
|
4276 |
||
4201 | 4277 |
viewDirsInContentsBrowser |
4278 |
||
4279 |
^ self aspectFor:#viewDirsInContentsBrowser ifAbsent:[ false asValue ]. |
|
9319
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4280 |
|
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4281 |
" |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4282 |
UserPreferences current viewDirsInContentsBrowser |
23ae966d9dbf
comment/format in: #viewDirsInContentsBrowser
Claus Gittinger <cg@exept.de>
parents:
9299
diff
changeset
|
4283 |
" |
4201 | 4284 |
! |
4285 |
||
5870 | 4286 |
viewFilesInContentsBrowser |
4287 |
||
4288 |
^ self aspectFor:#viewFilesInContentsBrowser ifAbsent:[ true asValue ]. |
|
4289 |
! |
|
4290 |
||
3892 | 4291 |
viewFilesInDirectoryTree |
4292 |
||
4201 | 4293 |
" aspect for view files in tree view (not only directories) " |
4294 |
||
3892 | 4295 |
^ self aspectFor:#viewFilesInDirectoryTree ifAbsent:[ false asValue ]. |
4296 |
! |
|
4297 |
||
4298 |
viewGroup |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4299 |
" aspect for show group information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4300 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4301 |
^ self directoryContentsBrowser viewGroup |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4302 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4303 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4304 |
viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4305 |
" aspect for show file-type icon in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4306 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4307 |
^ self directoryContentsBrowser viewIcon |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4308 |
! |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4309 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4310 |
viewInodeNumber |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4311 |
" aspect for show inode numbers in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4312 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4313 |
^ self directoryContentsBrowser viewInodeNumber |
3892 | 4314 |
! |
4315 |
||
4316 |
viewNoteBookApplicationHolder |
|
4317 |
||
4318 |
^ self aspectFor:#viewNoteBookApplicationHolder ifAbsent:[ false asValue]. |
|
4319 |
! |
|
4320 |
||
4321 |
viewOwner |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4322 |
" aspect for show owner 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 viewOwner |
3892 | 4325 |
! |
4326 |
||
4327 |
viewPermissions |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4328 |
" aspect for show permission information 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 viewPermissions |
3892 | 4331 |
! |
4332 |
||
4333 |
viewPreview |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4334 |
" aspect for show image previev 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 viewPreview |
3892 | 4337 |
! |
4338 |
||
4339 |
viewSize |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4340 |
" aspect for show size information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4341 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4342 |
^ self directoryContentsBrowser viewSize |
3892 | 4343 |
! |
4344 |
||
4974 | 4345 |
viewSizeInBytes |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4346 |
" aspect for show size-in-bytes information in DirectoryContentsBrowser " |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4347 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4348 |
^ self directoryContentsBrowser viewSizeInBytes |
4974 | 4349 |
! |
4350 |
||
5312 | 4351 |
viewSizeInKiloBytes |
4352 |
" aspect for show size-in-kilobytes information in DirectoryContentsBrowser " |
|
4353 |
||
4354 |
^ self directoryContentsBrowser viewSizeInKiloBytes |
|
4355 |
! |
|
4356 |
||
3892 | 4357 |
viewTime |
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4358 |
" aspect for show time information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4359 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4360 |
^ self directoryContentsBrowser viewTime |
3892 | 4361 |
! |
4362 |
||
4363 |
viewType |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4364 |
" aspect for show suffix (type) information in DirectoryContentsBrowser" |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4365 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
4366 |
^ self directoryContentsBrowser viewType |
3892 | 4367 |
! ! |
4368 |
||
4369 |
!AbstractFileBrowser methodsFor:'background processing'! |
|
4370 |
||
4371 |
executeCommand:cmd |
|
4372 |
||
4373 |
self executeCommand:cmd inDirectory:nil |
|
4374 |
! |
|
4375 |
||
5880 | 4376 |
executeCommand:cmd inDirectory:aDirectoryOrNil |
3892 | 4377 |
| nameString executionBlock| |
4378 |
||
5880 | 4379 |
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
|
4380 |
nameString := 'Execute: ', cmd. |
3892 | 4381 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
4382 |
! |
|
4383 |
||
4384 |
getExecutionBlockForCommand:cmd |
|
4385 |
||
4386 |
^ self getExecutionBlockForCommand:cmd inDirectory:nil |
|
4387 |
! |
|
4388 |
||
5880 | 4389 |
getExecutionBlockForCommand:cmd inDirectory:directoryOrNil |
4390 |
| dir| |
|
4391 |
||
4392 |
dir := directoryOrNil. |
|
4393 |
directoryOrNil isNil ifTrue:[ |
|
4394 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6671 | 4395 |
dir isNil ifTrue:[ |
12493 | 4396 |
Dialog warn:(resources string:'Please select a single directory.'). |
16732 | 4397 |
AbortOperationRequest raise. |
6671 | 4398 |
^ nil |
4399 |
]. |
|
3892 | 4400 |
]. |
4523 | 4401 |
|
4402 |
^ [:stream| |
|
4403 |
stream notNil ifTrue:[ |
|
4414 | 4404 |
OperatingSystem |
4405 |
executeCommand:cmd |
|
4406 |
inputFrom:nil |
|
4407 |
outputTo:stream |
|
4408 |
errorTo:stream |
|
4409 |
inDirectory:dir |
|
16732 | 4410 |
lineWise:true |
16825 | 4411 |
showWindow:false |
4414 | 4412 |
onError:[:status| false]. |
4413 |
] |
|
4523 | 4414 |
]. |
3892 | 4415 |
! |
4416 |
||
4417 |
killAllRunningBackgroundProcesses |
|
4418 |
||
4419 |
self backgroundProcesses do:[ : process | |
|
4523 | 4420 |
self notify:'kill ', process name. |
4414 | 4421 |
process terminate. |
3892 | 4422 |
]. |
4423 |
! |
|
4424 |
||
4425 |
makeExecutionResultProcessFor:aBlock withName:aString |
|
4426 |
| stream process appl nameString| |
|
4427 |
||
4428 |
appl := self openCommandResultApplication. |
|
4429 |
stream := appl resultStream. |
|
4430 |
nameString := aString ? 'Execution Result'. |
|
4431 |
appl changeTabTo:nameString. |
|
4523 | 4432 |
|
16102 | 4433 |
process := |
4434 |
[ |
|
4435 |
[aBlock value:stream] |
|
4436 |
ensure:[ |
|
4437 |
self backgroundProcesses remove:process ifAbsent:[]. |
|
4438 |
appl process value:nil. |
|
4439 |
||
4440 |
"/ close automatically, if there was no output. |
|
4571 | 4441 |
"/ appl resultStream contents isEmpty ifTrue:[ |
4442 |
"/ appl doClose. |
|
4443 |
"/ ] |
|
16102 | 4444 |
stream nextPutLine:'Done.'. |
4445 |
self enqueueMessage:#updateCurrentDirectory. |
|
4446 |
] |
|
4447 |
] newProcess. |
|
3892 | 4448 |
process priority:(Processor userBackgroundPriority). |
4449 |
process name:nameString. |
|
4450 |
self backgroundProcesses add:process. |
|
4451 |
appl process value:process. |
|
4452 |
process resume. |
|
4453 |
! ! |
|
4454 |
||
4455 |
!AbstractFileBrowser methodsFor:'change & update'! |
|
4456 |
||
4915 | 4457 |
currentFileNameHolderChanged |
4458 |
"/ self currentFileNameHolderChangedForCommon |
|
4459 |
! |
|
4460 |
||
4577 | 4461 |
currentFileNameHolderChangedForCommon |
5476 | 4462 |
|newDirectories oldDirectories size rootInTreeView selection selectionNotEmpty| |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4463 |
|
7560 | 4464 |
selection := self currentSelectedObjects. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4465 |
self class currentSelection:selection. |
4734 | 4466 |
|
13521 | 4467 |
selectionNotEmpty := selection notEmptyOrNil. |
5476 | 4468 |
self hasSelection value:selectionNotEmpty. |
4469 |
self hasFileSelection value:(selectionNotEmpty and:[self firstSelectedFile notNil]). |
|
4734 | 4470 |
|
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4471 |
newDirectories := self directoriesForFiles:selection. |
6725 | 4472 |
oldDirectories := self currentSelectedDirectories. |
4011 | 4473 |
oldDirectories ~= newDirectories ifTrue:[ |
4347 | 4474 |
self currentDirectories value:newDirectories. |
4475 |
size := newDirectories size. |
|
4774 | 4476 |
rootInTreeView := self |
4477 |
applicationNamed:#DirectoryTreeBrowser |
|
5009 | 4478 |
ifPresentDo:[:appl | appl rootHolder]. |
4479 |
rootInTreeView := rootInTreeView value. |
|
5437
3556b0348494
directory up not allowed for drive root under windows
penk
parents:
5432
diff
changeset
|
4480 |
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
|
4481 |
|
4347 | 4482 |
newDirectories notEmpty ifTrue:[ |
6369 | 4483 |
self directoryHistory addToHistory:(newDirectories first asString). |
4347 | 4484 |
]. |
5074 | 4485 |
self enableHome value:((newDirectories includes:(Filename homeDirectory asAbsoluteFilename))not). |
14308 | 4486 |
"/ self enableGotoDesktop value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
6456 | 4487 |
self enableGotoDefaultDirectory value:((newDirectories includes:(Filename defaultDirectory asAbsoluteFilename))not). |
4488 |
self enableGotoSmalltalkDirectory value:((newDirectories includes:(self smalltalkDirectory asAbsoluteFilename))not). |
|
9572 | 4489 |
self enableGotoDesktopDirectory value:((newDirectories includes:(Filename desktopDirectory asAbsoluteFilename))not). |
9677 | 4490 |
self enableGotoTempDirectory value:((newDirectories includes:(self tempDirectory asAbsoluteFilename))not). |
4011 | 4491 |
]. |
9599
6ffff091db22
changed: #currentFileNameHolderChangedForCommon
Claus Gittinger <cg@exept.de>
parents:
9596
diff
changeset
|
4492 |
self enableGotoDefaultDirectory value:(self currentDirectory isNil or:[self currentDirectory pathName ~= OperatingSystem getCurrentDirectory]). |
9596 | 4493 |
self enableMakeCurrentDirectory value:(newDirectories size == 1 |
4494 |
and:[ newDirectories first asFilename pathName ~= OperatingSystem getCurrentDirectory ]). |
|
4022 | 4495 |
self enableForward value:self canForward. |
4734 | 4496 |
self enableBack value:self canBackward. |
6095 | 4497 |
|
13856 | 4498 |
self updateCanMake. |
7560 | 4499 |
|
9677 | 4500 |
"Modified: / 29-12-2010 / 11:01:52 / cg" |
13856 | 4501 |
"Modified: / 17-12-2013 / 08:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4011 | 4502 |
! |
4503 |
||
4504 |
filterModelChanged |
|
4505 |
||
5658
eef91fc147fa
filter: allow multiple patterns
Claus Gittinger <cg@exept.de>
parents:
5644
diff
changeset
|
4506 |
self filterBlockHolder value:(self makeFilterBlock). |
4011 | 4507 |
! |
4508 |
||
3892 | 4509 |
update:something with:aParameter from:changedObject |
4510 |
||
4511 |
" do here all the things that have to be done for every part of the FileBrowserV2 |
|
4512 |
and the things that have to be done if it runs standalone " |
|
4513 |
||
4514 |
changedObject == self currentFileNameHolder ifTrue:[ |
|
4577 | 4515 |
self currentFileNameHolderChangedForCommon. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4516 |
^ self |
3892 | 4517 |
]. |
3989 | 4518 |
changedObject == self sortCaseless ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4519 |
self sortFileListsBy:#baseName withReverse:false. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4520 |
^ self |
3989 | 4521 |
]. |
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4522 |
changedObject == self sortBlockProperty ifTrue:[ |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4523 |
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
|
4524 |
^ self |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
4525 |
]. |
4011 | 4526 |
(changedObject == self filterModel or:[changedObject == self showHiddenFiles]) ifTrue:[ |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4527 |
self filterModelChanged. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4528 |
^ self |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4529 |
]. |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4530 |
changedObject == self rootHolder ifTrue:[ |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4531 |
self class rootHolder:(self rootHolder value). |
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
4532 |
^ self |
4004 | 4533 |
]. |
4781 | 4534 |
changedObject == self showDiskUsageHolder ifTrue:[ |
6190 | 4535 |
self notify:nil. |
4781 | 4536 |
^ self |
4537 |
]. |
|
3989 | 4538 |
|
3892 | 4539 |
super update:something with:aParameter from:changedObject |
5543 | 4540 |
! |
4541 |
||
6095 | 4542 |
updateCanMake |
4543 |
|dir can| |
|
4544 |
||
4545 |
can := false. |
|
4546 |
dir := self currentDirectory. |
|
4547 |
dir notNil ifTrue:[ |
|
13856 | 4548 |
"/ Check for make |
6095 | 4549 |
can := (dir asFilename construct:'Makefile') exists. |
13856 | 4550 |
can ifFalse:[ |
4551 |
can := (dir asFilename construct:'makefile') exists. |
|
4552 |
]. |
|
6095 | 4553 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
4554 |
can ifFalse:[ |
|
13856 | 4555 |
can := (self currentDirectory asFilename construct:'bc.mak') exists. |
6095 | 4556 |
] |
4557 |
]. |
|
13856 | 4558 |
can ifTrue:[ |
4559 |
self makeCommandHolder value: 'make'. |
|
4560 |
self canMake value: true. |
|
4561 |
^ self |
|
4562 |
]. |
|
4563 |
||
4564 |
"/Check for Apache ant |
|
4565 |
(OperatingSystem canExecuteCommand: 'ant') ifTrue:[ |
|
4566 |
can := (dir asFilename construct:'build.xml') exists. |
|
4567 |
can ifTrue:[ |
|
4568 |
self makeCommandHolder value: 'ant'. |
|
4569 |
self canMake value: true. |
|
4570 |
^ self |
|
4571 |
]. |
|
4572 |
]. |
|
4573 |
||
4574 |
"/Add more here... |
|
4575 |
||
6095 | 4576 |
]. |
4577 |
self canMake value:can. |
|
13856 | 4578 |
|
4579 |
"Modified: / 17-12-2013 / 08:13:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6095 | 4580 |
! |
4581 |
||
5543 | 4582 |
updateListAfterDelete:colOfFiles |
4583 |
self updateCurrentDirectory |
|
3892 | 4584 |
! ! |
4585 |
||
4586 |
!AbstractFileBrowser methodsFor:'clipboard'! |
|
4587 |
||
4588 |
canPaste |
|
4589 |
||
15259 | 4590 |
^ self aspectFor:#canPaste ifAbsent:[ ValueHolder with:false ]. |
3892 | 4591 |
! |
4592 |
||
4593 |
clipboard |
|
4594 |
||
4595 |
^ self aspectFor:#clipboard ifAbsent:[Clipboard new] |
|
4596 |
! |
|
4597 |
||
4598 |
copyFilesToClipBoard:colOfFiles |
|
4599 |
self putInClipBoard:colOfFiles as:#copy. |
|
4600 |
! |
|
4601 |
||
4602 |
cutFilesToClipBoard:colOfFiles |
|
4603 |
"defete current selected files/directories |
|
4604 |
" |
|
4605 |
self putInClipBoard:colOfFiles as:#cut. |
|
4606 |
! |
|
4607 |
||
4608 |
emptyClipBoard |
|
4609 |
||
4610 |
self clipboard files:nil. |
|
4611 |
self canPaste value:false. |
|
4612 |
! |
|
4613 |
||
4614 |
putInClipBoard:colOfFiles as:aSymbol |
|
4615 |
| stream clp| |
|
4616 |
||
4617 |
colOfFiles isEmpty ifTrue:[ ^ self]. |
|
4618 |
clp := self clipboard. |
|
4619 |
clp files:nil. |
|
4620 |
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
|
4621 |
|
603abfa8cf99
copy name(s) to clipboard - on lineFeed if only one file is selected
Claus Gittinger <cg@exept.de>
parents:
5756
diff
changeset
|
4622 |
stream := String writeStream. |
3892 | 4623 |
stream nextPutAll:aSymbol asString. |
4624 |
stream nextPutAll:' <'. |
|
4625 |
stream nextPutAll:colOfFiles first asString. |
|
4626 |
colOfFiles size > 1 ifTrue:[ |
|
4414 | 4627 |
stream nextPutAll:' ...'. |
3892 | 4628 |
]. |
4629 |
stream nextPutAll:'> to clipboard'. |
|
4630 |
||
4523 | 4631 |
self notify:stream contents. |
3892 | 4632 |
clp files:colOfFiles. |
4633 |
self canPaste value:true. |
|
4634 |
! ! |
|
4635 |
||
4636 |
!AbstractFileBrowser methodsFor:'drag & drop'! |
|
4637 |
||
4638 |
canDropFiles:dropedObjects for:filename |
|
6284 | 4639 |
|filenameDirString filenameDir| |
3892 | 4640 |
|
4641 |
dropedObjects isEmpty ifTrue:[^ false]. |
|
6284 | 4642 |
|
3892 | 4643 |
filenameDir := self getDirWithoutFileName:filename. |
7491 | 4644 |
filenameDir isNil ifTrue:[^ false ]. |
13232 | 4645 |
filenameDir isWritableDirectory ifFalse:[^ false]. |
6284 | 4646 |
|
3892 | 4647 |
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
|
4648 |
|
7ce6eae41e33
do not check if dropFile exists, if its an archive file
Claus Gittinger <cg@exept.de>
parents:
4959
diff
changeset
|
4649 |
dropedObjects do:[:aDropObject | |
6284 | 4650 |
(self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false]. |
4651 |
"/ |dropFileName dropFileNameString physicalPathName| |
|
4652 |
"/ |
|
4653 |
"/ dropFileName := aDropObject theObject. |
|
4654 |
"/ dropFileNameString := dropFileName asString. |
|
4655 |
"/ dropFileName isDirectory ifTrue:[ |
|
4656 |
"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
4657 |
"/ self notify:'Cannot drop a directory into one of its parent directories'. |
|
4658 |
"/ ^ false |
|
4659 |
"/ ] |
|
4660 |
"/ ] ifFalse:[ |
|
4661 |
"/ physicalPathName := dropFileName physicalPathName. |
|
4662 |
"/ (filenameDirString = dropFileName directory asString |
|
4663 |
"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil |
|
4664 |
"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[ |
|
4665 |
"/ self notify:'Cannot drop a file into same directory'. |
|
4666 |
"/ ^ false |
|
4667 |
"/ ] |
|
4668 |
"/ ] |
|
4669 |
]. |
|
4670 |
self notify:nil. |
|
4671 |
^ true |
|
4672 |
! |
|
4673 |
||
4674 |
canDropObject:aDropObject into:aDirectory |
|
4675 |
|filenameDirString dropFileName dropFileNameString physicalPathName| |
|
4676 |
||
4677 |
dropFileName := aDropObject theObject. |
|
4678 |
dropFileNameString := dropFileName asString. |
|
4679 |
dropFileName isDirectory ifTrue:[ |
|
4680 |
filenameDirString := aDirectory asString. |
|
4681 |
(self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[ |
|
4682 |
self notify:'Cannot drop a directory into one of its parent directories'. |
|
4683 |
^ false |
|
4414 | 4684 |
] |
6284 | 4685 |
] ifFalse:[ |
4686 |
physicalPathName := dropFileName physicalPathName. |
|
4687 |
(aDirectory = dropFileName directory |
|
4688 |
or:[ aDropObject isFileInArchive not |
|
4689 |
and:[physicalPathName notNil |
|
4690 |
and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[ |
|
4691 |
self notify:'Cannot drop a file into same directory'. |
|
4692 |
^ false |
|
4693 |
] |
|
4694 |
]. |
|
4695 |
^ true. |
|
3892 | 4696 |
! |
4697 |
||
7406 | 4698 |
canDropObjects:aCollectionOfDropObjects in:aWidget |
4699 |
^ aCollectionOfDropObjects contains:[:dropObject | dropObject isFileObject] |
|
4700 |
||
4701 |
"Created: / 13-10-2006 / 15:52:49 / cg" |
|
4702 |
! |
|
4703 |
||
17202 | 4704 |
doStartDrag:arg1 in:arg2 |
4705 |
^ self class doStartDrag:arg1 in:arg2 |
|
6479 | 4706 |
! |
4707 |
||
7408 | 4708 |
dropObjects:aCollectionOfDropObjects in:aWidget at:position |
7990 | 4709 |
|fileEntryFieldHolder destDir dropObject fn d| |
4710 |
||
4711 |
fileEntryFieldHolder := self masterApplication notNil |
|
4712 |
ifTrue:[ self masterApplication fileEntryFieldHolder ] |
|
4713 |
ifFalse:[ self fileEntryFieldHolder ]. |
|
4714 |
||
4715 |
aWidget model == fileEntryFieldHolder ifTrue:[ |
|
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4716 |
dropObject := aCollectionOfDropObjects first. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4717 |
dropObject isFileObject ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4718 |
fn := dropObject theObject asFilename. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4719 |
dropObject isDirectory ifTrue:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4720 |
d := fn. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4721 |
] ifFalse:[ |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4722 |
d := fn directory. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4723 |
]. |
7990 | 4724 |
fileEntryFieldHolder value:d pathName. |
7900
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4725 |
]. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4726 |
^ self. |
52ad708471ad
drop into fileName-path-field: goto that directory
Claus Gittinger <cg@exept.de>
parents:
7897
diff
changeset
|
4727 |
]. |
6479 | 4728 |
|
4729 |
destDir := self currentDirectory. |
|
4730 |
destDir isNil ifTrue:[^ self]. |
|
4731 |
||
8601 | 4732 |
self withWaitCursorDo:[ |
4733 |
aCollectionOfDropObjects do:[:dropObject | |
|
4734 |
|fn| |
|
4735 |
||
4736 |
dropObject isFileObject ifTrue:[ |
|
4737 |
fn := dropObject theObject asFilename. |
|
4738 |
dropObject isDirectory ifTrue:[ |
|
8808
cb6476c0cd3a
oops - drop of directories was broken
Claus Gittinger <cg@exept.de>
parents:
8716
diff
changeset
|
4739 |
fn recursiveCopyTo:destDir |
8601 | 4740 |
] ifFalse:[ |
8950
48c69259d82d
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
8887
diff
changeset
|
4741 |
fn copyTo:(destDir / fn baseName ) |
8601 | 4742 |
] |
6479 | 4743 |
] |
8601 | 4744 |
]. |
4745 |
]. |
|
9268
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4746 |
self directoryContentsBrowser notNil ifTrue:[ |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4747 |
self directoryContentsBrowser |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4748 |
directoryContentsChangeFlag:true; |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4749 |
wakeUp |
fbeb680106c9
changed: #dropObjects:in:at:
Claus Gittinger <cg@exept.de>
parents:
9267
diff
changeset
|
4750 |
]. |
7408 | 4751 |
|
4752 |
"Created: / 13-10-2006 / 18:26:41 / cg" |
|
3892 | 4753 |
! ! |
4754 |
||
4755 |
!AbstractFileBrowser methodsFor:'file operations'! |
|
4756 |
||
4757 |
copyFile:aSourceFile to:aDestFile |
|
6190 | 4758 |
"copy to" |
4759 |
||
7635 | 4760 |
^ self copyFile:aSourceFile to:aDestFile repairCorruptedFiles:false |
4761 |
||
4762 |
"Modified: / 07-02-2007 / 18:46:44 / cg" |
|
4763 |
! |
|
4764 |
||
4765 |
copyFile:aSourceFile to:aDestFile repairCorruptedFiles:repairCorruptedFiles |
|
4766 |
"copy to" |
|
4767 |
||
4768 |
|copyOperation msg| |
|
4769 |
||
4770 |
repairCorruptedFiles ifTrue:[ |
|
4771 |
copyOperation := FileOperation copyCorruptedFile:aSourceFile to:aDestFile |
|
4772 |
] ifFalse:[ |
|
4773 |
copyOperation := FileOperation copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true. |
|
4774 |
]. |
|
4775 |
copyOperation result ifTrue:[ |
|
6190 | 4776 |
msg := ('copy ', aSourceFile baseName, ' to:,', aDestFile baseName). |
3892 | 4777 |
] ifFalse:[ |
7635 | 4778 |
msg := copyOperation errorString. |
6190 | 4779 |
]. |
4780 |
self notify:msg. |
|
7635 | 4781 |
^ copyOperation result |
4782 |
||
4783 |
"Created: / 07-02-2007 / 18:46:34 / cg" |
|
3892 | 4784 |
! |
4785 |
||
4786 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
6374 | 4787 |
|copy result| |
3892 | 4788 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4789 |
self withActivityIndicationDo:[ |
5961 | 4790 |
copy := FileOperation copyFiles:aColOfSourceFiles to:aDirectory. |
6374 | 4791 |
copy result ifTrue:[ |
4792 |
result := Dictionary withKeys:(copy collectionOfCopiedFiles) andValues:(copy collectionOfNewFiles). |
|
4793 |
] ifFalse:[ |
|
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4794 |
self notify:copy errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4795 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
4796 |
self updateCurrentDirectory. |
3892 | 4797 |
]. |
6374 | 4798 |
^ result |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4799 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4800 |
"Modified: / 25-07-2006 / 09:07:04 / cg" |
3892 | 4801 |
! |
4802 |
||
15569 | 4803 |
copyFromToRepairingCorruptedFiles |
4804 |
"ask for source and destination and copy the entered file. |
|
4805 |
Especially useful for raw devices to copy corrupted disks/files |
|
4806 |
" |
|
4807 |
||
4808 |
|source destination| |
|
4809 |
||
4810 |
source := Dialog |
|
4811 |
requestDirectoryName:(resources string:'Copy from:') |
|
4812 |
default:(LastMoveDestination ? self currentDirectory) |
|
4813 |
ok:(resources string:'Continue') |
|
4814 |
abort:nil. |
|
4815 |
||
4816 |
source isEmptyOrNil ifTrue:[^ self]. |
|
4817 |
source := source asFilename. |
|
4818 |
||
4819 |
destination := Dialog |
|
4820 |
requestDirectoryName:(resources string:'Copy "%1" to:' with:source) |
|
4821 |
default:(LastMoveDestination ? self currentDirectory) |
|
4822 |
ok:(resources string:'Copy') |
|
4823 |
abort:nil. |
|
4824 |
||
4825 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
4826 |
destination := destination asFilename. |
|
4827 |
||
4828 |
self copyFile:source to:destination repairCorruptedFiles:true. |
|
4829 |
! |
|
4830 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4831 |
copyOrMoveDialog:aCollectionOfFiles for:aDestinationDirectory |
12850 | 4832 |
|size msg answer file| |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4833 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4834 |
size := aCollectionOfFiles size. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4835 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4836 |
"/ stream := WriteStream on:'' asText. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4837 |
"/ 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
|
4838 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4839 |
"/ stream nextPutAll:'s'. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4840 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4841 |
"/ stream nextPutAll:': '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4842 |
"/ 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
|
4843 |
"/ size == 1 ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4844 |
"/ stream nextPutAll:' ... '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4845 |
"/ 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
|
4846 |
"/ ]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4847 |
"/ stream cr; nextPutAll:'to: '. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4848 |
"/ 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
|
4849 |
"/ msg := stream contents |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4850 |
size == 1 ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4851 |
file := aCollectionOfFiles first. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4852 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4853 |
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
|
4854 |
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
|
4855 |
with:(file baseName allBold) |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4856 |
with:(aDestinationDirectory asFilename pathName allBold). |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4857 |
] ifFalse:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4858 |
msg := resources |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4859 |
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
|
4860 |
with:size |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4861 |
with:(aDestinationDirectory asFilename pathName allBold). |
3892 | 4862 |
]. |
4707
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 |
answer := OptionBox |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4865 |
request:msg |
8127 | 4866 |
label:(resources string:'Copy or Move') |
5898
f6214812e1d2
dont send obsolete message to OptionBox
Claus Gittinger <cg@exept.de>
parents:
5888
diff
changeset
|
4867 |
image:(WarningBox iconBitmap) |
8127 | 4868 |
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
|
4869 |
values:#(#cancel #move #copy #copyAs) |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4870 |
default:#copy. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4871 |
answer isNil ifTrue:[answer := #cancel]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4872 |
^ answer. |
3892 | 4873 |
! |
4874 |
||
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4875 |
copyOrMoveFiles:aColOfSourceFiles to:aDestinationDirectory |
4745 | 4876 |
"copy or move aColOfSourceFiles to aDirectory. |
4877 |
Asks the used if a move or a copy is wanted. |
|
4878 |
Returns true if the copyOrMove happened, false if user aborted the operation." |
|
4879 |
||
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4880 |
|answer lastOld lastNew| |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4881 |
|
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4882 |
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
|
4883 |
answer == #copyAs ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4884 |
aColOfSourceFiles do:[:eachSourceFile | |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4885 |
|initial destFile srcBase dstBase| |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4886 |
|
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4887 |
srcBase := eachSourceFile asFilename baseName. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4888 |
lastOld isNil ifTrue:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4889 |
initial := srcBase |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4890 |
] ifFalse:[ |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4891 |
initial := DoWhatIMeanSupport |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4892 |
goodRenameDefaultForFile:srcBase lastOld:lastOld lastNew:lastNew. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4893 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4894 |
dstBase := Dialog request:('Copy %1 as:' bindWith:srcBase) initialAnswer:initial. |
4745 | 4895 |
dstBase isNil ifTrue:[^ false]. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4896 |
self copyFile:eachSourceFile to:(aDestinationDirectory construct:dstBase). |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4897 |
lastOld := srcBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4898 |
lastNew := dstBase. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4899 |
]. |
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4900 |
|
4745 | 4901 |
^ true. |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4902 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4903 |
answer == #copy ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4904 |
self copyFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 4905 |
^ true. |
3892 | 4906 |
]. |
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
4907 |
answer == #move ifTrue:[ |
4354
0a1239cd339d
added copyAs in drag and drop
Claus Gittinger <cg@exept.de>
parents:
4347
diff
changeset
|
4908 |
self moveFiles:aColOfSourceFiles to:aDestinationDirectory. |
4745 | 4909 |
^ true. |
3892 | 4910 |
]. |
4745 | 4911 |
^ false. |
3892 | 4912 |
! |
4913 |
||
6107 | 4914 |
copySelectionTo |
4915 |
"copy the selected file(s) to another directory" |
|
4916 |
||
13704 | 4917 |
self copySelectionToRepairingCorruptedFiles:false. |
4918 |
self updateCurrentDirectoryWithReread. |
|
7635 | 4919 |
|
4920 |
"Modified: / 07-02-2007 / 18:42:48 / cg" |
|
4921 |
! |
|
4922 |
||
4923 |
copySelectionToRepairingCorruptedFiles |
|
4924 |
"copy the selected file(s) to another directory" |
|
4925 |
||
13704 | 4926 |
self copySelectionToRepairingCorruptedFiles:true. |
4927 |
self updateCurrentDirectoryWithReread. |
|
7635 | 4928 |
|
4929 |
"Created: / 07-02-2007 / 18:42:59 / cg" |
|
4930 |
! |
|
4931 |
||
4932 |
copySelectionToRepairingCorruptedFiles:repairingCorruptedFiles |
|
4933 |
"copy the selected file(s) to another directory" |
|
4934 |
||
6299 | 4935 |
|selectedFiles msg destination directory| |
4936 |
||
7560 | 4937 |
selectedFiles := self currentSelectedObjects copy. |
6299 | 4938 |
selectedFiles isEmptyOrNil ifTrue:[^ self]. |
4939 |
||
4940 |
msg := (selectedFiles size > 1) |
|
14588 | 4941 |
ifTrue:[ 'Copy Selected Items to Directory:' ] |
4942 |
ifFalse:[ 'Copy "%1" to Directory:' ]. |
|
6299 | 4943 |
|
4944 |
destination := Dialog |
|
14588 | 4945 |
requestDirectoryName:(resources stringWithCRs:msg with:selectedFiles first baseName) |
7635 | 4946 |
default:(LastMoveDestination ? self currentDirectory) |
4947 |
ok:(resources string:'Copy') |
|
4948 |
abort:nil. |
|
4949 |
||
6299 | 4950 |
destination isEmptyOrNil ifTrue:[^ self]. |
4951 |
destination := destination asFilename. |
|
4952 |
||
4953 |
destination isDirectory ifFalse:[ |
|
4954 |
selectedFiles size == 1 ifTrue:[ |
|
4955 |
directory := destination directory. |
|
4956 |
directory isDirectory ifTrue:[ |
|
4957 |
LastMoveDestination := directory. |
|
7635 | 4958 |
self copyFile:selectedFiles first to:destination repairCorruptedFiles:repairingCorruptedFiles. |
6299 | 4959 |
^ self. |
4960 |
] |
|
4961 |
] |
|
4962 |
]. |
|
4963 |
||
4964 |
LastMoveDestination := destination. |
|
7635 | 4965 |
repairingCorruptedFiles ifTrue:[ |
4966 |
selectedFiles do:[:eachFile | |
|
4967 |
self copyFile:eachFile to:destination repairCorruptedFiles:repairingCorruptedFiles. |
|
4968 |
]. |
|
4969 |
^ self. |
|
4970 |
] ifFalse:[ |
|
4971 |
self copyFiles:selectedFiles to:destination |
|
4972 |
] |
|
4973 |
||
4974 |
"Created: / 07-02-2007 / 18:42:35 / cg" |
|
6107 | 4975 |
! |
4976 |
||
3892 | 4977 |
deleteFile:aFile |
6373 | 4978 |
"delete the selected files/directories" |
3892 | 4979 |
|
4980 |
^ self deleteFiles:(OrderedCollection with:aFile). |
|
4981 |
! |
|
4982 |
||
4983 |
deleteFiles:colOfFiles |
|
6373 | 4984 |
"delete some files/directories" |
4985 |
||
5081 | 4986 |
^ self deleteFiles:colOfFiles confirm:true. |
4987 |
! |
|
4988 |
||
4989 |
deleteFiles:colOfFiles confirm:confirm |
|
6373 | 4990 |
"delete some files/directories" |
4991 |
||
5673 | 4992 |
|delete result| |
3892 | 4993 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
4994 |
self withActivityIndicationDo:[ |
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4995 |
ProgressNotification handle:[:info | |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4996 |
self progressPercentageHolder value:info progressValue. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4997 |
info proceed |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4998 |
] do:[ |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
4999 |
delete := FileOperation deleteFiles:colOfFiles confirm:confirm. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5000 |
result := delete result. |
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5001 |
]. |
5673 | 5002 |
result notNil ifTrue:[ |
5003 |
result ifFalse:[ |
|
5004 |
self notify:delete errorString. |
|
5753 | 5005 |
] ifTrue:[ |
5006 |
self updateListAfterDelete:colOfFiles. |
|
5007 |
] |
|
4394 | 5008 |
]. |
5673 | 5009 |
]. |
5010 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5011 |
|
9575
548adf8e9d98
added: #progressPercentageHolder
Claus Gittinger <cg@exept.de>
parents:
9572
diff
changeset
|
5012 |
"Modified: / 11-10-2010 / 13:08:24 / cg" |
3892 | 5013 |
! |
5014 |
||
6169 | 5015 |
eraseFiles:colOfFiles |
6373 | 5016 |
"erase (clear and delete) some files/directories" |
5017 |
||
6169 | 5018 |
^ self eraseFiles:colOfFiles confirm:true. |
5019 |
! |
|
5020 |
||
5021 |
eraseFiles:colOfFiles confirm:confirm |
|
6373 | 5022 |
"erase (clear and delete) some files/directories" |
5023 |
||
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5024 |
|deleteOperation result fileSize| |
6169 | 5025 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5026 |
self withActivityIndicationDo:[ |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5027 |
fileSize := colOfFiles first asFilename fileSize. |
8294 | 5028 |
deleteOperation := FileOperation eraseFiles:colOfFiles confirm:confirm. |
8462
a5d12742a900
changed #eraseFiles:confirm:
Claus Gittinger <cg@exept.de>
parents:
8454
diff
changeset
|
5029 |
(colOfFiles size == 1 and:[ fileSize < (10*1024*1024) ]) |
8294 | 5030 |
ifTrue:[ |
5031 |
result := deleteOperation result. |
|
5032 |
] ifFalse:[ |
|
5033 |
ProgressIndicator |
|
5034 |
displayProgressNotifications:'Erasing' |
|
5035 |
abortable:true |
|
5036 |
at:nil |
|
5037 |
during:[ |
|
5038 |
result := deleteOperation result. |
|
5039 |
]. |
|
5040 |
]. |
|
5041 |
||
6169 | 5042 |
result notNil ifTrue:[ |
5043 |
result ifFalse:[ |
|
8294 | 5044 |
self notify:deleteOperation errorString. |
6169 | 5045 |
] ifTrue:[ |
5046 |
self updateListAfterDelete:colOfFiles. |
|
5047 |
] |
|
5048 |
]. |
|
5049 |
]. |
|
5050 |
^ result. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5051 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5052 |
"Modified: / 25-07-2006 / 09:07:16 / cg" |
6169 | 5053 |
! |
5054 |
||
3892 | 5055 |
moveFile:aSourceFile to:aDestFile |
6373 | 5056 |
"move a file/directory" |
3892 | 5057 |
|
5058 |
|move| |
|
5059 |
||
5961 | 5060 |
move := FileOperation moveFile:aSourceFile to:aDestFile. |
3892 | 5061 |
move result ifTrue:[ |
15346 | 5062 |
self notify:(resources string: 'move "%1" to "%2"' with:aSourceFile asString with:aDestFile asString). |
3892 | 5063 |
] ifFalse:[ |
4523 | 5064 |
self notify:move errorString. |
3892 | 5065 |
]. |
5066 |
self updateCurrentDirectory. |
|
5067 |
^ move result |
|
5068 |
! |
|
5069 |
||
5070 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
6373 | 5071 |
"move some files to aDirectory" |
5072 |
||
3892 | 5073 |
|move| |
5074 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5075 |
self withActivityIndicationDo:[ |
5961 | 5076 |
move := FileOperation moveFiles:aColOfSourceFiles to:aDirectory. |
4629
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5077 |
move result ifFalse:[ |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5078 |
self notify:move errorString. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5079 |
]. |
e8739857466c
show busyCursor while moving/copying files.
Claus Gittinger <cg@exept.de>
parents:
4624
diff
changeset
|
5080 |
self updateCurrentDirectory. |
3892 | 5081 |
]. |
6373 | 5082 |
^ move collectionOfMovedFiles |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5083 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
5084 |
"Modified: / 25-07-2006 / 09:07:32 / cg" |
3892 | 5085 |
! |
5086 |
||
6107 | 5087 |
moveSelectionTo |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5088 |
"move the selected file(s) to another directory" |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5089 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5090 |
|destinationDirectory| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5091 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5092 |
destinationDirectory := Dialog |
14588 | 5093 |
requestDirectoryName:(resources stringWithCRs:'Move Selected Items to Directory:') |
5789 | 5094 |
default:(LastMoveDestination ? self currentDirectory) |
6952 | 5095 |
ok:(resources string:'Move') |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5096 |
abort:nil. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5097 |
destinationDirectory isEmptyOrNil ifTrue:[^ self]. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5098 |
|
5789 | 5099 |
LastMoveDestination := destinationDirectory. |
13704 | 5100 |
self moveFiles:(self currentSelectedObjects copy) to:destinationDirectory asFilename. |
5101 |
self updateCurrentDirectoryWithReread. |
|
5102 |
||
7560 | 5103 |
|
5104 |
"Modified: / 04-12-2006 / 13:15:12 / cg" |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5105 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5106 |
|
3892 | 5107 |
newDirectory |
5108 |
"ask for and create a new directory" |
|
5109 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5110 |
|selectedFiles singleSelectedFile defaultAnswer directory createOp newFile mime| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5111 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5112 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5113 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5114 |
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
|
5115 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5116 |
]. |
4521 | 5117 |
|
5118 |
"/ 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
|
5119 |
selectedFiles := self currentSelectedFiles. |
4521 | 5120 |
selectedFiles size == 1 ifTrue:[ |
5121 |
singleSelectedFile := selectedFiles first. |
|
5122 |
||
5123 |
mime := MIMETypes mimeTypeForFilename:singleSelectedFile. |
|
13714 | 5124 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5125 |
defaultAnswer := singleSelectedFile asFilename withoutSuffix baseName. |
5126 |
||
5127 |
mime := MIMETypes mimeTypeForFilename:defaultAnswer. |
|
13714 | 5128 |
(mime notNil and:[mime isArchiveType]) ifTrue:[ |
4521 | 5129 |
defaultAnswer := defaultAnswer asFilename withoutSuffix baseName |
5130 |
]. |
|
5131 |
]. |
|
5132 |
]. |
|
5133 |
||
5961 | 5134 |
|
4521 | 5135 |
defaultAnswer notNil ifTrue:[ |
5961 | 5136 |
createOp := FileOperation createDirectoryIn:directory initialAnswer:defaultAnswer. |
4521 | 5137 |
] ifFalse:[ |
5961 | 5138 |
createOp := FileOperation createDirectoryIn:directory. |
4521 | 5139 |
]. |
5140 |
createOp result ifFalse:[ ^ self]. |
|
5141 |
newFile := createOp createdFile. |
|
3892 | 5142 |
newFile notNil ifTrue:[ |
4414 | 5143 |
self updateCurrentDirectory. |
3892 | 5144 |
] |
5145 |
! |
|
5146 |
||
5147 |
newFile |
|
5148 |
"ask for and create a new file" |
|
5149 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5150 |
| curFile directory create file| |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5151 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5152 |
directory := self currentDirectory. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5153 |
directory isNil ifTrue:[ |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5154 |
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
|
5155 |
^ self. |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5156 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5157 |
|
3982 | 5158 |
curFile := self firstSelectedFile. |
3892 | 5159 |
curFile notNil ifTrue:[ |
4414 | 5160 |
file := curFile. |
3892 | 5161 |
] ifFalse:[ |
4414 | 5162 |
file := directory. |
3892 | 5163 |
]. |
5961 | 5164 |
create := FileOperation createFileIn:file. |
3892 | 5165 |
create result ifFalse:[ ^ self]. |
5166 |
self updateAndSelect:(OrderedCollection with:(create createdFile)). |
|
5167 |
! |
|
5168 |
||
5169 |
newHardLink |
|
5170 |
"ask for and create a hard link (unix only)" |
|
5171 |
||
6151 | 5172 |
self newLink:#hard. |
5173 |
! |
|
5174 |
||
5175 |
newLink:typeOfLink |
|
3892 | 5176 |
"ask for and create a symbolic if symbolic is true otherwise a hard link (unix only)" |
5177 |
||
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5178 |
| sel dir create createdFile| |
3892 | 5179 |
|
7560 | 5180 |
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
|
5181 |
(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
|
5182 |
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
|
5183 |
^ self |
366465d1a8a5
warn on create new file or directory if nothing selected or more than one directory
penk
parents:
4976
diff
changeset
|
5184 |
]. |
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5185 |
dir := sel first. |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
5186 |
|
6151 | 5187 |
create := FileOperation createLinkIn:dir soft:(typeOfLink == #soft). |
3892 | 5188 |
create result ifFalse:[ ^ self]. |
5189 |
createdFile := create createdFile. |
|
5190 |
createdFile notNil ifTrue:[ |
|
6151 | 5191 |
typeOfLink == #soft ifTrue:[ |
4785
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5192 |
self updateCurrentDirectory. |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5193 |
] ifFalse:[ |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5194 |
self updateAndSelect:(OrderedCollection with:createdFile). |
5a3f7a0c3ff1
symbolic link creation code fixed
Claus Gittinger <cg@exept.de>
parents:
4782
diff
changeset
|
5195 |
] |
3892 | 5196 |
]. |
7560 | 5197 |
|
5198 |
"Modified: / 04-12-2006 / 13:15:15 / cg" |
|
3892 | 5199 |
! |
5200 |
||
5201 |
newSoftLink |
|
5202 |
"ask for and create a soft link (unix only)" |
|
5203 |
||
6151 | 5204 |
self newLink:#soft. |
3892 | 5205 |
! |
5206 |
||
5207 |
pasteFiles |
|
6373 | 5208 |
"paste from clipBoard" |
5209 |
||
5210 |
|buffer destination files directories copiedFiles thisIsAFileMoveOperation| |
|
3892 | 5211 |
|
5212 |
files := self clipboard files. |
|
6482
00207f456339
isEmptyOrNil / notEmptyOrNil refactoring
Claus Gittinger <cg@exept.de>
parents:
6479
diff
changeset
|
5213 |
files isEmptyOrNil ifTrue:[ ^ self ]. |
6373 | 5214 |
|
5215 |
thisIsAFileMoveOperation := self clipboard method == #cut. |
|
5216 |
||
3892 | 5217 |
buffer := self clipboard copy. |
3982 | 5218 |
directories := self currentSelectedDirectories. |
5880 | 5219 |
directories size ~~ 1 ifTrue:[ |
4414 | 5220 |
|box dirStringCol| |
5880 | 5221 |
|
4414 | 5222 |
dirStringCol := directories collect:[:aDir| aDir asString]. |
5223 |
box := ListSelectionBox new. |
|
6373 | 5224 |
box title:'Paste into which directory ?'. |
4414 | 5225 |
box list:dirStringCol. |
5226 |
box okAction:[:sel | destination := sel asFilename]. |
|
5003
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5227 |
box show. |
a14ce263ada5
boxes no longer show at pointer
Claus Gittinger <cg@exept.de>
parents:
4982
diff
changeset
|
5228 |
box destroy. |
3892 | 5229 |
] ifFalse:[ |
5880 | 5230 |
destination := directories anElement. |
3892 | 5231 |
]. |
6373 | 5232 |
|
5233 |
thisIsAFileMoveOperation ifTrue:[ |
|
5081 | 5234 |
buffer files copy do:[:aFile| |
5235 |
aFile directory = destination ifTrue:[ |
|
5236 |
buffer files remove:aFile. |
|
5237 |
]. |
|
5238 |
]. |
|
5239 |
]. |
|
5240 |
copiedFiles := self copyFiles:(buffer files) to:destination. |
|
6374 | 5241 |
copiedFiles notEmptyOrNil ifTrue:[ |
5242 |
thisIsAFileMoveOperation ifTrue:[ |
|
5243 |
self deleteFiles:(copiedFiles keys) confirm:false. |
|
5244 |
]. |
|
5245 |
||
5246 |
"/ select those pasted files. |
|
5247 |
self updateCurrentDirectory:true. |
|
5248 |
self currentFileNameHolder value:copiedFiles values. |
|
5249 |
] |
|
3892 | 5250 |
! |
5251 |
||
5252 |
renameFile:aFile |
|
5253 |
"rename the selected file(s)" |
|
5254 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5255 |
^ self renameFiles:(Array with:aFile). |
3892 | 5256 |
! |
5257 |
||
4230 | 5258 |
renameFile:filename to:newFileString update:aBoolean |
3892 | 5259 |
"rename filename to newFileString" |
5260 |
||
5261 |
|rename| |
|
5262 |
||
5961 | 5263 |
rename := FileOperation renameFile:filename to:newFileString. |
3892 | 5264 |
rename result ifTrue:[ |
4230 | 5265 |
aBoolean ifTrue:[ |
5266 |
self updateAndSelect:(rename renamedFiles). |
|
5267 |
]. |
|
3892 | 5268 |
] ifFalse:[ |
4523 | 5269 |
self notify:rename errorString. |
3892 | 5270 |
]. |
5271 |
^ rename result |
|
5272 |
! |
|
5273 |
||
5274 |
renameFiles:aColOfFiles |
|
6373 | 5275 |
"rename some file(s)" |
3892 | 5276 |
|
5277 |
|rename| |
|
5278 |
||
5961 | 5279 |
rename := FileOperation renameFiles:aColOfFiles. |
3892 | 5280 |
rename result ifFalse:[ |
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5281 |
self notify:rename errorString. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5282 |
^ nil. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5283 |
]. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5284 |
^ rename |
3892 | 5285 |
! |
5286 |
||
5287 |
renameSelection |
|
5288 |
"rename the selected file(s)" |
|
5289 |
||
9793
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5290 |
|renamed| |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5291 |
|
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5292 |
renamed := self renameFiles:(self currentSelectedObjects copy). |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5293 |
renamed notNil ifTrue:[ |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5294 |
self updateAndSelect:renamed renamedFiles. |
df3c1b8165fa
variable renamed in: #renameFile:
Stefan Vogel <sv@exept.de>
parents:
9784
diff
changeset
|
5295 |
]. |
7560 | 5296 |
|
5297 |
"Modified: / 04-12-2006 / 13:15:24 / cg" |
|
3892 | 5298 |
! ! |
5299 |
||
4080 | 5300 |
!AbstractFileBrowser methodsFor:'menu accessing'! |
3892 | 5301 |
|
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5302 |
bookmarksMenu |
3952 | 5303 |
<resource: #programMenu> |
5304 |
||
14941 | 5305 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec. |
5306 |
! |
|
5307 |
||
5308 |
bookmarksMenuForBaseSpec:aBaseMenuSpec |
|
5309 |
<resource: #programMenu> |
|
5310 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5311 |
|menu bookmarks| |
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5312 |
|
14941 | 5313 |
menu := aBaseMenuSpec decodeAsLiteralArray. |
7763 | 5314 |
|
5315 |
"/ add the bookmark items ... |
|
5316 |
bookmarks := self class directoryBookmarks. |
|
5317 |
bookmarks notEmptyOrNil ifTrue:[ |
|
14604 | 5318 |
menu addSeparator. |
7763 | 5319 |
bookmarks do:[:dirName | |
12963 | 5320 |
menu addItem:(MenuItem |
5321 |
label:dirName asString |
|
5322 |
itemValue:[ |
|
5323 |
(self currentSelectedDirectories includes:dirName) ifFalse:[ |
|
5324 |
self setCurrentFileName:dirName. |
|
5325 |
]. |
|
5326 |
]). |
|
7763 | 5327 |
]. |
5328 |
]. |
|
4080 | 5329 |
menu findGuiResourcesIn:self. |
7763 | 5330 |
^ menu |
5331 |
||
11135 | 5332 |
"Modified: / 14-01-2012 / 21:14:03 / cg" |
7763 | 5333 |
! |
5334 |
||
5335 |
canBackward |
|
5336 |
^ self directoryHistory canBackward. |
|
5337 |
||
5338 |
"Modified: / 27-03-2007 / 10:54:55 / cg" |
|
5339 |
! |
|
5340 |
||
5341 |
canForward |
|
5342 |
^ self directoryHistory canForward. |
|
5343 |
||
5344 |
"Modified: / 27-03-2007 / 10:54:57 / cg" |
|
5345 |
! |
|
5346 |
||
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
5347 |
gotoBookmarksMenu |
7763 | 5348 |
<resource: #programMenu> |
5349 |
||
14941 | 5350 |
^ self bookmarksMenuForBaseSpec:self class baseBookmarksMenuSpec2. |
6099 | 5351 |
! |
5352 |
||
3892 | 5353 |
menuDirHistory:backOrForward |
7763 | 5354 |
"initialize the history menu" |
5355 |
||
3892 | 5356 |
<resource: #programMenu > |
5357 |
||
7763 | 5358 |
|hist menu pathList currentSel currentPath| |
5359 |
||
5360 |
hist := self directoryHistory. |
|
5361 |
hist isEmpty ifTrue:[^ nil]. |
|
5362 |
||
3892 | 5363 |
backOrForward == #back ifTrue:[ |
6725 | 5364 |
currentSel := self currentSelectedDirectories. |
4347 | 5365 |
currentSel size == 1 ifTrue:[ |
5366 |
currentPath := currentSel first asString. |
|
5367 |
] ifFalse:[ |
|
5368 |
currentPath := nil. |
|
5369 |
]. |
|
7763 | 5370 |
pathList := hist getBackCollection. |
3892 | 5371 |
] ifFalse:[ |
7763 | 5372 |
pathList := hist getForwardCollection. |
3892 | 5373 |
]. |
4022 | 5374 |
pathList isEmpty ifTrue:[ ^ nil]. |
7763 | 5375 |
|
6370 | 5376 |
pathList size > 30 ifTrue:[ |
5377 |
pathList := pathList copyTo:30 |
|
5378 |
]. |
|
7763 | 5379 |
|
5380 |
menu := Menu new. |
|
5381 |
||
3964 | 5382 |
pathList do:[:aPath| |
14593 | 5383 |
menu addItem:(MenuItem |
5384 |
label:aPath |
|
5385 |
itemValue:[ self setCurrentFileName:(aPath asFilename) ] |
|
5386 |
translateLabel:false). |
|
3952 | 5387 |
]. |
7763 | 5388 |
menu findGuiResourcesIn:self. |
3892 | 5389 |
^ menu |
7763 | 5390 |
|
11783 | 5391 |
"Modified: / 09-09-2012 / 13:07:22 / cg" |
3892 | 5392 |
! |
5393 |
||
5394 |
menuDirHistoryBack |
|
5395 |
"initialize the directory menu |
|
5396 |
" |
|
5397 |
<resource: #programMenu > |
|
5398 |
||
5399 |
^ self menuDirHistory:#back. |
|
5400 |
! |
|
5401 |
||
5402 |
menuDirHistoryForward |
|
5403 |
"initialize the directory menu |
|
5404 |
" |
|
5405 |
<resource: #programMenu > |
|
5406 |
||
5407 |
^ self menuDirHistory:#forward. |
|
3906 | 5408 |
! |
5409 |
||
5410 |
menuFileHistory |
|
5411 |
"initialize the file history menu |
|
5412 |
" |
|
5413 |
<resource: #programMenu > |
|
5414 |
||
7763 | 5415 |
|menu hist text removeItem| |
3906 | 5416 |
|
5417 |
hist := self fileHistory. |
|
5418 |
hist isEmpty ifTrue:[^ nil]. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5419 |
|
7763 | 5420 |
menu := Menu new. |
5421 |
||
5422 |
hist copy do:[:aFileItem| |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5423 |
aFileItem fileName exists ifTrue:[ |
12963 | 5424 |
menu addItem:(MenuItem |
5425 |
label: aFileItem fileName asString |
|
14593 | 5426 |
itemValue: |
5427 |
[ |
|
5428 |
self setCurrentFileName:(aFileItem fileName). |
|
5429 |
self openApplByFileItem:aFileItem |
|
5430 |
] |
|
5431 |
translateLabel:false). |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5432 |
] ifFalse:[ |
7763 | 5433 |
"/ remove all not existing history entries |
5434 |
hist remove:aFileItem. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5435 |
] |
3906 | 5436 |
]. |
7763 | 5437 |
menu addSeparator. |
5438 |
||
4080 | 5439 |
removeItem := MenuItem new. |
5440 |
removeItem translateLabel:true. |
|
4391
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5441 |
text := resources string:'Clear History'. |
05ad03de6f3c
no icon in clearHistory menuItem
Claus Gittinger <cg@exept.de>
parents:
4368
diff
changeset
|
5442 |
"/ text := LabelAndIcon icon:(self class clearHistoryIcon) string:text. |
4080 | 5443 |
removeItem label:text. |
11783 | 5444 |
removeItem |
5445 |
itemValue:[ |
|
5446 |
self fileHistory removeAll. |
|
5447 |
self enableFileHistory value:false. |
|
5448 |
]. |
|
3906 | 5449 |
menu addItem:removeItem. |
7763 | 5450 |
menu findGuiResourcesIn:self. |
3906 | 5451 |
^ menu |
7763 | 5452 |
|
11783 | 5453 |
"Modified (format): / 09-09-2012 / 13:07:36 / cg" |
3952 | 5454 |
! |
5455 |
||
4080 | 5456 |
sortMenu |
5457 |
<resource: #programMenu > |
|
5458 |
||
5459 |
|menu| |
|
5460 |
||
7763 | 5461 |
menu := Menu decodeFromLiteralArray:self class sortMenu. |
4080 | 5462 |
menu findGuiResourcesIn:self. |
5463 |
^ menu |
|
7763 | 5464 |
|
5465 |
"Modified: / 27-03-2007 / 10:47:42 / cg" |
|
4080 | 5466 |
! |
5467 |
||
5468 |
viewDetailsMenuSpec |
|
4976
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5469 |
|specContentsBrowser itemsContentsBrowser specHere itemsHere spec| |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5470 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5471 |
specHere := self class viewDetailsMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5472 |
itemsHere := specHere at:2. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5473 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5474 |
specContentsBrowser := self directoryContentsBrowser class viewBrowserMenuSpec. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5475 |
itemsContentsBrowser := (specContentsBrowser at:2). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5476 |
|
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5477 |
spec := specHere copy. |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5478 |
spec at:2 put:(itemsContentsBrowser , itemsHere). |
86594f3f8a9b
refactoring column visibility holder of DirectoryContentsBrowser
penk
parents:
4974
diff
changeset
|
5479 |
^ spec |
4080 | 5480 |
! |
5481 |
||
5482 |
viewInContentsBrowserMenu |
|
5009 | 5483 |
self |
5484 |
applicationNamed:#DirectoryContentsBrowser |
|
5485 |
ifPresentDo:[:appl | ^ appl viewBrowserMenu]. |
|
5486 |
||
5487 |
^ nil. |
|
4080 | 5488 |
! |
5489 |
||
3952 | 5490 |
visitedDirectoriesMenu |
5491 |
<resource: #programMenu > |
|
5492 |
||
5493 |
|menu histCopy text removeItem| |
|
5494 |
||
7763 | 5495 |
histCopy := self directoryHistory. |
5496 |
histCopy isEmpty ifTrue:[^ nil]. |
|
5497 |
||
3952 | 5498 |
menu := Menu new. |
7763 | 5499 |
|
5500 |
histCopy do:[:aFile| |
|
12963 | 5501 |
menu addItem:(MenuItem |
5502 |
label:aFile asString |
|
5503 |
itemValue:[ |
|
5504 |
self setCurrentFileName:(aFile path asFilename). |
|
5505 |
]). |
|
7763 | 5506 |
]. |
5507 |
menu addSeparator. |
|
5508 |
||
4672
185a4d75348f
common bookmark code with new fileBrowser
Claus Gittinger <cg@exept.de>
parents:
4663
diff
changeset
|
5509 |
"/ 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
|
5510 |
text := (resources string:'Clear History'). |
3952 | 5511 |
removeItem := MenuItem new. |
4040 | 5512 |
removeItem translateLabel:true. |
3952 | 5513 |
removeItem label:text. |
11783 | 5514 |
removeItem |
5515 |
itemValue:[ |
|
5516 |
self directoryHistory removeAll. |
|
5517 |
self enableForward value:self canForward. |
|
5518 |
self enableBack value:self canBackward. |
|
5519 |
]. |
|
7763 | 5520 |
|
3952 | 5521 |
menu addItem:removeItem. |
7763 | 5522 |
menu findGuiResourcesIn:self. |
3952 | 5523 |
^ menu |
7763 | 5524 |
|
11783 | 5525 |
"Modified: / 09-09-2012 / 13:07:45 / cg" |
3892 | 5526 |
! ! |
5527 |
||
5880 | 5528 |
!AbstractFileBrowser methodsFor:'menu actions'! |
5529 |
||
5530 |
doCompareTwoFiles |
|
5531 |
self openDiffView. |
|
5532 |
! |
|
5533 |
||
5534 |
doGoDirectoryUp |
|
5960 | 5535 |
| upDir directory rootInTreeView| |
5880 | 5536 |
|
5537 |
self enableDirectoryUp value ifFalse:[ ^ self]. |
|
5538 |
self currentFilesAreInSameDirectory ifTrue:[ |
|
5960 | 5539 |
directory := self currentDirectory. |
5540 |
directory isNil ifTrue:[ ^ self]. |
|
5880 | 5541 |
] ifFalse:[ |
5542 |
rootInTreeView := self |
|
5543 |
applicationNamed:#DirectoryTreeBrowser |
|
5544 |
ifPresentDo:[:appl | appl rootHolder]. |
|
5960 | 5545 |
directory := rootInTreeView value asFilename. |
5546 |
]. |
|
5547 |
upDir := directory directory. |
|
5959 | 5548 |
self setCurrentFileName:upDir. |
5880 | 5549 |
! |
5550 |
||
5551 |
doGotoDefaultDirectory |
|
5552 |
self gotoFile:(Filename defaultDirectory). |
|
5553 |
! |
|
5554 |
||
8091 | 5555 |
doGotoDesktopDirectory |
5556 |
self gotoFile:(Filename desktopDirectory). |
|
5557 |
! |
|
5558 |
||
5880 | 5559 |
doGotoHomeDirectory |
8091 | 5560 |
self gotoFile:(Filename homeDirectory). |
5880 | 5561 |
! |
5562 |
||
6434 | 5563 |
doGotoSmalltalkDirectory |
5564 |
self gotoFile:(self smalltalkDirectory). |
|
5565 |
! |
|
5566 |
||
17187 | 5567 |
doGotoSmalltalkWorkspaceDirectory |
5568 |
self gotoFile:(UserPreferences current workspaceDirectory). |
|
5569 |
! |
|
5570 |
||
9677 | 5571 |
doGotoTempDirectory |
5572 |
self gotoFile:(self tempDirectory). |
|
5573 |
||
5574 |
"Created: / 29-12-2010 / 11:03:17 / cg" |
|
5575 |
! |
|
5576 |
||
9596 | 5577 |
doMakeCurrentDirectory |
5578 |
OperatingSystem setCurrentDirectory:(self currentDirectory pathName). |
|
5579 |
self currentFileNameHolderChangedForCommon. |
|
5580 |
||
5581 |
"Created: / 26-10-2010 / 17:21:19 / cg" |
|
5582 |
! |
|
5583 |
||
5880 | 5584 |
fileGetInfo:longInfo |
5585 |
"get info on selected file - show it in a box" |
|
5586 |
||
5587 |
|string box updater| |
|
5588 |
||
5589 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
5590 |
string notNil ifTrue:[ |
|
5591 |
box := InfoBox title:string. |
|
5592 |
updater := [ |
|
5593 |
[true] whileTrue:[ |
|
5594 |
Delay waitForSeconds:2. |
|
5595 |
string := self getFileInfoStringForFirstSelectedFile:longInfo. |
|
5596 |
string isNil ifTrue:[ ^ self]. |
|
5597 |
box title:string |
|
5598 |
] |
|
5599 |
] fork. |
|
5600 |
box show. |
|
5601 |
updater terminate. |
|
5602 |
box destroy |
|
5603 |
] |
|
6434 | 5604 |
! |
5605 |
||
5606 |
smalltalkDirectory |
|
8590 | 5607 |
|stxPath| |
6434 | 5608 |
|
5609 |
stxPath := OperatingSystem pathOfSTXExecutable. |
|
8590 | 5610 |
stxPath isNil ifTrue:[ |
5611 |
^ Filename currentDirectory |
|
5612 |
]. |
|
5613 |
^ stxPath asFilename directory. |
|
9677 | 5614 |
! |
5615 |
||
5616 |
tempDirectory |
|
5617 |
^ Filename tempDirectory. |
|
5618 |
||
5619 |
"Created: / 29-12-2010 / 11:03:00 / cg" |
|
5880 | 5620 |
! ! |
5621 |
||
11139 | 5622 |
!AbstractFileBrowser methodsFor:'menu actions-file'! |
5623 |
||
14262 | 5624 |
addDirToJavaSourcePath |
5625 |
"add the current path to java's sourcePath |
|
5626 |
(only available with ST/J System" |
|
5627 |
||
5628 |
Java addToSourcePath:self currentDirectory pathName |
|
5629 |
||
5630 |
"Modified: 14.12.1996 / 15:37:47 / cg" |
|
5631 |
"Created: 2.8.1997 / 14:11:19 / cg" |
|
5632 |
! |
|
5633 |
||
11139 | 5634 |
copyFiles |
5635 |
self |
|
5636 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self copyFilesToClipBoard:filesOrDirs] |
|
5637 |
! |
|
5638 |
||
5639 |
cutFiles |
|
5640 |
self |
|
5641 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self cutFilesToClipBoard:filesOrDirs] |
|
5642 |
! |
|
5643 |
||
5644 |
deleteFiles |
|
5645 |
self |
|
5646 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self deleteFiles:filesOrDirs] |
|
5647 |
! |
|
5648 |
||
5649 |
eraseFiles |
|
5650 |
self |
|
5651 |
withSelectedFilesOrDirectoriesDo:[:filesOrDirs | self eraseFiles:filesOrDirs] |
|
5652 |
! |
|
5653 |
||
14262 | 5654 |
fileAddToJavaSourcePath |
5655 |
"add the current path to java's sourcePath |
|
5656 |
(only available with ST/J System" |
|
5657 |
||
5658 |
self currentSelectedObjects do:[:each | |
|
5659 |
Java addToSourcePath:(each pathName) |
|
5660 |
]. |
|
5661 |
||
5662 |
"Created: / 9.11.1998 / 05:41:34 / cg" |
|
5663 |
"Modified: / 9.11.1998 / 05:56:00 / cg" |
|
5664 |
! |
|
5665 |
||
11139 | 5666 |
openSettingsDialog |
5667 |
|dialog| |
|
5668 |
||
5669 |
dialog := FileBrowserV2SettingsDialog new. |
|
5670 |
dialog settingsDialog:self. |
|
5671 |
dialog allButOpen. |
|
5672 |
dialog doReload. |
|
5673 |
dialog openWindow |
|
5674 |
! |
|
5675 |
||
5676 |
withSelectedFilesOrDirectoriesDo:aBlock |
|
5677 |
|files dirs| |
|
5678 |
||
5679 |
files := self currentSelectedFiles. |
|
5680 |
files notEmpty ifTrue:[ |
|
5681 |
aBlock value:files. |
|
5682 |
] ifFalse:[ |
|
5683 |
dirs := self currentSelectedDirectories. |
|
5684 |
dirs notEmpty ifTrue:[ |
|
5685 |
aBlock value:dirs. |
|
5686 |
]. |
|
5687 |
]. |
|
5688 |
! ! |
|
5689 |
||
5690 |
!AbstractFileBrowser methodsFor:'menu actions-help'! |
|
5691 |
||
5692 |
openAboutThisApplication |
|
5693 |
"opens an about box for this application." |
|
5694 |
||
5695 |
Dialog aboutClass:self class. |
|
5696 |
! |
|
5697 |
||
5698 |
openHTMLDocument:relativeDocPath |
|
5699 |
HTMLDocumentView openFullOnDocumentationFile:relativeDocPath |
|
5700 |
! ! |
|
5701 |
||
5702 |
!AbstractFileBrowser methodsFor:'menu actions-scm-cvs'! |
|
3892 | 5703 |
|
15905 | 5704 |
canCvsAddAndCommit |
5705 |
||
5706 |
|selectedFiles| |
|
5707 |
||
5708 |
selectedFiles := self currentSelectedObjects. |
|
5709 |
^ (selectedFiles notEmpty and:[self currentFilesAreInSameDirectory]). |
|
5710 |
! |
|
5711 |
||
5712 |
canRemoveCVSContainer |
|
5713 |
^ self currentSelectedFiles |
|
5714 |
contains:[:fileName| |
|
5715 |
|dirOfFile cvsDir| |
|
5716 |
||
5717 |
dirOfFile := self getDirWithoutFileName:fileName. |
|
5718 |
cvsDir := dirOfFile construct:'CVS'. |
|
5719 |
cvsDir isDirectory |
|
5720 |
]. |
|
5721 |
! |
|
5722 |
||
12777 | 5723 |
commitFilesToCVS:files |
5724 |
|numFiles| |
|
5725 |
||
5726 |
(numFiles := files size) > 0 ifTrue:[ |
|
5727 |
self withActivityIndicationDo:[ |
|
5728 |
self cvsCommitFiles:files |
|
5729 |
] |
|
5730 |
] |
|
5731 |
! |
|
5732 |
||
3892 | 5733 |
cvsAddAndCommit |
4849 | 5734 |
self cvsAddAndCommitAsBinary:false |
5735 |
! |
|
5736 |
||
5737 |
cvsAddAndCommitAsBinary:asBinary |
|
8588 | 5738 |
|sel log logArg binArg cmd dir executionBlock nameString| |
3892 | 5739 |
|
5740 |
log := Dialog |
|
11139 | 5741 |
requestText:(resources string:'Enter initial log message:') |
4414 | 5742 |
lines:10 |
5743 |
columns:70 |
|
5744 |
initialAnswer:nil. |
|
8322
cf10f08b6164
care for cancel in #cvsAddAndCommitAsBinary:
Claus Gittinger <cg@exept.de>
parents:
8294
diff
changeset
|
5745 |
log isNil ifTrue:[^ self]. |
3892 | 5746 |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5747 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5748 |
logArg := '-m "' , log , '"'. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5749 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5750 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5751 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5752 |
|
8588 | 5753 |
binArg := ''. |
5754 |
asBinary ifTrue:[ |
|
5755 |
binArg := '-kb '. |
|
5756 |
]. |
|
3982 | 5757 |
sel := self currentSelectedFiles. |
11139 | 5758 |
executionBlock := |
5759 |
[:stream | |
|
5760 |
log notNil ifTrue:[ |
|
5761 |
sel size > 0 ifTrue:[ |
|
5762 |
sel do:[:fn | |
|
5763 |
|nameArg| |
|
5764 |
||
5765 |
nameArg := '"',fn baseName,'"'. |
|
5766 |
||
5767 |
dir := self getDirWithoutFileName:fn. |
|
5768 |
cmd := 'cvs add ',logArg,' ',binArg,nameArg. |
|
5769 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5770 |
||
5771 |
cmd := ('cvs commit -l ',logArg,' ',nameArg). |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5772 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
11139 | 5773 |
"/ mhmh - it seems that only old CVS implementations (at least turqoise) |
5774 |
"/ support and need the 'admin -kb' command. |
|
5775 |
"/ newer ones use the '-kb' option in the 'cvs add' command |
|
5776 |
asBinary ifTrue:[ |
|
5777 |
cmd := ('cvs admin -kb ' , nameArg). |
|
5778 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5779 |
||
5780 |
cmd := ('cvs upd ' , nameArg). |
|
5781 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5782 |
]. |
|
5783 |
] |
|
5784 |
] |
|
5785 |
] |
|
5786 |
]. |
|
4107 | 5787 |
nameString := 'Command> cvs add and commit'. |
3892 | 5788 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
11139 | 5789 |
|
5790 |
"Modified (format): / 15-01-2012 / 16:02:07 / cg" |
|
3892 | 5791 |
! |
5792 |
||
4849 | 5793 |
cvsAddBinaryAndCommit |
5794 |
self cvsAddAndCommitAsBinary:true |
|
5795 |
! |
|
5796 |
||
3892 | 5797 |
cvsCommit |
12777 | 5798 |
|selectedFiles| |
3892 | 5799 |
|
3982 | 5800 |
selectedFiles:= self currentSelectedFiles. |
12777 | 5801 |
self cvsCommitFiles:selectedFiles |
5802 |
! |
|
5803 |
||
5804 |
cvsCommitFiles:files |
|
5805 |
|nFiles log logTmp s logArg msg executionBlock nameString | |
|
5806 |
||
5807 |
nFiles := files size. |
|
5808 |
nFiles == 0 ifTrue:[^ self]. |
|
5809 |
||
5810 |
nFiles == 1 ifTrue:[ |
|
5811 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(files first baseName) |
|
3892 | 5812 |
] ifFalse:[ |
12777 | 5813 |
nFiles > 1 ifTrue:[ |
5814 |
msg := resources string:'Enter log message for %1 files to checkIn' with:nFiles printString |
|
4414 | 5815 |
] ifFalse:[ |
6627 | 5816 |
msg := resources string:'Enter log message for checkIn' |
4414 | 5817 |
] |
3892 | 5818 |
]. |
5819 |
||
5820 |
log := Dialog |
|
4414 | 5821 |
requestText:msg |
5822 |
lines:10 |
|
5823 |
columns:70 |
|
5824 |
initialAnswer:nil. |
|
3892 | 5825 |
|
4663 | 5826 |
log isNil ifTrue:[^ self]. |
12777 | 5827 |
log := log replChar:$" withString:'\"'. |
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5828 |
|
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5829 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
12777 | 5830 |
"/ save the log message into another tempFile ... |
13121 | 5831 |
s := FileStream newTemporary. |
5832 |
logTmp := s fileName. |
|
12777 | 5833 |
s nextPutAll:log. |
5834 |
s close. |
|
5835 |
||
5836 |
logArg := '-F "', logTmp pathName, '"'. |
|
6205
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5837 |
] ifFalse:[ |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5838 |
logArg := '-m ''' , log , ''''. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5839 |
]. |
0c94c101cfde
cvs - log-argument fixes for win32
Claus Gittinger <cg@exept.de>
parents:
6204
diff
changeset
|
5840 |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
5841 |
executionBlock := [:stream | |
12777 | 5842 |
[ |
5843 |
files do:[:fn | |
|
5844 |
| dir nameArg cmd | |
|
5845 |
||
5846 |
nameArg := '"',fn baseName,'"'. |
|
5847 |
dir := fn directory. |
|
5848 |
cmd := 'cvs commit ',logArg,' ' , nameArg. |
|
5849 |
stream showCR:fn pathName. |
|
5850 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
4663 | 5851 |
] |
12777 | 5852 |
] ensure:[ |
5853 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
5854 |
]. |
|
4107 | 5855 |
]. |
5856 |
nameString := 'Command> cvs commit'. |
|
5857 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
3892 | 5858 |
! |
5859 |
||
14527 | 5860 |
cvsCommitFolder |
5861 |
|dir log logTmp s logArg msg executionBlock nameString | |
|
5862 |
||
5863 |
(dir := self currentDirectory) isNil ifTrue:[ ^ self ]. |
|
5864 |
||
5865 |
msg := resources string:'Enter log message for checkIn of "%1"' with:(dir baseName). |
|
5866 |
log := Dialog |
|
5867 |
requestText:msg |
|
5868 |
lines:10 |
|
5869 |
columns:70 |
|
5870 |
initialAnswer:nil. |
|
5871 |
||
5872 |
log isNil ifTrue:[^ self]. |
|
5873 |
log := log replChar:$" withString:'\"'. |
|
5874 |
||
5875 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
5876 |
"/ save the log message into another tempFile ... |
|
5877 |
s := FileStream newTemporary. |
|
5878 |
logTmp := s fileName. |
|
5879 |
s nextPutAll:log. |
|
5880 |
s close. |
|
5881 |
||
5882 |
logArg := '-F "', logTmp pathName, '"'. |
|
5883 |
] ifFalse:[ |
|
5884 |
logArg := '-m ''' , log , ''''. |
|
5885 |
]. |
|
5886 |
||
5887 |
executionBlock := [:stream | |
|
5888 |
[ |
|
5889 |
|cmd| |
|
5890 |
||
5891 |
cmd := 'cvs commit ',logArg. |
|
5892 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5893 |
] ensure:[ |
|
5894 |
logTmp notNil ifTrue:[ logTmp remove ]. |
|
5895 |
]. |
|
5896 |
]. |
|
5897 |
||
5898 |
nameString := 'Command> cvs commit'. |
|
5899 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
5900 |
! |
|
5901 |
||
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5902 |
cvsCompareWithNewest |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5903 |
|selectedFiles| |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5904 |
|
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5905 |
selectedFiles:= self currentSelectedFiles. |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5906 |
selectedFiles do:[:each | |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5907 |
|out diffs| |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5908 |
|
15589 | 5909 |
out := CharacterWriteStream new:100. |
11176
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5910 |
OperatingSystem |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5911 |
executeCommand:'cvs diff -b ',each baseName |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5912 |
outputTo:out |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5913 |
inDirectory:each directoryName. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5914 |
diffs := out contents. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5915 |
TextView openWith:diffs. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5916 |
]. |
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5917 |
|
eb02b211e777
changed: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
11162
diff
changeset
|
5918 |
"Modified: / 23-01-2012 / 14:08:28 / cg" |
9407
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5919 |
! |
cf114ba82b6d
added: #cvsCompareWithNewest
Claus Gittinger <cg@exept.de>
parents:
9405
diff
changeset
|
5920 |
|
15211 | 5921 |
cvsRemoveAndRemoveFromCVS:filesToRemove |
5922 |
"remove the selected file(s) and their CVS containers - no questions asked" |
|
5923 |
||
5924 |
|toRemove updateRunning executionBlock nameString| |
|
5925 |
||
5926 |
updateRunning := self backgroundProcesses value notEmpty. |
|
5927 |
self killAllRunningBackgroundProcesses. |
|
5928 |
toRemove := OrderedCollection new. |
|
5929 |
||
5930 |
executionBlock := |
|
5931 |
[:stream | |
|
5932 |
|cmd logArg prevDir prevFiles| |
|
5933 |
||
5934 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
5935 |
logArg := '-m "' , 'removed via FileBrowser' , '"'. |
|
5936 |
] ifFalse:[ |
|
5937 |
logArg := '-m ''' , 'removed via FileBrowser' , ''''. |
|
5938 |
]. |
|
5939 |
prevFiles := ''. |
|
5940 |
||
5941 |
filesToRemove do:[:fileName | |
|
5942 |
|dir file| |
|
5943 |
||
5944 |
dir := fileName directory. |
|
5945 |
(prevDir notNil and:[prevDir ~= dir]) ifTrue:[ |
|
5946 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
5947 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
5948 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
5949 |
prevFiles := ''. |
|
5950 |
]. |
|
5951 |
||
17116 | 5952 |
OsError handle:[:ex| |
15211 | 5953 |
"was not able to remove it" |
5954 |
| lastError msg | |
|
5955 |
lastError := OperatingSystem lastErrorString. |
|
5956 |
msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
|
5957 |
lastError isNil ifFalse:[ |
|
5958 |
msg := msg , '\\(' , lastError , ')' |
|
5959 |
]. |
|
5960 |
Dialog warn:msg withCRs |
|
5961 |
] do:[ |
|
5962 |
(fileName isSymbolicLink) ifFalse:[ |
|
5963 |
fileName remove. |
|
5964 |
file := fileName baseName. |
|
5965 |
cmd := ('cvs remove -f "',file,'"'). |
|
5966 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
5967 |
"/ Transcript show:dir; space; showCR:cmd. |
|
5968 |
] |
|
5969 |
]. |
|
5970 |
prevDir := dir. |
|
5971 |
prevFiles := prevFiles,' ',file. |
|
5972 |
]. |
|
5973 |
cmd := 'cvs commit -l ',logArg, ' ',prevFiles. |
|
5974 |
"/ Transcript show:prevDir; space; showCR:cmd. |
|
5975 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
5976 |
]. |
|
5977 |
nameString := 'Command> cvs remove and commit ', filesToRemove first baseName. |
|
5978 |
filesToRemove size > 1 ifTrue:[ |
|
5979 |
nameString := nameString, ' ...'. |
|
5980 |
]. |
|
5981 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
5982 |
! |
|
3892 | 5983 |
|
5984 |
cvsRemoveFileAndCVSContainer |
|
12493 | 5985 |
|files| |
5986 |
||
5987 |
files := self currentSelectedFiles copy. |
|
5988 |
self removeFilesAndCVSContainers:files |
|
3892 | 5989 |
! |
5990 |
||
9338 | 5991 |
cvsRevisionLog |
5992 |
| cmd sel executionBlock nameString| |
|
5993 |
||
5994 |
sel := self currentSelectedObjects. |
|
5995 |
sel isEmpty ifTrue:[ ^ self ]. |
|
5996 |
||
5997 |
executionBlock := [:stream | |
|
5998 |
sel do:[:fn | |
|
5999 |
| dir nameArg | |
|
6000 |
||
6001 |
nameArg := '"',fn baseName,'"'. |
|
6002 |
dir := fn directory. |
|
6003 |
cmd := 'cvs log ' , nameArg. |
|
6004 |
(self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream. |
|
6005 |
] |
|
6006 |
]. |
|
6007 |
nameString := 'Command> cvs log'. |
|
6008 |
self makeExecutionResultProcessFor:executionBlock withName:nameString. |
|
6009 |
! |
|
6010 |
||
8562 | 6011 |
cvsTagSelection |
12856 | 6012 |
|tag tags cmd| |
6013 |
||
6014 |
tag := Dialog |
|
6015 |
request:(resources string:'Tag (possibly multiple, separated by ";"):') |
|
6016 |
initialAnswer:(CVSSourceCodeManager recentTag). |
|
6017 |
tag isEmptyOrNil ifTrue:[^ self ]. |
|
6018 |
||
6019 |
CVSSourceCodeManager recentTag:tag. |
|
8562 | 6020 |
|
6021 |
CVSSourceCodeManager notNil ifTrue:[ |
|
6022 |
cmd := CVSSourceCodeManager cvsExecutable. |
|
6023 |
] ifFalse:[ |
|
6024 |
cmd := 'cvs'. |
|
6025 |
]. |
|
6026 |
||
12856 | 6027 |
tags := tag asCollectionOfSubstringsSeparatedByAny:',;'. |
6028 |
tags do:[:eachTag | |
|
6029 |
self executeCommand:('%1 tag -F "%2" %3' |
|
6030 |
bindWith:cmd |
|
12858 | 6031 |
with:(eachTag withoutSeparators) |
12856 | 6032 |
with:(self makeFileNameArgumentString)) |
6033 |
]. |
|
8562 | 6034 |
! |
6035 |
||
3892 | 6036 |
cvsUpdateAll |
6037 |
| cmd | |
|
6038 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6039 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6040 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6041 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6042 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6043 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6044 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6045 |
self executeCommand:(cmd, ' upd -l'). |
3892 | 6046 |
! |
6047 |
||
6048 |
cvsUpdateAllRecursive |
|
6049 |
| cmd | |
|
6050 |
||
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6051 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6052 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6053 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6054 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6055 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6056 |
self executeCommand:(cmd, ' upd -d'). |
3892 | 6057 |
! |
6058 |
||
6059 |
cvsUpdateSelection |
|
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6060 |
|stream cmd| |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6061 |
|
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6062 |
CVSSourceCodeManager notNil ifTrue:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6063 |
cmd := CVSSourceCodeManager cvsExecutable. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6064 |
] ifFalse:[ |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6065 |
cmd := 'cvs'. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6066 |
]. |
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6067 |
|
15589 | 6068 |
stream := CharacterWriteStream new. |
8563 | 6069 |
stream |
6070 |
nextPutAll:cmd; |
|
6071 |
nextPutAll:' upd '; |
|
6072 |
nextPutAll:(self makeFileNameArgumentString). |
|
6073 |
||
6074 |
self executeCommand:stream contents. |
|
6075 |
! |
|
6076 |
||
6077 |
makeFileNameArgumentString |
|
6078 |
|stream| |
|
6079 |
||
15589 | 6080 |
stream := CharacterWriteStream new. |
8042
5a4655a03124
Get cvs executable path from CVSSourceCodeManager
Stefan Vogel <sv@exept.de>
parents:
8039
diff
changeset
|
6081 |
self currentSelectedFiles do:[: file | |
8563 | 6082 |
stream nextPut:$". |
4414 | 6083 |
stream nextPutAll:file baseName. |
8563 | 6084 |
stream nextPutAll:'" '. |
6085 |
]. |
|
6086 |
^ stream contents. |
|
12493 | 6087 |
! |
6088 |
||
6089 |
removeFilesAndCVSContainers:files |
|
6090 |
|numFiles question aswer| |
|
6091 |
||
6092 |
(numFiles := files size) > 0 ifTrue:[ |
|
6093 |
numFiles > 1 ifTrue:[ |
|
6094 |
question := resources string:'Remove %1 selected files and their CVS containers ?' with:numFiles |
|
6095 |
] ifFalse:[ |
|
6096 |
question := resources string:'Remove ''%1'' and its CVS container ?' with:(files first baseName allBold) |
|
6097 |
]. |
|
6098 |
||
6099 |
aswer := Dialog |
|
6100 |
confirm:question withCRs |
|
6101 |
yesLabel:(resources string:'Remove') |
|
6102 |
noLabel:(resources string:'Cancel'). |
|
6103 |
||
6104 |
aswer ifTrue:[ |
|
6105 |
self withActivityIndicationDo:[ |
|
6106 |
self cvsRemoveAndRemoveFromCVS:files |
|
6107 |
] |
|
6108 |
] |
|
6109 |
] |
|
3892 | 6110 |
! ! |
6111 |
||
14126 | 6112 |
|
11139 | 6113 |
!AbstractFileBrowser methodsFor:'menu actions-scm-mercurial'! |
6114 |
||
6115 |
mercurialAdd |
|
6116 |
|executionBlock sel maxCmdSize| |
|
6117 |
||
6118 |
maxCmdSize := 512. |
|
6119 |
||
6120 |
sel := self currentSelectedObjects. |
|
6121 |
sel isEmptyOrNil ifTrue:[ |
|
6122 |
^ self |
|
6123 |
]. |
|
6124 |
||
6125 |
executionBlock := |
|
6126 |
[:stream | |
|
6127 |
|prevDir cmd| |
|
6128 |
||
6129 |
prevDir := nil. |
|
6130 |
sel do:[:fn | |
|
6131 |
|nameArg dir| |
|
6132 |
||
6133 |
nameArg := '"',fn baseName,'"'. |
|
6134 |
dir := fn directory. |
|
6135 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6136 |
"/ flush |
|
6137 |
cmd notNil ifTrue:[ |
|
6138 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6139 |
cmd := nil. |
|
6140 |
] |
|
6141 |
]. |
|
6142 |
cmd isNil ifTrue:[ |
|
6143 |
cmd := 'hg add'. |
|
6144 |
]. |
|
6145 |
cmd := cmd,' ',nameArg. |
|
6146 |
prevDir := dir. |
|
6147 |
]. |
|
6148 |
cmd notNil ifTrue:[ |
|
6149 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6150 |
cmd := nil. |
|
6151 |
]. |
|
6152 |
stream nextPutLine:'Commit to finish the transaction'. |
|
6153 |
]. |
|
6154 |
||
6155 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg add'. |
|
6156 |
||
6157 |
"Created: / 15-01-2012 / 15:55:47 / cg" |
|
6158 |
! |
|
6159 |
||
6160 |
mercurialCommit |
|
6161 |
|dir executionBlock| |
|
6162 |
||
6163 |
"/ dir := self currentDirectory. |
|
6164 |
dir := self directoryContentsBrowser directory. |
|
6165 |
executionBlock := |
|
6166 |
[:stream | |
|
6167 |
(self getExecutionBlockForCommand:'hg commit' |
|
6168 |
inDirectory:dir) value:stream. |
|
6169 |
stream nextPutLine:'Push to sync other repositories'. |
|
6169 | 6170 |
]. |
11139 | 6171 |
|
6172 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg commit'. |
|
6173 |
||
6174 |
"Created: / 15-01-2012 / 16:21:27 / cg" |
|
6175 |
! |
|
6176 |
||
11144 | 6177 |
mercurialInit |
6178 |
|dir executionBlock| |
|
6179 |
||
6180 |
dir := self directoryContentsBrowser directory. |
|
6181 |
||
6182 |
(Dialog confirm:(resources |
|
6183 |
string:'Initialize new Mercurial Repository in %1?' |
|
6184 |
with:dir baseName)) ifFalse:[^ self]. |
|
6185 |
||
6186 |
executionBlock := |
|
6187 |
[:stream | |
|
6188 |
(self getExecutionBlockForCommand:('hg init') |
|
6189 |
inDirectory:dir) value:stream. |
|
6190 |
]. |
|
6191 |
||
6192 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg init'. |
|
6193 |
||
6194 |
"Created: / 17-01-2012 / 15:58:46 / cg" |
|
6195 |
! |
|
6196 |
||
11139 | 6197 |
mercurialPush |
6198 |
|destination dir executionBlock| |
|
6199 |
||
6200 |
destination := Dialog request:'Mercurial Repository' |
|
6201 |
initialAnswer:(LastMercurialRepository ? MercurialSourceCodeManager repositoryName). |
|
6202 |
destination isEmptyOrNil ifTrue:[^ self]. |
|
6203 |
||
6204 |
LastMercurialRepository := destination. |
|
6205 |
||
6206 |
dir := self directoryContentsBrowser directory. |
|
6207 |
executionBlock := |
|
6208 |
[:stream | |
|
6209 |
(self getExecutionBlockForCommand:('hg push "%1"' bindWith:destination) |
|
6210 |
inDirectory:dir) value:stream. |
|
6211 |
]. |
|
6212 |
||
6213 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg push'. |
|
6214 |
||
6215 |
"Created: / 15-01-2012 / 16:29:41 / cg" |
|
6216 |
! |
|
6217 |
||
6218 |
mercurialStatus |
|
6219 |
|executionBlock sel maxCmdSize| |
|
6220 |
||
6221 |
maxCmdSize := 512. |
|
6222 |
||
6223 |
sel := self currentSelectedObjects. |
|
6224 |
sel isEmptyOrNil ifTrue:[ |
|
6225 |
^ self |
|
6226 |
]. |
|
6227 |
||
6228 |
executionBlock := |
|
6229 |
[:stream | |
|
6230 |
|prevDir cmd| |
|
6231 |
||
6232 |
prevDir := nil. |
|
6233 |
sel do:[:fn | |
|
6234 |
|nameArg dir| |
|
6235 |
||
6236 |
nameArg := '"',fn baseName,'"'. |
|
6237 |
dir := fn directory. |
|
6238 |
(dir ~= prevDir or:[ (cmd size + nameArg size) > maxCmdSize]) ifTrue:[ |
|
6239 |
"/ flush |
|
6240 |
cmd notNil ifTrue:[ |
|
6241 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6242 |
cmd := nil. |
|
6243 |
] |
|
6244 |
]. |
|
6245 |
cmd isNil ifTrue:[ |
|
6246 |
cmd := 'hg status'. |
|
6247 |
]. |
|
6248 |
cmd := cmd,' ',nameArg. |
|
6249 |
prevDir := dir. |
|
6250 |
]. |
|
6251 |
cmd notNil ifTrue:[ |
|
6252 |
(self getExecutionBlockForCommand:cmd inDirectory:prevDir) value:stream. |
|
6253 |
cmd := nil. |
|
6254 |
]. |
|
6255 |
]. |
|
6256 |
||
6257 |
self makeExecutionResultProcessFor:executionBlock withName:'Command> hg status'. |
|
6258 |
||
6259 |
"Created: / 15-01-2012 / 19:43:08 / cg" |
|
3892 | 6260 |
! ! |
6261 |
||
4849 | 6262 |
!AbstractFileBrowser methodsFor:'menu actions-tools'! |
3892 | 6263 |
|
8510 | 6264 |
allFilesInSelectedDirectoriesForWhich:aBlock |
6265 |
|directories allFiles| |
|
6266 |
||
6267 |
directories := self currentSelectedDirectories. |
|
6268 |
directories isEmpty ifTrue:[^ self]. |
|
6269 |
||
6270 |
allFiles := OrderedCollection new. |
|
6271 |
directories do:[:dir| |
|
6272 |
[ |
|
6273 |
|fileNames| |
|
6274 |
||
6275 |
fileNames := dir directoryContents. |
|
6276 |
fileNames notNil ifTrue:[ |
|
6277 |
fileNames := fileNames |
|
6278 |
collect:[:fn | dir construct:fn] |
|
6279 |
thenSelect:[:fn | fn isDirectory not and:[aBlock value:fn]]. |
|
6280 |
allFiles addAll:fileNames. |
|
6281 |
] |
|
6282 |
] on:FileStream openErrorSignal do:[:ex| |
|
6283 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
|
6284 |
with:ex pathName |
|
6285 |
with:ex description). |
|
6286 |
ex proceedWith:nil. |
|
6287 |
]. |
|
6288 |
]. |
|
6289 |
||
6290 |
^ allFiles |
|
6291 |
! |
|
6292 |
||
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6293 |
conversionChainFrom:inSuffix to:outSuffix |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6294 |
|conv| |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6295 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6296 |
inSuffix = outSuffix ifTrue:[ |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6297 |
^ nil |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6298 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6299 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6300 |
"/ 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
|
6301 |
"/ 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
|
6302 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6303 |
conv := OrderedCollection new. |
4722 | 6304 |
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
|
6305 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6306 |
outSuffix = 'png' ifTrue:[ |
4722 | 6307 |
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
|
6308 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6309 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6310 |
outSuffix = 'gif' ifTrue:[ |
4722 | 6311 |
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
|
6312 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6313 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6314 |
outSuffix = 'xpm' ifTrue:[ |
4722 | 6315 |
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
|
6316 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6317 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6318 |
outSuffix = 'jpg' ifTrue:[ |
4722 | 6319 |
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
|
6320 |
^ conv. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6321 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6322 |
self error:'unimplemented conversion'. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6323 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6324 |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6325 |
convertImageFrom:fileName to:outFile onError:exceptionBlock |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6326 |
|writer image outSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6327 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6328 |
outSuffix := outFile suffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6329 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6330 |
((writer := MIMETypes imageReaderForSuffix:outSuffix) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6331 |
and:[ (image := Image fromFile:fileName) notNil |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6332 |
and:[ writer canRepresent:image ]]) ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6333 |
"/ can do it with Smalltalk tools |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6334 |
writer save:image onFile:outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6335 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6336 |
"/ use external tools (pbm-package, if available) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6337 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6338 |
convertImageUsingExternalFileToolsFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6339 |
toSuffix:outSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6340 |
onError:exceptionBlock. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6341 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6342 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6343 |
"Created: / 20-05-2010 / 11:12:36 / cg" |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6344 |
! |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6345 |
|
4367 | 6346 |
convertImageToGIF |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6347 |
self convertImageToSuffix:'gif' |
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 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6350 |
convertImageToJPG |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6351 |
self convertImageToSuffix:'jpg' |
4531 | 6352 |
! |
6353 |
||
6354 |
convertImageToPNG |
|
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6355 |
self convertImageToSuffix:'png' |
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 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6358 |
convertImageToSuffix:outSuffix |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6359 |
|outFile filesToConvert| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6360 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6361 |
self withActivityIndicationDo:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6362 |
filesToConvert := self currentSelectedObjects copy. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6363 |
filesToConvert do:[:fileName | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6364 |
self notify:(resources string:'Converting: %1...' with:fileName baseName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6365 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6366 |
fileName isDirectory ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6367 |
|skip| |
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 |
skip := false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6370 |
outFile := fileName withSuffix:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6371 |
outFile exists ifTrue:[ |
4722 | 6372 |
|answer| |
6373 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6374 |
answer := Dialog |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6375 |
confirmWithCancel:(resources string:'Overwrite existing %1 ?' with:outFile baseName allBold) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6376 |
default:false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6377 |
answer isNil ifTrue:[AbortSignal raise]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6378 |
answer ifFalse:[ skip := true ]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6379 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6380 |
skip ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6381 |
self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6382 |
convertImageFrom:fileName |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6383 |
to:outFile |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6384 |
onError:[:errMsg | |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6385 |
filesToConvert size == 1 ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6386 |
Dialog warn:errMsg |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6387 |
] ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6388 |
(Dialog confirm:errMsg yesLabel:(resources string:'OK') noLabel:(resources string:'Cancel')) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6389 |
^ self |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6390 |
] |
4721
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6391 |
]. |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6392 |
]. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6393 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6394 |
self updateAndSelect:nil. |
4367 | 6395 |
] |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6396 |
] |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6397 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6398 |
self notify:nil. |
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 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6401 |
"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
|
6402 |
! |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6403 |
|
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6404 |
convertImageToXPM |
2fe2500194e6
more image conversions (png); req'd for eXept swiki.
Claus Gittinger <cg@exept.de>
parents:
4708
diff
changeset
|
6405 |
self convertImageToSuffix:'xpm' |
4367 | 6406 |
! |
6407 |
||
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6408 |
convertImageUsingExternalFileToolsFrom:fileName toSuffix:outSuffix onError:exceptionBlock |
13121 | 6409 |
|inFile outFile chainOfConversions conversionStream |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6410 |
eachConversionSuffixCommandPair eachConversionCommand eachConversionSuffix| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6411 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6412 |
chainOfConversions := self conversionChainFrom:(fileName suffix) to:outSuffix. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6413 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6414 |
chainOfConversions isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6415 |
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
|
6416 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6417 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6418 |
conversionStream := chainOfConversions readStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6419 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6420 |
inFile := fileName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6421 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6422 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6423 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6424 |
eachConversionCommand == #readToXPM ifTrue:[ |
13121 | 6425 |
|image tempStreamXPM| |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6426 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6427 |
image := Image fromFile:(inFile pathName). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6428 |
image isNil ifTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6429 |
self warn:'Unknown format/not an image: ' , inFile baseName. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6430 |
^ false. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6431 |
]. |
13121 | 6432 |
tempStreamXPM := FileStream newTemporaryWithSuffix:'xpm'. |
6433 |
XPMReader save:image onStream:tempStreamXPM. |
|
6434 |
tempStreamXPM close. |
|
6435 |
inFile := tempStreamXPM fileName. |
|
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6436 |
eachConversionSuffixCommandPair := conversionStream next. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6437 |
]. |
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 |
|command errOutput errMsg| |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6441 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6442 |
[eachConversionSuffixCommandPair notNil] whileTrue:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6443 |
eachConversionCommand := eachConversionSuffixCommandPair key. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6444 |
eachConversionSuffix := eachConversionSuffixCommandPair value. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6445 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6446 |
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
|
6447 |
|
13121 | 6448 |
outFile := (FileStream newTemporaryWithSuffix:eachConversionSuffix) close pathName. |
9493
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6449 |
command := eachConversionCommand |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6450 |
bindWith:(inFile pathName) |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6451 |
with:(outFile pathName). |
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 |
errOutput := String writeStream. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6454 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6455 |
(OperatingSystem executeCommand:command errorTo:errOutput) ifFalse:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6456 |
errMsg := resources |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6457 |
stringWithCRs:'Conversion of %1 to %2 using %3 failed:\\%4.' |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6458 |
with:inFile baseName allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6459 |
with:eachConversionSuffix |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6460 |
with:eachConversionCommand allBold |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6461 |
with:errOutput contents. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6462 |
exceptionBlock value:errMsg. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6463 |
|
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6464 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6465 |
outFile delete. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6466 |
^ false |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6467 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6468 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6469 |
inFile := outFile. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6470 |
eachConversionSuffixCommandPair := conversionStream next |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6471 |
]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6472 |
outFile moveTo:(fileName withSuffix:(chainOfConversions last value)). |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6473 |
] ifCurtailed:[ |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6474 |
(inFile ~= fileName) ifTrue:[inFile delete]. |
3fc4fb8c1b0a
changed: #convertImageToSuffix:
Claus Gittinger <cg@exept.de>
parents:
9490
diff
changeset
|
6475 |
outFile delete. |
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 |
^ true. |
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 |
"Created: / 20-05-2010 / 11:05:50 / cg" |
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 |
|
3892 | 6482 |
createProjectAndOpenProjectBrowser |
6483 |
|nm f s directory| |
|
6484 |
||
6485 |
self currentFilesAreInSameDirectory ifFalse:[^ self]. |
|
5960 | 6486 |
directory := self currentDirectory. |
3892 | 6487 |
nm := directory baseName. |
6488 |
f := (directory construct:nm) withSuffix:'prj'. |
|
6489 |
f exists ifTrue:[ |
|
4414 | 6490 |
Dialog warn:'A file named ' , f baseName , ' already exists.'. |
6491 |
^ self. |
|
3892 | 6492 |
]. |
6493 |
s := f writeStream. |
|
6494 |
s nextPutAll:' |
|
6495 |
name ''' , nm , ''' |
|
6496 |
type #classLibrary |
|
6497 |
package #''private:' , nm , ''' |
|
6498 |
prerequisites nil |
|
6499 |
||
6500 |
classes #( ) |
|
6501 |
'. |
|
6502 |
s close. |
|
6503 |
ProjectBrowser openOnFile:f. |
|
6504 |
! |
|
6505 |
||
5880 | 6506 |
doExecuteCommand |
6507 |
"execute an OperatingSystem-command" |
|
6508 |
||
6509 |
| action fileName| |
|
6510 |
||
6511 |
fileName := self firstSelectedFile. |
|
6512 |
action := [:command | |
|
6513 |
self addToCommandHistory:command for:fileName. |
|
6514 |
self executeCommand:command. |
|
6515 |
]. |
|
6516 |
self askForCommandFor:fileName thenDo:action |
|
6517 |
! |
|
6518 |
||
6519 |
doExecuteScript |
|
16941 | 6520 |
"execute a Smalltalk script" |
5880 | 6521 |
|
6522 |
|textHolder dialog template dummyClass dummyInstance| |
|
6523 |
||
6524 |
template := |
|
6525 |
'"/ Smalltalk script: |
|
6526 |
||
16084 | 6527 |
"/ the following variables are accessible: |
5880 | 6528 |
"/ directory (= ' , (self theSingleSelectedDirectoryOrNil ? Filename homeDirectory) pathName , ') |
6529 |
"/ selectedFiles (= ...) |
|
6530 |
"/ |
|
6531 |
"/ Beginner warning: Smalltalk know-how is useful here ;-). |
|
6532 |
"/ |
|
6533 |
"/ Useful operations are: |
|
6534 |
"/ directory directoryContentsDo:[:eachBaseNameString | ...] |
|
6535 |
"/ directory directoryContentsAsFilenamesDo:[:eachFilename | ...] |
|
6536 |
"/ directory directory |
|
6537 |
"/ |
|
6538 |
"/ example: move all files which match a aarticular pattern to |
|
6539 |
"/ a separate directory: |
|
6540 |
"/ |
|
6541 |
"/ |directory idx prefix rest newDir oldFile newFile| |
|
6542 |
"/ |
|
6543 |
"/ directory := ''/mnt/var/priv/image/tv/frank/frank2/2131_008.jpg'' asFilename. |
|
6544 |
"/ |
|
6545 |
"/ directory directoryContentsDo:[:eachBaseNameString | |
|
6546 |
"/ (eachBaseNameString includes:$_) ifTrue:[ |
|
6547 |
"/ idx := eachBaseNameString indexOf:$_. |
|
6548 |
"/ prefix := eachBaseNameString copyTo:(idx - 1). |
|
6549 |
"/ rest := eachBaseNameString copyFrom:(idx + 1). |
|
6550 |
"/ newDir := directory construct:prefix. |
|
6551 |
"/ newDir exists ifFalse:[ |
|
6552 |
"/ (Dialog confirm:''Create '' , newDir pathName) ifTrue:[ |
|
6553 |
"/ newDir makeDirectory. |
|
6554 |
"/ ]. |
|
6555 |
"/ ]. |
|
6556 |
"/ newDir exists ifTrue:[ |
|
6557 |
"/ oldFile := directory construct:eachBaseNameString. |
|
6558 |
"/ newFile := newDir construct:rest. |
|
6559 |
"/ oldFile moveTo:newFile |
|
6560 |
"/ ] |
|
6561 |
"/ ] |
|
6562 |
"/ ] |
|
6563 |
'. |
|
6564 |
||
6565 |
LastScriptBlockString isNil ifTrue:[ |
|
6566 |
LastScriptBlockString := template. |
|
6567 |
]. |
|
6568 |
||
6569 |
textHolder := ValueHolder new. |
|
6570 |
dialog := Dialog |
|
6571 |
forRequestText:(resources string:'Enter script') |
|
6572 |
editViewClass:CodeView |
|
6573 |
lines:25 |
|
6574 |
columns:70 |
|
6575 |
initialAnswer:LastScriptBlockString |
|
6576 |
model:textHolder. |
|
6577 |
dialog addButton:(Button label:'Template' action:[textHolder value:template. textHolder changed:#value.]). |
|
6578 |
dialog open. |
|
6579 |
dialog accepted ifFalse:[^ self]. |
|
6580 |
||
6581 |
LastScriptBlockString := textHolder value. |
|
6582 |
||
6583 |
Class classConventionViolationConfirmationQuerySignal |
|
6584 |
answer:true |
|
6585 |
do:[ |
|
6586 |
dummyClass := Object class |
|
6587 |
name:#Dummy |
|
6588 |
inEnvironment:nil |
|
6589 |
subclassOf:Object |
|
6590 |
instanceVariableNames:'directory selectedFiles' |
|
6591 |
variable:false |
|
6592 |
words:true |
|
6593 |
pointers:true |
|
6594 |
classVariableNames:'' |
|
6595 |
poolDictionaries:'' |
|
6596 |
category:#dummyCategory |
|
6597 |
comment:nil |
|
6598 |
changed:true. |
|
6599 |
]. |
|
6600 |
||
6601 |
dummyInstance := dummyClass basicNew. |
|
6602 |
dummyInstance instVarAt:1 put:(self theSingleSelectedDirectoryOrNil ? Filename homeDirectory). |
|
6603 |
dummyInstance instVarAt:2 put:(self currentSelectedFiles value). |
|
6604 |
||
6605 |
Compiler |
|
6606 |
evaluate:textHolder value |
|
6607 |
in:nil |
|
6608 |
receiver:dummyInstance |
|
6609 |
notifying:nil |
|
6610 |
logged:false |
|
6611 |
ifFail:[] |
|
6612 |
compile:true. |
|
6613 |
||
6614 |
"/ fileName := self firstSelectedFile. |
|
6615 |
"/ action := [:command | |
|
6616 |
"/ self addToCommandHistory:command for:fileName. |
|
6617 |
"/ self executeCommand:command. |
|
6618 |
"/ ]. |
|
6619 |
"/ self askForCommandFor:fileName thenDo:action |
|
6620 |
! |
|
6621 |
||
4230 | 6622 |
doMake |
7938 | 6623 |
|dir cmd| |
4230 | 6624 |
|
13856 | 6625 |
cmd := self makeCommandHolder value. |
6626 |
||
6627 |
"Make" |
|
6628 |
cmd = 'make' ifTrue:[ |
|
6629 |
dir := self theSingleSelectedDirectoryOrNil. |
|
6630 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
6631 |
dir notNil ifTrue:[ |
|
6632 |
(dir construct:'bmake.bat') exists ifTrue:[ |
|
6633 |
cmd := 'bmake.bat'. |
|
6634 |
] |
|
7938 | 6635 |
] |
13856 | 6636 |
]. |
6637 |
self executeCommand:cmd. |
|
6638 |
^self. |
|
6639 |
]. |
|
6640 |
||
6641 |
"Apache ant" |
|
6642 |
cmd = 'ant' ifTrue:[ |
|
6643 |
self executeCommand:cmd. |
|
6644 |
^self. |
|
6645 |
]. |
|
6646 |
||
6647 |
"Add more here..." |
|
6648 |
||
6649 |
"Modified (comment): / 13-04-2012 / 17:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4230 | 6650 |
! |
6651 |
||
8256 | 6652 |
doOpenCBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6653 |
"the CBrowser is an eXept-internal C-language IDE tool. |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6654 |
(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
|
6655 |
20 years ago ;-)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6656 |
|
8256 | 6657 |
|destDir| |
6658 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6659 |
(CBrowser isNil or:[ CBrowser::Browser isNil ]) ifTrue:[ |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6660 |
Smalltalk loadPackage:'exept:CC' |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6661 |
]. |
8256 | 6662 |
destDir := self currentDirectory. |
6663 |
CBrowser::Browser openIn:destDir pathName |
|
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6664 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
6665 |
"Modified: / 04-10-2011 / 13:41:31 / cg" |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
6666 |
"Modified (comment): / 27-07-2012 / 20:41:40 / cg" |
8256 | 6667 |
! |
6668 |
||
7829 | 6669 |
doOpenExplorer |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6670 |
self currentDirectory asFilename openExplorer |
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6671 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6672 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
7829 | 6673 |
! |
6674 |
||
12473 | 6675 |
doOpenFinder |
6676 |
self currentDirectory asFilename openFinder |
|
6677 |
||
6678 |
"Modified: / 21-07-2012 / 12:28:36 / cg" |
|
6679 |
! |
|
6680 |
||
12811 | 6681 |
doOpenMonticelloBrowser |
12874
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
6682 |
MCMczReader isNil ifTrue:[ Smalltalk loadPackage:'stx:goodies/monticello']. |
f08360e7ac62
oops - startup did not enable directoryUp
Claus Gittinger <cg@exept.de>
parents:
12871
diff
changeset
|
6683 |
|
12811 | 6684 |
self withWaitCursorDo:[ |
6685 |
self currentSelectedFiles do:[:fn | |
|
6686 |
|version snapshot| |
|
6687 |
||
6688 |
fn suffix asLowercase = 'mcz' ifTrue:[ |
|
6689 |
version := MCMczReader versionFromFile:fn. |
|
6690 |
snapshot := version snapshot. |
|
6691 |
(Tools::ChangeSetBrowser2 |
|
6692 |
on: snapshot asChangeSet |
|
6693 |
label: version info name) |
|
6694 |
beTwoColumn; |
|
6695 |
targetNamespace:nil; |
|
6696 |
targetPackage:nil; |
|
6697 |
open |
|
6698 |
] |
|
6699 |
] |
|
6700 |
] |
|
6701 |
! |
|
6702 |
||
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6703 |
doOpenSettings |
8168 | 6704 |
self openSettingsDialog |
4317
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6705 |
! |
bf3f150809c2
settings is a new application now and will be inserted under tools in
penk
parents:
4294
diff
changeset
|
6706 |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6707 |
doOpenWithShellCommand |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6708 |
"open using win32-shell" |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6709 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6710 |
|fileName| |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6711 |
|
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6712 |
fileName := self firstSelectedFile. |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6713 |
fileName notNil ifTrue:[ |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6714 |
OperatingSystem |
9405
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6715 |
openApplicationForDocument:fileName pathName |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6716 |
operation:#open |
5b598565288a
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9393
diff
changeset
|
6717 |
] |
11642
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6718 |
|
72cd5c5e2615
changed: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
11591
diff
changeset
|
6719 |
"Modified: / 21-07-2012 / 12:26:10 / cg" |
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6720 |
! |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
6721 |
|
7104 | 6722 |
editMode:aSymbol |
6723 |
self |
|
6724 |
applicationNamed:#FileApplicationNoteBook |
|
6725 |
ifPresentDo:[:appl | |
|
6726 |
|subApp| |
|
6727 |
||
6728 |
subApp := appl selectedApplication. |
|
6729 |
subApp notNil ifTrue:[ |
|
6730 |
^ subApp perform:aSymbol |
|
6731 |
] |
|
6732 |
]. |
|
6733 |
||
6734 |
"Created: / 11-09-2006 / 12:42:08 / cg" |
|
6735 |
! |
|
6736 |
||
6737 |
editModeInsert |
|
6738 |
self editMode:#editModeInsert |
|
6739 |
||
6740 |
"Created: / 11-09-2006 / 12:40:36 / cg" |
|
6741 |
! |
|
6742 |
||
6743 |
editModeInsertAndSelect |
|
6744 |
self editMode:#editModeInsertAndSelect |
|
6745 |
||
6746 |
"Created: / 11-09-2006 / 12:40:45 / cg" |
|
6747 |
! |
|
6748 |
||
6749 |
editModeOverwrite |
|
6750 |
self editMode:#editModeOverwrite |
|
6751 |
||
6752 |
"Modified: / 11-09-2006 / 12:42:26 / cg" |
|
6753 |
! |
|
6754 |
||
15528 | 6755 |
fetchFileByURL |
6756 |
|url destinationFilename| |
|
6757 |
||
6758 |
url := Dialog request:'URL to Fetch:' initialAnswer:'http://host/path'. |
|
6759 |
url isEmptyOrNil ifTrue:[^ self]. |
|
6760 |
url := url asURL. |
|
6761 |
||
6762 |
destinationFilename := Dialog request:'Download As:' initialAnswer:(UnixFilename named:url path) baseName. |
|
6763 |
destinationFilename isEmptyOrNil ifTrue:[^ self]. |
|
6764 |
||
6765 |
destinationFilename := self currentDirectory asFilename / destinationFilename. |
|
6766 |
destinationFilename exists ifTrue:[ |
|
6767 |
|answer| |
|
6768 |
||
6769 |
answer := Dialog |
|
6770 |
confirm:(resources string:'Overwrite existing %1 ?' with:destinationFilename baseName allBold) |
|
6771 |
default:false. |
|
6772 |
answer ~~ true ifTrue:[^ self]. |
|
6773 |
]. |
|
6774 |
self withActivityIndicationDo:[ |
|
6775 |
self notify:(resources string:'Fetching %1' with:url). |
|
6776 |
HTTPInterface get:url destinationFile:destinationFilename. |
|
6777 |
self notify:nil. |
|
6778 |
] |
|
6779 |
||
6780 |
"Modified: / 20-05-2010 / 11:15:35 / cg" |
|
6781 |
! |
|
6782 |
||
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6783 |
fileContentsAsByteArray |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6784 |
|file| |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6785 |
|
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6786 |
file := self firstSelectedFile. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6787 |
file isNil ifTrue:[^ self ]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6788 |
file asFilename fileSize > (1024*1024) ifTrue:[ |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6789 |
file asFilename fileSize > (128*1024*1024) ifTrue:[ |
11889 | 6790 |
Dialog warn:(resources string:'File is too big'). |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6791 |
^ self. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6792 |
]. |
11889 | 6793 |
(Dialog confirm:(resources string:'File is big - proceed ?')) ifFalse:[^ self]. |
8454
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6794 |
]. |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6795 |
file asFilename binaryContentsOfEntireFile inspect |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6796 |
! |
15917af80ff6
changed #fileContentsAsByteArray
Claus Gittinger <cg@exept.de>
parents:
8440
diff
changeset
|
6797 |
|
3892 | 6798 |
fileFileIn |
6799 |
"fileIn the selected file(s)" |
|
6800 |
||
6801 |
self fileFileInLazy:false |
|
6802 |
! |
|
6803 |
||
7324 | 6804 |
fileFileIn:aFilename lazy:lazy |
6805 |
"fileIn a file" |
|
6806 |
||
6807 |
self withActivityIndicationDo:[ |
|
6808 |
self notify:('File in:', aFilename asFilename baseName). |
|
6809 |
self singleFileFileIn:aFilename lazy:lazy. |
|
6810 |
self notify:nil. |
|
6811 |
] |
|
6812 |
||
6813 |
"Created: / 20-09-2006 / 14:28:35 / cg" |
|
6814 |
! |
|
6815 |
||
3892 | 6816 |
fileFileInLazy |
6817 |
"fileIn the selected file(s). Do a quick load (no compilation)" |
|
6818 |
||
6819 |
self fileFileInLazy:true |
|
6820 |
! |
|
6821 |
||
6822 |
fileFileInLazy:lazy |
|
6823 |
"fileIn the selected file(s)" |
|
6824 |
||
7324 | 6825 |
self currentSelectedFiles do:[:fileName | |
6826 |
self fileIn:fileName lazy:lazy |
|
6827 |
]. |
|
6828 |
||
6829 |
"Modified: / 20-09-2006 / 14:29:24 / cg" |
|
3892 | 6830 |
! |
6831 |
||
12497 | 6832 |
fileFileInPackage |
6833 |
"assuming the current directory is a package directory, load it" |
|
6834 |
||
6835 |
|packageDir dir path top packageID| |
|
6836 |
||
6837 |
"/ find a reasonable package-id (walk up until we find stx) |
|
6838 |
path := ''. |
|
6839 |
dir := packageDir := self currentDirectory. |
|
6840 |
||
6841 |
top := (Smalltalk projectDirectoryForPackage:'stx') asFilename. |
|
6842 |
[ (dir / 'stx') = top ] whileFalse:[ |
|
6843 |
path := dir baseName , '/' , path. |
|
6844 |
dir := dir directory. |
|
6845 |
dir isNil ifTrue:[ |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
6846 |
Dialog warn:'Could not find a path from "stx" to the current directory.'. |
12497 | 6847 |
"/ should ask the user for a packageID and proceed... |
6848 |
^ self. |
|
6849 |
]. |
|
6850 |
]. |
|
12707
6e9276c4fc95
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
12684
diff
changeset
|
6851 |
packageID := path copyButLast:1. |
12497 | 6852 |
Smalltalk loadPackage:packageID fromDirectory:packageDir asAutoloaded:true |
6853 |
! |
|
6854 |
||
3892 | 6855 |
fileFileInToNameSpace |
6856 |
"fileIn the selected file(s)<into a nameSpace" |
|
6857 |
||
6858 |
|ns listOfKnownNameSpaces| |
|
6859 |
||
6860 |
listOfKnownNameSpaces := Set new. |
|
6861 |
NameSpace |
|
6672
478b83a3753a
max size to be shown without dialog
Claus Gittinger <cg@exept.de>
parents:
6671
diff
changeset
|
6862 |
allNameSpaces |
4414 | 6863 |
do:[:eachNameSpace | |
6864 |
listOfKnownNameSpaces add:eachNameSpace name |
|
6865 |
]. |
|
3892 | 6866 |
listOfKnownNameSpaces := listOfKnownNameSpaces asOrderedCollection sort. |
6867 |
||
6868 |
ns := Dialog |
|
4414 | 6869 |
request:'During fileIn, new classes are created in nameSpace:' |
6870 |
initialAnswer:(LastEnforcedNameSpace ? Class nameSpaceQuerySignal query name) |
|
6871 |
list:listOfKnownNameSpaces. |
|
3892 | 6872 |
ns isEmptyOrNil ifTrue:[^ self]. |
6873 |
||
6874 |
LastEnforcedNameSpace := ns. |
|
6875 |
ns := NameSpace name:ns. |
|
6876 |
||
6877 |
Class nameSpaceQuerySignal |
|
4414 | 6878 |
answer:ns |
6879 |
do:[ |
|
6880 |
self fileFileInLazy:false |
|
6881 |
] |
|
3892 | 6882 |
! |
6883 |
||
6884 |
fileFindAllDuplicates |
|
6885 |
"scan directory and all subdirs for duplicate files" |
|
6886 |
||
6887 |
|fileNames dir infoDir filesBySize |
|
6888 |
result info dirPrefix myName stream textBox maxLength directories| |
|
6889 |
||
6890 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
6891 |
self withActivityIndicationDo:[ |
4414 | 6892 |
result := Dictionary new. |
6893 |
myName := self class name asString. |
|
6894 |
directories := self currentSelectedDirectories. |
|
6895 |
directories isEmpty ifTrue:[^ self]. |
|
3892 | 6896 |
|
4414 | 6897 |
dir := directories first. |
3892 | 6898 |
"/ self label: myName, '- gathering file names ...'. |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6899 |
[ |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6900 |
fileNames := dir recursiveDirectoryContents. |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6901 |
] on:FileStream openErrorSignal do:[:ex| |
6352 | 6902 |
self warn:(resources stringWithCRs:'Cannot access: %1\(%2)' |
6903 |
with:ex pathName |
|
6904 |
with:ex description). |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6905 |
^ self |
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
6906 |
]. |
4765 | 6907 |
fileNames := fileNames |
6908 |
collect:[:fn | dir construct:fn] |
|
6909 |
thenSelect:[:fn | fn isDirectory not]. |
|
3892 | 6910 |
|
6911 |
"/ self label:myName , '- gathering sizes ...'. |
|
4414 | 6912 |
infoDir := Dictionary new. |
6913 |
fileNames do:[:fn | |
|
6914 |
infoDir at:fn put:(fn fileSize) |
|
6915 |
]. |
|
6916 |
||
14497 | 6917 |
"/ for each, get the file's size. |
4414 | 6918 |
"/ in a first pass, look for files of the same size and |
6919 |
"/ compare them ... |
|
3892 | 6920 |
|
6921 |
"/ self label:myName , '- preselect possible duplicates ...'. |
|
4414 | 6922 |
filesBySize := Dictionary new. |
6923 |
infoDir keysAndValuesDo:[:fn :sz | |
|
6924 |
|entry| |
|
6925 |
||
6926 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
6927 |
entry add:fn. |
|
6928 |
]. |
|
6929 |
||
6930 |
"/ any of same size ? |
|
3892 | 6931 |
|
6932 |
"/ self label:myName , '- checking for duplicates ...'. |
|
4414 | 6933 |
filesBySize do:[:entry | |
6934 |
|files| |
|
6935 |
||
6936 |
entry size > 1 ifTrue:[ |
|
6937 |
files := entry asArray. |
|
6938 |
1 to:files size-1 do:[:idx1 | |
|
6939 |
idx1+1 to:files size do:[:idx2 | |
|
6940 |
|fn1 fn2| |
|
6941 |
||
6942 |
fn1 := files at:idx1. |
|
6943 |
fn2 := files at:idx2. |
|
3892 | 6944 |
|
6945 |
"/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
|
4414 | 6946 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
6947 |
"/ compare the files |
|
6948 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 6949 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4414 | 6950 |
result at:fn1 put:fn2. |
6951 |
] |
|
6952 |
] |
|
6953 |
] |
|
6954 |
] |
|
6955 |
] |
|
6956 |
]. |
|
3892 | 6957 |
|
6958 |
"/ self label:myName , '- sorting ...'. |
|
4414 | 6959 |
dirPrefix := dir pathName. |
6960 |
result := result associations. |
|
6961 |
result := result collect:[:assoc | |
|
6962 |
|f1 f2| |
|
6963 |
||
6964 |
f1 := assoc key name. |
|
6965 |
f2 := assoc value name. |
|
6966 |
(f1 startsWith:dirPrefix) ifTrue:[ |
|
6967 |
f1 := f1 copyFrom:dirPrefix size + 2. |
|
6968 |
]. |
|
6969 |
(f2 startsWith:dirPrefix) ifTrue:[ |
|
6970 |
f2 := f2 copyFrom:dirPrefix size + 2. |
|
6971 |
]. |
|
6972 |
f1 < f2 ifTrue:[ |
|
6973 |
f2 -> f1 |
|
6974 |
] ifFalse:[ |
|
6975 |
f1 -> f2 |
|
6976 |
] |
|
6977 |
]. |
|
6978 |
result sort:[:f1 :f2 | f2 value < f1 value]. |
|
6979 |
||
6980 |
info := OrderedCollection new. |
|
6981 |
result do:[:assoc | |
|
6982 |
info add:(assoc key , ' same as ' , assoc value) |
|
6983 |
]. |
|
6984 |
info isEmpty ifTrue:[ |
|
11889 | 6985 |
Dialog information:(resources string:'No duplicate files found.'). |
5543 | 6986 |
^ self. |
4414 | 6987 |
]. |
3892 | 6988 |
]. |
6989 |
||
15589 | 6990 |
stream := CharacterWriteStream new. |
11688 | 6991 |
stream nextPutAllLines:info. |
5542 | 6992 |
|
3892 | 6993 |
textBox := TextBox new. |
6994 |
textBox initialText:(stream contents). |
|
5542 | 6995 |
stream close. |
11889 | 6996 |
textBox title:(resources string:'File duplicates in directory: %1' with:dir asString). |
3892 | 6997 |
textBox readOnly:true. |
6998 |
textBox noCancel. |
|
11889 | 6999 |
textBox label:(resources string:'Duplicates in %1' with:dir asString). |
3892 | 7000 |
maxLength := 10. |
7001 |
info do:[: el | |
|
4414 | 7002 |
maxLength := maxLength max:(el size). |
3892 | 7003 |
]. |
7004 |
textBox extent:((maxLength * 5)@(info size * 20)); sizeFixed:false. |
|
5542 | 7005 |
textBox maxExtent:Screen current extent. |
7006 |
textBox openModeless. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7007 |
|
11688 | 7008 |
"Modified: / 27-07-2012 / 09:29:00 / cg" |
3892 | 7009 |
! |
7010 |
||
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7011 |
fileFindDuplicateFile |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7012 |
"scan directory for duplicates of the selected files" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7013 |
|
10306 | 7014 |
|files filesBySize samePerFile stream textBox mustHaveMatches| |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7015 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7016 |
files := self currentSelectedFiles. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7017 |
files isEmpty ifTrue:[^ self]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7018 |
|
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7019 |
self withWaitCursorDo:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7020 |
filesBySize := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7021 |
files do:[:fn | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7022 |
|sz entry| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7023 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7024 |
sz := fn asFilename fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7025 |
(filesBySize at:sz ifAbsentPut:[Set new]) add:fn. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7026 |
]. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7027 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7028 |
samePerFile := Dictionary new. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7029 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7030 |
self currentSelectedDirectories do:[:eachDir | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7031 |
eachDir recursiveDirectoryContentsAsFilenamesDo:[:eachFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7032 |
eachFile isDirectory ifFalse:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7033 |
|sz possibleMatches| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7034 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7035 |
sz := eachFile fileSize. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7036 |
possibleMatches := filesBySize at:sz ifAbsent:nil. |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7037 |
possibleMatches notNil ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7038 |
possibleMatches do:[:eachFileWithSameSize | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7039 |
eachFileWithSameSize ~= eachFile ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7040 |
(eachFileWithSameSize sameContentsAs:eachFile) ifTrue:[ |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7041 |
(samePerFile at:eachFileWithSameSize ifAbsentPut:[Set new]) add:eachFile |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7042 |
] |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7043 |
] |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7044 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7045 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7046 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7047 |
] |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7048 |
]. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7049 |
]. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7050 |
|
15589 | 7051 |
stream := CharacterWriteStream with:'Duplicates:'. |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7052 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7053 |
do:[:origFile | |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7054 |
|sameFiles| |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7055 |
|
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
7056 |
sameFiles := samePerFile at:origFile. |
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7057 |
stream nextPutLine:origFile baseName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7058 |
(sameFiles asOrderedCollection collect:[:each | each baseName]) sort do:[:eachSameName | |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7059 |
stream nextPutAll:' '; nextPutLine:eachSameName. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7060 |
] |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7061 |
]. |
10306 | 7062 |
stream nextPutLine:'Files without duplicates:'. |
7063 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7064 |
do:[:origFile | |
|
7065 |
|sameFiles| |
|
7066 |
||
7067 |
sameFiles := samePerFile at:origFile. |
|
7068 |
sameFiles isEmpty ifTrue:[ |
|
7069 |
stream nextPutLine:origFile baseName. |
|
7070 |
]. |
|
7071 |
]. |
|
7072 |
||
7073 |
mustHaveMatches := Dialog request:'Must have for duplicates matching ?:' initialAnswer:(LastMustMatchPattern ? '[a-z][a-z][a-z]_[0-9][0-9][0-9].*'). |
|
7074 |
mustHaveMatches notEmptyOrNil ifTrue:[ |
|
7075 |
LastMustMatchPattern := mustHaveMatches. |
|
7076 |
||
7077 |
stream nextPutLine:'Files without duplicates in xxx_nnn.jpg:'. |
|
7078 |
(samePerFile keys asOrderedCollection sort:[:a :b | a asFilename baseName < b asFilename baseName]) |
|
7079 |
do:[:origFile | |
|
7080 |
|sameFiles| |
|
7081 |
||
7082 |
sameFiles := samePerFile at:origFile. |
|
7083 |
sameFiles notEmpty ifTrue:[ |
|
7084 |
(sameFiles contains:[:file | mustHaveMatches match:file baseName]) ifFalse:[ |
|
7085 |
stream nextPutLine:origFile baseName. |
|
7086 |
] |
|
7087 |
]. |
|
7088 |
]. |
|
7089 |
]. |
|
10304
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7090 |
|
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7091 |
textBox := TextBox new. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7092 |
textBox initialText:(stream contents). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7093 |
textBox title:'Files with same contents'. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7094 |
textBox readOnly:true. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7095 |
textBox noCancel. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7096 |
textBox extent:(350@400). |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7097 |
textBox maxExtent:Screen current extent. |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7098 |
textBox openModeless. "/ showAtPointer. |
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 |
"Created: / 11-07-2011 / 12:39:44 / cg" |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7101 |
! |
ef51c640ee76
added: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10258
diff
changeset
|
7102 |
|
3892 | 7103 |
fileFindDuplicates |
7104 |
"scan directory for duplicate files" |
|
7105 |
||
8510 | 7106 |
|infoDir filesBySize result info stream textBox maxLength directories allFiles titleStream size| |
7107 |
||
7108 |
directories := self currentSelectedDirectories. |
|
3892 | 7109 |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7110 |
self withActivityIndicationDo:[ |
4355 | 7111 |
result := Dictionary new. |
7112 |
||
7113 |
directories := self currentSelectedDirectories. |
|
7114 |
directories isEmpty ifTrue:[^ self]. |
|
7115 |
||
8510 | 7116 |
allFiles := self allFilesInSelectedDirectoriesForWhich:[:f | true]. |
4355 | 7117 |
|
7118 |
infoDir := Dictionary new. |
|
7119 |
allFiles do:[:fn | |
|
7120 |
infoDir at:fn put:(fn info) |
|
7121 |
]. |
|
7122 |
||
14497 | 7123 |
"/ for each, get the file's size. |
4355 | 7124 |
"/ in a first pass, look for files of the same size and |
7125 |
"/ compare them ... |
|
7126 |
||
7127 |
filesBySize := Dictionary new. |
|
7128 |
infoDir keysAndValuesDo:[:fn :info | |
|
7129 |
|sz entry| |
|
7130 |
||
7131 |
sz := info size. |
|
7132 |
entry := filesBySize at:sz ifAbsentPut:[Set new]. |
|
7133 |
entry add:fn. |
|
7134 |
]. |
|
7135 |
||
7136 |
"/ any of same size ? |
|
7137 |
||
7138 |
filesBySize do:[:entry | |
|
7139 |
|files| |
|
7140 |
||
7141 |
entry size > 1 ifTrue:[ |
|
7142 |
files := entry asArray. |
|
7143 |
1 to:files size-1 do:[:idx1 | |
|
7144 |
idx1+1 to:files size do:[:idx2 | |
|
7145 |
|fn1 fn2| |
|
7146 |
||
7147 |
fn1 := files at:idx1. |
|
7148 |
fn2 := files at:idx2. |
|
7149 |
||
7150 |
(result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
|
7151 |
"/ compare the files |
|
7152 |
(fn1 sameContentsAs:fn2) ifTrue:[ |
|
3892 | 7153 |
"/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
4355 | 7154 |
result at:fn1 put:fn2. |
7155 |
] |
|
7156 |
] |
|
7157 |
] |
|
7158 |
] |
|
7159 |
] |
|
7160 |
]. |
|
7161 |
||
7162 |
result := result associations. |
|
7163 |
result := result collect:[:assoc | |
|
7164 |
|f1 f2| |
|
7165 |
||
7166 |
f1 := assoc key asString. |
|
7167 |
f2 := assoc value asString. |
|
7168 |
f1 < f2 ifTrue:[ |
|
7169 |
f2 -> f1 |
|
7170 |
] ifFalse:[ |
|
7171 |
f1 -> f2 |
|
7172 |
] |
|
7173 |
]. |
|
5789 | 7174 |
"/ result sort:[:f1 :f2 | f1 key > f2 key "f2 value < f1 key value"]. |
7175 |
result sort:[:f1 :f2 | " f1 key > f2 key" f2 value < f1 key value]. |
|
4355 | 7176 |
|
7177 |
info := OrderedCollection new. |
|
7178 |
size := self getBestDirectory asString size. |
|
7179 |
result do:[:assoc | |
|
7180 |
|fn1 fn2| |
|
7181 |
||
7182 |
fn1 := assoc key. |
|
7183 |
fn2 := assoc value. |
|
7184 |
size > 1 ifTrue:[ |
|
7185 |
fn1 := ('..', (fn1 copyFrom:(size + 1))). |
|
7186 |
fn2 := ('..', (fn2 copyFrom:(size + 1))). |
|
7187 |
]. |
|
7188 |
(fn1 includes:Character space) ifTrue:[ |
|
7189 |
fn1 := '"' , fn1 , '"' |
|
7190 |
]. |
|
7191 |
(fn2 includes:Character space) ifTrue:[ |
|
7192 |
fn2 := '"' , fn2 , '"' |
|
7193 |
]. |
|
7194 |
info add:(fn1 , ' same as ' , fn2) |
|
7195 |
]. |
|
7196 |
info isEmpty ifTrue:[ |
|
5543 | 7197 |
Dialog information:'No duplicate files found.'. |
7198 |
^ self. |
|
4355 | 7199 |
]. |
3892 | 7200 |
]. |
15589 | 7201 |
stream := CharacterWriteStream new. |
11688 | 7202 |
stream nextPutAllLines:info. |
7203 |
||
15589 | 7204 |
titleStream := CharacterWriteStream with:'File duplicates in directory'. |
3892 | 7205 |
directories size == 1 ifTrue:[ |
12602 | 7206 |
titleStream nextPutAll:'y: '; nextPutAll: directories first asString. |
3892 | 7207 |
] ifFalse:[ |
4535 | 7208 |
titleStream nextPutLine:'ies: '. |
4355 | 7209 |
directories do:[:dir| |
7210 |
size > 1 ifTrue:[ |
|
7211 |
titleStream nextPutAll:'..'. |
|
4535 | 7212 |
titleStream nextPutLine:((dir asString) copyFrom:(size + 1)). |
4355 | 7213 |
] ifFalse:[ |
4535 | 7214 |
titleStream nextPutLine:(dir asString). |
4355 | 7215 |
]. |
7216 |
] |
|
3892 | 7217 |
]. |
5543 | 7218 |
|
3892 | 7219 |
textBox := TextBox new. |
7220 |
textBox initialText:(stream contents). |
|
7221 |
textBox title:(titleStream contents). |
|
7222 |
textBox readOnly:true. |
|
7223 |
textBox noCancel. |
|
14715 | 7224 |
stream := WriteStream on:''. |
7225 |
stream nextPutAll:'Duplicates in '. |
|
4170 | 7226 |
directories do:[ :aDirectory | |
4355 | 7227 |
stream nextPutAll:aDirectory baseName. |
7228 |
stream space. |
|
4050 | 7229 |
]. |
4170 | 7230 |
textBox label:stream contents. |
3892 | 7231 |
maxLength := 10. |
7232 |
info do:[: el | |
|
4355 | 7233 |
maxLength := maxLength max:(el size). |
3892 | 7234 |
]. |
5092 | 7235 |
textBox extent:((maxLength * 5)@((info size max:40)* 10)). |
7236 |
textBox maxExtent:Screen current extent. |
|
4355 | 7237 |
textBox openModeless. "/ showAtPointer. |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7238 |
|
11688 | 7239 |
"Modified: / 27-07-2012 / 09:29:14 / cg" |
3892 | 7240 |
! |
7241 |
||
7242 |
fileFindFile |
|
5961 | 7243 |
|filename| |
7244 |
||
7245 |
filename := self firstSelectedFileName. |
|
7246 |
filename isNil ifTrue:[ |
|
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
7247 |
filename := Filename homeDirectory. |
3892 | 7248 |
]. |
4101 | 7249 |
FindFileApplication openOnFileName:filename for:self. |
3892 | 7250 |
! |
7251 |
||
8510 | 7252 |
fileFindSimilarImages |
7253 |
"scan directory for similar image files" |
|
7254 |
||
8512 | 7255 |
|result stream textBox directories imageFiles histogramsV histogramsH |
7256 |
similarV similarH similar alreadyPrinted| |
|
8510 | 7257 |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7258 |
self withWaitCursorDo:[ |
8510 | 7259 |
self withActivityIndicationDo:[ |
7260 |
result := Dictionary new. |
|
7261 |
||
7262 |
directories := self currentSelectedDirectories. |
|
7263 |
directories isEmpty ifTrue:[^ self]. |
|
7264 |
||
13714 | 7265 |
imageFiles := self allFilesInSelectedDirectoriesForWhich:[:f | f mimeTypeFromName isImageType]. |
8511 | 7266 |
"/ imageFiles := imageFiles select:[:f | f baseName startsWith:'foo']. |
7267 |
imageFiles sort:[:a :b | a pathName < b pathName]. |
|
7268 |
||
8510 | 7269 |
"/ for each, get the color histogram |
7270 |
histogramsV := Dictionary new. |
|
7271 |
histogramsH := Dictionary new. |
|
7272 |
imageFiles do:[:fn | |
|
7273 |
|hist image| |
|
7274 |
||
7275 |
image := Image fromFile:fn. |
|
7276 |
Transcript showCR:'generating histogram for ',fn baseName. |
|
7277 |
hist := ImageColorHistogram new forImage:image. |
|
7278 |
histogramsV at:fn put:(hist histogramVectorV). |
|
7279 |
histogramsH at:fn put:(hist histogramVectorH). |
|
7280 |
]. |
|
7281 |
||
7282 |
similarH := Dictionary new. |
|
7283 |
similarV := Dictionary new. |
|
7284 |
similar := Dictionary new. |
|
7285 |
||
8512 | 7286 |
(self firstSelectedFile notNil |
7287 |
ifTrue:[ Array with:self firstSelectedFile ] |
|
7288 |
ifFalse:[ imageFiles ]) |
|
7289 |
do:[:eachFile1 | |
|
8510 | 7290 |
|setOfSimilar distancesV distancesH| |
7291 |
||
7292 |
distancesV := OrderedCollection new. |
|
7293 |
distancesH := OrderedCollection new. |
|
7294 |
setOfSimilar := OrderedCollection new. |
|
7295 |
||
7296 |
imageFiles do:[:eachFile2 | |
|
7297 |
|v1 v2 dV dH| |
|
7298 |
||
7299 |
eachFile1 ~= eachFile2 ifTrue:[ |
|
7300 |
v1 := histogramsV at:eachFile1. |
|
7301 |
v2 := histogramsV at:eachFile2. |
|
7302 |
dV := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7303 |
distancesV add:(eachFile2 -> dV). |
|
7304 |
v1 := histogramsH at:eachFile1. |
|
7305 |
v2 := histogramsH at:eachFile2. |
|
7306 |
dH := ImageColorHistogram distanceFrom:v1 to:v2. |
|
7307 |
distancesH add:(eachFile2 -> dH). |
|
7308 |
(dV < 10000 and:[dH < 10000]) ifTrue:[ |
|
8512 | 7309 |
setOfSimilar add:eachFile2->(dV + dH). |
8510 | 7310 |
]. |
7311 |
] |
|
7312 |
]. |
|
7313 |
distancesV sort:[:a1 :a2 | a1 value < a2 value]. |
|
7314 |
distancesH sort:[:a1 :a2 | a1 value < a2 value]. |
|
7315 |
similarV at:eachFile1 put:distancesV. |
|
7316 |
similarH at:eachFile1 put:distancesH. |
|
7317 |
setOfSimilar notEmpty ifTrue:[ similar at:eachFile1 put:setOfSimilar ]. |
|
7318 |
]. |
|
7319 |
||
7320 |
similar isEmpty ifTrue:[ |
|
7321 |
Dialog information:'No similarities found.'. |
|
7322 |
^ self. |
|
7323 |
]. |
|
7324 |
]. |
|
7325 |
||
15589 | 7326 |
stream := CharacterWriteStream new. |
8512 | 7327 |
alreadyPrinted := Set new. |
7328 |
||
7329 |
imageFiles do:[:eachFile | |
|
7330 |
|eachSet| |
|
7331 |
||
7332 |
(alreadyPrinted includes:eachFile) ifFalse:[ |
|
7333 |
eachSet := similar at:eachFile ifAbsent:nil. |
|
7334 |
eachSet notNil ifTrue:[ |
|
7335 |
stream nextPutLine:eachFile pathName. |
|
7336 |
eachSet do:[:info | |
|
7337 |
|fn2 dist| |
|
7338 |
||
7339 |
fn2 := info key. |
|
7340 |
dist := info value. |
|
7341 |
stream nextPutAll:' '. |
|
7342 |
stream nextPutAll:fn2 pathName. |
|
7343 |
stream nextPutLine:' (',dist printString,')'. |
|
7344 |
alreadyPrinted add:fn2. |
|
7345 |
]. |
|
7346 |
stream cr. |
|
7347 |
]. |
|
8510 | 7348 |
]. |
7349 |
]. |
|
8524
cac6b19eae23
changed #fileFindSimilarImages
Claus Gittinger <cg@exept.de>
parents:
8512
diff
changeset
|
7350 |
]. |
8510 | 7351 |
|
7352 |
textBox := TextBox new. |
|
7353 |
textBox initialText:(stream contents). |
|
7354 |
textBox title:'File similarities:'. |
|
7355 |
textBox readOnly:true. |
|
7356 |
textBox noCancel. |
|
7357 |
||
7358 |
textBox label:'File similarities'. |
|
7359 |
textBox extent:(400@((similar size max:40)* 10)). |
|
7360 |
textBox maxExtent:Screen current extent. |
|
7361 |
textBox openModeless. "/ showAtPointer. |
|
7362 |
||
7363 |
"Modified: / 25-07-2006 / 09:07:25 / cg" |
|
7364 |
! |
|
7365 |
||
4618 | 7366 |
fileHexDump |
7367 |
||
7368 |
| file item| |
|
7369 |
||
7370 |
file := self firstSelectedFile. |
|
7371 |
file notNil ifTrue:[ |
|
7372 |
item := DirectoryContentsBrowser itemClass fileName:file. |
|
5009 | 7373 |
self |
7374 |
applicationNamed:#FileApplicationNoteBook |
|
7375 |
ifPresentDo:[:appl | appl openTextEditorWithHexPresentationOn:item]. |
|
4618 | 7376 |
]. |
7377 |
! |
|
7378 |
||
7324 | 7379 |
fileIn:aFilename |
7380 |
"fileIn a file" |
|
7381 |
||
7382 |
self fileIn:aFilename lazy:false |
|
7383 |
||
7384 |
"Created: / 20-09-2006 / 14:30:06 / cg" |
|
7385 |
! |
|
7386 |
||
7387 |
fileIn:aFilename lazy:lazy |
|
7388 |
"fileIn a file" |
|
7389 |
||
7390 |
self withActivityIndicationDo:[ |
|
7391 |
self notify:('File in:', aFilename asFilename baseName). |
|
7392 |
self singleFileFileIn:aFilename lazy:lazy. |
|
7393 |
self notify:nil. |
|
7394 |
] |
|
7395 |
||
7396 |
"Created: / 20-09-2006 / 14:29:21 / cg" |
|
7397 |
! |
|
7398 |
||
4930 | 7399 |
filterSelectedFiles:whichFilter |
7400 |
|selectedFiles numFiles msg filterBlock| |
|
7401 |
||
7560 | 7402 |
selectedFiles := self currentSelectedObjects. |
4930 | 7403 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
7404 |
||
7405 |
msg := 'Replace contents of file ''%2'' with output of %3-filter ?'. |
|
7406 |
numFiles > 1 ifTrue:[ |
|
7407 |
msg := 'Replace contents of %1 files with output of %3-filter ?'. |
|
7408 |
]. |
|
7409 |
||
7410 |
(Dialog |
|
6352 | 7411 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold with:whichFilter) |
4930 | 7412 |
initialAnswer:false |
7413 |
) ifFalse:[ |
|
7414 |
^ self |
|
7415 |
]. |
|
7416 |
||
7417 |
whichFilter == #rot13 ifTrue:[ |
|
7418 |
filterBlock := [:charIn | charIn rot13 ]. |
|
7419 |
]. |
|
7420 |
"/ add more here... |
|
7421 |
||
7422 |
filterBlock isNil ifTrue:[ |
|
7423 |
self information:'No such filter: ' , whichFilter. |
|
7424 |
^ self. |
|
7425 |
]. |
|
7426 |
||
7427 |
selectedFiles do:[:fileName | |
|
7428 |
|s| |
|
7429 |
||
7430 |
self notify:('Processing:', fileName baseName). |
|
7431 |
fileName isDirectory ifFalse:[ |
|
7432 |
[ |
|
7433 |
|inFile outFile in out| |
|
7434 |
||
7435 |
inFile := fileName asFilename. |
|
7436 |
outFile := (fileName pathName , '.filter') asFilename. |
|
7437 |
||
7438 |
[ |
|
7439 |
|charIn charOut| |
|
7440 |
||
7441 |
in := inFile readStream. |
|
7442 |
out := outFile writeStream. |
|
7443 |
[in atEnd] whileFalse:[ |
|
7444 |
charIn := in next. |
|
7445 |
charOut := filterBlock value:charIn. |
|
7446 |
out nextPut:charOut. |
|
7447 |
]. |
|
13683 | 7448 |
out close. out:= nil. |
4930 | 7449 |
outFile renameTo:inFile. |
7450 |
] ensure:[ |
|
7451 |
out notNil ifTrue:[ out close ]. |
|
7452 |
in notNil ifTrue:[ in close ]. |
|
7453 |
outFile delete. |
|
7454 |
] |
|
7455 |
] on:FileStream openErrorSignal do:[:ex| |
|
7456 |
self warn:('Cannot process "%1".' bindWith:fileName baseName allBold). |
|
7457 |
]. |
|
7458 |
] |
|
7459 |
]. |
|
6190 | 7460 |
self notify:nil. |
7560 | 7461 |
|
7462 |
"Modified: / 04-12-2006 / 13:14:48 / cg" |
|
4930 | 7463 |
! |
7464 |
||
9784 | 7465 |
forEachParsedXmlFileDo:aBlock |
7466 |
"parse all selected XML files, for each dom-tree, evaluate aBlock" |
|
7467 |
||
7468 |
self withActivityIndicationDo:[ |
|
7469 |
| selectedFiles xmlDocument | |
|
7470 |
||
7471 |
selectedFiles:= self currentSelectedFiles. |
|
7472 |
selectedFiles do:[:fileName | |
|
7473 |
XML::XMLSignal handle:[:ex | |
|
14551 | 7474 |
Dialog |
7475 |
information:('Error while reading XML:\ %1' bindWith:ex description) withCRs |
|
7476 |
title:'XML Error'. |
|
9784 | 7477 |
^ self. |
7478 |
] do:[ |
|
7479 |
|s d magic encoder document| |
|
7480 |
||
7481 |
s := fileName asFilename readStream. |
|
14012 | 7482 |
[ |
7483 |
s binary. |
|
7484 |
magic := (s next:2). |
|
7485 |
magic = #[254 255] ifTrue:[ |
|
7486 |
"/ UTF16BE |
|
7487 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16be. |
|
7488 |
] ifFalse:[ |
|
7489 |
magic = #[255 254] ifTrue:[ |
|
7490 |
"/ UTF16LE |
|
7491 |
document := CharacterEncoder decodeString:(s upToEnd) from:#utf16le. |
|
7492 |
]. |
|
7493 |
]. |
|
7494 |
] ensure:[ |
|
7495 |
s close. |
|
7496 |
]. |
|
9784 | 7497 |
document notNil ifTrue:[ |
7498 |
xmlDocument := XML::XMLParser |
|
7499 |
processDocumentString:document |
|
7500 |
beforeScanDo:[:parse| parse validate:false]. |
|
7501 |
] ifFalse:[ |
|
7502 |
xmlDocument := XML::XMLParser |
|
7503 |
processDocumentInFilename:fileName |
|
7504 |
beforeScanDo:[:parse| parse validate:false]. |
|
7505 |
] |
|
7506 |
]. |
|
7507 |
aBlock value:xmlDocument. |
|
7508 |
]. |
|
7509 |
] |
|
7510 |
||
7511 |
"Created: / 17-02-2011 / 13:58:21 / cg" |
|
7512 |
! |
|
7513 |
||
8832 | 7514 |
forEachSelectedFileIgnoringDirectories:ignoreDirs do:aBlock |
7515 |
|numItems path files| |
|
7516 |
||
7517 |
files := self currentSelectedFiles. |
|
7518 |
||
7519 |
(numItems := files size) > 2 ifTrue:[ |
|
7520 |
(self |
|
7521 |
confirm:(resources string:'Open for each of the %1 items ?' |
|
7522 |
with:numItems)) ifFalse:[^ self]. |
|
7523 |
]. |
|
7524 |
||
7525 |
self withActivityIndicationDo:[ |
|
7526 |
files do:[:fileName | |
|
7527 |
(ignoreDirs not or:[fileName isDirectory not]) ifTrue:[ |
|
7528 |
fileName isAbsolute ifTrue:[ |
|
17239 | 7529 |
path := fileName name. |
8832 | 7530 |
] ifFalse:[ |
7531 |
path := fileName pathName. |
|
7532 |
]. |
|
7533 |
aBlock value:path |
|
7534 |
] |
|
7535 |
]. |
|
7536 |
]. |
|
17239 | 7537 |
|
7538 |
"Modified: / 19-01-2017 / 16:57:03 / stefan" |
|
8832 | 7539 |
! |
7540 |
||
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7541 |
generateDetachedSignaturesForSelectedFiles |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7542 |
"generate detached signature (pkcs7) files from the contents of the selected files. |
16941 | 7543 |
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
|
7544 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7545 |
self withActivityIndicationDo:[ |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7546 |
self currentSelectedFiles do:[:fn | |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7547 |
|data hash signature signatureFile| |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7548 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7549 |
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
|
7550 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7551 |
data := fn contentsAsString. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7552 |
hash := SHA1Stream hashValueOf:data. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7553 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7554 |
signature := Expecco::KeyFileGenerator new signExpeccoCode:hash. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7555 |
|
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7556 |
signatureFile := fn addSuffix:'sig'. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7557 |
signatureFile contents:signature. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7558 |
]. |
13677 | 7559 |
self updateCurrentDirectoryWithReread. |
8648
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7560 |
self notify:nil. |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7561 |
] |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7562 |
! |
e8a98d146af2
Generate both integrated and detached PKCS#7 signatures
Stefan Vogel <sv@exept.de>
parents:
8646
diff
changeset
|
7563 |
|
15211 | 7564 |
generatePatchInstallerForSelectedFiles |
7565 |
"generate an expecco patch, which installs the selected file(s). |
|
7566 |
Opens a dialog asking for the target directory and if the patch should be signed" |
|
7567 |
||
7568 |
|dialog targetDirHolder targetDir |
|
7569 |
generateSignedPatchHolder patchFileNameHolder patchFileName| |
|
7570 |
||
7571 |
targetDirHolder := '.' asValue. |
|
7572 |
generateSignedPatchHolder := true asValue. |
|
7573 |
patchFileNameHolder := '/tmp/00nn_patchFile.st' asValue. |
|
7574 |
||
7575 |
dialog := Dialog new. |
|
7576 |
dialog label:(resources string:'Patch Installer for File(s)'). |
|
7577 |
dialog addTextLabel:'Patchfile Name' adjust:#left. |
|
7578 |
dialog addInputFieldOn:patchFileNameHolder tabable:true. |
|
7579 |
dialog addTextLabel:'Target directory (relative to executable''s directory at execution time)' adjust:#left. |
|
7580 |
dialog addInputFieldOn:targetDirHolder tabable:true. |
|
7581 |
dialog addCheckBox:'Generate Signed Patch' on:generateSignedPatchHolder. |
|
7582 |
dialog addAbortAndOkButtons. |
|
7583 |
dialog open. |
|
7584 |
||
7585 |
dialog accepted ifFalse:[^ self]. |
|
7586 |
||
7587 |
targetDir := targetDirHolder value asFilename. |
|
7588 |
patchFileName := patchFileNameHolder value asFilename. |
|
7589 |
||
7590 |
self withActivityIndicationDo:[ |
|
7591 |
|outStream zipArchive pkcs7SignedData signatureFilename| |
|
7592 |
||
7593 |
self notify:'Generating self extracting st script: ', patchFileName name, '...'. |
|
7594 |
outStream := patchFileName writeStream. |
|
7595 |
outStream nextPutAll:' |
|
7596 |
|patchStream zipArchive| |
|
7597 |
patchStream := Expecco::Browser::CurrentPatchStreamQuery query. |
|
7598 |
patchStream isNil ifTrue:[ self error:''sorry, this patch can only be installed in expecco 2.6.2 and newer (missing CurrentPatchStreamQuery)'']. |
|
7599 |
zipArchive := ZipArchive readingFrom:patchStream. |
|
7600 |
zipArchive members do:[:each | zipArchive extract:each fileName]. |
|
7601 |
patchStream setToEnd. "/ to force fileIn to finish |
|
7602 |
!! |
|
7603 |
||
7604 |
!! !! |
|
7605 |
||
7606 |
'. |
|
7607 |
zipArchive := ZipArchive writingTo:outStream. "/ newFileNamed:(patchFileName). |
|
7608 |
||
7609 |
self currentSelectedFiles do:[:fn | |
|
7610 |
|inStream signatureFilename| |
|
7611 |
||
7612 |
inStream := fn asFilename readStream. |
|
7613 |
zipArchive addFile: (targetDir construct:fn asFilename baseName) name fromStream:inStream. |
|
7614 |
inStream close. |
|
7615 |
]. |
|
7616 |
||
16975 | 7617 |
zipArchive close. |
15211 | 7618 |
|
7619 |
generateSignedPatchHolder value ifTrue:[ |
|
7620 |
self notify:'Generating signed file from: ', patchFileName name, '...'. |
|
7621 |
||
7622 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:patchFileName contentsOfEntireFile. |
|
7623 |
signatureFilename := patchFileName withSuffix:'expeccoPatch'. |
|
7624 |
signatureFilename contents:pkcs7SignedData. |
|
7625 |
]. |
|
7626 |
self notify:nil. |
|
7627 |
] |
|
7628 |
! |
|
13783 | 7629 |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7630 |
generateSignaturesForSelectedFiles |
13783 | 7631 |
"generate signed pkcs7 files from the contents of the selected files. |
7632 |
These can be delivered as expeccoPatch files" |
|
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7633 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7634 |
self withActivityIndicationDo:[ |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7635 |
self currentSelectedFiles do:[:fn | |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7636 |
|pkcs7SignedData signatureFilename| |
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7637 |
|
8646 | 7638 |
self notify:'Generating signed file from: ', (fn baseName), '...'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7639 |
|
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7640 |
pkcs7SignedData := Expecco::KeyFileGenerator new signExpeccoCode:fn contentsOfEntireFile. |
12094 | 7641 |
signatureFilename := fn withSuffix:'expeccoPatch'. |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
7642 |
signatureFilename contents:pkcs7SignedData. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7643 |
]. |
13677 | 7644 |
self updateCurrentDirectoryWithReread. |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7645 |
self notify:nil. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7646 |
] |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7647 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
7648 |
|
9784 | 7649 |
inspectXmlFile |
7650 |
"Show an XML file - either in an XMLInspector or fall back to |
|
7651 |
a plain inspector on the XML tree" |
|
7652 |
||
7653 |
self forEachParsedXmlFileDo:[:xmlDocument | |
|
7654 |
XML::XMLInspector notNil ifTrue:[ |
|
7655 |
XML::XMLInspector openOn:xmlDocument. |
|
7656 |
] ifFalse:[ |
|
7657 |
"fall back..." |
|
7658 |
xmlDocument inspect. |
|
7659 |
] |
|
7660 |
]. |
|
7661 |
||
7662 |
"Modified: / 17-02-2011 / 13:58:16 / cg" |
|
7663 |
! |
|
7664 |
||
3892 | 7665 |
installAllAsAutoloaded |
7666 |
"install all classes found here as autoloaded classes" |
|
7667 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7668 |
self installAllAsAutoloadedRecursive:false |
3892 | 7669 |
! |
7670 |
||
6521 | 7671 |
installAllAsAutoloadedRecursive |
7672 |
"install all classes found here and in subdirectories as autoloaded classes" |
|
7673 |
||
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7674 |
self installAllAsAutoloadedRecursive:true |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7675 |
! |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7676 |
|
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7677 |
installAllAsAutoloadedRecursive:aBoolean |
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7678 |
"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
|
7679 |
|
6521 | 7680 |
[ |
15507 | 7681 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
7682 |
|installAction| |
|
7683 |
||
7684 |
installAction := |
|
7685 |
[:fn | |
|
7686 |
(fn suffix = 'st') ifTrue:[ |
|
7687 |
self notify:('Install as autoloaded: ', fn baseName). |
|
7688 |
self installAsAutoloaded:fn. |
|
7689 |
] |
|
7690 |
]. |
|
7691 |
||
7692 |
self withActivityIndicationDo:[ |
|
7693 |
self currentSelectedDirectories do:[:dir| |
|
7694 |
aBoolean ifTrue:[ |
|
7695 |
dir recursiveDirectoryContentsAsFilenamesDo:installAction |
|
7696 |
] ifFalse:[ |
|
7697 |
dir directoryContentsAsFilenamesDo:installAction |
|
15152 | 7698 |
]. |
9674
3c3c1ef9974b
added: #installAllAsAutoloadedRecursive:
Claus Gittinger <cg@exept.de>
parents:
9649
diff
changeset
|
7699 |
]. |
15507 | 7700 |
self notify:nil. |
7701 |
]. |
|
7702 |
] |
|
6521 | 7703 |
] fork. |
7704 |
! |
|
7705 |
||
3892 | 7706 |
installAsAutoloaded:aFilename |
7707 |
"install aFilename as autoloaded class" |
|
7708 |
||
13292 | 7709 |
Smalltalk installAutoloadedClassFromSourceFile:aFilename |
7710 |
||
7711 |
"Modified: / 01-08-2013 / 16:58:09 / cg" |
|
3892 | 7712 |
! |
7713 |
||
15211 | 7714 |
joinSelectedFiles |
7715 |
|selectedFiles numFiles msg outFileName outFile outStream| |
|
7716 |
||
7717 |
selectedFiles := self currentSelectedObjects. |
|
7718 |
(numFiles := selectedFiles size) <= 1 ifTrue:[^ self]. |
|
7719 |
||
7720 |
msg := 'Join each of the %1 files into single file named:\\Attention: order in which files were selected is relevant here !!'. |
|
7721 |
outFileName := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
7722 |
outFileName isEmptyOrNil ifTrue:[^ self]. |
|
7723 |
outFile := selectedFiles first directory construct:outFileName. |
|
7724 |
||
7725 |
outStream := outFile writeStream. |
|
7726 |
||
7727 |
selectedFiles do:[:fileName | |
|
7728 |
|inStream| |
|
7729 |
||
7730 |
self notify:('Adding:', fileName baseName). |
|
7731 |
inStream := fileName readStream. |
|
7732 |
inStream copyToEndInto:outStream. |
|
7733 |
inStream close. |
|
7734 |
]. |
|
7735 |
outStream close. |
|
7736 |
self notify:nil. |
|
7737 |
||
7738 |
"Modified: / 04-12-2006 / 13:15:10 / cg" |
|
7739 |
! |
|
4558 | 7740 |
|
6292 | 7741 |
loadImageThenDo:aBlock |
3892 | 7742 |
|img path files| |
7743 |
||
3982 | 7744 |
files := self currentSelectedFiles. |
3892 | 7745 |
files isEmpty ifTrue:[ ^ self]. |
7746 |
files do:[:fileName | |
|
4414 | 7747 |
path := fileName. |
7748 |
path isDirectory ifFalse:[ |
|
7749 |
img := Image fromFile:(path pathName). |
|
7750 |
img notNil ifTrue:[ |
|
6292 | 7751 |
aBlock value:img |
4414 | 7752 |
] ifFalse:[ |
15346 | 7753 |
Dialog warn:(resources string:'Unknown image format: "%1"' with:fileName asString) |
4414 | 7754 |
] |
7755 |
] |
|
3892 | 7756 |
]. |
7757 |
! |
|
7758 |
||
13089 | 7759 |
loadSignatureSupport |
7760 |
Expecco::KeyFileGenerator isNil ifTrue:[ |
|
14047 | 7761 |
Smalltalk loadPackage:'exept:expecco/license' |
13089 | 7762 |
]. |
7763 |
! |
|
7764 |
||
3892 | 7765 |
openASN1Browser |
7766 |
||
7767 |
self openTool:OSI::ASN1Browser |
|
7768 |
! |
|
7769 |
||
7770 |
openAppletViewer |
|
7771 |
|numItems files| |
|
7772 |
||
3982 | 7773 |
files := self currentSelectedFiles. |
3892 | 7774 |
(numItems := files size) > 2 ifTrue:[ |
4414 | 7775 |
(self |
7776 |
confirm:(resources string:'open for each of the %1 items ?' |
|
7777 |
with:numItems)) ifFalse:[^ self]. |
|
3892 | 7778 |
]. |
7779 |
||
7780 |
Java startupJavaSystem. |
|
7781 |
"/ Java markAllClassesUninitialized. |
|
7782 |
"/ Java initAllStaticFields. |
|
7783 |
"/ Java initAllClasses. |
|
7784 |
||
7785 |
files do:[:fileName | |
|
4414 | 7786 |
|p path| |
7787 |
||
7788 |
path := fileName. |
|
7789 |
path isDirectory ifFalse:[ |
|
7790 |
p := Java |
|
7791 |
javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
|
7792 |
argumentString:path pathName. |
|
7793 |
p resume. |
|
7794 |
] |
|
3892 | 7795 |
]. |
7796 |
! |
|
7797 |
||
7798 |
openCBrowser |
|
6031 | 7799 |
|dir files| |
5880 | 7800 |
|
7801 |
dir := self theSingleSelectedDirectoryOrNil. |
|
7802 |
dir isNil ifTrue:[ ^ self]. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7803 |
self withActivityIndicationDo:[ |
7560 | 7804 |
files := self currentSelectedObjects. |
6031 | 7805 |
files notEmptyOrNil ifTrue:[ |
7806 |
CBrowser::Browser openOn:files first. |
|
7807 |
] ifFalse:[ |
|
7808 |
CBrowser::Browser openIn:dir. |
|
7809 |
] |
|
3892 | 7810 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7811 |
|
7560 | 7812 |
"Modified: / 04-12-2006 / 13:15:19 / cg" |
3892 | 7813 |
! |
7814 |
||
4230 | 7815 |
openChangeSetBrowser |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7816 |
"open a changeSet browser on the selected file(s)" |
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7817 |
|
4230 | 7818 |
self |
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7819 |
openTool:(UserPreferences current changeSetBrowserClass) |
4230 | 7820 |
with:#openOnFile: |
7821 |
ignoreDirectories:true |
|
11712
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7822 |
|
ed8877d9356b
comment/format in: #doOpenCBrowser
Claus Gittinger <cg@exept.de>
parents:
11688
diff
changeset
|
7823 |
"Modified (comment): / 27-07-2012 / 20:42:55 / cg" |
4230 | 7824 |
! |
7825 |
||
3892 | 7826 |
openChangesBrowser |
7827 |
"open a change browser on the selected file(s)" |
|
7828 |
||
7829 |
self openTool:(UserPreferences current changesBrowserClass) |
|
7830 |
! |
|
7831 |
||
7832 |
openDiffView |
|
15215 | 7833 |
"open a diff-view on the two selected files" |
7834 |
||
7835 |
|name1 name2 files title |
|
7836 |
defaultName defaultDir| |
|
6460 | 7837 |
|
7838 |
files := self currentSelectedObjects. |
|
3892 | 7839 |
files isEmpty ifTrue:[ |
6460 | 7840 |
Dialog warn:(resources string:'You have to select a file first'). |
4414 | 7841 |
^ self. |
3892 | 7842 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7843 |
|
3892 | 7844 |
(files size == 2) ifTrue:[ |
4414 | 7845 |
name1 := files last. |
7846 |
name2 := files first. |
|
3892 | 7847 |
] ifFalse:[ |
4414 | 7848 |
LastFileDiffFile notNil ifTrue:[ |
11052 | 7849 |
LastFileDiffFile exists ifTrue:[ |
7850 |
name1 := LastFileDiffFile. |
|
7851 |
]. |
|
7852 |
"/ | directory | |
|
7853 |
"/ directory := self currentDirectory. |
|
7854 |
"/ directory notNil ifTrue:[ |
|
7855 |
"/ lastFile := directory asFilename construct:(LastFileDiffFile baseName). |
|
7856 |
"/ (lastFile exists and:[lastFile isReadable]) ifTrue:[ |
|
7857 |
"/ name1 := lastFile. |
|
7858 |
"/ ] |
|
7859 |
"/ ] |
|
4414 | 7860 |
]. |
7861 |
name2 := files first. |
|
6460 | 7862 |
title := resources string:'Show differences between "%1" and:' with:name2 baseName. |
4414 | 7863 |
defaultName := name1 notNil ifTrue:[name1 baseName] ifFalse:[nil]. |
11052 | 7864 |
defaultDir := name1 notNil ifTrue:[name1 directory] ifFalse:[self currentDirectory]. |
4414 | 7865 |
name1 := DialogBox |
7866 |
requestFileName:title |
|
7867 |
default:defaultName |
|
6460 | 7868 |
ok:(resources string:'OK') |
7869 |
abort:(resources string:'Compare against File List') |
|
4414 | 7870 |
pattern:'*' |
11052 | 7871 |
fromDirectory:defaultDir. |
3892 | 7872 |
]. |
15215 | 7873 |
self openDiffViewOn:name1 and:name2 |
7874 |
||
7875 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
|
7876 |
! |
|
7877 |
||
7878 |
openDiffViewOn:fileArg1 and:fileArg2 |
|
7879 |
"open a diff-view on two files" |
|
7880 |
||
7881 |
|file1 file2 text1 text2 d err nm l1 sameContents msg| |
|
7882 |
||
7883 |
file1 := fileArg1. |
|
7884 |
file2 := fileArg2. |
|
3892 | 7885 |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7886 |
self withWaitCursorDo:[ |
15215 | 7887 |
(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
|
7888 |
text1 := self getAllFilesAsStrings asStringCollection withTabs. |
14126 | 7889 |
text1 := text1 collect:[:l | l isNil ifTrue:[' '] ifFalse:[l string]]. |
15215 | 7890 |
file1 := nil. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7891 |
l1 := 'browser contents' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7892 |
] ifFalse:[ |
15215 | 7893 |
file1 := file1 asFilename. |
7894 |
LastFileDiffFile := file1. |
|
7895 |
file1 isReadable ifFalse:[ |
|
7896 |
nm := file1. |
|
7897 |
file1 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7898 |
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
|
7899 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7900 |
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
|
7901 |
]. |
4414 | 7902 |
]. |
15215 | 7903 |
l1 := file1 pathName |
4414 | 7904 |
]. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7905 |
|
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7906 |
err isNil ifTrue:[ |
15215 | 7907 |
file2 isReadable ifFalse:[ |
7908 |
nm := file2. |
|
7909 |
file2 exists ifFalse:[ |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7910 |
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
|
7911 |
] ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7912 |
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
|
7913 |
]. |
4414 | 7914 |
]. |
7915 |
]. |
|
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7916 |
err notNil ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7917 |
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
|
7918 |
^ self |
6176 | 7919 |
]. |
7920 |
||
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7921 |
self withActivityIndicationDo:[ |
15215 | 7922 |
((file1 notNil and:[file1 fileSize > (1024*1024*32)]) |
7923 |
or:[ file2 fileSize > (1024*1024*32) ]) ifTrue:[ |
|
7924 |
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
|
7925 |
ProgressIndicator |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7926 |
displayBusyIndicator:'Comparing...' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7927 |
at:(Screen default center) |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7928 |
during:[ |
15215 | 7929 |
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
|
7930 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7931 |
sameContents ifTrue:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7932 |
self information:'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7933 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7934 |
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
|
7935 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7936 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7937 |
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
|
7938 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7939 |
^ self. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7940 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7941 |
|
15215 | 7942 |
file1 notNil ifTrue:[ |
7943 |
file1 isDirectory ifTrue:[ |
|
7944 |
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
|
7945 |
] ifFalse:[ |
15215 | 7946 |
text1 := file1 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7947 |
] |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7948 |
]. |
15215 | 7949 |
file2 isDirectory ifTrue:[ |
7950 |
text2 := file2 directoryContents asString. |
|
6460 | 7951 |
] ifFalse:[ |
15215 | 7952 |
text2 := file2 contents. |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7953 |
]. |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7954 |
text1 = text2 ifTrue:[ |
15215 | 7955 |
(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
|
7956 |
msg := 'Same filename lists.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7957 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7958 |
msg := 'Same contents.' |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7959 |
]. |
16911 | 7960 |
self information:msg |
8287
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7961 |
] ifFalse:[ |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7962 |
d := DiffTextView |
df5c80b5bbfb
show busy cursor while computing the diff of two files
Claus Gittinger <cg@exept.de>
parents:
8261
diff
changeset
|
7963 |
openOn:text1 label:l1 |
15215 | 7964 |
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
|
7965 |
d topView label:(resources string:'File Differences'). |
6460 | 7966 |
] |
4414 | 7967 |
] |
3892 | 7968 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
7969 |
|
11494 | 7970 |
"Modified: / 03-05-2012 / 08:03:16 / cg" |
3892 | 7971 |
! |
7972 |
||
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7973 |
openDirectoryDiffView |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7974 |
"open a directory diff-view" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7975 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7976 |
|name1 name2 files| |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7977 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
7978 |
files := self currentSelectedObjects. |
11108 | 7979 |
files notEmpty ifTrue:[ |
7980 |
name1 := files first asFilename. |
|
7981 |
name1 asFilename isDirectory ifFalse:[ |
|
7982 |
name1 := name1 directory |
|
7983 |
]. |
|
7984 |
]. |
|
7985 |
||
7986 |
(files size == 2) ifTrue:[ |
|
7987 |
name2 := files second. |
|
7988 |
] ifFalse:[ |
|
7989 |
(files size ~= 1) ifTrue:[ |
|
7990 |
Dialog warn:(resources string:'Please select one or two directories.'). |
|
7991 |
^ self. |
|
7992 |
]. |
|
7993 |
name2 := Dialog |
|
7994 |
requestDirectoryName:(resources |
|
7995 |
string:'Recursive compare "%1" with folder:' |
|
7996 |
with:name1 asFilename baseName) |
|
7997 |
default:(LastFileDiffDirectory ? self currentDirectory). |
|
7998 |
name2 isEmptyOrNil ifTrue:[^ self]. |
|
7999 |
LastFileDiffDirectory := name2. |
|
8000 |
]. |
|
8001 |
name2 := name2 asFilename. |
|
8002 |
||
8003 |
name2 asFilename isDirectory ifFalse:[ |
|
8004 |
name2 := name2 directory |
|
8005 |
]. |
|
8006 |
||
8007 |
self |
|
8008 |
applicationNamed:#FileApplicationNoteBook |
|
8009 |
ifPresentDo:[:appl | ^ appl openCompareDirectory:name1 with:name2]. |
|
9496
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8010 |
|
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8011 |
"Created: / 20-05-2010 / 15:01:17 / cg" |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8012 |
! |
0cfc347edb59
added: #openDirectoryDiffView
Claus Gittinger <cg@exept.de>
parents:
9493
diff
changeset
|
8013 |
|
3892 | 8014 |
openEditor |
8015 |
self openTool:EditTextView |
|
8016 |
! |
|
8017 |
||
4957 | 8018 |
openGV |
8019 |
self openOSCommandWithFiles:'gv' |
|
8020 |
! |
|
8021 |
||
3892 | 8022 |
openHTMLReader |
8023 |
||
8024 |
self openTool:HTMLDocumentView ignoreDirectories:false |
|
8025 |
! |
|
8026 |
||
8027 |
openImageEditor |
|
6292 | 8028 |
[ |
8029 |
self loadImageThenDo:[:img | img edit] |
|
8030 |
] fork |
|
3892 | 8031 |
! |
8032 |
||
8033 |
openImageInspector |
|
6292 | 8034 |
[ |
8035 |
self loadImageThenDo:[:img | img inspect] |
|
8036 |
] fork |
|
3892 | 8037 |
! |
8038 |
||
8039 |
openImagePreview |
|
5778 | 8040 |
[ |
8041 |
self |
|
6292 | 8042 |
loadImageThenDo: |
5778 | 8043 |
[:img | |
8044 |
|i top viewer| |
|
8045 |
||
8046 |
top := StandardSystemView new. |
|
8047 |
||
8048 |
viewer := ImageView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8049 |
i := img. |
|
8050 |
top extent:200@200. |
|
8051 |
top label:(img fileName asFilename directory baseName , Filename separator , img fileName asFilename baseName). |
|
8052 |
top openAndWait. |
|
8053 |
||
8054 |
(i width > 200 or:[i height > 200]) ifTrue:[ |
|
8055 |
i := i magnifiedPreservingRatioTo:200@200. |
|
8056 |
]. |
|
8057 |
viewer image:i. |
|
8058 |
]. |
|
3892 | 8059 |
] fork |
8060 |
! |
|
8061 |
||
8062 |
openMP3Player |
|
8063 |
|file| |
|
8064 |
||
3982 | 8065 |
file := self currentSelectedFiles. |
3892 | 8066 |
(file isEmpty) ifTrue:[ |
4414 | 8067 |
^ self. |
3892 | 8068 |
]. |
8069 |
file := file first. |
|
8070 |
(MP3PlayerApplication ? SaugFix::MP3PlayerApplication) playSong:file. |
|
8071 |
! |
|
8072 |
||
4957 | 8073 |
openOSCommandWithFiles:command |
8074 |
|files fileNames| |
|
8075 |
||
8076 |
files := self currentSelectedFiles. |
|
8077 |
(files isEmpty) ifTrue:[ |
|
8078 |
^ self. |
|
8079 |
]. |
|
8080 |
||
8081 |
fileNames := files collect:[:each | |
|
8082 |
'"' , each asFilename pathName , '"' |
|
8083 |
]. |
|
8084 |
||
8085 |
[ |
|
8086 |
OperatingSystem |
|
4959 | 8087 |
executeCommand:command , ' ' , fileNames asStringCollection asString |
8088 |
inDirectory:(files first asFilename directory). |
|
4957 | 8089 |
] fork |
8090 |
! |
|
8091 |
||
4820 | 8092 |
openPDFViewer |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8093 |
|files fileNames cmd arg| |
4820 | 8094 |
|
8095 |
files := self currentSelectedFiles. |
|
8096 |
(files isEmpty) ifTrue:[ |
|
8097 |
^ self. |
|
8098 |
]. |
|
12972 | 8099 |
cmd := MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'. |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8100 |
cmd isNil ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8101 |
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
|
8102 |
^ self. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8103 |
]. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8104 |
|
4820 | 8105 |
fileNames := |
8106 |
files |
|
8107 |
collect: |
|
8108 |
[:each | |
|
8109 |
'"' , each asFilename pathName , '"' |
|
8110 |
]. |
|
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8111 |
arg := fileNames asStringCollection asStringWith:' '. |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8112 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8113 |
(cmd includesString:'"%1"') ifTrue:[ |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8114 |
cmd := cmd copyReplaceString:'"%1"' withString:'%1' |
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8115 |
]. |
4820 | 8116 |
|
4950 | 8117 |
[ |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8118 |
OperatingSystem executeCommand:(cmd bindWith:arg). |
4950 | 8119 |
] fork |
5836
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8120 |
|
922c94b683a1
ask MIMETypes for pdf-command
Claus Gittinger <cg@exept.de>
parents:
5832
diff
changeset
|
8121 |
"Modified: / 12-05-2004 / 12:31:20 / cg" |
4820 | 8122 |
! |
8123 |
||
4958 | 8124 |
openRP |
8125 |
self openOSCommandWithFiles:'realplay' |
|
8126 |
! |
|
8127 |
||
8426 | 8128 |
openResourceFileEditor |
8129 |
||
8130 |
self |
|
8131 |
openTool: Tools::InternationalLanguageTranslationEditor |
|
8132 |
with: #openOnFile: |
|
8133 |
! |
|
8134 |
||
3892 | 8135 |
openSlideShow |
5880 | 8136 |
|dir| |
8137 |
||
8138 |
dir := self theSingleSelectedDirectoryOrNil. |
|
8139 |
dir isNil ifTrue:[^ self]. |
|
8140 |
||
3892 | 8141 |
CodingExamples_GUI::SlideShow openIn:dir. |
8142 |
! |
|
8143 |
||
8144 |
openSnapshotImageBrowser |
|
4491 | 8145 |
"Sorry, for now, only the old browser can handle snapShotImages." |
8146 |
||
3892 | 8147 |
^ self openTool:SystemBrowser with:#openOnSnapShotImage: ignoreDirectories:true |
8148 |
! |
|
8149 |
||
8150 |
openTerminal |
|
5880 | 8151 |
|dir| |
8152 |
||
8153 |
dir := self theSingleSelectedDirectoryOrHomeDir. |
|
3892 | 8154 |
|
5300 | 8155 |
TerminalApplication notNil ifTrue:[ |
8156 |
TerminalApplication openIn:dir |
|
8157 |
] ifFalse:[ |
|
8158 |
VT100TerminalView openShellIn:dir. |
|
8159 |
]. |
|
3892 | 8160 |
! |
8161 |
||
8162 |
openTool:aToolClass |
|
8163 |
"open a tool on the selected file(s)" |
|
8164 |
||
8165 |
^ self openTool:aToolClass ignoreDirectories:true |
|
8166 |
! |
|
8167 |
||
8168 |
openTool:aToolClass ignoreDirectories:ignoreDirs |
|
8169 |
"open a tool on the selected file(s)" |
|
8170 |
||
8171 |
^ self |
|
4414 | 8172 |
openTool:aToolClass |
8173 |
with:#openOn: |
|
8174 |
ignoreDirectories:ignoreDirs |
|
3892 | 8175 |
! |
8176 |
||
8426 | 8177 |
openTool:aToolClass with:aSelector |
8178 |
"open a tool on the selected file(s)" |
|
8179 |
||
8180 |
^ self openTool:aToolClass with:aSelector ignoreDirectories:true |
|
8181 |
! |
|
8182 |
||
3892 | 8183 |
openTool:aToolClass with:aSelector ignoreDirectories:ignoreDirs |
8184 |
"open a tool on the selected file(s)" |
|
8185 |
||
8832 | 8186 |
|tool| |
3892 | 8187 |
|
8188 |
aToolClass isNil ifTrue:[ |
|
4414 | 8189 |
Dialog warn:'Sorry, that tool seems to be not available'. |
8190 |
^ nil. |
|
3892 | 8191 |
]. |
8832 | 8192 |
self forEachSelectedFileIgnoringDirectories:ignoreDirs do:[:path | |
8193 |
tool := aToolClass perform:aSelector with:path. |
|
3892 | 8194 |
]. |
8195 |
^ tool |
|
8832 | 8196 |
! |
8197 |
||
8198 |
openWebBrowser |
|
9343
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8199 |
self |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8200 |
forEachSelectedFileIgnoringDirectories:true |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8201 |
do:[:path | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8202 |
Error |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8203 |
handle:[:ex | |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8204 |
Dialog warn:'Shell execution failed: ',ex description |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8205 |
] do:[ |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8206 |
OperatingSystem openApplicationForDocument:path operation:#open. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8207 |
^ self. |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8208 |
] |
895543baebfe
added: #doOpenWithShellCommand
Claus Gittinger <cg@exept.de>
parents:
9338
diff
changeset
|
8209 |
]. |
3892 | 8210 |
! |
8211 |
||
6022 | 8212 |
openWorkspace |
8213 |
self |
|
8214 |
openTool:WorkspaceApplication |
|
8215 |
with:#openOnFile: |
|
8216 |
ignoreDirectories:true |
|
8217 |
! |
|
8218 |
||
4950 | 8219 |
openXV |
4957 | 8220 |
self openOSCommandWithFiles:'xv' |
4950 | 8221 |
! |
8222 |
||
3892 | 8223 |
openZipTool |
5880 | 8224 |
|zipTool| |
3892 | 8225 |
|
8226 |
(zipTool := self openTool:ZipTool) notNil ifTrue:[ |
|
5880 | 8227 |
zipTool initialExtractDirectory:(self theSingleSelectedDirectoryOrHomeDir). |
3892 | 8228 |
]. |
8229 |
! |
|
8230 |
||
8231 |
readAbbrevFile |
|
8232 |
"read the abbrev file and install classes found there as autoloaded classes" |
|
8233 |
||
5880 | 8234 |
|directories| |
3892 | 8235 |
|
3982 | 8236 |
directories := self currentSelectedDirectories. |
3892 | 8237 |
directories isEmpty ifTrue:[^ self]. |
8238 |
||
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8239 |
self withActivityIndicationDo:[ |
5880 | 8240 |
directories do:[:eachDir | |
8241 |
Smalltalk installAutoloadedClassesFrom:(eachDir construct:'abbrev.stc'). |
|
8242 |
] |
|
5828 | 8243 |
] |
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8244 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
8245 |
"Modified: / 25-07-2006 / 09:07:43 / cg" |
3892 | 8246 |
! |
8247 |
||
6460 | 8248 |
readAndShowResources |
8249 |
self withActivityIndicationDo:[ |
|
8250 |
| selectedFiles| |
|
8251 |
||
8252 |
selectedFiles:= self currentSelectedFiles. |
|
8253 |
selectedFiles do:[:fileName | |
|
8254 |
resources := ResourcePack fromFile:fileName. |
|
8255 |
resources inspect. |
|
8256 |
]. |
|
8257 |
] |
|
8258 |
! |
|
8259 |
||
3892 | 8260 |
singleFileFileIn:fileName lazy:lazy |
8261 |
"fileIn the selected file(s)" |
|
8262 |
||
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8263 |
|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
|
8264 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8265 |
fileName isRegularFile ifFalse:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8266 |
^ self. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8267 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8268 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8269 |
[ |
4345 | 8270 |
(ObjectFileLoader notNil |
5491 | 8271 |
and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[ |
4345 | 8272 |
AbortOperationRequest catch:[ |
8273 |
|p| |
|
8274 |
||
8275 |
"/ |
|
8276 |
"/ look if already loaded ... then unload first |
|
8277 |
"/ |
|
8278 |
p := fileName pathName. |
|
8279 |
(ObjectFileLoader loadedObjectFiles includes:p) ifTrue:[ |
|
8280 |
(Dialog confirm:(resources |
|
8281 |
string:'%1 is already loaded; load anyway ?' |
|
8282 |
with:p)) ifFalse:[ |
|
8283 |
^ self |
|
8284 |
]. |
|
8285 |
notifyString := 'unloading old ' , p , ' ...'. |
|
8286 |
Transcript showCR:notifyString. |
|
4523 | 8287 |
self notify:notifyString. |
4345 | 8288 |
ObjectFileLoader unloadObjectFile:p. |
8289 |
]. |
|
8290 |
||
8291 |
notifyString := 'loading ' , p , ' ...'. |
|
8292 |
Transcript showCR:notifyString. |
|
4523 | 8293 |
self notify:notifyString. |
12426 | 8294 |
(ObjectFileLoader loadObjectFile:p) isNil ifTrue:[ |
8295 |
notifyString := 'Error: could not load ' , p. |
|
8296 |
Transcript showCR:notifyString. |
|
8297 |
self notify:notifyString. |
|
8298 |
] ifFalse:[ |
|
8299 |
Class addInfoRecord:('fileIn ' , fileName asFilename pathName) |
|
8300 |
]. |
|
4345 | 8301 |
] |
8302 |
] ifFalse:[ ((fileName hasSuffix:'cls') |
|
8303 |
and:[((fileName mimeTypeOfContents ? '') startsWith:'application/x-smalltalk-source') not ]) ifTrue:[ |
|
8304 |
"/ loading a binary class file |
|
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
8305 |
aStream := fileName readStreamOrNil. |
4345 | 8306 |
aStream notNil ifTrue:[ |
8307 |
aStream fileInBinary. |
|
8308 |
] |
|
8309 |
] ifFalse:[ |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8310 |
((fileName hasSuffix:'class') or:[(fileName hasSuffix:'cla')]) ifTrue:[ |
4345 | 8311 |
"/ loading a java class file |
8312 |
JavaClassReader notNil ifTrue:[ |
|
5491 | 8313 |
JavaClassReader loadFile:fileName |
4345 | 8314 |
] |
8315 |
] ifFalse:[ (fileName hasSuffix:'sif') ifTrue:[ |
|
8316 |
"/ loading a sif (smalltalk interchange format) file |
|
8317 |
SmalltalkInterchangeSTXFileInManager autoload. |
|
8318 |
SmalltalkInterchangeFileManager newForFileIn |
|
8319 |
fileName: fileName pathName; |
|
8320 |
fileIn. |
|
8321 |
] ifFalse:[ (fileName hasSuffix:'pcl') ifTrue:[ |
|
8322 |
Parcel isNil ifTrue:[ |
|
8323 |
Dialog warn:'Parcel support not loaded.' |
|
8324 |
] ifFalse:[ |
|
8325 |
Parcel loadParcelFrom: fileName pathName |
|
8326 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8327 |
] ifFalse:[ (fileName hasSuffix:'jar') ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8328 |
JavaVM isNil ifTrue:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8329 |
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
|
8330 |
^ self. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8331 |
] ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8332 |
JavaVM booted ifFalse:[ |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8333 |
(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
|
8334 |
JavaVM boot. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8335 |
]. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8336 |
JavaVM loadClassesIn: fileName. |
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8337 |
] |
4345 | 8338 |
] ifFalse:[ |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8339 |
"/ ask programming languages... |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8340 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
14360 | 8341 |
(lang isNil and:[(fileName hasSuffix:'js')]) ifTrue:[ |
14362 | 8342 |
Smalltalk loadPackage:'stx:libjavascript'. |
14360 | 8343 |
lang := ProgrammingLanguage allDetect:[:l | l canReadSourceFile:fileName] ifNone:nil. |
8344 |
]. |
|
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8345 |
(lang notNil and:[lang ~= SmalltalkLanguage]) ifTrue:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8346 |
lang fileIn:fileName. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8347 |
] ifFalse:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8348 |
"/ loading a regular (chunk) or xml source file |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8349 |
Error handle:[:ex | |
15675 | 8350 |
self errorNotify:'Error during file in: ', ex description. |
15981 | 8351 |
ex resume. |
9299
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8352 |
] do:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8353 |
aStream := fileName readStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8354 |
[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8355 |
Class withoutUpdatingChangesDo:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8356 |
wasLazy := Compiler compileLazy:lazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8357 |
Smalltalk fileInStream:aStream. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8358 |
]. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8359 |
Class addInfoRecord:('fileIn ' , fileName asString) |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8360 |
] ensure:[ |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8361 |
Compiler compileLazy:wasLazy. |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8362 |
aStream close |
3c234ab3fae2
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
9296
diff
changeset
|
8363 |
] |
4345 | 8364 |
] |
8365 |
] |
|
13968
45cdc56fd50a
Added support for filing-in .jar files.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13910
diff
changeset
|
8366 |
]]]] |
4345 | 8367 |
]] |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8368 |
] 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
|
8369 |
|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
|
8370 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8371 |
isRedef := false. |
12684 | 8372 |
sig := ex creator. |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8373 |
(dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8374 |
action := #continue |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8375 |
] ifFalse:[ |
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8376 |
(sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8377 |
ex reject |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8378 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8379 |
sig == Class methodRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8380 |
msg := 'trying to overwrite method:\\ ' , ex oldMethod whoString , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8381 |
, ex oldPackage , ''' with method from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8382 |
label := 'Method redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8383 |
redefKind := 'method'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8384 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8385 |
] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8386 |
msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8387 |
, ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8388 |
label := 'Class redefinition in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8389 |
redefKind := 'class'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8390 |
isRedef := true. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8391 |
] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender| |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8392 |
label := msg := 'Breakpoint/Halt in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8393 |
sender := ex suspendedContext. |
17024 | 8394 |
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
|
8395 |
] ifFalse:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8396 |
label := 'Error in fileIn'. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8397 |
msg := 'error in fileIn: %1' |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8398 |
]]]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8399 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8400 |
msg := msg bindWith:ex description. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8401 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8402 |
labels := #('Cancel' 'Skip' 'Debug' 'Compare Sources'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8403 |
values := #(abort skip debug compareSources). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8404 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8405 |
isRedef ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8406 |
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
|
8407 |
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
|
8408 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8409 |
labels := labels , #('Keep Package' ). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8410 |
values := values , #(keep). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8411 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8412 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8413 |
labels := labels , #( 'Continue' 'ContinueForAll'). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8414 |
values := values , #( continue continueForAll). |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8415 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8416 |
AbortAllOperationWantedQuery query ifTrue:[ |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8417 |
labels := #('Cancel All') , labels. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8418 |
values := #(cancelAll) , values. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8419 |
]. |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8420 |
|
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8421 |
action := Dialog |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8422 |
choose:(msg withCRs) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8423 |
label:label |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8424 |
image:(WarningBox iconBitmap) |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8425 |
labels:labels |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8426 |
values:values |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8427 |
default:#continue |
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8428 |
onCancel:#abort. |
6281
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8429 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8430 |
|
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8431 |
action == #continueForAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8432 |
dontAskSignals isNil ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8433 |
dontAskSignals := IdentityDictionary new. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8434 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8435 |
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
|
8436 |
action := #continue. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8437 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8438 |
|
8887
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8439 |
(action == #compareSources) ifTrue:[ |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8440 |
DiffCodeView |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8441 |
openOn:(ex oldMethod source) label:'Old Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8442 |
and:(ex newMethod source) label:'New Source' |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8443 |
title:ex description. |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8444 |
ex resignalAs:ex |
f9ab42af84ff
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
8882
diff
changeset
|
8445 |
]. |
8082
40a926dc460d
On class/method redefinition allow the user to select both #keep and #continue
Stefan Vogel <sv@exept.de>
parents:
8068
diff
changeset
|
8446 |
(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
|
8447 |
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
|
8448 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8449 |
action == #abort ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8450 |
AbortOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8451 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8452 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8453 |
action == #cancelAll ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8454 |
AbortAllOperationRequest raise. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8455 |
ex return |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8456 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8457 |
action == #skip ifTrue:[ |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8458 |
ex proceedWith:nil |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8459 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8460 |
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
|
8461 |
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
|
8462 |
withMessage:ex description |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8463 |
mayProceed:true. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8464 |
ex proceedWith:nil. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8465 |
]. |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8466 |
ex reject |
e8e47b1b290f
Do not pop up dialogs on PackageRedefinitions when doing a fileIn
Stefan Vogel <sv@exept.de>
parents:
6265
diff
changeset
|
8467 |
] |
7040 | 8468 |
|
10887
f2a55c7f0ed6
changed: #singleFileFileIn:lazy:
Claus Gittinger <cg@exept.de>
parents:
10775
diff
changeset
|
8469 |
"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
|
8470 |
"Modified: / 19-02-2014 / 12:49:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4531 | 8471 |
! |
8472 |
||
4558 | 8473 |
splitFile:infile intoPiecesOfSize:kiloBytes |
8474 |
|bytesPerSplit splitIndex bufferSize buffer n |
|
8475 |
inStream outFile outStream remaining remainingInThisOutfile| |
|
8476 |
||
8477 |
bufferSize := 32*1024. |
|
8478 |
||
8479 |
inStream := infile readStream. |
|
8480 |
||
8481 |
bytesPerSplit := kiloBytes * 1024. |
|
8482 |
||
8483 |
remaining := infile fileSize. |
|
8484 |
splitIndex := 1. |
|
8485 |
[remaining > 0] whileTrue:[ |
|
8486 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8487 |
outStream := outFile asFilename writeStream. |
|
8488 |
remainingInThisOutfile := remaining min:bytesPerSplit. |
|
8489 |
[remainingInThisOutfile > 0] whileTrue:[ |
|
8490 |
buffer := ByteArray new:bufferSize. |
|
8491 |
n := inStream |
|
8492 |
nextBytes:(bufferSize min:remainingInThisOutfile) |
|
8493 |
into:buffer |
|
8494 |
startingAt:1. |
|
8495 |
outStream nextPutBytes:n from:buffer startingAt:1. |
|
8496 |
remainingInThisOutfile := remainingInThisOutfile - n. |
|
8497 |
remaining := remaining - n. |
|
8498 |
]. |
|
8499 |
outStream close. |
|
8500 |
splitIndex := splitIndex + 1. |
|
8501 |
]. |
|
8502 |
inStream close. |
|
8503 |
! |
|
8504 |
||
15906 | 8505 |
splitFile:infile intoPiecesWithNumberOfLines:numberOfLines |
8506 |
|splitIndex line |
|
8507 |
inStream outFile outStream remainingLinesInThisOutfile| |
|
8508 |
||
8509 |
inStream := infile readStream. |
|
8510 |
||
8511 |
splitIndex := 1. |
|
8512 |
[inStream atEnd] whileFalse:[ |
|
8513 |
outFile := infile pathName , '_' , (splitIndex printString leftPaddedTo:3 with:$0). |
|
8514 |
outStream := outFile asFilename writeStream. |
|
8515 |
remainingLinesInThisOutfile := numberOfLines. |
|
8516 |
[(remainingLinesInThisOutfile > 0) and:[inStream atEnd not]] whileTrue:[ |
|
8517 |
line := inStream nextLine. |
|
15910 | 8518 |
outStream nextPutLine:line. |
15906 | 8519 |
remainingLinesInThisOutfile := remainingLinesInThisOutfile - 1. |
8520 |
]. |
|
8521 |
outStream close. |
|
8522 |
splitIndex := splitIndex + 1. |
|
8523 |
]. |
|
8524 |
inStream close. |
|
8525 |
! |
|
8526 |
||
4558 | 8527 |
splitSelectedFiles |
6264 | 8528 |
|selectedFiles numFiles msg sizeString kiloBytes| |
4558 | 8529 |
|
12871 | 8530 |
selectedFiles := self currentSelectedFiles. |
4558 | 8531 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
8532 |
||
6265 | 8533 |
msg := (numFiles > 1) |
8534 |
ifTrue:'Split each of the %1 files into pieces of size (in kB):' |
|
8535 |
ifFalse:'Split %2 into pieces of size (in kB):'. |
|
4558 | 8536 |
|
6352 | 8537 |
sizeString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
6264 | 8538 |
sizeString isEmptyOrNil ifTrue:[^ self]. |
8539 |
kiloBytes := Integer readFrom:sizeString onError:nil. |
|
4558 | 8540 |
kiloBytes isNil ifTrue:[^ self]. |
8541 |
||
8542 |
selectedFiles do:[:fileName | |
|
8543 |
self notify:('Splitting:', fileName baseName). |
|
8544 |
fileName isDirectory ifFalse:[ |
|
8545 |
self splitFile:fileName intoPiecesOfSize:kiloBytes. |
|
8546 |
] |
|
8547 |
]. |
|
6190 | 8548 |
self notify:nil. |
6265 | 8549 |
|
7560 | 8550 |
"Modified: / 04-12-2006 / 13:15:26 / cg" |
4558 | 8551 |
! |
8552 |
||
15906 | 8553 |
splitSelectedFilesByLines |
8554 |
|selectedFiles numFiles msg numLinesString numLines| |
|
8555 |
||
8556 |
selectedFiles := self currentSelectedFiles. |
|
8557 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
8558 |
||
8559 |
msg := (numFiles > 1) |
|
8560 |
ifTrue:'Split each of the %1 files into pieces with number of lines:' |
|
8561 |
ifFalse:'Split %2 into pieces with number of lines:'. |
|
8562 |
||
8563 |
numLinesString := Dialog request:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName). |
|
8564 |
numLinesString isEmptyOrNil ifTrue:[^ self]. |
|
8565 |
||
8566 |
numLines := Integer readFrom:numLinesString onError:nil. |
|
8567 |
numLines isNil ifTrue:[^ self]. |
|
8568 |
||
8569 |
selectedFiles do:[:fileName | |
|
8570 |
self notify:('Splitting:', fileName baseName). |
|
8571 |
fileName isDirectory ifFalse:[ |
|
8572 |
self splitFile:fileName intoPiecesWithNumberOfLines:numLines |
|
8573 |
] |
|
8574 |
]. |
|
8575 |
self notify:nil. |
|
8576 |
! |
|
8577 |
||
15211 | 8578 |
truncateSelectedFilesToZeroSize |
8579 |
|selectedFiles numFiles msg| |
|
8580 |
||
8581 |
selectedFiles := self currentSelectedObjects. |
|
8582 |
(numFiles := selectedFiles size) == 0 ifTrue:[^ self]. |
|
8583 |
||
8584 |
msg := 'Really truncate file ''%2'' to zero length ?\\WARNING: contents of file is lost !!\This cannot be undone.'. |
|
8585 |
numFiles > 1 ifTrue:[ |
|
8586 |
msg := 'Really truncate %1 files to zero length ?\\WARNING: contents of files is lost !!\This cannot be undone.'. |
|
8587 |
]. |
|
8588 |
||
8589 |
(Dialog |
|
8590 |
confirm:(resources stringWithCRs:msg with:numFiles with:selectedFiles first baseName allBold) |
|
8591 |
initialAnswer:false |
|
8592 |
) ifFalse:[ |
|
8593 |
^ self |
|
8594 |
]. |
|
8595 |
||
8596 |
selectedFiles do:[:fileName | |
|
8597 |
|s| |
|
8598 |
||
8599 |
self notify:('Truncating:', fileName baseName). |
|
8600 |
fileName isDirectory ifFalse:[ |
|
8601 |
[ |
|
8602 |
s := fileName writeStream. |
|
8603 |
s close. |
|
8604 |
] on:FileStream openErrorSignal do:[:ex| |
|
8605 |
self warn:('Cannot truncate "%1".' bindWith:fileName baseName allBold). |
|
8606 |
]. |
|
8607 |
] |
|
8608 |
]. |
|
8609 |
self notify:nil. |
|
8610 |
||
8611 |
"Modified: / 04-12-2006 / 13:15:28 / cg" |
|
8612 |
! ! |
|
3892 | 8613 |
|
4849 | 8614 |
!AbstractFileBrowser methodsFor:'menu queries-tools'! |
3892 | 8615 |
|
6521 | 8616 |
anySTFilesOrDirectoriesPresent |
8617 |
^ self anyDirectoriesOrFilesPresentWithSuffix:'st' |
|
8618 |
! |
|
8619 |
||
3892 | 8620 |
anySTFilesPresent |
8621 |
^ self anyFilesPresentWithSuffix:'st' |
|
8622 |
! |
|
8623 |
||
8624 |
canCreateNewProject |
|
8625 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
12811 | 8626 |
^ self currentSelectedFiles contains:[:fileName| |
8627 |
| suffix| |
|
8628 |
suffix := fileName suffix asLowercase. |
|
8629 |
(suffix = 'prj' or:[suffix = 'st']) |
|
8630 |
] |
|
3892 | 8631 |
! |
8632 |
||
8633 |
canDoTerminal |
|
8634 |
||
8635 |
^ OperatingSystem isUNIXlike |
|
8636 |
or:[OperatingSystem isMSWINDOWSlike] |
|
8637 |
! |
|
8638 |
||
8639 |
canDoTerminalAndSystemIsDOS |
|
8640 |
||
8641 |
^ self canDoTerminal and:[OperatingSystem isMSWINDOWSlike] |
|
8642 |
! |
|
8643 |
||
8644 |
canDoTerminalAndSystemIsUnix |
|
8645 |
||
8646 |
^ self canDoTerminal and:[OperatingSystem isUNIXlike] |
|
8647 |
! |
|
8648 |
||
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8649 |
canGenerateSignatureFiles |
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8650 |
"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
|
8651 |
|
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8652 |
Expecco::KeyFileGenerator isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8653 |
Expecco::KeyFile isNil ifTrue:[ ^ false ]. |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8654 |
|
8645
00e4d07c6d6d
Generate signed expecco patch files
Stefan Vogel <sv@exept.de>
parents:
8641
diff
changeset
|
8655 |
^ self currentSelectedFiles notEmptyOrNil |
8640
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8656 |
! |
fe2bc358dec4
added generateSignatureFile to tools-menu
Claus Gittinger <cg@exept.de>
parents:
8617
diff
changeset
|
8657 |
|
12811 | 8658 |
canOpenMonticelloBrowser |
8659 |
^ self currentSelectedFiles |
|
8660 |
contains:[:fileName| |
|
8661 |
fileName suffix asLowercase = 'mcz' |
|
8662 |
] |
|
8663 |
! |
|
8664 |
||
3892 | 8665 |
canReadAbbrevFile |
8666 |
||
5960 | 8667 |
|currentDirectory| |
3892 | 8668 |
|
8669 |
self currentFilesAreInSameDirectory ifFalse:[^ false]. |
|
5960 | 8670 |
currentDirectory := self currentDirectory. |
8671 |
^ currentDirectory notNil |
|
8672 |
and:[ (currentDirectory construct:'abbrev.stc') exists ] |
|
3892 | 8673 |
! |
8674 |
||
8675 |
canRemoveFromSourcePath |
|
8676 |
||
8677 |
^ false |
|
8678 |
! |
|
8679 |
||
13089 | 8680 |
cannotGenerateSignatureFiles |
8681 |
^ self canGenerateSignatureFiles not |
|
8682 |
! |
|
8683 |
||
3892 | 8684 |
hasASN1 |
8685 |
^ [ OSI::ASN1Parser notNil |
|
4414 | 8686 |
and:[OSI::ASN1Parser isLoaded]] |
3892 | 8687 |
|
8688 |
! |
|
8689 |
||
8690 |
hasASN1AndSelection |
|
8691 |
^ [ self hasSelection value |
|
4414 | 8692 |
and:[self currentSelectedFiles size > 0 |
8693 |
and:[OSI::ASN1Parser notNil |
|
8694 |
and:[OSI::ASN1Parser isLoaded]]]] |
|
3892 | 8695 |
! |
8696 |
||
8697 |
hasCBrowser |
|
8698 |
^ [ CBrowser::Browser notNil ] |
|
8699 |
! |
|
8700 |
||
8701 |
hasJava |
|
8702 |
||
14298 | 8703 |
^ [ JavaVM notNil |
8704 |
and:[JavaClassReader notNil |
|
8705 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 8706 |
! |
8707 |
||
8708 |
hasJavaAndSelection |
|
8709 |
||
12871 | 8710 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 8711 |
and:[JavaClassReader notNil |
8712 |
and:[JavaClassReader isLoaded]]] |
|
3892 | 8713 |
! |
8714 |
||
8715 |
hasMP3Player |
|
8716 |
||
8717 |
^ [ MP3PlayerApplication notNil |
|
4414 | 8718 |
or:[SaugFix::MP3PlayerApplication notNil ]] |
3892 | 8719 |
! |
8720 |
||
8721 |
hasMP3PlayerAndSelection |
|
8722 |
||
12871 | 8723 |
^ [ self currentSelectedFiles notEmptyOrNil |
4414 | 8724 |
and:[ self hasMP3Player value]] |
3892 | 8725 |
! |
8726 |
||
8426 | 8727 |
hasResourceFileSelected |
12871 | 8728 |
^ (self currentSelectedFiles) |
8729 |
contains:[:fn | |
|
12811 | 8730 |
fn suffix asLowercase = 'rs' |
8731 |
]. |
|
8426 | 8732 |
! |
8733 |
||
3892 | 8734 |
hasSlideShow |
8735 |
||
8736 |
^ [CodingExamples_GUI::SlideShow notNil] |
|
8737 |
! |
|
8738 |
||
8739 |
hasSnapshotSelection |
|
8740 |
||
8741 |
^ [ |
|
4414 | 8742 |
| files | |
8426 | 8743 |
|
4414 | 8744 |
files := self currentSelectedFiles. |
8745 |
((files size == 1) |
|
8746 |
and:[ files first hasSuffix:'img' ]) |
|
3892 | 8747 |
] |
8748 |
! |
|
8749 |
||
7869 | 8750 |
hasXml |
9206 | 8751 |
^ [ XML::XMLParser notNil ] |
7869 | 8752 |
! |
8753 |
||
8754 |
hasXmlFileSelected |
|
8611
3d979ab577b7
xml-inspector always enabled.
Claus Gittinger <cg@exept.de>
parents:
8601
diff
changeset
|
8755 |
"/ 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
|
8756 |
"/ then handle the error when it ever fails during xml-parsing. |
7869 | 8757 |
|
8426 | 8758 |
^ [ |
8759 |
|sel fileName| |
|
7869 | 8760 |
|
8761 |
sel := self currentSelectedFiles. |
|
8762 |
sel size == 1 ifTrue:[ |
|
8763 |
fileName := sel first. |
|
8764 |
fileName notNil ifTrue:[ |
|
15936 | 8765 |
#('xml' 'xsd' 'vdx') includes:fileName suffix asLowercase |
7869 | 8766 |
] ifFalse:[ |
8767 |
false |
|
8768 |
] |
|
8769 |
] ifFalse:[ |
|
8770 |
false |
|
8771 |
] |
|
8772 |
] |
|
8773 |
! |
|
8774 |
||
3892 | 8775 |
hasZipFileSelected |
9764
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8776 |
|sel fileName suff| |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8777 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8778 |
sel := self currentSelectedFiles. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8779 |
sel size == 1 ifFalse:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8780 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8781 |
fileName := sel first. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8782 |
fileName isNil ifTrue:[^ false]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8783 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8784 |
suff := fileName suffix asLowercase. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8785 |
(suff = 'zip' or:[suff = 'jar']) ifTrue:[^ true]. |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8786 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8787 |
^ fileName mimeTypeOfContents = 'application/x-zip-compressed' |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8788 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8789 |
"Modified: / 14-02-2011 / 17:17:03 / cg" |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8790 |
! |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8791 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8792 |
hasZipFileSelectedHolder |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8793 |
^ [ self hasZipFileSelected ] |
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8794 |
|
47b9c33465a1
added: #hasZipFileSelectedHolder
Claus Gittinger <cg@exept.de>
parents:
9752
diff
changeset
|
8795 |
"Created: / 14-02-2011 / 17:16:08 / cg" |
3892 | 8796 |
! |
8797 |
||
8798 |
javaSupportLoaded |
|
8799 |
||
8800 |
^ false |
|
8801 |
! ! |
|
8802 |
||
14126 | 8803 |
|
8804 |
||
3906 | 8805 |
!AbstractFileBrowser methodsFor:'presentation'! |
8806 |
||
8807 |
getModeString:modeBits |
|
8808 |
"convert file-mode bits into a more user-friendly string. |
|
8809 |
This is wrong here - should be moved into OperatingSystem." |
|
8810 |
||
8811 |
^ self getModeString:modeBits |
|
4414 | 8812 |
with:#( 'owner:' $r $w $x |
8813 |
' group:' $r $w $x |
|
8814 |
' others:' $r $w $x ) |
|
3906 | 8815 |
! |
8816 |
||
8817 |
getModeString:modeBits with:texts |
|
8818 |
"convert file-mode bits into a more user-friendly string. |
|
8819 |
This is wrong here - should be moved into OperatingSystem." |
|
8820 |
||
8821 |
|bits modeString| |
|
8822 |
||
8823 |
bits := modeBits bitAnd:8r777. |
|
8824 |
modeString := ''. |
|
8825 |
||
8826 |
#( nil 8r400 8r200 8r100 nil 8r040 8r020 8r010 nil 8r004 8r002 8r001 ) |
|
8827 |
with: texts do:[:bitMask :access | |
|
4414 | 8828 |
|ch| |
8829 |
||
8830 |
bitMask isNil ifTrue:[ |
|
8831 |
modeString := modeString , access |
|
8832 |
] ifFalse:[ |
|
8833 |
(bits bitAnd:bitMask) == 0 ifTrue:[ |
|
8834 |
ch := $- |
|
8835 |
] ifFalse:[ |
|
8836 |
ch := access |
|
8837 |
]. |
|
8838 |
modeString := modeString copyWith:ch |
|
8839 |
] |
|
3906 | 8840 |
]. |
8841 |
^ modeString |
|
8842 |
! ! |
|
8843 |
||
5880 | 8844 |
!AbstractFileBrowser methodsFor:'private'! |
8845 |
||
8846 |
theSingleSelectedDirectoryOrHomeDir |
|
8847 |
|dir| |
|
8848 |
||
5888 | 8849 |
dir := self theSingleSelectedDirectoryOrNil. |
5880 | 8850 |
dir isNil ifTrue:[ dir := Filename homeDirectory]. |
8851 |
^ dir. |
|
8852 |
! |
|
8853 |
||
8854 |
theSingleSelectedDirectoryOrNil |
|
8855 |
|dirs| |
|
8856 |
||
8857 |
dirs := self currentSelectedDirectories. |
|
8858 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
8859 |
^ dirs anElement. |
|
14577 | 8860 |
! |
8861 |
||
8862 |
theSingleSelectedFileOrNil |
|
8863 |
|dirs| |
|
8864 |
||
8865 |
dirs := self currentSelectedFiles. |
|
8866 |
dirs size ~= 1 ifTrue:[ ^ nil]. |
|
8867 |
^ dirs anElement. |
|
5880 | 8868 |
! ! |
8869 |
||
3892 | 8870 |
!AbstractFileBrowser methodsFor:'queries'! |
8871 |
||
8256 | 8872 |
cBrowserLoaded |
8873 |
^ CBrowser::Browser notNil |
|
8874 |
! |
|
8875 |
||
10747
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8876 |
cBrowserMenuItemVisible |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8877 |
^ self cBrowserLoaded or:[ OperatingSystem getLoginName = 'cg' ] |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8878 |
|
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8879 |
"Created: / 04-10-2011 / 13:40:38 / cg" |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8880 |
! |
aa57b76e8318
added: #cBrowserMenuItemVisible
Claus Gittinger <cg@exept.de>
parents:
10678
diff
changeset
|
8881 |
|
5334
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8882 |
getAllFilesAsStrings |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8883 |
"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
|
8884 |
|
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8885 |
^ self subclassResponsibility |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8886 |
! |
637f49d94b1b
move file(s) operation added
Claus Gittinger <cg@exept.de>
parents:
5318
diff
changeset
|
8887 |
|
3906 | 8888 |
getFileInfoStringForFirstSelectedFile:longInfo |
8889 |
"get stat info on selected file - return a string which can be |
|
8890 |
shown in a box" |
|
8891 |
||
5973
0baf6c6b685f
#linkInfo now returns the info also for files that are not a symlink
Stefan Vogel <sv@exept.de>
parents:
5971
diff
changeset
|
8892 |
|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
|
8893 |
sizeString fileSize tAccess tModification buffer| |
3906 | 8894 |
|
7560 | 8895 |
selFiles := self currentSelectedObjects. |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
8896 |
selFiles size ~~ 1 ifTrue:[ ^ nil]. |
3906 | 8897 |
filename := selFiles first. |
8898 |
||
8364 | 8899 |
info := filename linkInfo. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8900 |
info isNil ifTrue:[ |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8901 |
^ 'Cannot get fileInfo'. |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8902 |
^ nil |
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
8903 |
]. |
8364 | 8904 |
|
5755
5e8165d55605
replaced '' writeStream by String writeStream
Claus Gittinger <cg@exept.de>
parents:
5753
diff
changeset
|
8905 |
buffer := Text writeStream. |
4765 | 8906 |
|
8907 |
buffer |
|
8908 |
nextPutAll:'filename: '; |
|
8909 |
nextPutLine:filename asString. |
|
8910 |
||
8364 | 8911 |
OperatingSystem isMSDOSlike ifTrue: [ |
8912 |
(info alternativeName notNil |
|
8913 |
and:[ info alternativeName ~= info fullName ]) ifTrue:[ |
|
8914 |
buffer nextPutAll:'shortname: '. |
|
8915 |
buffer nextPutLine:info alternativeName. |
|
8916 |
] |
|
8917 |
]. |
|
8918 |
||
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8919 |
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
|
8920 |
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
|
8921 |
filename exists ifFalse:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8922 |
buffer nextPutAll:'broken '. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8923 |
]. |
4765 | 8924 |
buffer |
8925 |
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
|
8926 |
nextPutLine:(info path ? '???'). |
3906 | 8927 |
] 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
|
8928 |
(longInfo and:[info isRegular]) ifTrue:[ |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8929 |
fileOutput := filename fileType. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8930 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8931 |
|
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8932 |
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
|
8933 |
s := info type asString |
5360
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8934 |
] ifFalse:[ |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8935 |
s := 'regular (' , fileOutput , ')' |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8936 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8937 |
buffer nextPutLine:s. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8938 |
]. |
1f2f874c8c9a
avoid blocking on mounted directories;
Claus Gittinger <cg@exept.de>
parents:
5356
diff
changeset
|
8939 |
|
4707
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8940 |
fileSize := info fileSize. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8941 |
sizeString := 'size: ', fileSize printString. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8942 |
longInfo ifTrue:[ |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8943 |
fileSize > 1024 ifTrue:[ |
8172 | 8944 |
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
|
8945 |
]. |
e0a527ba0898
show Kb & Mb based on 1024 bytes per kilo
Claus Gittinger <cg@exept.de>
parents:
4692
diff
changeset
|
8946 |
]. |
4765 | 8947 |
buffer nextPutLine:sizeString. |
3906 | 8948 |
|
8949 |
modeBits := info mode. |
|
8950 |
modeString := self getModeString:modeBits. |
|
4765 | 8951 |
|
8952 |
buffer nextPutAll:'access: '; nextPutAll:modeString. |
|
3906 | 8953 |
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
|
8954 |
buffer nextPutAll:' ('; nextPutAll:(modeBits printStringRadix:8); nextPut:$). |
3906 | 8955 |
]. |
4765 | 8956 |
buffer |
8957 |
cr; |
|
8958 |
nextPutAll:'owner: '; |
|
8959 |
nextPutLine:(OperatingSystem getUserNameFromID:(info uid)). |
|
8960 |
||
3906 | 8961 |
longInfo ifTrue:[ |
4765 | 8962 |
buffer |
8963 |
nextPutAll:'group: '; |
|
8964 |
nextPutLine:(OperatingSystem getGroupNameFromID:(info gid)). |
|
8965 |
||
8966 |
tAccess := info accessTime. |
|
8967 |
buffer |
|
8968 |
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
|
8969 |
nextPutAll:tAccess asDate printString; |
4765 | 8970 |
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
|
8971 |
nextPutLine:tAccess asTime printString. |
4765 | 8972 |
|
8973 |
tModification := info modificationTime. |
|
8974 |
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
|
8975 |
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
|
8976 |
nextPutAll:tModification asDate printString; |
4765 | 8977 |
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
|
8978 |
nextPutLine:tModification asTime printString. |
3906 | 8979 |
]. |
4765 | 8980 |
^ buffer contents |
7560 | 8981 |
|
7633
0a85c590f98f
ignore nil-return from get link name (for broken links)
Claus Gittinger <cg@exept.de>
parents:
7585
diff
changeset
|
8982 |
"Modified: / 07-02-2007 / 10:38:14 / cg" |
3906 | 8983 |
! |
8984 |
||
8510 | 8985 |
hasImageColorHistogram |
8986 |
^ ImageColorHistogram notNil |
|
8987 |
! |
|
8988 |
||
10258 | 8989 |
hasSubversionSupport |
11156
11c0b4cbc836
Use Configurable includesFeature:#Feature instead of direct send of #hasFeature
vrany
parents:
11149
diff
changeset
|
8990 |
^ ConfigurableFeatures includesFeature: #SubversionSupport |
10258 | 8991 |
|
8992 |
"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
|
8993 |
"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
|
8994 |
"Modified: / 19-01-2012 / 10:43:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10258 | 8995 |
! |
8996 |
||
3892 | 8997 |
initialCommandFor:fileName into:aBox |
8998 |
"set a useful initial command for execute box." |
|
8999 |
||
4496
513e99a8621b
defaultCommandPerMIME moved to MIMETypes
Claus Gittinger <cg@exept.de>
parents:
4491
diff
changeset
|
9000 |
self class initialCommandFor:fileName in:Filename currentDirectory intoBox:aBox |
3892 | 9001 |
! |
9002 |
||
9003 |
isAbstractFileBrowser |
|
9004 |
||
9005 |
^ true |
|
9006 |
! |
|
9007 |
||
9008 |
systemIsDOS |
|
9009 |
||
9010 |
^ OperatingSystem isMSDOSlike |
|
9011 |
! |
|
9012 |
||
12473 | 9013 |
systemIsOSX |
9014 |
||
9015 |
^ OperatingSystem isOSXlike |
|
9016 |
! |
|
9017 |
||
3892 | 9018 |
systemIsUnix |
9019 |
^ OperatingSystem isUNIXlike |
|
14980 | 9020 |
! |
9021 |
||
9022 |
systemSupportsVolumes |
|
9023 |
||
9024 |
^ OperatingSystem supportsVolumes |
|
3892 | 9025 |
! ! |
9026 |
||
9027 |
!AbstractFileBrowser methodsFor:'queries-file'! |
|
9028 |
||
9029 |
allItemsOfCurrentDirectory |
|
5009 | 9030 |
self |
4774 | 9031 |
applicationNamed:#DirectoryContentsBrowser |
5009 | 9032 |
ifPresentDo:[:app | ^ app allItemsOfCurrentDirectory]. |
9033 |
||
9034 |
^ nil |
|
3892 | 9035 |
! |
9036 |
||
9037 |
anyFilesPresentWithSuffix:suffix |
|
6725 | 9038 |
self currentSelectedDirectories do:[:dir| |
4636
08b2b63e3107
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4629
diff
changeset
|
9039 |
[ |
5810
4661bf4c3bbf
openErrorSignal arg: always a string
Claus Gittinger <cg@exept.de>
parents:
5789
diff
changeset
|
9040 |
(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
|
9041 |
] on:FileStream openErrorSignal do:[:ex|]. |
3892 | 9042 |
]. |
9043 |
^ false. |
|
9044 |
! |
|
9045 |
||
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9046 |
commonPrefixOfSelectedFiles |
4773 | 9047 |
|selFiles stringCol firstPre| |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9048 |
|
7560 | 9049 |
selFiles := self currentSelectedObjects. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9050 |
selFiles isEmpty ifTrue:[^ nil]. |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9051 |
|
4772 | 9052 |
stringCol := selFiles collect:[:file | file asString]. |
4773 | 9053 |
firstPre := stringCol at:1. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9054 |
stringCol from:2 do:[:el| |
4773 | 9055 |
firstPre := firstPre commonPrefixWith:el. |
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9056 |
]. |
4773 | 9057 |
^ firstPre asFilename |
7560 | 9058 |
|
9059 |
"Modified: / 04-12-2006 / 13:14:25 / cg" |
|
4771
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9060 |
! |
9290fdb65a5d
#getCommonForCurrentFiles renamed to #commonPrefixOfSelectedFiles
Claus Gittinger <cg@exept.de>
parents:
4769
diff
changeset
|
9061 |
|
12481 | 9062 |
compressTabsOnSave |
9063 |
"if true, compress leading spaces (multiples of 8) with a tab character |
|
9064 |
when saving. |
|
9065 |
Default is true" |
|
9066 |
||
9067 |
^ true |
|
9068 |
! |
|
9069 |
||
3892 | 9070 |
currentFilesAreInSameDirectory |
9071 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9072 |
^ self parentDirectoriesOfCurrentFiles size < 2 |
3892 | 9073 |
! |
9074 |
||
9075 |
currentFilesHasDirectories |
|
9076 |
||
6725 | 9077 |
^ self currentSelectedDirectories notEmpty. |
3892 | 9078 |
! |
9079 |
||
3982 | 9080 |
directoriesForFiles:aFileCol |
11743 | 9081 |
^ aFileCol collect:[:file| self getDirWithoutFileName:file] as:Set. |
3982 | 9082 |
! |
9083 |
||
3892 | 9084 |
fileListIsEmpty |
5009 | 9085 |
self |
9086 |
applicationNamed:#DirectoryContentsBrowser |
|
9087 |
ifPresentDo:[:appl | ^ appl fileListIsEmpty]. |
|
9088 |
||
9089 |
^ nil. |
|
3892 | 9090 |
! |
9091 |
||
9092 |
fileListIsNotEmpty |
|
9093 |
||
9094 |
^ self fileListIsEmpty not. |
|
9095 |
! |
|
9096 |
||
9097 |
fileName:aFilename1 startsWith:aFilename2 |
|
6284 | 9098 |
" check if aFilename2 is a prefix of aFilename1" |
3892 | 9099 |
|
9100 |
| file1 file2 | |
|
9101 |
||
6284 | 9102 |
(aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false]. |
3892 | 9103 |
file1 := aFilename1 asFilename. |
9104 |
file2 := aFilename2 asFilename. |
|
6284 | 9105 |
|
3892 | 9106 |
file2 isRootDirectory ifTrue:[ ^ true]. |
6284 | 9107 |
|
3892 | 9108 |
((file1 isDirectory) |
9109 |
and:[(file2 isDirectory) |
|
9110 |
and:[file1 directory = file2 directory]]) ifTrue:[ |
|
4414 | 9111 |
^ file1 baseName = file2 baseName |
3892 | 9112 |
]. |
3982 | 9113 |
^ (file1 pathName) startsWith:(file2 pathName) |
3892 | 9114 |
! |
9115 |
||
9116 |
getAllFilesAsStringCollection |
|
5009 | 9117 |
self |
9118 |
applicationNamed:#DirectoryContentsBrowser |
|
9119 |
ifPresentDo:[:appl | ^ appl getAllFilesAsStringCollection]. |
|
9120 |
||
9121 |
^ nil |
|
3892 | 9122 |
! |
9123 |
||
9124 |
getBestDirectory |
|
9125 |
||
9126 |
|selFiles stringCol firstPre| |
|
9127 |
||
6725 | 9128 |
selFiles := self currentSelectedDirectories. |
3892 | 9129 |
selFiles isEmpty ifTrue:[^ nil]. |
9130 |
selFiles size == 1 ifTrue:[^ selFiles first]. |
|
4486 | 9131 |
stringCol := (selFiles collect:[:file| file asString]) asOrderedCollection. |
3892 | 9132 |
firstPre := stringCol at:1. |
9133 |
stringCol from:2 do:[:el| |
|
4414 | 9134 |
firstPre := firstPre commonPrefixWith:el. |
3892 | 9135 |
]. |
9136 |
(firstPre endsWith:(OperatingSystem fileSeparator)) ifTrue:[ |
|
4414 | 9137 |
firstPre removeLast. |
3892 | 9138 |
]. |
9139 |
^ firstPre asFilename |
|
9140 |
! |
|
9141 |
||
9142 |
getDirWithoutFileName:aFileName |
|
9143 |
||
9144 |
| dir | |
|
9145 |
aFileName isNil ifTrue:[ |
|
4414 | 9146 |
^ aFileName. |
3892 | 9147 |
]. |
9148 |
dir := aFileName asFilename. |
|
9149 |
dir isDirectory ifFalse:[ |
|
4414 | 9150 |
dir := dir directory. |
3892 | 9151 |
]. |
9152 |
^ dir. |
|
9153 |
! |
|
9154 |
||
9155 |
getInfoItem |
|
9156 |
"get filename of a description-file (.dir.info, README etc.); |
|
16778 | 9157 |
This file is automatically shown when a directory is entered. |
3892 | 9158 |
You can add more names below if you like." |
9159 |
||
5880 | 9160 |
|dir| |
9161 |
||
9162 |
dir := self theSingleSelectedDirectoryOrNil. |
|
9163 |
dir isNil ifTrue:[ ^ nil]. |
|
3892 | 9164 |
|
16778 | 9165 |
#( |
3892 | 9166 |
'.dir.info' |
9167 |
'README' |
|
9168 |
'ReadMe' |
|
9169 |
'Readme' |
|
9170 |
'readme' |
|
9171 |
'read.me' |
|
9172 |
'Read.me' |
|
9173 |
'READ.ME' |
|
9174 |
'README.TXT' |
|
15915 | 9175 |
'README.txt' |
3892 | 9176 |
'readme.txt' |
9177 |
'Readme.txt' |
|
9178 |
'Info.txt' |
|
9179 |
'info.txt' |
|
9180 |
'INFO.TXT' |
|
15915 | 9181 |
'INFO.txt' |
16778 | 9182 |
) do:[:f | |
5883 | 9183 |
|n| |
4414 | 9184 |
|
5880 | 9185 |
n := dir construct:f. |
4414 | 9186 |
(n isReadable and:[n isDirectory not]) ifTrue:[ |
9187 |
^ DirectoryContentsBrowser itemClass fileName:n |
|
9188 |
] |
|
3892 | 9189 |
]. |
9190 |
^ nil |
|
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9191 |
! |
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9192 |
|
12497 | 9193 |
hasPackageDirectorySelected |
9194 |
|dir| |
|
9195 |
||
9196 |
dir := self currentDirectory. |
|
9197 |
^ dir notNil |
|
9198 |
and:[ dir exists |
|
9199 |
and:[ (dir / 'abbrev.stc') exists ]] |
|
9200 |
! |
|
9201 |
||
4881
e6fc72aac6e6
multiple select allowed in DirectoryTreeBrowser some changes in DirectoryContentsBrowser
penk
parents:
4880
diff
changeset
|
9202 |
parentDirectoriesOfCurrentFiles |
11743 | 9203 |
^ self currentSelectedObjects |
9204 |
collect:[:file | file directory] as:Set |
|
7560 | 9205 |
|
9206 |
"Modified: / 04-12-2006 / 13:15:21 / cg" |
|
6521 | 9207 |
! |
9208 |
||
9209 |
recursiveAnyFilesPresentWithSuffix:suffix |
|
6652 | 9210 |
^ true. "/ the code below is too slow for a menu enabling operation |
9211 |
||
9212 |
"/ |directories| |
|
9213 |
"/ |
|
9214 |
"/ directories := self currentDirectories value. |
|
9215 |
"/ directories do:[:dir| |
|
9216 |
"/ [ |
|
9217 |
"/ dir recursiveDirectoryContentsDo:[:f | |
|
9218 |
"/ (f asFilename suffix = suffix) ifTrue:[ ^ true] |
|
9219 |
"/ ] |
|
9220 |
"/ ] on:FileStream openErrorSignal do:[:ex|]. |
|
9221 |
"/ ]. |
|
9222 |
"/ ^ false. |
|
6586 | 9223 |
! |
9224 |
||
9225 |
recursiveAnySTFilesPresent |
|
9226 |
^ self recursiveAnyFilesPresentWithSuffix:'st' |
|
3982 | 9227 |
! ! |
9228 |
||
9229 |
!AbstractFileBrowser methodsFor:'selection'! |
|
9230 |
||
9231 |
currentSelectedDirectories |
|
6725 | 9232 |
^ self currentDirectoriesValue. |
3982 | 9233 |
! |
9234 |
||
9235 |
currentSelectedFiles |
|
12824 | 9236 |
^ self currentSelectedObjects reject:[:file | file isDirectory]. |
7560 | 9237 |
|
9238 |
"Modified: / 04-12-2006 / 13:14:39 / cg" |
|
3982 | 9239 |
! |
9240 |
||
6460 | 9241 |
currentSelectedObjects |
9242 |
^ self currentFileNameHolder value |
|
9243 |
! |
|
9244 |
||
3982 | 9245 |
firstSelectedFile |
7560 | 9246 |
^ self currentSelectedObjects |
12102 | 9247 |
detect:[:file | (file ? '') asFilename isDirectory not] |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9248 |
ifNone:[]. |
7560 | 9249 |
|
9250 |
"Modified: / 04-12-2006 / 13:14:50 / cg" |
|
4414 | 9251 |
! |
9252 |
||
9490 | 9253 |
hasOnlyDirectoriesSelected |
9254 |
^ self currentSelectedObjects conform:[:file | file isDirectory]. |
|
9255 |
||
9256 |
"Created: / 20-05-2010 / 10:45:03 / cg" |
|
9257 |
! |
|
9258 |
||
4414 | 9259 |
hasOnlyFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9260 |
|
7560 | 9261 |
^ self currentSelectedObjects conform:[:file | file isDirectory not]. |
9262 |
||
9263 |
"Modified: / 04-12-2006 / 13:15:01 / cg" |
|
4414 | 9264 |
! |
9265 |
||
9490 | 9266 |
hasTwoDirectoriesSelected |
9267 |
||
9268 |
^ self currentSelectedObjects size == 2 |
|
9269 |
and:[self hasOnlyDirectoriesSelected] |
|
9270 |
||
9271 |
"Created: / 20-05-2010 / 10:45:18 / cg" |
|
9272 |
! |
|
9273 |
||
4414 | 9274 |
hasTwoFilesSelected |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9275 |
|
7560 | 9276 |
^ self currentSelectedObjects size == 2 |
5374
c654db6e8c37
Save bookmarks - as documented - in home directory
Stefan Vogel <sv@exept.de>
parents:
5366
diff
changeset
|
9277 |
and:[self hasOnlyFilesSelected] |
7560 | 9278 |
|
9279 |
"Modified: / 04-12-2006 / 13:15:04 / cg" |
|
14577 | 9280 |
! |
9281 |
||
9282 |
selectNextFile |
|
9283 |
self |
|
9284 |
applicationNamed:#DirectoryContentsBrowser |
|
9285 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectNextFile ]]. |
|
9286 |
! |
|
9287 |
||
9288 |
selectPreviousFile |
|
9289 |
self |
|
9290 |
applicationNamed:#DirectoryContentsBrowser |
|
9291 |
ifPresentDo:[:appl | appl ~~ self ifTrue:[ appl selectPreviousFile ]]. |
|
3892 | 9292 |
! ! |
9293 |
||
3964 | 9294 |
!AbstractFileBrowser methodsFor:'sorting'! |
9295 |
||
3989 | 9296 |
currentSortOrder |
4027 | 9297 |
^ self aspectFor:#currentSortOrder ifAbsent:[ Dictionary new asValue ]. |
3989 | 9298 |
! |
9299 |
||
9300 |
sortBlockHolder |
|
9301 |
^ self aspectFor:#sortBlockHolder ifAbsent:[ |
|
5383 | 9302 |
(FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9303 |
selector:#fileName |
|
9304 |
sortCaseless:self sortCaseless value |
|
9305 |
sortReverse:false) asValue. |
|
3989 | 9306 |
]. |
9307 |
! |
|
9308 |
||
9309 |
sortBlockProperty |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9310 |
|v| |
4027 | 9311 |
|
6785
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9312 |
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
|
9313 |
v addDependent:self. |
cac8107d889c
clear reverseSort flag, when sort-order is changed via menu.
Claus Gittinger <cg@exept.de>
parents:
6767
diff
changeset
|
9314 |
^ v. |
3989 | 9315 |
! |
9316 |
||
9317 |
sortCaseless |
|
4201 | 9318 |
" aspect for sort caseless " |
3989 | 9319 |
|
13000 | 9320 |
^ self |
9321 |
aspectFor:#sortCaseless |
|
9322 |
ifAbsent:[ (Filename isCaseSensitive not) asValue ] |
|
3989 | 9323 |
! |
9324 |
||
4074 | 9325 |
sortDirectoriesBeforeFiles |
9326 |
||
4201 | 9327 |
" aspect for sort directories always before files" |
4074 | 9328 |
^ self aspectFor:#sortDirectoriesBeforeFiles ifAbsent:[ true asValue ]. |
9329 |
! |
|
9330 |
||
3989 | 9331 |
sortFileListsBy:instanceName |
9332 |
||
9333 |
self sortFileListsBy:instanceName withReverse:true |
|
9334 |
! |
|
9335 |
||
9336 |
sortFileListsBy:instanceName withReverse:aBoolean |
|
8994
b14c9dd8a662
comment/format in: #sortFileListsBy:withReverse:
Claus Gittinger <cg@exept.de>
parents:
8950
diff
changeset
|
9337 |
| aSymbol sortCaselessLocal currentSortOrder sorter isReverse| |
3964 | 9338 |
|
9339 |
aSymbol := instanceName asSymbol. |
|
4027 | 9340 |
self sortBlockProperty setValue:instanceName asSymbol. |
4151 | 9341 |
sortCaselessLocal := self sortCaseless value. |
4027 | 9342 |
currentSortOrder := self currentSortOrder value. |
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9343 |
currentSortOrder isEmptyOrNil ifTrue:[ |
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9344 |
self currentSortOrder value:(currentSortOrder := Dictionary new). |
4343 | 9345 |
currentSortOrder at:#column put:aSymbol. |
9346 |
currentSortOrder at:#reverse put:false. |
|
9347 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
3964 | 9348 |
] ifFalse:[ |
4343 | 9349 |
(currentSortOrder at:#sortCaseless) ~= sortCaselessLocal ifTrue:[ |
9350 |
"/ sort caseless changed |
|
9351 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
9352 |
] ifFalse:[ |
|
9353 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
9354 |
"/ same column like before - change sort order ifReverse is true |
|
9355 |
aBoolean ifTrue:[ |
|
9356 |
isReverse := currentSortOrder at:#reverse. |
|
9357 |
currentSortOrder at:#reverse put:(isReverse not). |
|
9358 |
]. |
|
9359 |
] ifFalse:[ |
|
9360 |
"/ another column - remark column |
|
9361 |
currentSortOrder at:#column put:aSymbol. |
|
9362 |
] |
|
9363 |
] |
|
3964 | 9364 |
]. |
4027 | 9365 |
self currentSortOrder changed. |
9111
4566dd920e09
changes for better FileDialog
Claus Gittinger <cg@exept.de>
parents:
9108
diff
changeset
|
9366 |
|
5383 | 9367 |
sorter := FileSorter directoriesBeforeFiles:(self sortDirectoriesBeforeFiles value and:[self viewDirsInContentsBrowser value]) |
9368 |
selector:instanceName |
|
9369 |
sortCaseless:sortCaselessLocal |
|
9370 |
sortReverse:(currentSortOrder at:#reverse). |
|
9371 |
self sortBlockHolder value:sorter. |
|
7841
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9372 |
|
ea9a45f1cd5e
oops - repair bad currentSorter
Claus Gittinger <cg@exept.de>
parents:
7829
diff
changeset
|
9373 |
"Modified: / 18-09-2007 / 09:42:47 / cg" |
3964 | 9374 |
! ! |
9375 |
||
3892 | 9376 |
!AbstractFileBrowser methodsFor:'startup & release'! |
9377 |
||
16720 | 9378 |
initializeAspects |
9379 |
aspects := IdentityDictionary new. |
|
9380 |
aspects at:#applications put:(IdentityDictionary new). |
|
9381 |
! |
|
9382 |
||
3892 | 9383 |
makeDependent |
4074 | 9384 |
self filterModel addDependent:self. |
4004 | 9385 |
self currentFileNameHolder addDependent:self. |
4074 | 9386 |
self sortDirectoriesBeforeFiles addDependent:self. |
4004 | 9387 |
self sortCaseless addDependent:self. |
4011 | 9388 |
self showHiddenFiles addDependent:self. |
4368
ec625478fad7
remark root and selection for every change in classvar
penk
parents:
4367
diff
changeset
|
9389 |
self rootHolder addDependent:self. |
3892 | 9390 |
! |
9391 |
||
9392 |
masterApplication:anApplication |
|
9393 |
||
9394 |
masterApplication isNil ifTrue:[ |
|
4414 | 9395 |
(anApplication notNil and:[anApplication askFor:#isAbstractFileBrowser]) ifTrue:[ |
9396 |
aspects := anApplication aspects |
|
9397 |
] ifFalse:[ |
|
9398 |
aspects isNil ifTrue:[ |
|
16721 | 9399 |
self initializeAspects. |
4414 | 9400 |
] |
9401 |
]. |
|
9402 |
self applications at:(self className) put:self. |
|
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9403 |
"/ self makeDependent. |
3892 | 9404 |
]. |
3952 | 9405 |
^ super masterApplication:anApplication. |
3892 | 9406 |
! |
9407 |
||
4800
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9408 |
postBuildWith:aBuilder |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9409 |
self makeDependent. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9410 |
super postBuildWith:aBuilder. |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9411 |
! |
56854b83f710
subAppAspects - to be continued
Claus Gittinger <cg@exept.de>
parents:
4789
diff
changeset
|
9412 |
|
3892 | 9413 |
postOpenWith:aBuilder |
9414 |
||
9415 |
super postOpenWith:aBuilder. |
|
14655 | 9416 |
"/ now done for all windowGroups by the group itself |
9417 |
"/ self windowGroup showWaitCursorWhenBusyForMillis:100. |
|
6829
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9418 |
|
3bcad14c59fc
wait-cursor -> activity indication
Claus Gittinger <cg@exept.de>
parents:
6785
diff
changeset
|
9419 |
"Modified: / 25-07-2006 / 09:12:45 / cg" |
3892 | 9420 |
! ! |
9421 |
||
9422 |
!AbstractFileBrowser::Clipboard methodsFor:'accessing'! |
|
9423 |
||
9424 |
files |
|
9425 |
"return the value of the instance variable 'files' (automatically generated)" |
|
9426 |
||
9427 |
^ files |
|
9428 |
! |
|
9429 |
||
9430 |
files:something |
|
9431 |
"set the value of the instance variable 'files' (automatically generated)" |
|
9432 |
||
9433 |
files := something. |
|
9434 |
! |
|
9435 |
||
9436 |
method |
|
9437 |
"return the value of the instance variable 'method' (automatically generated)" |
|
9438 |
||
9439 |
^ method |
|
9440 |
! |
|
9441 |
||
9442 |
method:something |
|
9443 |
"set the value of the instance variable 'method' (automatically generated)" |
|
9444 |
||
9445 |
method := something. |
|
9446 |
! ! |
|
9447 |
||
9448 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'! |
|
9449 |
||
9450 |
locked |
|
9451 |
"return the value of the instance variable 'locked' (automatically generated)" |
|
9452 |
||
9453 |
locked isNil ifTrue:[ |
|
4414 | 9454 |
locked := false. |
3892 | 9455 |
]. |
9456 |
^ locked |
|
9457 |
! ! |
|
9458 |
||
9459 |
!AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'! |
|
9460 |
||
9461 |
doIfUnLocked:aBlock |
|
9462 |
||
9463 |
self locked ifFalse:[ |
|
4414 | 9464 |
aBlock value. |
3892 | 9465 |
]. |
9466 |
! |
|
9467 |
||
9468 |
doLocked:aBlock |
|
9469 |
||
9470 |
locked := true. |
|
4004 | 9471 |
aBlock ensure:[ |
4414 | 9472 |
locked := false. |
4004 | 9473 |
] |
3892 | 9474 |
! ! |
9475 |
||
3952 | 9476 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'! |
9477 |
||
6369 | 9478 |
defaultHistorySize |
9479 |
^ 50 |
|
3892 | 9480 |
! ! |
9481 |
||
6371 | 9482 |
!AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'! |
4032 | 9483 |
|
9484 |
new |
|
6371 | 9485 |
^ (super new) initializeHistory. |
6369 | 9486 |
! ! |
9487 |
||
9488 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'! |
|
9489 |
||
9490 |
historySize |
|
9491 |
historySize isNil ifTrue:[^ self class defaultHistorySize]. |
|
9492 |
^ historySize |
|
9493 |
! |
|
9494 |
||
9495 |
historySize:aNumber |
|
9496 |
historySize := aNumber |
|
4032 | 9497 |
! ! |
9498 |
||
3892 | 9499 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'actions'! |
9500 |
||
3952 | 9501 |
addToHistory:aPath |
15803 | 9502 |
| item pathToAdd sep| |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9503 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9504 |
pathToAdd := aPath. |
15803 | 9505 |
(pathToAdd endsWith:(sep := Filename separator)) ifTrue:[ |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9506 |
pathToAdd asFilename isRootDirectory ifFalse:[ |
15803 | 9507 |
pathToAdd := pathToAdd copyButLast:(sep asString size). |
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9508 |
] |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9509 |
]. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9510 |
|
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9511 |
item := self getItemFor:pathToAdd. |
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9512 |
self backForwardListAdd:pathToAdd. |
3952 | 9513 |
item isNil ifTrue:[ |
4347 | 9514 |
" not already in history" |
6369 | 9515 |
self size >= self historySize ifTrue:[ |
4347 | 9516 |
self removeLast. |
9517 |
]. |
|
7566
3e92cf7a6706
ignore trailing file-separator in history.
Claus Gittinger <cg@exept.de>
parents:
7565
diff
changeset
|
9518 |
item := DirectoryHistoryItem path:pathToAdd. |
3952 | 9519 |
] ifFalse:[ |
4347 | 9520 |
"already been there before; move the entry to |
9521 |
the beginning, so it will fall out later." |
|
9522 |
self remove:item. |
|
10381
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9523 |
]. |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9524 |
self addFirst:item |
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9525 |
|
ad4b61b0b2fd
duplicate code in if refactored
Claus Gittinger <cg@exept.de>
parents:
10306
diff
changeset
|
9526 |
"Modified: / 24-07-2011 / 07:12:54 / cg" |
3952 | 9527 |
! |
9528 |
||
4347 | 9529 |
backForwardListAdd:aPath |
9530 |
|pathIndex| |
|
9531 |
||
9532 |
pathIndex := backForwardList indexOf:aPath. |
|
9533 |
pathIndex == 0 ifTrue:[ |
|
9534 |
" a new path comes in remove forward paths " |
|
9535 |
(backForwardList size) > backForwardIndex ifTrue:[ |
|
9536 |
backForwardList removeFromIndex:(backForwardIndex + 1) toIndex:(backForwardList size). |
|
9537 |
]. |
|
9538 |
] ifFalse:[ |
|
9539 |
backForwardList remove:aPath. |
|
9540 |
pathIndex <= backForwardIndex ifTrue:[ |
|
9541 |
backForwardIndex := backForwardIndex - 1. |
|
9542 |
] |
|
4022 | 9543 |
]. |
4347 | 9544 |
backForwardList add:aPath afterIndex:backForwardIndex. |
9545 |
backForwardIndex := backForwardIndex + 1. |
|
6369 | 9546 |
backForwardIndex > self historySize ifTrue:[ |
4347 | 9547 |
backForwardList removeFirst. |
9548 |
backForwardIndex := backForwardIndex - 1. |
|
3892 | 9549 |
]. |
4347 | 9550 |
! |
9551 |
||
9552 |
goBackward |
|
4288 | 9553 |
"return the first path of the backward list; |
9554 |
remove it from the back list and add it ti the forward list." |
|
4022 | 9555 |
|
4347 | 9556 |
|retPath| |
9557 |
||
9558 |
self canBackward ifTrue:[ |
|
9559 |
retPath := backForwardList at:(backForwardIndex - 1). |
|
9560 |
backForwardIndex := backForwardIndex - 1. |
|
4288 | 9561 |
]. |
4022 | 9562 |
^ retPath. |
9563 |
! |
|
9564 |
||
9565 |
goForward |
|
4288 | 9566 |
"return the first path of the forward list; |
9567 |
remove it from the list." |
|
4022 | 9568 |
|
4347 | 9569 |
|retPath| |
9570 |
||
9571 |
self canForward ifTrue:[ |
|
9572 |
retPath := backForwardList at:backForwardIndex + 1. |
|
9573 |
backForwardIndex := backForwardIndex + 1. |
|
4288 | 9574 |
]. |
4022 | 9575 |
^ retPath. |
9576 |
! |
|
9577 |
||
9578 |
resetForwardBackward |
|
9579 |
||
4347 | 9580 |
self initialize |
4022 | 9581 |
! |
9582 |
||
9583 |
setPosition:aPosition for:aPath |
|
9584 |
||
9585 |
self do:[:item| |
|
4414 | 9586 |
item path = aPath ifTrue:[ |
9587 |
item position:aPosition. |
|
9588 |
] |
|
4022 | 9589 |
]. |
3892 | 9590 |
! ! |
9591 |
||
4870 | 9592 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'! |
4032 | 9593 |
|
6371 | 9594 |
initializeHistory |
4032 | 9595 |
|
4347 | 9596 |
backForwardList := OrderedCollection new. |
9597 |
self reverseDo:[:el| |
|
9598 |
backForwardList add:el path. |
|
9599 |
]. |
|
9600 |
backForwardIndex := backForwardList size. |
|
4032 | 9601 |
! ! |
9602 |
||
3892 | 9603 |
!AbstractFileBrowser::DirectoryHistory methodsFor:'queries'! |
9604 |
||
4288 | 9605 |
canBackward |
4347 | 9606 |
|
9607 |
^ backForwardIndex > 1 |
|
4288 | 9608 |
! |
9609 |
||
3892 | 9610 |
canForward |
4347 | 9611 |
|
9612 |
^ (backForwardList size >= (backForwardIndex + 1)) |
|
9613 |
! |
|
9614 |
||
9615 |
getBackCollection |
|
9616 |
||
9617 |
| backCol | |
|
9618 |
||
9619 |
backCol := OrderedCollection new. |
|
9620 |
self canBackward ifTrue:[ |
|
9621 |
| tmpCol | |
|
9622 |
tmpCol := backForwardList copyTo:backForwardIndex - 1. |
|
9623 |
tmpCol reverseDo:[ :el| |
|
9624 |
backCol add:el. |
|
9625 |
] |
|
9626 |
]. |
|
9627 |
^ backCol |
|
3952 | 9628 |
! |
9629 |
||
9630 |
getForwardCollection |
|
9631 |
||
4347 | 9632 |
| forwCol | |
9633 |
||
9634 |
forwCol := OrderedCollection new. |
|
9635 |
self canForward ifTrue:[ |
|
9636 |
forwCol := backForwardList copyFrom:(backForwardIndex + 1) |
|
9637 |
]. |
|
9638 |
^ forwCol |
|
3952 | 9639 |
! |
9640 |
||
9641 |
getItemFor:aPath |
|
6627 | 9642 |
^ self detect:[:item| item path = aPath] ifNone:nil. |
9643 |
"/ self do:[:item| item path = aPath ifTrue:[^ item]]. |
|
9644 |
"/ ^ nil. |
|
3952 | 9645 |
! |
9646 |
||
9647 |
getPositionFor:aPath |
|
9648 |
||
9649 |
|item| |
|
9650 |
||
9651 |
item := self getItemFor:aPath. |
|
9652 |
||
9653 |
item notNil ifTrue:[ |
|
4414 | 9654 |
^ item position. |
3952 | 9655 |
]. |
9656 |
^ nil |
|
9657 |
! |
|
9658 |
||
9659 |
includesPath:aPath |
|
6627 | 9660 |
^ self contains:[:item | item path = aPath]. |
9661 |
||
9662 |
"/ self do:[:item| item path = aPath ifTrue:[^ true]]. |
|
9663 |
"/ ^ false. |
|
4347 | 9664 |
! |
9665 |
||
9666 |
nextBackwardItem |
|
9667 |
"return the first path of the backward list" |
|
9668 |
||
9669 |
|retPath| |
|
9670 |
||
9671 |
self canBackward ifTrue:[ |
|
9672 |
retPath := backForwardList at:backForwardIndex. |
|
9673 |
]. |
|
9674 |
^ retPath. |
|
9675 |
! |
|
9676 |
||
9677 |
nextForwardItem |
|
9678 |
"return the first path of the forward list" |
|
9679 |
||
9680 |
|retPath| |
|
9681 |
||
9682 |
self canForward ifTrue:[ |
|
9683 |
retPath := backForwardList at:backForwardIndex + 1. |
|
9684 |
]. |
|
9685 |
^ retPath. |
|
3952 | 9686 |
! ! |
9687 |
||
9688 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'! |
|
9689 |
||
9690 |
path:aPath |
|
9691 |
||
9692 |
^ self new path:aPath |
|
9693 |
! ! |
|
9694 |
||
9695 |
!AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'! |
|
9696 |
||
6433 | 9697 |
asFilename |
9698 |
^ path asFilename |
|
9699 |
! |
|
9700 |
||
3952 | 9701 |
path |
9702 |
"return the value of the instance variable 'path' (automatically generated)" |
|
9703 |
||
9704 |
^ path |
|
9705 |
! |
|
9706 |
||
9707 |
path:something |
|
9708 |
"set the value of the instance variable 'path' (automatically generated)" |
|
9709 |
||
9710 |
path := something. |
|
9711 |
! |
|
9712 |
||
9713 |
position |
|
9714 |
"return the value of the instance variable 'position' (automatically generated)" |
|
9715 |
||
9716 |
^ position |
|
9717 |
! |
|
9718 |
||
9719 |
position:something |
|
9720 |
"set the value of the instance variable 'position' (automatically generated)" |
|
9721 |
||
9722 |
position := something. |
|
9723 |
! |
|
9724 |
||
9725 |
printString |
|
9726 |
||
9727 |
^ self path asString |
|
3892 | 9728 |
! ! |
9729 |
||
9730 |
!AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'! |
|
9731 |
||
9732 |
withValue:aValue isHolder:aBoolean |
|
9733 |
||
9734 |
| instance | |
|
9735 |
||
9736 |
instance := self basicNew. |
|
9737 |
instance value:aValue. |
|
9738 |
instance isHolder:aBoolean. |
|
9739 |
^ instance |
|
9740 |
! ! |
|
9741 |
||
9742 |
!AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'! |
|
9743 |
||
9744 |
isHolder |
|
9745 |
"return the value of the instance variable 'isHolder' (automatically generated)" |
|
9746 |
||
9747 |
^ isHolder |
|
9748 |
! |
|
9749 |
||
9750 |
isHolder:something |
|
9751 |
"set the value of the instance variable 'isHolder' (automatically generated)" |
|
9752 |
||
9753 |
isHolder := something. |
|
9754 |
! |
|
9755 |
||
9756 |
value |
|
9757 |
"return the value of the instance variable 'value' (automatically generated)" |
|
9758 |
||
9759 |
^ value |
|
9760 |
! |
|
9761 |
||
9762 |
value:something |
|
9763 |
"set the value of the instance variable 'value' (automatically generated)" |
|
9764 |
||
9765 |
value := something. |
|
9766 |
! ! |
|
9767 |
||
9768 |
!AbstractFileBrowser class methodsFor:'documentation'! |
|
9769 |
||
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9770 |
version |
15803 | 9771 |
^ '$Header$' |
10305
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9772 |
! |
58cfe23bd6cd
changed: #fileFindDuplicateFile
Claus Gittinger <cg@exept.de>
parents:
10304
diff
changeset
|
9773 |
|
8832 | 9774 |
version_CVS |
15803 | 9775 |
^ '$Header$' |
3892 | 9776 |
! ! |
12094 | 9777 |